Skip to content

Commit

Permalink
[Bug]: 华为推送消息触发频控 #5299(2.5)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunhaolin committed Oct 10, 2023
1 parent 6c42946 commit 0023476
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 116 deletions.
53 changes: 18 additions & 35 deletions creator/packages/steedos-huaweipush/server/huaweiProvider.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const request = require('requestretry');
const tokenUrl = "https://login.vmall.com/oauth2/token";
const apiUrl = "https://api.push.hicloud.com/pushsend.do";
const tokenUrl = "https://oauth-login.cloud.huawei.com/oauth2/v3/token";
const apiUrl = "https://push-api.cloud.huawei.com/v1/[clientid]/messages:send";
const timeout = 5000;

HuaweiPush = {
Expand Down Expand Up @@ -50,11 +50,11 @@ HuaweiPush.doSendMany = function(notification, package_name, tokens, timeToLive)
console.log("sendMany ", notification, timeToLive);
const postData = this.getPostData(notification, package_name, tokens, timeToLive);
request.post({
url: apiUrl,
qs: {
nsp_ctx: `{"ver":1,"appId":"${this.authInfo[package_name].client_id}"}`
url: apiUrl.replace('[clientid]', this.authInfo[package_name].client_id),
body: JSON.stringify(postData),
'headers': {
'Authorization': 'Bearer '+ this.authInfo[package_name].access_token
},
form: postData,
timeout: timeout,
maxAttempts: 2,
retryDelay: 5000,
Expand All @@ -76,39 +76,22 @@ HuaweiPush.doSendMany = function(notification, package_name, tokens, timeToLive)

HuaweiPush.getPostData = function(notification, package_name, tokens, timeToLive) {
const postData = {
access_token: this.authInfo[package_name].access_token,
nsp_svc: "openpush.message.api.send",
nsp_ts: Math.floor(Date.now() / 1000)
};
postData.payload = {
hps: {
msg: {
type: 3,
body: {
content: notification.android.message,
title: notification.android.title
},
action: {
type: 3,
param: {
appPkgName: package_name
"validate_only": false,
"message": {
"android": {
"notification": {
"title": notification.android.title,
"body": notification.android.message,
"click_action": {
"type": 3
}
},
category: 'WORK' // 工作事项提醒
"category": "WORK"
},
ext: {
customize: this.extras(notification.extras)
}
"token": tokens,
"data": JSON.stringify(notification.extras)
}
};
postData.payload = JSON.stringify(postData.payload);
postData.device_token_list = JSON.stringify(tokens);

if (timeToLive > 0) {
postData.expire_time = this.formatHuaweiDate(new Date(Date.now() + timeToLive));
if (HuaweiPush.debug)
console.log("postData.expire_time ", postData.expire_time);
}
}
return postData;
}

Expand Down
26 changes: 13 additions & 13 deletions server/bundle/programs/server/packages/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ module.useNode();
//
module.exports = {
"name": "@steedos/objectql",
"version": "2.5.15-beta.10",
"version": "2.5.15-beta.12",
"main": "lib/index.js"
};

Expand All @@ -490,7 +490,7 @@ module.useNode();
//
module.exports = {
"name": "@steedos/i18n",
"version": "2.5.15-beta.10",
"version": "2.5.15-beta.12",
"main": "lib/index.js"
};

Expand All @@ -517,7 +517,7 @@ module.useNode();
//
module.exports = {
"name": "@steedos/core",
"version": "2.5.15-beta.10",
"version": "2.5.15-beta.12",
"main": "lib/index.js"
};

Expand All @@ -544,7 +544,7 @@ module.useNode();
//
module.exports = {
"name": "@steedos/service-meteor-package-loader",
"version": "2.5.15-beta.10",
"version": "2.5.15-beta.12",
"main": "index.js"
};

Expand All @@ -571,7 +571,7 @@ module.useNode();
//
module.exports = {
"name": "@steedos/service-api",
"version": "2.5.15-beta.10",
"version": "2.5.15-beta.12",
"main": "index.js"
};

Expand All @@ -598,7 +598,7 @@ module.useNode();
//
module.exports = {
"name": "@steedos/service-metadata-server",
"version": "2.5.15-beta.10",
"version": "2.5.15-beta.12",
"main": "index.js"
};

Expand All @@ -625,7 +625,7 @@ module.useNode();
//
module.exports = {
"name": "@steedos/service-package-registry",
"version": "2.5.15-beta.10",
"version": "2.5.15-beta.12",
"main": "package.service.js"
};

Expand All @@ -652,7 +652,7 @@ module.useNode();
//
module.exports = {
"name": "@steedos/service-objectql",
"version": "2.5.15-beta.10",
"version": "2.5.15-beta.12",
"main": "package.service.js"
};

Expand All @@ -679,7 +679,7 @@ module.useNode();
//
module.exports = {
"name": "@steedos/service-ui",
"version": "2.5.15-beta.10",
"version": "2.5.15-beta.12",
"main": "package.service.js"
};

Expand All @@ -706,7 +706,7 @@ module.useNode();
//
module.exports = {
"name": "@steedos/service-pages",
"version": "2.5.15-beta.10",
"version": "2.5.15-beta.12",
"main": "package.service.js"
};

Expand All @@ -733,7 +733,7 @@ module.useNode();
//
module.exports = {
"name": "@steedos/router",
"version": "2.5.15-beta.10",
"version": "2.5.15-beta.12",
"main": "lib/index.js"
};

Expand All @@ -760,7 +760,7 @@ module.useNode();
//
module.exports = {
"name": "@steedos/auth",
"version": "2.5.15-beta.10",
"version": "2.5.15-beta.12",
"main": "lib/index.js"
};

Expand All @@ -787,7 +787,7 @@ module.useNode();
//
module.exports = {
"name": "@steedos/workflow",
"version": "2.5.15-beta.10",
"version": "2.5.15-beta.12",
"main": "index.js"
};

Expand Down
54 changes: 18 additions & 36 deletions server/bundle/programs/server/packages/steedos_huaweipush.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "2.6.0"
},
"totalMinifiedBytes": 4282901,
"totalMinifiedGzipBytes": 1079253,
"totalMinifiedGzipBytes": 1079250,
"minifiedBytesByPackage": {
"packages/meteor.js": 9504,
"packages/coffeescript.js": 32,
Expand Down
16 changes: 8 additions & 8 deletions server/bundle/programs/web.browser.legacy/program.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
"format": "web-program-pre1",
"manifest": [
{
"path": "a295cec1971530e01efde31e17b7abedc91f0ccc.js",
"path": "d5f372170ee952f1ff72451eb1632c94a7763f93.js",
"where": "client",
"type": "js",
"cacheable": true,
"url": "/a295cec1971530e01efde31e17b7abedc91f0ccc.js?meteor_js_resource=true",
"url": "/d5f372170ee952f1ff72451eb1632c94a7763f93.js?meteor_js_resource=true",
"size": 4282901,
"hash": "a295cec1971530e01efde31e17b7abedc91f0ccc",
"sri": "YDgu77Shu403tNwxCFkodCkuum9vyd/sA0rmR9JlY3HKfCFZshvzYpnjy27Q78MVSdqLAd6sijMLh+mIaLLhtQ=="
"hash": "d5f372170ee952f1ff72451eb1632c94a7763f93",
"sri": "vT/ysKtF2HlHqkVCrapn1azq8uznRozqp/IF1Nhe20erDpLs5KbWd+jJzWfNO8Og+89mjIuCz4Q39HsVB2/DLA=="
},
{
"path": "a295cec1971530e01efde31e17b7abedc91f0ccc.stats.json",
"path": "d5f372170ee952f1ff72451eb1632c94a7763f93.stats.json",
"where": "client",
"type": "json",
"cacheable": true,
"url": "/a295cec1971530e01efde31e17b7abedc91f0ccc.stats.json?meteor_js_resource=true",
"url": "/d5f372170ee952f1ff72451eb1632c94a7763f93.stats.json?meteor_js_resource=true",
"size": 92296,
"hash": "1a8a85ddb625b712be7a166cb5523c851420a81d",
"sri": "qhAOnFhJWcSl67s+2u5unMGSf06A+s70mWGWZccPamOL4MLCNHzOdrhA3tsCMrqq/NMMFP6L/Rb9nyZXqzQsNg=="
"hash": "787a1e57ea24f18f68b02394f1e00c2120ac15ca",
"sri": "tVwekOle0r56jJQoXw7edGlfjIHX+FYYsi4fdJUex6FpEXK027cVF0wVYVtxoKjYPrvhUSnyacaM/DUzAMh1UQ=="
},
{
"path": "dynamic/node_modules/formBuilder/dist/form-builder.min.js",
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "2.6.0"
},
"totalMinifiedBytes": 4282901,
"totalMinifiedGzipBytes": 1079253,
"totalMinifiedGzipBytes": 1079250,
"minifiedBytesByPackage": {
"packages/meteor.js": 9504,
"packages/coffeescript.js": 32,
Expand Down
16 changes: 8 additions & 8 deletions server/bundle/programs/web.browser/program.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
"format": "web-program-pre1",
"manifest": [
{
"path": "a295cec1971530e01efde31e17b7abedc91f0ccc.js",
"path": "d5f372170ee952f1ff72451eb1632c94a7763f93.js",
"where": "client",
"type": "js",
"cacheable": true,
"url": "/a295cec1971530e01efde31e17b7abedc91f0ccc.js?meteor_js_resource=true",
"url": "/d5f372170ee952f1ff72451eb1632c94a7763f93.js?meteor_js_resource=true",
"size": 4282901,
"hash": "a295cec1971530e01efde31e17b7abedc91f0ccc",
"sri": "YDgu77Shu403tNwxCFkodCkuum9vyd/sA0rmR9JlY3HKfCFZshvzYpnjy27Q78MVSdqLAd6sijMLh+mIaLLhtQ=="
"hash": "d5f372170ee952f1ff72451eb1632c94a7763f93",
"sri": "vT/ysKtF2HlHqkVCrapn1azq8uznRozqp/IF1Nhe20erDpLs5KbWd+jJzWfNO8Og+89mjIuCz4Q39HsVB2/DLA=="
},
{
"path": "a295cec1971530e01efde31e17b7abedc91f0ccc.stats.json",
"path": "d5f372170ee952f1ff72451eb1632c94a7763f93.stats.json",
"where": "client",
"type": "json",
"cacheable": true,
"url": "/a295cec1971530e01efde31e17b7abedc91f0ccc.stats.json?meteor_js_resource=true",
"url": "/d5f372170ee952f1ff72451eb1632c94a7763f93.stats.json?meteor_js_resource=true",
"size": 92296,
"hash": "1a8a85ddb625b712be7a166cb5523c851420a81d",
"sri": "qhAOnFhJWcSl67s+2u5unMGSf06A+s70mWGWZccPamOL4MLCNHzOdrhA3tsCMrqq/NMMFP6L/Rb9nyZXqzQsNg=="
"hash": "787a1e57ea24f18f68b02394f1e00c2120ac15ca",
"sri": "tVwekOle0r56jJQoXw7edGlfjIHX+FYYsi4fdJUex6FpEXK027cVF0wVYVtxoKjYPrvhUSnyacaM/DUzAMh1UQ=="
},
{
"path": "dynamic/node_modules/formBuilder/dist/form-builder.min.js",
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "2.6.0"
},
"totalMinifiedBytes": 4559694,
"totalMinifiedGzipBytes": 1160419,
"totalMinifiedGzipBytes": 1160416,
"minifiedBytesByPackage": {
"packages/meteor.js": 9639,
"packages/coffeescript.js": 32,
Expand Down
16 changes: 8 additions & 8 deletions server/bundle/programs/web.cordova/program.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
"format": "web-program-pre1",
"manifest": [
{
"path": "e7beb1dfd71e2de82e55a2456aa966c89fce16f8.js",
"path": "dbfc952814ef7f8ddde79c44d60aae0c7d6c7d76.js",
"where": "client",
"type": "js",
"cacheable": true,
"url": "/__cordova/e7beb1dfd71e2de82e55a2456aa966c89fce16f8.js?meteor_js_resource=true",
"url": "/__cordova/dbfc952814ef7f8ddde79c44d60aae0c7d6c7d76.js?meteor_js_resource=true",
"size": 4559694,
"hash": "e7beb1dfd71e2de82e55a2456aa966c89fce16f8",
"sri": "RhiqOmWlBd47WkTWv9HlGt4ge3E6a5hB3xXyT9KjGKhVjpY9bknChVafdSuagRPIJS0zsp3G/nU51e8Hf9utlg=="
"hash": "dbfc952814ef7f8ddde79c44d60aae0c7d6c7d76",
"sri": "CQv+BAP+ib+YUoBDjOJevC25NSd1vW0IsptEVvvLqHXG3SR68fT3KWxBH+bci/cgq9+3oZ/vmxWy4B9xMEZweA=="
},
{
"path": "e7beb1dfd71e2de82e55a2456aa966c89fce16f8.stats.json",
"path": "dbfc952814ef7f8ddde79c44d60aae0c7d6c7d76.stats.json",
"where": "client",
"type": "json",
"cacheable": true,
"url": "/__cordova/e7beb1dfd71e2de82e55a2456aa966c89fce16f8.stats.json?meteor_js_resource=true",
"url": "/__cordova/dbfc952814ef7f8ddde79c44d60aae0c7d6c7d76.stats.json?meteor_js_resource=true",
"size": 92680,
"hash": "c0ca8926f232ebea84435bacdd3a7948a23af016",
"sri": "pfkZXttRfLCHoIGk7Ey9b88Dx1IjQ4KV0Htd5nJpB2Kswmt+c29LdLX7Jq0R9Cgc1x536msRjwRQs5pYu/NfEw=="
"hash": "2dbacef8c30757238f36148565f6b66c7126b90b",
"sri": "wzsgGLo7JBKMPjeNlA2beZdE5+WzHrkIut9w/id2EkIz64v3Mf3+atrxL3xDSmvNZpJg5C5YQHAtmJ/20h7UAg=="
},
{
"path": "e7d73b0e0bf8437a4be1c523a2f897106779544b.css",
Expand Down
2 changes: 1 addition & 1 deletion server/bundle/star.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
"meteorRelease": "[email protected]",
"nodeVersion": "12.16.1",
"npmVersion": "6.13.4",
"gitCommitHash": "d1e8792849880b7b2f05ab6d0fc6f8cdfff4a4b9"
"gitCommitHash": "6c429463fab24594572da01647f1985021236ac9"
}

0 comments on commit 0023476

Please sign in to comment.