This commit is contained in:
孟帅
2023-07-20 18:01:10 +08:00
parent 9113fc5297
commit 373d9627fb
492 changed files with 12170 additions and 6982 deletions

View File

@@ -8,7 +8,6 @@ package common
import (
"context"
"github.com/gogf/gf/v2/net/ghttp"
"hotgo/internal/consts"
"hotgo/internal/library/storager"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
@@ -26,23 +25,8 @@ func init() {
}
// UploadFile 上传文件
func (s *sCommonUpload) UploadFile(ctx context.Context, file *ghttp.UploadFile) (res *sysin.AttachmentListModel, err error) {
attachment, err := storager.DoUpload(ctx, file, consts.UploadTypeFile)
if err != nil {
return
}
attachment.FileUrl = storager.LastUrl(ctx, attachment.FileUrl, attachment.Drive)
res = &sysin.AttachmentListModel{
SysAttachment: *attachment,
SizeFormat: format.FileSize(attachment.Size),
}
return
}
// UploadImage 上传图片
func (s *sCommonUpload) UploadImage(ctx context.Context, file *ghttp.UploadFile) (res *sysin.AttachmentListModel, err error) {
attachment, err := storager.DoUpload(ctx, file, consts.UploadTypeImage)
func (s *sCommonUpload) UploadFile(ctx context.Context, uploadType string, file *ghttp.UploadFile) (res *sysin.AttachmentListModel, err error) {
attachment, err := storager.DoUpload(ctx, uploadType, file)
if err != nil {
return
}

View File

@@ -53,7 +53,7 @@ func init() {
}
// Authorize 微信用户授权
func (s *sCommonWechat) Authorize(ctx context.Context, in commonin.WechatAuthorizeInp) (res *commonin.WechatAuthorizeModel, err error) {
func (s *sCommonWechat) Authorize(ctx context.Context, in *commonin.WechatAuthorizeInp) (res *commonin.WechatAuthorizeModel, err error) {
basic, err := service.SysConfig().GetBasic(ctx)
if err != nil {
return
@@ -100,7 +100,7 @@ func (s *sCommonWechat) Authorize(ctx context.Context, in commonin.WechatAuthori
return
}
func (s *sCommonWechat) AuthorizeCall(ctx context.Context, in commonin.WechatAuthorizeCallInp) (res *commonin.WechatAuthorizeCallModel, err error) {
func (s *sCommonWechat) AuthorizeCall(ctx context.Context, in *commonin.WechatAuthorizeCallInp) (res *commonin.WechatAuthorizeCallModel, err error) {
data, ok := s.temp[in.State]
if !ok || data == nil {
err = gerror.New("授权无效或已过期,请重试")