j***@126.com
j***@126.com
  • 发布:2024-11-26 17:37
  • 更新:2024-11-26 18:29
  • 阅读:17

已经存在发送成功的日志,但手机并未收到通知消息,手机的通知权限也是打开的,前端APP代码如下

分类:uni-app

uni.onPushMessage(res => {
console.log("2收到推送消息:", res) //监听推送消息
if(res.type=='receive'){
uni.createPushMessage({
title: res.data.title,
content: res.data.content,
sound:'system',
payload: res.data.payload
})
}else if(res.type=='click'){
if (osName == 'ios') {
plus.runtime.setBadgeNumber(res.data.aps.badge-1)
}else{
plus.runtime.setBadgeNumber(0)
}
let cikid = res.data.payload.userId //接收通知人userId
let objNo = res.data.payload.objNo//业务不同编号
let userEname = res.data.payload.userEname//接收通知人userEname
let businessType = res.data.payload.msgType //业务类型 订单、合同、工程....
console.log('businessType-objNo', businessType,objNo)
// 订单系列
if (businessType == 'order') {
let type = loginUser.userType
console.log('人员类型-', loginUser.userType)
if (loginUser.userType == 'manager') { //业务员001194 + =orderListYw DD2024071200022
uni.navigateTo({
url: '/pages/order/orderExamine?status=&appCikId=' + objNo
})
} else if (loginUser.userType == 'supplier') { // 1310000047
uni.navigateTo({
url: '/pages/home/oem?appCikId=' + objNo
})
} else { //100086 orderList
uni.navigateTo({
url: '/pages/order/orderList??status=&appCikId=' + objNo
})
}
} else if (businessType == 'contract') {//合同
if (loginUser.userType == 'supplier') { // 1310000047
uni.navigateTo({
url: '/pagesA/contract/contractApprove2?appCikId=' + objNo
})
} else { //100086 orderList
uni.navigateTo({
url: '/pagesA/contract/contractApprove??status=&appCikId=' + objNo
})
}
} else if (businessType == 'leavemessage') { //留言
uni.navigateTo({
url: '/pages/feedback/feedbackAdmin?objNo=' + objNo
})
}else if (businessType == 'tssgcrm_gcsb'||businessType == 'tssgcrm_gcbh'||businessType == 'tssgcrm_zlbh'||businessType == 'tssgcrm_zlsq'||businessType == 'tssgcrm_gcbg'||businessType == 'tssgcrm_zlbg') { //工程
uni.navigateTo({
url: '/pagesA/engineePrice/projectApprove?objNo=' + objNo
})
}else if (businessType == 'tssgcrm_gcbb') { //工程报备
uni.navigateTo({
url: '/pagesA/engineePrice/engineeringApprove?objNo=' + objNo
})
}
}
})

后端代码//appNoticeUrl=https://fc-mp-a9eeaxxxxacaffb.next.bspapp.com/orderAudit
log.info("APP消息通知参数 ===> appNoticeUtl: {}, userEnameList: {}, title: {}, content: {}, type: {}, objNo: {}, objId: {}",
appNoticeUrl, userEnameList, title, content, type, objNo, objId);

    // 参数校验  
    if (StrUtil.isEmpty(userEnameList) || StrUtil.isNull(title) || StrUtil.isNull(content) || StrUtil.isNull(type) || StrUtil.isNull(objNo) || StrUtil.isNull(objId)) return;  

    List<DataMap> uctUserList = searchFormUctUser(userEnameList);  
    if (StrUtil.isEmpty(uctUserList)) return;  

    for (DataMap item : uctUserList){  
        String appUid = StrUtil.doNull(String.valueOf(item.get("appUid")));  
        if (StrUtil.isNull(appUid)) continue;  

        // 创建内部的 Map  
        Map<String, Object> payload = new HashMap<>();  
        payload.put("msgType",type);  
        payload.put("objNo",objNo);  
        payload.put("objId",objId);  
        payload.put("userId",item.get("userId"));  
        payload.put("userEname",item.get("userEname"));  

        // 填充外部的 Map  
        Map<String, Object> messageMap = new HashMap<>();  
        messageMap.put("cids",appUid);  
        messageMap.put("title",title);  
        messageMap.put("content",content);  
        messageMap.put("request_id", UUIDUtil.generateId());  
        messageMap.put("payload", payload);  

        HttpService.sendPostHttp(appNoticeUrl, messageMap, prepareHeadMap());
2024-11-26 17:37 负责人:无 分享
已邀请:
BoredApe

BoredApe - 有问题就会有答案。

请联系个推技术支持

要回复问题请先登录注册