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

response fix

parent bffca079
Pipeline #7925 passed with stage
in 11 seconds
...@@ -6,17 +6,23 @@ class ResponseController extends Controller { ...@@ -6,17 +6,23 @@ class ResponseController extends Controller {
//内部授权注册 //内部授权注册
async internalAuth() { async internalAuth() {
//https://b.jianbing.com/51business/api/response/internal/auth?target_url=https://b.jianbing.com/webserve/51estate/index?channel_id=fc_gjjfc1
const { ctx } = this; const { ctx } = this;
const header = ctx.request.header; const header = ctx.request.header;
const input_params = ctx.query; const input_params = ctx.query;
const target_url = input_params.target_url; let target_url = input_params.target_url;
const rule = { const rule = {
target_url: { type: 'string', required: true }, target_url: { type: 'string', required: true },
channel_id: { type: 'string', required: true }, channel_id: { type: 'string', required: true },
} }
ctx.validate(rule, input_params); ctx.validate(rule, input_params);
if (target_url.indexOf('?') !== -1) {
target_url += `&channel_id=${channel_id}`;
} else {
target_url += `?channel_id=${channel_id}`;
}
//如果cookie中已存在 5要素 则可直接 跳到目标地址 //如果cookie中已存在 5要素 则可直接 跳到目标地址
const token = ctx.cookies.get('token', { signed: false }); const token = ctx.cookies.get('token', { signed: false });
const user_id = ctx.cookies.get('user_id', { signed: false }); const user_id = ctx.cookies.get('user_id', { signed: false });
......
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