Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
||||
@@ -138,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), "", 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,7 +182,12 @@ func pushMsgByUniApp(storeId int, storeName string, cID []string, msg string, bo
|
||||
var (
|
||||
errs []error
|
||||
options = make(map[string]interface{}, 0)
|
||||
offMsg MsgContext
|
||||
)
|
||||
if err := json.Unmarshal([]byte(body), &offMsg); err != nil {
|
||||
globals.SugarLogger.Debugf("pushMsgByUniApp marshal err")
|
||||
}
|
||||
globals.SugarLogger.Debugf("pushMsgByUniApp body")
|
||||
if flag == FlagOrder {
|
||||
options = map[string]interface{}{
|
||||
"XM": map[string]interface{}{
|
||||
@@ -215,6 +219,7 @@ func pushMsgByUniApp(storeId int, storeName string, cID []string, msg string, bo
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
for _, v := range cID {
|
||||
param := map[string]interface{}{
|
||||
"request_id": utils.Int64ToStr(time.Now().Unix()) + "_" + utils.Int2Str(storeId),
|
||||
@@ -232,9 +237,9 @@ func pushMsgByUniApp(storeId int, storeName string, cID []string, msg string, bo
|
||||
"ups": map[string]interface{}{
|
||||
"notification": map[string]interface{}{
|
||||
"title": storeName,
|
||||
"body": msg,
|
||||
"body": body,
|
||||
"click_type": "startapp",
|
||||
"notify_id": rand.Int(), // 每次通知需要不一样 范围:0-2147483647
|
||||
"notify_id": time.Now().Unix(), // 每次通知需要不一样 范围:0-2147483647
|
||||
},
|
||||
"options": options,
|
||||
},
|
||||
@@ -256,7 +261,6 @@ func pushMsgByUniApp(storeId int, storeName string, cID []string, msg string, bo
|
||||
}
|
||||
|
||||
if err := api.UniAppApi.SendMsgByUinApp(param); err != nil {
|
||||
globals.SugarLogger.Debugf("SendMsgByUinApp err=%v", err)
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user