aa
This commit is contained in:
@@ -3993,16 +3993,30 @@ func RefreshMTWMToken(ctx *jxcontext.Context) (err error) {
|
|||||||
return err
|
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 := &model.MessageStatus{}
|
||||||
msgStatus.ID = msgStatusID
|
msgStatus.ID = msgStatusID
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
if err = dao.GetEntity(db, msgStatus); err != nil {
|
if err = dao.GetEntity(db, msgStatus); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
msgStatus.ReadCount++
|
if status == model.YES {
|
||||||
msgStatus.ConfirmStatus = model.YES
|
msg := &model.Message{}
|
||||||
dao.WrapUpdateULEntity(msgStatus, ctx.GetUserName())
|
msg.ID = msgStatus.MessageID
|
||||||
_, err = dao.UpdateEntity(db, msgStatus, "ReadCount", "ConfirmStatus")
|
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, "ConfirmStatus")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1042,13 +1042,14 @@ func (c *StoreController) GetBrandStore() {
|
|||||||
// @Title 商家确认参与活动
|
// @Title 商家确认参与活动
|
||||||
// @Description 商家确认参与活动
|
// @Description 商家确认参与活动
|
||||||
// @Param token header string false "认证token"
|
// @Param token header string false "认证token"
|
||||||
|
// @Param status formData int true "确认或取消,确认1,取消-1"
|
||||||
// @Param msgStatusID formData int true "消息状态ID"
|
// @Param msgStatusID formData int true "消息状态ID"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /StoreConfirmAct [post]
|
// @router /StoreConfirmAct [post]
|
||||||
func (c *StoreController) StoreConfirmAct() {
|
func (c *StoreController) StoreConfirmAct() {
|
||||||
c.callStoreConfirmAct(func(params *tStoreStoreConfirmActParams) (retVal interface{}, errCode string, err error) {
|
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
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user