fix(shops): 视频号授权允许回调地址为空,透传 appId/toUserName,超时调至 15s
This commit is contained in:
parent
2e95fb19d4
commit
f127853592
@ -149,6 +149,10 @@ class ShopsMethodService extends MainService {
|
|||||||
callbackurl,
|
callbackurl,
|
||||||
callback_url: callbackUrlSnake,
|
callback_url: callbackUrlSnake,
|
||||||
callbackUrl,
|
callbackUrl,
|
||||||
|
appId,
|
||||||
|
app_id: appIdSnake,
|
||||||
|
toUserName,
|
||||||
|
to_user_name: toUserNameSnake,
|
||||||
} = data || {};
|
} = data || {};
|
||||||
|
|
||||||
return await this.callShopsSystem('getAuthorizeSessionKey', {
|
return await this.callShopsSystem('getAuthorizeSessionKey', {
|
||||||
@ -156,6 +160,8 @@ class ShopsMethodService extends MainService {
|
|||||||
callbackurl: callbackurl !== undefined
|
callbackurl: callbackurl !== undefined
|
||||||
? callbackurl
|
? callbackurl
|
||||||
: (callbackUrlSnake !== undefined ? callbackUrlSnake : callbackUrl),
|
: (callbackUrlSnake !== undefined ? callbackUrlSnake : callbackUrl),
|
||||||
|
appId: appId !== undefined ? appId : appIdSnake,
|
||||||
|
toUserName: toUserName !== undefined ? toUserName : toUserNameSnake,
|
||||||
}, '获取授权会话失败');
|
}, '获取授权会话失败');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -691,11 +691,6 @@ class ShopsService extends Service {
|
|||||||
const authUrl = 'http://61.160.223.183:3012/api';
|
const authUrl = 'http://61.160.223.183:3012/api';
|
||||||
|
|
||||||
const shopId = data.id !== undefined ? data.id : (data.shop_id !== undefined ? data.shop_id : data.shopId);
|
const shopId = data.id !== undefined ? data.id : (data.shop_id !== undefined ? data.shop_id : data.shopId);
|
||||||
const callbackUrl = this.normalizeText(
|
|
||||||
data.callbackurl !== undefined ? data.callbackurl : data.callback_url,
|
|
||||||
'callbackurl',
|
|
||||||
{ required: true, maxLength: 500 }
|
|
||||||
);
|
|
||||||
const appId = data.appId || '';
|
const appId = data.appId || '';
|
||||||
const toUserName = data.toUserName || '';
|
const toUserName = data.toUserName || '';
|
||||||
const shop = await this.findShopById(shopId, { allowDeleted: false });
|
const shop = await this.findShopById(shopId, { allowDeleted: false });
|
||||||
@ -712,6 +707,12 @@ class ShopsService extends Service {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const platName = printPlatform ? printPlatform.get_auth_platform_name : platformCode;
|
const platName = printPlatform ? printPlatform.get_auth_platform_name : platformCode;
|
||||||
|
// 视频号授权不依赖回调地址,允许 callbackurl 为空;其他平台仍必填
|
||||||
|
const callbackUrl = this.normalizeText(
|
||||||
|
data.callbackurl !== undefined ? data.callbackurl : data.callback_url,
|
||||||
|
'callbackurl',
|
||||||
|
{ required: platName !== '视频号', maxLength: 500 }
|
||||||
|
);
|
||||||
const requestData = {
|
const requestData = {
|
||||||
RedirectCodeUrl: callbackUrl,
|
RedirectCodeUrl: callbackUrl,
|
||||||
command: 'saveShop',
|
command: 'saveShop',
|
||||||
@ -735,7 +736,7 @@ class ShopsService extends Service {
|
|||||||
const respone = await ctx.curl(authUrl, {
|
const respone = await ctx.curl(authUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
timeout: 5000,
|
timeout: 15000,
|
||||||
data: requestData,
|
data: requestData,
|
||||||
});
|
});
|
||||||
await this.app.setCacheAsync('last_respone_auth_polo', JSON.stringify(respone), 3600);
|
await this.app.setCacheAsync('last_respone_auth_polo', JSON.stringify(respone), 3600);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user