diff --git a/app/service/systemMethods/shops.js b/app/service/systemMethods/shops.js index 8c1034d..c828973 100644 --- a/app/service/systemMethods/shops.js +++ b/app/service/systemMethods/shops.js @@ -149,6 +149,10 @@ class ShopsMethodService extends MainService { callbackurl, callback_url: callbackUrlSnake, callbackUrl, + appId, + app_id: appIdSnake, + toUserName, + to_user_name: toUserNameSnake, } = data || {}; return await this.callShopsSystem('getAuthorizeSessionKey', { @@ -156,6 +160,8 @@ class ShopsMethodService extends MainService { callbackurl: callbackurl !== undefined ? callbackurl : (callbackUrlSnake !== undefined ? callbackUrlSnake : callbackUrl), + appId: appId !== undefined ? appId : appIdSnake, + toUserName: toUserName !== undefined ? toUserName : toUserNameSnake, }, '获取授权会话失败'); } } diff --git a/app/service/systems/shops.js b/app/service/systems/shops.js index ad9d8d2..87f440b 100644 --- a/app/service/systems/shops.js +++ b/app/service/systems/shops.js @@ -691,11 +691,6 @@ class ShopsService extends Service { 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 callbackUrl = this.normalizeText( - data.callbackurl !== undefined ? data.callbackurl : data.callback_url, - 'callbackurl', - { required: true, maxLength: 500 } - ); const appId = data.appId || ''; const toUserName = data.toUserName || ''; 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; + // 视频号授权不依赖回调地址,允许 callbackurl 为空;其他平台仍必填 + const callbackUrl = this.normalizeText( + data.callbackurl !== undefined ? data.callbackurl : data.callback_url, + 'callbackurl', + { required: platName !== '视频号', maxLength: 500 } + ); const requestData = { RedirectCodeUrl: callbackUrl, command: 'saveShop', @@ -735,7 +736,7 @@ class ShopsService extends Service { const respone = await ctx.curl(authUrl, { method: 'POST', dataType: 'json', - timeout: 5000, + timeout: 15000, data: requestData, }); await this.app.setCacheAsync('last_respone_auth_polo', JSON.stringify(respone), 3600);