This commit is contained in:
richboo111
2023-07-12 17:22:30 +08:00
parent ff7e9aa343
commit f0635405b4

View File

@@ -137,8 +137,8 @@ func NotifyImNewMessage(vendorStoreID string, vendorID int) error {
msg.StoreTitle = store.Name
msg.Context = "老板,你有新的用户消息,请及时查看!"
context, _ := json.Marshal(msg)
pushMsgByUniApp(store.ID, store.Name, cid, string(context), string(context), SoundsFileNewImMsg, FlagIm)
body := fmt.Sprintf(msg.Context+"(%s)", model.VendorChineseNames[vendorID])
pushMsgByUniApp(store.ID, store.Name, cid, string(context), body, SoundsFileNewImMsg, FlagIm)
return err
}
@@ -183,13 +183,12 @@ 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")
}
globals.SugarLogger.Debugf("pushMsgByUniApp body")
if flag == FlagOrder {
sub = "号订单"
options = map[string]interface{}{
"XM": map[string]interface{}{
"/extra.channel_id": "108892", // 订单类填写108892消息通知类填写108898
@@ -205,7 +204,6 @@ 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
@@ -239,7 +237,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 + sub + ")",
"body": body,
"click_type": "startapp",
"notify_id": time.Now().Unix(), // 每次通知需要不一样 范围0-2147483647
},