Commit f4914f21 authored by daidekun's avatar daidekun

rm

parent 312a5374
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);
local register_cookie = ngx.var.cookie_registerFrom
local merchant_cookie = ngx.var.cookie_merchantId
local args = ngx.req.get_uri_args()
local register_uri = args['registerFrom']
local merchant_uri = args['merchantId']
if (register_uri) then
hitRegister = isInTable(register_uri, register)
else
hitRegister = isInTable(register_cookie, register)
end
if (merchant_uri) then
hitMerchantId = isInTable(merchant_uri, register)
else
hitMerchantId = isInTable(merchant_cookie, register)
end
local baiTiao = '222';
local isBaitiao = (register_cookie == baiTiao or register_uri == baiTiao)
if (isBaitiao and ngx.var.merchantChannel == '') then
return channelPath
end
if (isBaitiao and ngx.var.merchantChannel ~= '' and hitMerchantId) then
return channelPath
end
if ( not isBaitiao and hitRegister) then
return channelPath
end
return path;
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