web 邮件接口
This commit is contained in:
parent
b7ad761d96
commit
158ea726cf
@ -5,11 +5,19 @@ import (
|
|||||||
"go_dreamfactory/lego/sys/gin/engine"
|
"go_dreamfactory/lego/sys/gin/engine"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CrateMailReq struct {
|
type CrateMailReq struct {
|
||||||
pb.DBMailData
|
Uid string // uid
|
||||||
Sign string `json:"sign"`
|
Title string // 邮件标题
|
||||||
|
Contex string // 邮件内容 支持自定义
|
||||||
|
Items []*pb.UserAssets // 附件
|
||||||
|
Cid string // 多语言表id
|
||||||
|
Param []string // 自定义参数
|
||||||
|
Sign string `json:"sign"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建邮件
|
//创建邮件
|
||||||
@ -23,15 +31,13 @@ func (this *Api_Comp) CreateMail(c *engine.Context) {
|
|||||||
data interface{}
|
data interface{}
|
||||||
)
|
)
|
||||||
defer c.JSON(http.StatusOK, &Respond{Code: code, Message: msg, Data: data})
|
defer c.JSON(http.StatusOK, &Respond{Code: code, Message: msg, Data: data})
|
||||||
if sign := gin.ParamSign(this.options.Key, map[string]interface{}{
|
if sign := gin.ParamSign(this.options.Key, map[string]interface{}{
|
||||||
"Uid": req.Uid,
|
"Uid": req.Uid,
|
||||||
"Title": req.Title,
|
"Title": req.Title,
|
||||||
"Contex": req.Contex,
|
"Contex": req.Contex,
|
||||||
"CreateTime": req.CreateTime,
|
"Items": req.Items,
|
||||||
"DueTime": req.DueTime,
|
"Cid": req.Cid,
|
||||||
"Check": req.Check,
|
"Param": req.Param,
|
||||||
"Reward": req.Reward,
|
|
||||||
"Items": req.Items,
|
|
||||||
}); sign != req.Sign {
|
}); sign != req.Sign {
|
||||||
this.module.Errorf("LoginByCaptchaReq SignError sgin:%s", sign)
|
this.module.Errorf("LoginByCaptchaReq SignError sgin:%s", sign)
|
||||||
code = pb.ErrorCode_SignError
|
code = pb.ErrorCode_SignError
|
||||||
@ -43,7 +49,23 @@ func (this *Api_Comp) CreateMail(c *engine.Context) {
|
|||||||
msg = pb.GetErrorCodeMsg(code)
|
msg = pb.GetErrorCodeMsg(code)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err = this.module.modelMail.CreateGMMail(&req.DBMailData); err != nil {
|
mail := &pb.DBMailData{
|
||||||
|
ObjId: primitive.NewObjectID().Hex(),
|
||||||
|
Uid: req.Uid,
|
||||||
|
Title: req.Title,
|
||||||
|
Contex: req.Contex,
|
||||||
|
CreateTime: uint64(time.Now().Unix()),
|
||||||
|
DueTime: uint64(time.Now().Unix() + 30*24*3600),
|
||||||
|
Check: false,
|
||||||
|
Reward: false,
|
||||||
|
Items: req.Items,
|
||||||
|
Cid: req.Cid,
|
||||||
|
Param: req.Param,
|
||||||
|
}
|
||||||
|
if len(req.Items) > 0 {
|
||||||
|
mail.Reward = true
|
||||||
|
}
|
||||||
|
if err = this.module.modelMail.CreateGMMail(mail); err != nil {
|
||||||
this.module.Errorf("LoginByCaptchaReq CreateMail err:%v", err)
|
this.module.Errorf("LoginByCaptchaReq CreateMail err:%v", err)
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
msg = pb.GetErrorCodeMsg(code)
|
msg = pb.GetErrorCodeMsg(code)
|
||||||
|
Loading…
Reference in New Issue
Block a user