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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user