mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-10-12 04:53:47 +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:
@@ -9,14 +9,12 @@ import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/common"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
var Sms = new(cSms)
|
||||
@@ -25,16 +23,7 @@ type cSms struct{}
|
||||
|
||||
// SendTest 发送测试短信
|
||||
func (c *cSms) SendTest(ctx context.Context, req *common.SendTestSmsReq) (res *common.SendTestSmsRes, err error) {
|
||||
var in sysin.SendCodeInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysSmsLog().SendCode(ctx, in)
|
||||
err = service.SysSmsLog().SendCode(ctx, &req.SendCodeInp)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -50,11 +39,7 @@ func (c *cSms) SendBindSms(ctx context.Context, _ *common.SendBindSmsReq) (res *
|
||||
return
|
||||
}
|
||||
|
||||
err = g.Model("admin_member").
|
||||
Fields("mobile").
|
||||
Where("id", memberId).
|
||||
Scan(&models)
|
||||
if err != nil {
|
||||
if err = g.Model("admin_member").Fields("mobile").Where("id", memberId).Scan(&models); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -68,7 +53,7 @@ func (c *cSms) SendBindSms(ctx context.Context, _ *common.SendBindSmsReq) (res *
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysSmsLog().SendCode(ctx, sysin.SendCodeInp{
|
||||
err = service.SysSmsLog().SendCode(ctx, &sysin.SendCodeInp{
|
||||
Event: consts.SmsTemplateBind,
|
||||
Mobile: models.Mobile,
|
||||
})
|
||||
@@ -77,15 +62,6 @@ func (c *cSms) SendBindSms(ctx context.Context, _ *common.SendBindSmsReq) (res *
|
||||
|
||||
// SendSms 发送短信
|
||||
func (c *cSms) SendSms(ctx context.Context, req *common.SendSmsReq) (res *common.SendSmsRes, err error) {
|
||||
var in sysin.SendCodeInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysSmsLog().SendCode(ctx, in)
|
||||
err = service.SysSmsLog().SendCode(ctx, &req.SendCodeInp)
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user