From f1278535921fdd08a7fdf5e126a77fe34283cd90 Mon Sep 17 00:00:00 2001 From: liufumingren Date: Sat, 15 Aug 2026 20:12:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(shops):=20=E8=A7=86=E9=A2=91=E5=8F=B7?= =?UTF-8?q?=E6=8E=88=E6=9D=83=E5=85=81=E8=AE=B8=E5=9B=9E=E8=B0=83=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E4=B8=BA=E7=A9=BA=EF=BC=8C=E9=80=8F=E4=BC=A0=20appId/?= =?UTF-8?q?toUserName=EF=BC=8C=E8=B6=85=E6=97=B6=E8=B0=83=E8=87=B3=2015s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/systemMethods/shops.js | 6 ++++++ app/service/systems/shops.js | 13 +++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) 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);