Commit 4ec72751 authored by daidekun's avatar daidekun

1

parent ca31f10d
var protocol = window.location.protocol
var apiHost = protocol + '//payapi.xyqb.com';
var xyqbUserUrl = protocol + '//passport.xyqb.com';
module.exports = {
api: apiHost,
test: false,
xyqbUserUrl: xyqbUserUrl
}
var protocal = window.location.protocol;
var apiHost = protocal + '//payapi.xyqb.com';
module.exports = {
api: apiHost,
test:true
};
\ No newline at end of file
var protocol = window.location.protocol
var apiHost = protocol + '//api.xyqb.com/'
var xyqbUserUIHost = protocol + '//passport.xyqb.com/'
var activityUI = protocol + '//activity.xyqb.com/'
var qiniuHost = protocol + '//ohsx2fi5w.bkt.clouddn.com/'
var btHost = protocol + '//bt.xyqb.com/'
var shuntHost = protocol + '//flow.xyqb.com/'
var mallApi = protocol + '//mallapi.xyqb.com';
var mallUrl = protocol + '//mall.xyqb.com';
var h5Url = protocol + '//h5.xyqb.com';
var redPacketUrl = protocol + '//redpacket.xyqb.com/';
module.exports = {
ApiBaseUrl: apiHost, // 信用钱包后端
XyqbUserUI: xyqbUserUIHost, // 用户中心
ActivityUI: activityUI, // 活动中心
QiniuHostUrl: qiniuHost,
BtBaseUrl: btHost, // 白条
ShuntBaseUrl: shuntHost, // 流量分发
mallApi: mallApi, // 商城后端
mallUrl: mallUrl, // 商城前端
h5Url: h5Url,
RedPacketUrl: redPacketUrl // 红包
}
(function () {
'use strict';
var protocol = window.location.protocol;
var apiHost = protocol + '//api.xyqb.com/';
var xyqbUserUIHost = protocol + '//passport.xyqb.com/';
var authHost = protocol + '//auth.xyqb.com/';
var bankCardReturnToken = 'BIND_RETURN_ONLINE';
var repayReturnToken = 'REPAY_RETURN_ONLINE';
var rebindRepayReturnToken = 'REBIND_RETURN_ONLINE';
var activityUI= protocol +'//activity.xyqb.com/';
var qiniuHost= protocol +'//ohsx2fi5w.bkt.clouddn.com/';
var btHost= protocol +'//bt.xyqb.com/';
var shuntHost = protocol + '//flow.xyqb.com/';
var h5Host = protocol + '//h5.xyqb.com/';
var xyqbApp = angular.module('xyqbUiApp');
xyqbApp.value('ApiBaseUrl', apiHost);
xyqbApp.value('AuthBaseUrl', authHost);
xyqbApp.value('ActivityUI', activityUI);
xyqbApp.value('QiniuHostUrl', qiniuHost);
xyqbApp.value('BtBaseUrl', btHost);
xyqbApp.value('ShuntBaseUrl', shuntHost);
xyqbApp.value('XyqbUserUI', xyqbUserUIHost);
xyqbApp.value('h5BaseUrl', h5Host);
if (location.host === '58.xyqb.com') {
bankCardReturnToken = '58BIND_RETURN_ONLINE';
repayReturnToken = '58REPAY_RETURN_ONLINE';
rebindRepayReturnToken = '58REBIND_RETURN_ONLINE';
xyqbApp.value('BindCardToken', bankCardReturnToken);
xyqbApp.value('RepayToken', repayReturnToken);
xyqbApp.value('RebindToken', rebindRepayReturnToken);
} else {
xyqbApp.value('BindCardToken', bankCardReturnToken);
xyqbApp.value('RepayToken', repayReturnToken);
xyqbApp.value('RebindToken', rebindRepayReturnToken);
}
})();
server {
listen 80;
server_name _;
location / {
root /home/quant_group/project/public;
try_files $uri $uri/ /index.html;
}
}
\ No newline at end of file
local args = ngx.req.get_uri_args()
local register_uri = args['registerFrom']
local merchant_uri = args['merchantId']
if (register_uri) then
ngx.header['Set-Cookie'] = {'registerFrom=' .. register_uri .. '; path=/;'}
end
if (merchant_uri) then
ngx.header['Set-Cookie'] = {'merchantId=' .. merchant_uri .. '; path=/;'}
end
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
access_log logs/access.log combined;
server {
listen 8100;
server_name sc.xyqb.com;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml application/javascript;
gzip_vary on;
# 正常发布路径 和 灰度发布路径
set $rootPath "/Users/xuezhijie/playground/nginx/test1/public";
set $gatedRootPath "/Users/xuezhijie/playground/nginx/test1-gated/public";
# jenkins灰度渠道参数
set $gatedStr "registerFrom=1,2&merchantId=2,3";
# 解析灰度配置
# 1,2
set_by_lua_file $regConfig confs/parseConfig.lua $gatedStr "registerFrom";
# 2,3
set_by_lua_file $merchantConfig confs/parseConfig.lua $gatedStr "merchantId";
location / {
echo "http_cookie: $http_cookie";
# 获取cookie渠道号,判断是否属于灰度范围
echo "registerFrom渠道号: $cookie_registerFrom";
echo "merchantId渠道号: $cookie_merchantId";
echo "灰度配置registerFrom: $regConfig";
echo "灰度配置merchantId: $merchantConfig";
set_by_lua_file $isGray confs/isGray.lua $regConfig $merchantConfig $cookie_registerFrom $cookie_merchantId;
echo $isGray;
# 按渠道发布
if ($isGray != '') {
set $rootPath $gatedRootPath;
}
root $rootPath;
try_files $uri $uri/ /index.html;
}
}
}
\ No newline at end of file
--[[ 参数:
registerFrom 灰度设置
merchantId 灰度设置
cookie registerFrom值
cookie merchantId值
]]
local regConfig = ngx.arg[1];
local merConfig = ngx.arg[2];
local regCookie = ngx.arg[3];
local merCookie = ngx.arg[4];
local isGrayReg = false;
local isGrayMer = false;
if (regConfig ~= '' and regCookie~= '' and string.find(regConfig, regCookie)) then
isGrayReg = true;
end
if (merConfig ~= '' and merCookie ~= '' and string.find(merConfig, merCookie)) then
isGrayMer = true;
end
local isGray = '';
if (isGrayReg or isGrayMer) then
isGray = '1';
end
--print(isGray)
return isGray;
\ No newline at end of file
local t = "";
local str = ngx.arg[1];
local prop = ngx.arg[2];
-- local str = "registerFrom=1,2,3&merchantId=2,3";
-- local prop = "merchantId";
for k,v in string.gmatch(str, "(%w+)=([%w,]+)") do
if (k == prop) then
-- print(k, v)
t = v;
break;
end
end
return t;
\ No newline at end of file
function string.split(str)
local splitlist = {};
string.gsub(str, '[^,]+', function(w) table.insert(splitlist, w) end )
return splitlist;
end
function isInTable(value, tbl)
for k,v in ipairs(tbl) do
if v == value then
return true;
end
end
return false;
end
local path = ngx.var.normalPath;
local channelPath = ngx.var.channelPath;
-- 没有设置渠道,返回旧目录
if (ngx.var.registerChannel == '' and ngx.var.merchantChannel == '') then
return path;
end
-- 解析渠道设置
local register = string.split(ngx.var.registerChannel);
local merchant = string.split(ngx.var.merchantChannel);
-- cookie值
local register_cookie = ngx.var.cookie_registerFrom
local merchant_cookie = ngx.var.cookie_merchantId
-- uri参数值
local args = ngx.req.get_uri_args()
local register_uri = args['registerFrom']
local merchant_uri = args['merchantId']
-- 优先匹配参数中的registerFrom
if (register_uri) then
hitRegister = isInTable(register_uri, register)
else
hitRegister = isInTable(register_cookie, register)
end
-- 优先匹配参数中的merchantId
if (merchant_uri) then
hitMerchantId = isInTable(merchant_uri, register)
else
hitMerchantId = isInTable(merchant_cookie, register)
end
local baiTiao = '222';
--
if (register_uri) then
isBaitiao = register_uri == baiTiao
else
isBatitiao = register_cookie == baiTiao
end
-- 是白条,未设置merchantId规则,命中
if (isBaitiao and ngx.var.merchantChannel == '') then
return channelPath
end
-- 是白条,设置了merchantId规则,匹配merchantId后命中
if (isBaitiao and ngx.var.merchantChannel ~= '' and hitMerchantId) then
return channelPath
end
-- 不是白条,匹配registerFrom后命中
if ( not isBaitiao and hitRegister) then
return channelPath
end
return path;
server {
listen 80;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 4;
gzip_types text/plain application/x-javascript text/css application/xml application/javascript;
gzip_vary on;
set $normalPath "/home/quant_group/paycenter-ui/dist";
set $channelPath "/home/quant_group/new-paycenter-ui/dist";
set $registerChannel "758,222,198";
set $merchantChannel "";
location / {
expires -1;
set_by_lua_file $rootPath /usr/local/openresty/nginx/conf/conf.d/lua/toChannel.lua;
header_filter_by_lua_file /usr/local/openresty/nginx/conf/conf.d/lua/addCookie.lua;
root $rootPath;
try_files $uri $uri/ /index.html?$query_string;
}
}
server {
listen 80;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 4;
gzip_types text/plain application/x-javascript text/css application/xml application/javascript;
gzip_vary on;
set $normalPath "/home/quant_group/xyqb-ui/dist/public";
set $channelPath "/home/quant_group/xjd-ui/dist";
set $registerChannel "864,158744";
set $merchantChannel "";
location / {
expires -1;
set_by_lua_file $rootPath /usr/local/openresty/nginx/conf/conf.d/lua/toChannel.lua;
header_filter_by_lua_file /usr/local/openresty/nginx/conf/conf.d/lua/addCookie.lua;
root $rootPath;
try_files $uri $uri/ /index.html?$query_string;
}
}
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