兼容异常,并给出示例

This commit is contained in:
aixianling
2024-04-23 15:10:24 +08:00
parent 482391d6d3
commit 45f727ed7e
4 changed files with 20 additions and 8 deletions

View File

@@ -6,8 +6,8 @@
* @returns {*}
*/
const getSign = (token, appKey, formData) => {
token = token.split("_")[0]
export const getSign = (token, appKey, formData) => {
token = token?.split("_")[0]
const t = (new Date()).getTime();
return {
t, sign: function (e) {
@@ -158,3 +158,4 @@ const getSign = (token, appKey, formData) => {
}(token + "&" + t + "&" + appKey + "&" + formData)
}
}

View File

@@ -86,6 +86,8 @@ export function sendChromeNotification(message) {
*/
export function sendAliexpressAPIMessage(message) {
message.type = 'aliexpress'
const {mtopConfig = {appKey: "12574478"}} = window
message.appKey = message.appKey || mtopConfig.appKey
return new Promise((resolve) => {
chrome.runtime.sendMessage(message, resolve)
})