Commit cbeecb20 authored by 李尚科's avatar 李尚科

fix

parent ce611868
Pipeline #15671 passed with stage
in 1 minute 22 seconds
...@@ -4,6 +4,7 @@ const Controller = require('egg').Controller; ...@@ -4,6 +4,7 @@ const Controller = require('egg').Controller;
const WECHAT_CODE_URL = 'https://open.weixin.qq.com/connect/oauth2/authorize'; const WECHAT_CODE_URL = 'https://open.weixin.qq.com/connect/oauth2/authorize';
const WECHAT_AUTH = 'https://api.weixin.qq.com/sns/oauth2/access_token'; const WECHAT_AUTH = 'https://api.weixin.qq.com/sns/oauth2/access_token';
const WECHAT_APPID = 'wx3c772df2d8d78da3'; const WECHAT_APPID = 'wx3c772df2d8d78da3';
const WECHAT_APPID_TEST = 'wxa9df2d60730b25d9';
const WECHAT_SECRET = 'b369fd28a9f9320ebe4e35dfaa00b194'; const WECHAT_SECRET = 'b369fd28a9f9320ebe4e35dfaa00b194';
const WECHAT_SECRET_TEST = 'dfede7a3b543149a88b07b46bcc28e00'; const WECHAT_SECRET_TEST = 'dfede7a3b543149a88b07b46bcc28e00';
const REDIRECT_PAGE = '/webserve/accumulation/index'; const REDIRECT_PAGE = '/webserve/accumulation/index';
...@@ -16,7 +17,7 @@ class WechatController extends Controller { ...@@ -16,7 +17,7 @@ class WechatController extends Controller {
const { ctx } = this; const { ctx } = this;
const code = ctx.query.code; const code = ctx.query.code;
const channel_id = ctx.query.channel_id; const channel_id = ctx.query.channel_id;
const app_id = ctx.query.app_id || WECHAT_APPID; const app_id = ['https://lan-nginx.jianbing.com', 'https://pro-nginx.jianbing.com'].includes(this.config.NODE_BASE_URL) ? WECHAT_APPID : WECHAT_APPID_TEST;
const appsecret = ['https://lan-nginx.jianbing.com', 'https://pro-nginx.jianbing.com'].includes(this.config.NODE_BASE_URL) ? WECHAT_SECRET : WECHAT_SECRET_TEST; const appsecret = ['https://lan-nginx.jianbing.com', 'https://pro-nginx.jianbing.com'].includes(this.config.NODE_BASE_URL) ? WECHAT_SECRET : WECHAT_SECRET_TEST;
if (!code || code.length === 0) { if (!code || code.length === 0) {
const target_url = WECHAT_CODE_URL + `?appid=${app_id}&redirect_uri=${encodeURIComponent(`${this.app.config.OUT_P_NODE_URL}/51business/api/gjj/wechat/oauth_login?&channel_id=${channel_id}`)}&response_type=code&scope=snsapi_base&state=gjjquery#wechat_redirect`; const target_url = WECHAT_CODE_URL + `?appid=${app_id}&redirect_uri=${encodeURIComponent(`${this.app.config.OUT_P_NODE_URL}/51business/api/gjj/wechat/oauth_login?&channel_id=${channel_id}`)}&response_type=code&scope=snsapi_base&state=gjjquery#wechat_redirect`;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment