From 04839ce472b3e723f350d29b062ba1535b61a311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 24 Feb 2021 11:53:26 +0800 Subject: [PATCH] aa --- business/jxstore/cms/store.go | 4 ++-- business/jxutils/weixinmsg/weixinmsg.go | 6 +++--- business/model/message.go | 16 ++++++---------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 4881a363a..81f28604c 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -4023,9 +4023,9 @@ func StoreConfirmAct(ctx *jxcontext.Context, status, msgStatusID int) (err error if err = dao.GetEntity(db, msg); err != nil { return err } - actMap := make(map[string]interface{}) + actMap := &model.MessageActInfo{} err = json.Unmarshal([]byte(msg.ActInfo), &actMap) - if time.Now().Sub(utils.Str2Time(actMap["beginAt"].(string))) > 0 { + if time.Now().Sub(utils.Str2Time(actMap.BeginAt)) > 0 { msgStatus.ConfirmStatus = -1 dao.WrapUpdateULEntity(msgStatus, ctx.GetUserName()) _, err = dao.UpdateEntity(db, msgStatus, "ConfirmStatus") diff --git a/business/jxutils/weixinmsg/weixinmsg.go b/business/jxutils/weixinmsg/weixinmsg.go index ee9d77ee5..9288fe851 100644 --- a/business/jxutils/weixinmsg/weixinmsg.go +++ b/business/jxutils/weixinmsg/weixinmsg.go @@ -632,7 +632,7 @@ func NotifyStoreMessage(storeID, msgID, msgStatusID int, msg *model.Message) (er }, } case model.MessageTypeStoreAct: - actMap := make(map[string]interface{}) + actMap := &model.MessageActInfo{} err = json.Unmarshal([]byte(msg.ActInfo), &actMap) templateID = WX_NORMAL_STORE_ACT_MSG_TEMPLATE_ID data = map[string]interface{}{ @@ -645,11 +645,11 @@ func NotifyStoreMessage(storeID, msgID, msgStatusID int, msg *model.Message) (er "color": "#2E408E", }, "keyword2": map[string]interface{}{ - "value": actMap["beginAt"].(string) + "-" + actMap["endAt"].(string), + "value": actMap.BeginAt + "-" + actMap.EndAt, "color": "#2E408E", }, "keyword3": map[string]interface{}{ - "value": model.VendorNames[int(utils.Interface2Float64WithDefault((actMap["vendorID"]), 0))], + "value": model.VendorNames[int(utils.Interface2Float64WithDefault((actMap.VendorID), 0))], "color": "#2E408E", }, "remark": map[string]interface{}{ diff --git a/business/model/message.go b/business/model/message.go index 31f7868d1..ef8475cb4 100644 --- a/business/model/message.go +++ b/business/model/message.go @@ -1,9 +1,5 @@ package model -import ( - "time" -) - const ( MessageTypeStore = 1 MessageTypeUser = 2 @@ -41,12 +37,6 @@ func (*Message) TableIndex() [][]string { } } -type MessageActInfo struct { - BeginAt time.Time `json:"beginAt"` - EndAt time.Time `json:"endAt"` - VendorID int `orm:"column(vendor_id)" json:"vendorID"` -} - type MessageStatus struct { ModelIDCULD MessageID int `orm:"column(message_id)" json:"messageID"` @@ -64,6 +54,12 @@ func (*MessageStatus) TableIndex() [][]string { } } +type MessageActInfo struct { + VendorID int `orm:"colmun(vendor_id)" json:"vendorID"` + BeginAt string `json:"beginAt"` + EndAt string `json:"endAt"` +} + type ImMessageRecord struct { ModelIDCULD UserID string `orm:"size(48);column(user_id)" json:"userID"` //消息发送方userID