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
c8a955c1
Commit
c8a955c1
authored
Jan 04, 2018
by
tywldx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new lua
parent
82123050
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
phoneChannel.lua
lua-ui/lua/phoneChannel.lua
+75
-0
No files found.
lua-ui/lua/phoneChannel.lua
0 → 100644
View file @
c8a955c1
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
;
local
tailNumbers
=
string
.
split
(
ngx
.
var
.
tailNumber
);
local
excludeChannel
=
string
.
split
(
ngx
.
var
.
excludeChannel
)
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'
]
local
baiTiao
=
'222'
;
if
(
register_uri
)
then
isBaitiao
=
register_uri
==
baiTiao
else
isBatitiao
=
register_cookie
==
baiTiao
end
if
(
isBatitiao
)
then
return
channelPath
;
end
if
(
ngx
.
var
.
excludeChannel
~=
''
or
ngx
.
var
.
tailNumber
~=
''
)
then
local
hitExclude
=
isInTable
(
register_uri
,
excludeChannel
)
or
isInTable
(
register_cookie
,
excludeChannel
)
or
isInTable
(
merchant_cookie
,
excludeChannel
)
or
isInTable
(
merchant_uri
,
excludeChannel
)
if
(
hitExclude
)
then
return
path
;
end
local
hitTailNumber
=
false
if
ngx
.
var
.
cookie_phoneNo
then
for
key
,
value
in
ipairs
(
tailNumbers
)
do
if
(
string.match
(
ngx
.
var
.
cookie_phoneNo
,
value
..
'$'
))
then
hitTailNumber
=
true
break
end
end
end
if
(
hitTailNumber
)
then
return
channelPath
;
end
end
return
channelPath
;
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