This commit is contained in:
richboo111
2023-07-12 17:15:07 +08:00
parent 0cf862d600
commit ff7e9aa343

View File

@@ -138,7 +138,7 @@ func NotifyImNewMessage(vendorStoreID string, vendorID int) error {
msg.Context = "老板,你有新的用户消息,请及时查看!"
context, _ := json.Marshal(msg)
pushMsgByUniApp(store.ID, store.Name, cid, string(context), "", SoundsFileNewImMsg, FlagIm)
pushMsgByUniApp(store.ID, store.Name, cid, string(context), string(context), SoundsFileNewImMsg, FlagIm)
return err
}
@@ -183,8 +183,13 @@ func pushMsgByUniApp(storeId int, storeName string, cID []string, msg string, bo
errs []error
options = make(map[string]interface{}, 0)
offMsg MsgContext
sub string
)
if err := json.Unmarshal([]byte(body), &offMsg); err != nil {
globals.SugarLogger.Debugf("pushMsgByUniApp marshal err")
}
if flag == FlagOrder {
sub = "号订单"
options = map[string]interface{}{
"XM": map[string]interface{}{
"/extra.channel_id": "108892", // 订单类填写108892消息通知类填写108898
@@ -200,6 +205,7 @@ func pushMsgByUniApp(storeId int, storeName string, cID []string, msg string, bo
},
}
} else if flag == FlagIm {
sub = " "
options = map[string]interface{}{
"XM": map[string]interface{}{
"/extra.channel_id": "108898", // 订单类填写108892消息通知类填写108898
@@ -215,9 +221,7 @@ func pushMsgByUniApp(storeId int, storeName string, cID []string, msg string, bo
},
}
}
if err := json.Unmarshal([]byte(body), &offMsg); err != nil {
globals.SugarLogger.Debugf("pushMsgByUniApp marshal err")
}
for _, v := range cID {
param := map[string]interface{}{
"request_id": utils.Int64ToStr(time.Now().Unix()) + "_" + utils.Int2Str(storeId),
@@ -235,7 +239,7 @@ func pushMsgByUniApp(storeId int, storeName string, cID []string, msg string, bo
"ups": map[string]interface{}{
"notification": map[string]interface{}{
"title": storeName,
"body": offMsg.Context + "(" + offMsg.VendorName + offMsg.OrderSqs + "号订单)",
"body": offMsg.Context + "(" + offMsg.VendorName + offMsg.OrderSqs + sub + ")",
"click_type": "startapp",
"notify_id": time.Now().Unix(), // 每次通知需要不一样 范围0-2147483647
},