1
This commit is contained in:
@@ -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
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user