1
This commit is contained in:
@@ -138,7 +138,7 @@ func NotifyImNewMessage(vendorStoreID string, vendorID int) error {
|
|||||||
msg.Context = "老板,你有新的用户消息,请及时查看!"
|
msg.Context = "老板,你有新的用户消息,请及时查看!"
|
||||||
context, _ := json.Marshal(msg)
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,8 +183,13 @@ func pushMsgByUniApp(storeId int, storeName string, cID []string, msg string, bo
|
|||||||
errs []error
|
errs []error
|
||||||
options = make(map[string]interface{}, 0)
|
options = make(map[string]interface{}, 0)
|
||||||
offMsg MsgContext
|
offMsg MsgContext
|
||||||
|
sub string
|
||||||
)
|
)
|
||||||
|
if err := json.Unmarshal([]byte(body), &offMsg); err != nil {
|
||||||
|
globals.SugarLogger.Debugf("pushMsgByUniApp marshal err")
|
||||||
|
}
|
||||||
if flag == FlagOrder {
|
if flag == FlagOrder {
|
||||||
|
sub = "号订单"
|
||||||
options = map[string]interface{}{
|
options = map[string]interface{}{
|
||||||
"XM": map[string]interface{}{
|
"XM": map[string]interface{}{
|
||||||
"/extra.channel_id": "108892", // 订单类填写:108892,消息通知类填写:108898
|
"/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 {
|
} else if flag == FlagIm {
|
||||||
|
sub = " "
|
||||||
options = map[string]interface{}{
|
options = map[string]interface{}{
|
||||||
"XM": map[string]interface{}{
|
"XM": map[string]interface{}{
|
||||||
"/extra.channel_id": "108898", // 订单类填写:108892,消息通知类填写:108898
|
"/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 {
|
for _, v := range cID {
|
||||||
param := map[string]interface{}{
|
param := map[string]interface{}{
|
||||||
"request_id": utils.Int64ToStr(time.Now().Unix()) + "_" + utils.Int2Str(storeId),
|
"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{}{
|
"ups": map[string]interface{}{
|
||||||
"notification": map[string]interface{}{
|
"notification": map[string]interface{}{
|
||||||
"title": storeName,
|
"title": storeName,
|
||||||
"body": offMsg.Context + "(" + offMsg.VendorName + offMsg.OrderSqs + "号订单)",
|
"body": offMsg.Context + "(" + offMsg.VendorName + offMsg.OrderSqs + sub + ")",
|
||||||
"click_type": "startapp",
|
"click_type": "startapp",
|
||||||
"notify_id": time.Now().Unix(), // 每次通知需要不一样 范围:0-2147483647
|
"notify_id": time.Now().Unix(), // 每次通知需要不一样 范围:0-2147483647
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user