diff --git a/business/jxutils/unipush/push.go b/business/jxutils/unipush/push.go index 6cdbeb757..a711b2331 100644 --- a/business/jxutils/unipush/push.go +++ b/business/jxutils/unipush/push.go @@ -116,7 +116,7 @@ func NotifyOrderCanceled(order *model.GoodsOrder) (err error) { } // NotifyImNewMessage IM 新消息通知 -func NotifyImNewMessage(vendorStoreID string, vendorID int) error { +func NotifyImNewMessage(vendorStoreID string, vendorID int, offMsg string) error { if len(vendorStoreID) == 0 { return nil } @@ -137,9 +137,9 @@ func NotifyImNewMessage(vendorStoreID string, vendorID int) error { msg.VendorName = model.VendorChineseNames[vendorID] msg.StoreTitle = store.Name msg.Context = "老板,你有新的用户消息,请及时查看!" - context, _ := json.Marshal(msg) + //context, _ := json.Marshal(msg) body := fmt.Sprintf(msg.Context+"(%s)", model.VendorChineseNames[vendorID]) - pushMsgByUniApp(store.ID, store.Name, cid, string(context), body, SoundsFileNewImMsg, FlagIm) + pushMsgByUniApp(store.ID, store.Name, cid, offMsg, body, SoundsFileNewImMsg, FlagIm) return err } diff --git a/business/partner/purchase/im/im.go b/business/partner/purchase/im/im.go index 0b5350b92..cfb9e6818 100644 --- a/business/partner/purchase/im/im.go +++ b/business/partner/purchase/im/im.go @@ -106,7 +106,7 @@ func ReadMsgFromVendor(vendorID int, elmAppID string, msg []byte) error { errList errlist.ErrList userList = &UserMessageList{} ) - if string(msg) == "" { + if len(string(msg)) == 0 { errList.AddErr(fmt.Errorf("读取平台数据为空,请检查")) } if vendorID == VendorIDMT { @@ -151,7 +151,7 @@ func ReadMsgFromVendor(vendorID int, elmAppID string, msg []byte) error { errList.AddErr(fmt.Errorf("存储STU聊天记录错误:%v", err)) } //3 cid推送新消息 - if err = PushMsgByCid(vendorStoreID, vendorID); err != nil { + if err = PushMsgByCid(vendorStoreID, vendorID, string(msg)); err != nil { errList.AddErr(fmt.Errorf("向商家cid推送新消息错误:%v", err)) } @@ -162,8 +162,8 @@ func ReadMsgFromVendor(vendorID int, elmAppID string, msg []byte) error { } // PushMsgByCid 通过cid push用户 -func PushMsgByCid(vendorStoreID string, vendorID int) error { - if err := push.NotifyImNewMessage(vendorStoreID, vendorID); err != nil { +func PushMsgByCid(vendorStoreID string, vendorID int, msg string) error { + if err := push.NotifyImNewMessage(vendorStoreID, vendorID, msg); err != nil { return err } return nil