...
|
...
|
@@ -69,18 +69,31 @@ end |
|
|
|
|
|
|
|
|
function get_redirect_url()
|
|
|
local redirectPath = "/apigateway" ;
|
|
|
local redirectPath = "/apigateway"
|
|
|
local awsPath = "/apiaws"
|
|
|
|
|
|
init_read_body()
|
|
|
|
|
|
-- get params
|
|
|
local percentage = switch_controller.get_percentage()
|
|
|
local force_uid = switch_controller.get_force_uid()
|
|
|
|
|
|
-- get uid
|
|
|
local uid = 0
|
|
|
local str_uid = http_request.get_req_param("uid")
|
|
|
if str_uid then
|
|
|
uid = tonumber(str_uid)
|
|
|
end
|
|
|
-- force uid
|
|
|
if force_uid and uid == force_uid then
|
|
|
return awsPath
|
|
|
end
|
|
|
|
|
|
--- hash percentage
|
|
|
if percentage >= 1 then
|
|
|
local uid = http_request.get_req_param("uid")
|
|
|
if not uid then
|
|
|
uid = 0
|
|
|
end
|
|
|
|
|
|
local hash = tonumber(uid) % 100
|
|
|
local hash = uid % 100
|
|
|
if hash <= percentage then
|
|
|
redirectPath = "/apiaws";
|
|
|
return awsPath
|
|
|
end
|
|
|
end
|
|
|
return redirectPath
|
...
|
...
|
|