mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-08-28 15:05:01 +08:00
发布v2.8.4版本,更新内容请查看:https://github.com/bufanyun/hotgo/tree/v2.0/docs/guide-zh-CN/addon-version-upgrade.md
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
@@ -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("授权无效或已过期,请重试")
|
||||
|
Reference in New Issue
Block a user