fix
This commit is contained in:
parent
22d0f6a5b1
commit
9bcb1d9377
@ -22,11 +22,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||||||
Path: "/qrcode-set/list",
|
Path: "/qrcode-set/list",
|
||||||
Handler: GetQrCodeSetListHandler(serverCtx),
|
Handler: GetQrCodeSetListHandler(serverCtx),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Method: http.MethodPost,
|
|
||||||
Path: "/upload/qrcode",
|
|
||||||
Handler: UploadQrcodeHandler(serverCtx),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -16,14 +16,7 @@ type GetQrCodeSetListRsp struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UploadQrcodeReq struct {
|
type Request struct {
|
||||||
Url string `json:"url"`
|
|
||||||
QRcodeType int64 `json:"QRcodeType"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type UploadQrcodeRsp struct {
|
|
||||||
Link string `json:"link"`
|
|
||||||
Data string `json:"d"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Response struct {
|
type Response struct {
|
||||||
@ -32,20 +25,26 @@ type Response struct {
|
|||||||
Data interface{} `json:"data"`
|
Data interface{} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResponseJwt struct {
|
|
||||||
Code int `json:"code"`
|
|
||||||
Message string `json:"msg"`
|
|
||||||
Data interface{} `json:"data"`
|
|
||||||
AccessSecret string `json:"accessSecret"`
|
|
||||||
AccessExpire int64 `json:"accessExpire"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Auth struct {
|
type Auth struct {
|
||||||
AccessSecret string `json:"accessSecret"`
|
AccessSecret string `json:"accessSecret"`
|
||||||
AccessExpire int64 `json:"accessExpire"`
|
AccessExpire int64 `json:"accessExpire"`
|
||||||
RefreshAfter int64 `json:"refreshAfter"`
|
RefreshAfter int64 `json:"refreshAfter"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type File struct {
|
||||||
|
Filename string `fsfile:"filename"`
|
||||||
|
Header map[string][]string `fsfile:"header"`
|
||||||
|
Size int64 `fsfile:"size"`
|
||||||
|
Data []byte `fsfile:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Meta struct {
|
||||||
|
TotalCount int64 `json:"totalCount"`
|
||||||
|
PageCount int64 `json:"pageCount"`
|
||||||
|
CurrentPage int `json:"currentPage"`
|
||||||
|
PerPage int `json:"perPage"`
|
||||||
|
}
|
||||||
|
|
||||||
// Set 设置Response的Code和Message值
|
// Set 设置Response的Code和Message值
|
||||||
func (resp *Response) Set(Code int, Message string) *Response {
|
func (resp *Response) Set(Code int, Message string) *Response {
|
||||||
return &Response{
|
return &Response{
|
||||||
|
@ -27,6 +27,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||||||
Path: "/upload/upload-file-backend",
|
Path: "/upload/upload-file-backend",
|
||||||
Handler: UploadFileBackendHandler(serverCtx),
|
Handler: UploadFileBackendHandler(serverCtx),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodPost,
|
||||||
|
Path: "/upload/qrcode",
|
||||||
|
Handler: UploadQrcodeHandler(serverCtx),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,9 @@ import (
|
|||||||
"fusenapi/utils/auth"
|
"fusenapi/utils/auth"
|
||||||
"fusenapi/utils/basic"
|
"fusenapi/utils/basic"
|
||||||
|
|
||||||
"fusenapi/server/data-transfer/internal/logic"
|
"fusenapi/server/upload/internal/logic"
|
||||||
"fusenapi/server/data-transfer/internal/svc"
|
"fusenapi/server/upload/internal/svc"
|
||||||
"fusenapi/server/data-transfer/internal/types"
|
"fusenapi/server/upload/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UploadQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func UploadQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
@ -4,14 +4,16 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fusenapi/model/gmodel"
|
"fusenapi/model/gmodel"
|
||||||
"fusenapi/server/data-transfer/internal/svc"
|
|
||||||
"fusenapi/server/data-transfer/internal/types"
|
|
||||||
"fusenapi/utils/auth"
|
"fusenapi/utils/auth"
|
||||||
"fusenapi/utils/basic"
|
"fusenapi/utils/basic"
|
||||||
"fusenapi/utils/qrcode"
|
"fusenapi/utils/qrcode"
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"fusenapi/server/upload/internal/svc"
|
||||||
|
"fusenapi/server/upload/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UploadQrcodeLogic struct {
|
type UploadQrcodeLogic struct {
|
||||||
@ -28,7 +30,6 @@ func NewUploadQrcodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Uplo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生成base64二维码
|
|
||||||
func (l *UploadQrcodeLogic) UploadQrcode(req *types.UploadQrcodeReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
func (l *UploadQrcodeLogic) UploadQrcode(req *types.UploadQrcodeReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
if userinfo.GetIdType() != auth.IDTYPE_User {
|
if userinfo.GetIdType() != auth.IDTYPE_User {
|
||||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please login first")
|
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please login first")
|
@ -23,6 +23,16 @@ type RequestUploadFileBackend struct {
|
|||||||
Category string `form:"category"` // 类别
|
Category string `form:"category"` // 类别
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type UploadQrcodeReq struct {
|
||||||
|
Url string `json:"url"`
|
||||||
|
QRcodeType int64 `json:"QRcodeType"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UploadQrcodeRsp struct {
|
||||||
|
Link string `json:"link"`
|
||||||
|
Data string `json:"d"`
|
||||||
|
}
|
||||||
|
|
||||||
type Request struct {
|
type Request struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,9 +16,6 @@ service data-transfer {
|
|||||||
//获取二维码设置列表
|
//获取二维码设置列表
|
||||||
@handler GetQrCodeSetListHandler
|
@handler GetQrCodeSetListHandler
|
||||||
get /qrcode-set/list returns (response);
|
get /qrcode-set/list returns (response);
|
||||||
//生成二维码
|
|
||||||
@handler UploadQrcodeHandler
|
|
||||||
post /upload/qrcode (UploadQrcodeReq) returns (response);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取标准logo列表
|
//获取标准logo列表
|
||||||
@ -32,12 +29,3 @@ type GetQrCodeSetListRsp {
|
|||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
//生成二维码
|
|
||||||
type UploadQrcodeReq {
|
|
||||||
Url string `json:"url"`
|
|
||||||
QRcodeType int64 `json:"QRcodeType"`
|
|
||||||
}
|
|
||||||
type UploadQrcodeRsp {
|
|
||||||
Link string `json:"link"`
|
|
||||||
Data string `json:"d"`
|
|
||||||
}
|
|
@ -9,6 +9,20 @@ info (
|
|||||||
|
|
||||||
import "basic.api"
|
import "basic.api"
|
||||||
|
|
||||||
|
service upload {
|
||||||
|
@handler UploadUpFileHandler
|
||||||
|
get /upload/up-file(RequestUpFile) returns (response);
|
||||||
|
|
||||||
|
@handler UploadFileFrontendHandler
|
||||||
|
post /upload/upload-file-frontend(RequestUploadFileFrontend) returns (response);
|
||||||
|
|
||||||
|
@handler UploadFileBackendHandler
|
||||||
|
post /upload/upload-file-backend(RequestUploadFileBackend) returns (response);
|
||||||
|
//生成二维码
|
||||||
|
@handler UploadQrcodeHandler
|
||||||
|
post /upload/qrcode (UploadQrcodeReq) returns (response);
|
||||||
|
}
|
||||||
|
|
||||||
type RequestUpFile {
|
type RequestUpFile {
|
||||||
UpFile string `form:"upfile"`
|
UpFile string `form:"upfile"`
|
||||||
IsCut string `form:"is_cut"` // 是否裁剪
|
IsCut string `form:"is_cut"` // 是否裁剪
|
||||||
@ -27,13 +41,12 @@ type RequestUploadFileBackend {
|
|||||||
Category string `form:"category"` // 类别
|
Category string `form:"category"` // 类别
|
||||||
}
|
}
|
||||||
|
|
||||||
service upload {
|
//生成二维码
|
||||||
@handler UploadUpFileHandler
|
type UploadQrcodeReq {
|
||||||
get /upload/up-file(RequestUpFile) returns (response);
|
Url string `json:"url"`
|
||||||
|
QRcodeType int64 `json:"QRcodeType"`
|
||||||
@handler UploadFileFrontendHandler
|
}
|
||||||
post /upload/upload-file-frontend(RequestUploadFileFrontend) returns (response);
|
type UploadQrcodeRsp {
|
||||||
|
Link string `json:"link"`
|
||||||
@handler UploadFileBackendHandler
|
Data string `json:"d"`
|
||||||
post /upload/upload-file-backend(RequestUploadFileBackend) returns (response);
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user