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",
|
||||
Handler: GetQrCodeSetListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/upload/qrcode",
|
||||
Handler: UploadQrcodeHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
@ -16,14 +16,7 @@ type GetQrCodeSetListRsp struct {
|
|||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
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 Response struct {
|
||||
|
@ -32,20 +25,26 @@ type Response struct {
|
|||
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 {
|
||||
AccessSecret string `json:"accessSecret"`
|
||||
AccessExpire int64 `json:"accessExpire"`
|
||||
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值
|
||||
func (resp *Response) Set(Code int, Message string) *Response {
|
||||
return &Response{
|
||||
|
|
|
@ -27,6 +27,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||
Path: "/upload/upload-file-backend",
|
||||
Handler: UploadFileBackendHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/upload/qrcode",
|
||||
Handler: UploadQrcodeHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
|
||||
"fusenapi/server/data-transfer/internal/logic"
|
||||
"fusenapi/server/data-transfer/internal/svc"
|
||||
"fusenapi/server/data-transfer/internal/types"
|
||||
"fusenapi/server/upload/internal/logic"
|
||||
"fusenapi/server/upload/internal/svc"
|
||||
"fusenapi/server/upload/internal/types"
|
||||
)
|
||||
|
||||
func UploadQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|
@ -4,14 +4,16 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fusenapi/model/gmodel"
|
||||
"fusenapi/server/data-transfer/internal/svc"
|
||||
"fusenapi/server/data-transfer/internal/types"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
"fusenapi/utils/qrcode"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gorm.io/gorm"
|
||||
"strings"
|
||||
|
||||
"fusenapi/server/upload/internal/svc"
|
||||
"fusenapi/server/upload/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
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) {
|
||||
if userinfo.GetIdType() != auth.IDTYPE_User {
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "please login first")
|
|
@ -23,6 +23,16 @@ type RequestUploadFileBackend struct {
|
|||
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 {
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,6 @@ service data-transfer {
|
|||
//获取二维码设置列表
|
||||
@handler GetQrCodeSetListHandler
|
||||
get /qrcode-set/list returns (response);
|
||||
//生成二维码
|
||||
@handler UploadQrcodeHandler
|
||||
post /upload/qrcode (UploadQrcodeReq) returns (response);
|
||||
}
|
||||
|
||||
//获取标准logo列表
|
||||
|
@ -31,13 +28,4 @@ type GetStandardLogoListRsp {
|
|||
type GetQrCodeSetListRsp {
|
||||
Id int64 `json:"id"`
|
||||
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"
|
||||
|
||||
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 {
|
||||
UpFile string `form:"upfile"`
|
||||
IsCut string `form:"is_cut"` // 是否裁剪
|
||||
|
@ -27,13 +41,12 @@ type RequestUploadFileBackend {
|
|||
Category string `form:"category"` // 类别
|
||||
}
|
||||
|
||||
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);
|
||||
//生成二维码
|
||||
type UploadQrcodeReq {
|
||||
Url string `json:"url"`
|
||||
QRcodeType int64 `json:"QRcodeType"`
|
||||
}
|
||||
type UploadQrcodeRsp {
|
||||
Link string `json:"link"`
|
||||
Data string `json:"d"`
|
||||
}
|
Loading…
Reference in New Issue
Block a user