Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
"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.StoreTitle = store.Name
|
||||||
msg.Context = "老板,你有新的用户消息,请及时查看!"
|
msg.Context = "老板,你有新的用户消息,请及时查看!"
|
||||||
context, _ := json.Marshal(msg)
|
context, _ := json.Marshal(msg)
|
||||||
|
body := fmt.Sprintf(msg.Context+"(%s)", model.VendorChineseNames[vendorID])
|
||||||
pushMsgByUniApp(store.ID, store.Name, cid, string(context), "", SoundsFileNewImMsg, FlagIm)
|
pushMsgByUniApp(store.ID, store.Name, cid, string(context), body, SoundsFileNewImMsg, FlagIm)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +182,12 @@ 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 err := json.Unmarshal([]byte(body), &offMsg); err != nil {
|
||||||
|
globals.SugarLogger.Debugf("pushMsgByUniApp marshal err")
|
||||||
|
}
|
||||||
|
globals.SugarLogger.Debugf("pushMsgByUniApp body")
|
||||||
if flag == FlagOrder {
|
if flag == FlagOrder {
|
||||||
options = map[string]interface{}{
|
options = map[string]interface{}{
|
||||||
"XM": 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 {
|
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),
|
||||||
@@ -232,9 +237,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": body,
|
||||||
"click_type": "startapp",
|
"click_type": "startapp",
|
||||||
"notify_id": rand.Int(), // 每次通知需要不一样 范围:0-2147483647
|
"notify_id": time.Now().Unix(), // 每次通知需要不一样 范围:0-2147483647
|
||||||
},
|
},
|
||||||
"options": options,
|
"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 {
|
if err := api.UniAppApi.SendMsgByUinApp(param); err != nil {
|
||||||
globals.SugarLogger.Debugf("SendMsgByUinApp err=%v", err)
|
|
||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user