Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
config_repository
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
config_repository
Commits
ffcfe1dd
Commit
ffcfe1dd
authored
Mar 09, 2018
by
tywldx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
d4fd4308
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
126 deletions
+20
-126
addCookie.lua
lua-ui/lua/addCookie.lua
+3
-3
channel.conf
lua-ui/lua/channel.conf
+0
-57
isGray.lua
lua-ui/lua/isGray.lua
+0
-34
parseConfig.lua
lua-ui/lua/parseConfig.lua
+0
-15
phoneChannel.lua
lua-ui/lua/phoneChannel.lua
+15
-15
paycenter-ui--new-paycenter-ui.vh.conf
lua-ui/nginx/paycenter-ui--new-paycenter-ui.vh.conf
+2
-2
No files found.
lua-ui/lua/addCookie.lua
View file @
ffcfe1dd
...
@@ -3,9 +3,9 @@ local register_uri = args['registerFrom']
...
@@ -3,9 +3,9 @@ local register_uri = args['registerFrom']
local
merchant_uri
=
args
[
'merchantId'
]
local
merchant_uri
=
args
[
'merchantId'
]
if
(
register_uri
)
then
if
(
register_uri
)
then
ngx
.
header
[
'Set-Cookie'
]
=
{
'registerFrom='
..
register_uri
..
'; path=/;'
}
ngx
.
header
[
'Set-Cookie'
]
=
{
'registerFrom='
..
register_uri
..
'; path=/;
domain=.q-gp.com;
'
}
end
end
if
(
merchant_uri
)
then
if
(
merchant_uri
)
then
ngx
.
header
[
'Set-Cookie'
]
=
{
'merchantId='
..
merchant_uri
..
'; path=/;'
}
ngx
.
header
[
'Set-Cookie'
]
=
{
'merchantId='
..
merchant_uri
..
'; path=/;
domain=.q-gp.com;
'
}
end
end
\ No newline at end of file
lua-ui/lua/channel.conf
deleted
100644 → 0
View file @
d4fd4308
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
.
domain
.
com
;
gzip
on
;
gzip_min_length
1
k
;
gzip_buffers
4
16
k
;
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
lua-ui/lua/isGray.lua
deleted
100644 → 0
View file @
d4fd4308
--[[ 参数:
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
lua-ui/lua/parseConfig.lua
deleted
100644 → 0
View file @
d4fd4308
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
lua-ui/lua/phoneChannel.lua
View file @
ffcfe1dd
...
@@ -16,23 +16,23 @@ end
...
@@ -16,23 +16,23 @@ end
local
path
=
ngx
.
var
.
normalPath
;
local
path
=
ngx
.
var
.
normalPath
;
local
channelPath
=
ngx
.
var
.
channelPath
;
local
channelPath
=
ngx
.
var
.
channelPath
;
-- 解析手机号和特殊渠道
local
tailNumbers
=
string
.
split
(
ngx
.
var
.
tailNumber
);
local
tailNumbers
=
string
.
split
(
ngx
.
var
.
tailNumber
);
local
excludeChannel
=
string
.
split
(
ngx
.
var
.
excludeChannel
)
local
excludeChannel
=
string
.
split
(
ngx
.
var
.
excludeChannel
)
-- 解析渠道设置
local
register
=
string
.
split
(
ngx
.
var
.
registerChannel
);
local
register
=
string
.
split
(
ngx
.
var
.
registerChannel
);
local
merchant
=
string
.
split
(
ngx
.
var
.
merchantChannel
);
-- cookie值
local
register_cookie
=
ngx
.
var
.
cookie_registerFrom
local
register_cookie
=
ngx
.
var
.
cookie_registerFrom
local
merchant_cookie
=
ngx
.
var
.
cookie_merchantId
-- uri参数值
local
args
=
ngx
.
req
.
get_uri_args
()
local
args
=
ngx
.
req
.
get_uri_args
()
local
register_uri
=
args
[
'registerFrom'
]
local
register_uri
=
args
[
'registerFrom'
]
local
merchant_uri
=
args
[
'merchantId'
]
local
phoneNo
=
args
[
'phoneNo'
]
if
(
not
phoneNo
or
string.len
(
phoneNo
)
==
0
)
then
phoneNo
=
ngx
.
var
.
cookie_phoneNo
end
local
baiTiao
=
'222'
;
local
baiTiao
=
'222'
;
...
@@ -46,21 +46,20 @@ if (isBatitiao) then
...
@@ -46,21 +46,20 @@ if (isBatitiao) then
return
channelPath
;
return
channelPath
;
end
end
-- 没有设置渠道,设置了手机号,属于特殊渠道(不属于特殊,但符合尾号规则)时,返回旧版
if
(
ngx
.
var
.
excludeChannel
~=
''
or
ngx
.
var
.
tailNumber
~=
''
)
then
if
(
ngx
.
var
.
excludeChannel
~=
''
or
ngx
.
var
.
tailNumber
~=
''
)
then
local
hitExclude
=
isInTable
(
register_uri
,
excludeChannel
)
or
isInTable
(
register_cookie
,
excludeChannel
)
local
hitExclude
=
isInTable
(
register_uri
,
excludeChannel
)
or
isInTable
(
register_cookie
,
excludeChannel
)
or
isInTable
(
merchant_cookie
,
excludeChannel
)
or
isInTable
(
merchant_uri
,
excludeChannel
)
if
(
hitExclude
)
then
if
(
hitExclude
)
then
return
path
;
return
path
;
end
end
-- 是否符合手机尾号规则
local
hitTailNumber
=
false
local
hitTailNumber
=
false
if
ngx
.
var
.
cookie_
phoneNo
then
if
phoneNo
then
for
key
,
value
in
ipairs
(
tailNumbers
)
for
key
,
value
in
ipairs
(
tailNumbers
)
do
do
if
(
string.match
(
ngx
.
var
.
cookie_
phoneNo
,
value
..
'$'
))
then
if
(
string.match
(
phoneNo
,
value
..
'$'
))
then
hitTailNumber
=
true
hitTailNumber
=
true
break
break
end
end
...
@@ -72,4 +71,5 @@ if (ngx.var.excludeChannel ~= '' or ngx.var.tailNumber ~= '') then
...
@@ -72,4 +71,5 @@ if (ngx.var.excludeChannel ~= '' or ngx.var.tailNumber ~= '') then
end
end
end
end
return
path
;
return
channelPath
;
lua-ui/nginx/paycenter-ui--new-paycenter-ui.vh.conf
View file @
ffcfe1dd
...
@@ -16,7 +16,7 @@ server {
...
@@ -16,7 +16,7 @@ server {
set
$
merchantChannel
""
;
set
$
merchantChannel
""
;
set
$
excludeChannel
"222,504,900"
;
set
$
excludeChannel
"222,504,900"
;
set
$
tailNumber
"
0,
1,2,3,4,5,6,7,8,9"
;
set
$
tailNumber
"1,2,3,4,5,6,7,8,9"
;
location
/ {
location
/ {
expires
-
1
;
expires
-
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment