From dcaef6fa2f59374e85be20f2a9fac6cc35d795e8 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Wed, 12 Jul 2023 17:24:01 +0800 Subject: [PATCH 1/5] 1 --- business/jxutils/unipush/push.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/business/jxutils/unipush/push.go b/business/jxutils/unipush/push.go index e6e026562..fc92d23da 100644 --- a/business/jxutils/unipush/push.go +++ b/business/jxutils/unipush/push.go @@ -182,12 +182,7 @@ func pushMsgByUniApp(storeId int, storeName string, cID []string, msg string, bo var ( errs []error options = make(map[string]interface{}, 0) - offMsg MsgContext ) - if err := json.Unmarshal([]byte(body), &offMsg); err != nil { - globals.SugarLogger.Debugf("pushMsgByUniApp marshal err") - } - globals.SugarLogger.Debugf("pushMsgByUniApp body") if flag == FlagOrder { options = map[string]interface{}{ "XM": map[string]interface{}{ From 82b8b9df649168de4fc1b559b5e8e0765f88c1f3 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Wed, 12 Jul 2023 17:27:40 +0800 Subject: [PATCH 2/5] 1 --- business/jxutils/unipush/push.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/business/jxutils/unipush/push.go b/business/jxutils/unipush/push.go index fc92d23da..24654a253 100644 --- a/business/jxutils/unipush/push.go +++ b/business/jxutils/unipush/push.go @@ -52,7 +52,7 @@ func NotifyNewOrder(order *model.GoodsOrder) { msg.Context = "老板,你有新的订单了!" msg.VendorOrderId = order.VendorOrderID context, _ := json.Marshal(msg) - body := fmt.Sprintf(msg.Context+"(%s)", model.VendorChineseNames[order.VendorID]+"#"+msg.OrderSqs) + body := fmt.Sprintf(msg.Context+"(%s)", model.VendorChineseNames[order.VendorID]+"#"+msg.OrderSqs+"号订单") pushMsgByUniApp(storeDetail.ID, storeDetail.Name, cid, string(context), body, SoundsFileNewOrder, FlagOrder) } @@ -80,7 +80,7 @@ func NotifyAfsOrder(afsOrder *model.AfsOrder) (err error) { msg.StoreTitle = storeDetail.Name msg.Context = "老板订单申请退款了!" context, _ := json.Marshal(msg) - body := fmt.Sprintf(msg.Context+"(%s)", model.VendorChineseNames[afsOrder.VendorID]+"#"+msg.OrderSqs) + body := fmt.Sprintf(msg.Context+"(%s)", model.VendorChineseNames[afsOrder.VendorID]+"#"+msg.OrderSqs+"号订单") pushMsgByUniApp(storeDetail.ID, storeDetail.Name, cid, string(context), body, SoundsFileNewAfsOrder, FlagOrder) return err } @@ -109,7 +109,7 @@ func NotifyOrderCanceled(order *model.GoodsOrder) (err error) { msg.StoreTitle = storeDetail.Name msg.Context = "老板订单被取消了!" context, _ := json.Marshal(msg) - body := fmt.Sprintf(msg.Context+"(%s)", model.VendorChineseNames[order.VendorID]+"#"+msg.OrderSqs) + body := fmt.Sprintf(msg.Context+"(%s)", model.VendorChineseNames[order.VendorID]+"#"+msg.OrderSqs+"号订单") pushMsgByUniApp(storeDetail.ID, storeDetail.Name, cid, string(context), body, SoundsFileNewCancelOrder, FlagOrder) return err } From f9ef8b3afbc0fe81f580deb83676d6ab7d9f2df3 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Wed, 12 Jul 2023 17:34:39 +0800 Subject: [PATCH 3/5] 1 --- business/partner/purchase/im/im.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/business/partner/purchase/im/im.go b/business/partner/purchase/im/im.go index 56ea0698f..0b5350b92 100644 --- a/business/partner/purchase/im/im.go +++ b/business/partner/purchase/im/im.go @@ -360,9 +360,7 @@ func DecryptIm(appID int, msg string) (string, error) { data, _ := base64.StdEncoding.DecodeString(msg) key := utils.LimitUTF8StringLen2(rel[appID], 16) res, err := utils.AESCBCDecpryt(data, []byte(key), []byte(key)) - globals.SugarLogger.Debugf("DecryptIm err=%v", err) if len(string(res)) > 0 && err == nil { - globals.SugarLogger.Debugf("DecryptIm res=%v", string(res)) return string(res), nil } return "", err From c2be67e175f99b6a9a63ada8a886a9705d9bb866 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Wed, 12 Jul 2023 17:44:14 +0800 Subject: [PATCH 4/5] 1 --- business/jxutils/unipush/push.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/business/jxutils/unipush/push.go b/business/jxutils/unipush/push.go index 24654a253..6cdbeb757 100644 --- a/business/jxutils/unipush/push.go +++ b/business/jxutils/unipush/push.go @@ -4,6 +4,7 @@ import ( "encoding/json" "errors" "fmt" + "log" "time" "git.rosy.net.cn/jx-callback/business/authz/autils" @@ -260,6 +261,6 @@ func pushMsgByUniApp(storeId int, storeName string, cID []string, msg string, bo } } if len(errs) != 0 { - globals.SugarLogger.Errorf("uinapp 消息推送错误:%s", utils.Format4Output(errs, false)) + log.Printf("uinapp 消息推送错误:%s", utils.Format4Output(errs, false)) } } From de40be335cbafea2cdc2732bb049c5ac0e5a3670 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Wed, 12 Jul 2023 17:53:14 +0800 Subject: [PATCH 5/5] 1 --- business/jxutils/unipush/push.go | 6 +++--- business/partner/purchase/im/im.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) 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