go_dreamfactory/modules/gm/api_createnotify.go
2022-07-13 18:20:27 +08:00

46 lines
1.2 KiB
Go

package gm
import (
"go_dreamfactory/lego/sys/gin"
"go_dreamfactory/lego/sys/gin/engine"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
)
type CreateNotifyReq struct {
pb.DBSystemNotify
Sign string `json:"sign"`
}
//服务列表
func (this *Api_Comp) CreateNotify(c *engine.Context) {
req := &CreateNotifyReq{}
err := c.BindJSON(&req)
log.Debugf("CreateNotify:%+v err:%v", req, err)
var (
// code pb.ErrorCode
// msg string
// data interface{}
// err error
)
// defer c.JSON(http.StatusOK, &Respond{Code: code, Message: msg, Data: data})
if sign := gin.ParamSign(this.options.Key, map[string]interface{}{"Title": req.Title, "Ctime": req.Ctime, "Rtime": req.Rtime}); sign != req.Sign {
log.Errorf("LoginByCaptchaReq SignError sgin:%s", sign)
// code = pb.ErrorCode_SignError
// msg = pb.GetErrorCodeMsg(code)
return
}
if len(req.Title) == 0 {
// code = pb.ErrorCode_ReqParameterError
// msg = pb.GetErrorCodeMsg(code)
return
}
if err = this.module.modelNotify.CreateSystemNotify(&req.DBSystemNotify); err != nil {
log.Errorf("LoginByCaptchaReq CreateSystemNotify err:%v", err)
// code = pb.ErrorCode_DBError
// msg = pb.GetErrorCodeMsg(code)
return
}
// msg = pb.GetErrorCodeMsg(code)
}