aa
This commit is contained in:
@@ -3993,16 +3993,30 @@ func RefreshMTWMToken(ctx *jxcontext.Context) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func StoreConfirmAct(ctx *jxcontext.Context, msgStatusID int) (err error) {
|
||||
func StoreConfirmAct(ctx *jxcontext.Context, status, msgStatusID int) (err error) {
|
||||
msgStatus := &model.MessageStatus{}
|
||||
msgStatus.ID = msgStatusID
|
||||
db := dao.GetDB()
|
||||
if err = dao.GetEntity(db, msgStatus); err != nil {
|
||||
return err
|
||||
}
|
||||
msgStatus.ReadCount++
|
||||
msgStatus.ConfirmStatus = model.YES
|
||||
if status == model.YES {
|
||||
msg := &model.Message{}
|
||||
msg.ID = msgStatus.MessageID
|
||||
if err = dao.GetEntity(db, msg); err != nil {
|
||||
return err
|
||||
}
|
||||
actMap := make(map[string]interface{})
|
||||
err = json.Unmarshal([]byte(msg.ActInfo), &actMap)
|
||||
if time.Now().Sub(utils.Str2Time(actMap["beginAt"].(string))) > 0 {
|
||||
msgStatus.ConfirmStatus = -1
|
||||
dao.WrapUpdateULEntity(msgStatus, ctx.GetUserName())
|
||||
_, err = dao.UpdateEntity(db, msgStatus, "ConfirmStatus")
|
||||
return fmt.Errorf("参与活动时间已过期!")
|
||||
}
|
||||
}
|
||||
msgStatus.ConfirmStatus = status
|
||||
dao.WrapUpdateULEntity(msgStatus, ctx.GetUserName())
|
||||
_, err = dao.UpdateEntity(db, msgStatus, "ReadCount", "ConfirmStatus")
|
||||
_, err = dao.UpdateEntity(db, msgStatus, "ConfirmStatus")
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1042,13 +1042,14 @@ func (c *StoreController) GetBrandStore() {
|
||||
// @Title 商家确认参与活动
|
||||
// @Description 商家确认参与活动
|
||||
// @Param token header string false "认证token"
|
||||
// @Param status formData int true "确认或取消,确认1,取消-1"
|
||||
// @Param msgStatusID formData int true "消息状态ID"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /StoreConfirmAct [post]
|
||||
func (c *StoreController) StoreConfirmAct() {
|
||||
c.callStoreConfirmAct(func(params *tStoreStoreConfirmActParams) (retVal interface{}, errCode string, err error) {
|
||||
err = cms.StoreConfirmAct(params.Ctx, params.MsgStatusID)
|
||||
err = cms.StoreConfirmAct(params.Ctx, params.Status, params.MsgStatusID)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user