|
@@ -69,18 +69,31 @@ end |
|
@@ -69,18 +69,31 @@ end |
69
|
|
69
|
|
70
|
|
70
|
|
71
|
function get_redirect_url()
|
71
|
function get_redirect_url()
|
72
|
- local redirectPath = "/apigateway" ;
|
72
|
+ local redirectPath = "/apigateway"
|
|
|
73
|
+ local awsPath = "/apiaws"
|
|
|
74
|
+
|
73
|
init_read_body()
|
75
|
init_read_body()
|
|
|
76
|
+
|
|
|
77
|
+ -- get params
|
74
|
local percentage = switch_controller.get_percentage()
|
78
|
local percentage = switch_controller.get_percentage()
|
|
|
79
|
+ local force_uid = switch_controller.get_force_uid()
|
|
|
80
|
+
|
|
|
81
|
+ -- get uid
|
|
|
82
|
+ local uid = 0
|
|
|
83
|
+ local str_uid = http_request.get_req_param("uid")
|
|
|
84
|
+ if str_uid then
|
|
|
85
|
+ uid = tonumber(str_uid)
|
|
|
86
|
+ end
|
|
|
87
|
+ -- force uid
|
|
|
88
|
+ if force_uid and uid == force_uid then
|
|
|
89
|
+ return awsPath
|
|
|
90
|
+ end
|
|
|
91
|
+
|
|
|
92
|
+ --- hash percentage
|
75
|
if percentage >= 1 then
|
93
|
if percentage >= 1 then
|
76
|
- local uid = http_request.get_req_param("uid")
|
|
|
77
|
- if not uid then
|
|
|
78
|
- uid = 0
|
|
|
79
|
- end
|
|
|
80
|
-
|
|
|
81
|
- local hash = tonumber(uid) % 100
|
94
|
+ local hash = uid % 100
|
82
|
if hash <= percentage then
|
95
|
if hash <= percentage then
|
83
|
- redirectPath = "/apiaws";
|
96
|
+ return awsPath
|
84
|
end
|
97
|
end
|
85
|
end
|
98
|
end
|
86
|
return redirectPath
|
99
|
return redirectPath
|