This commit is contained in:
richboo111
2023-07-12 17:09:03 +08:00
parent 6ab899ea0d
commit 58da22323f

View File

@@ -182,6 +182,7 @@ func pushMsgByUniApp(storeId int, storeName string, cID []string, msg string, bo
var ( var (
errs []error errs []error
options = make(map[string]interface{}, 0) options = make(map[string]interface{}, 0)
offMsg MsgContext
) )
if flag == FlagOrder { if flag == FlagOrder {
options = map[string]interface{}{ options = map[string]interface{}{
@@ -214,6 +215,9 @@ 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),
@@ -231,10 +235,9 @@ 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": msg, "body": offMsg.Context + "(" + offMsg.VendorName + offMsg.OrderSqs + "号订单)",
"click_type": "startapp", "click_type": "startapp",
//"notify_id": rand.Intn(1000000000), "notify_id": time.Now().Unix(), // 每次通知需要不一样 范围0-2147483647
"notify_id": time.Now().Unix(), // 每次通知需要不一样 范围0-2147483647
}, },
"options": options, "options": options,
}, },