@@ -13,47 +13,40 @@ local cjson = require("cjson.safe");
1313cjson .encode_empty_table_as_object (false )
1414
1515
16- local Router = function ()
16+ local Handler = function ()
1717 local service_empty = cache :get (tl_ops_constant_balance .cache_key .service_empty )
1818 if not service_empty then
19- tl_ops_utils_func :set_ngx_req_return_ok (tl_ops_rt .not_found , " not found service_empty" , _ );
20- return ;
19+ return tl_ops_rt .not_found , " not found service_empty" , _
2120 end
2221
2322 local mode_empty = cache :get (tl_ops_constant_balance .cache_key .mode_empty )
2423 if not mode_empty then
25- tl_ops_utils_func :set_ngx_req_return_ok (tl_ops_rt .not_found , " not found mode_empty" , _ );
26- return ;
24+ return tl_ops_rt .not_found , " not found mode_empty" , _
2725 end
2826
2927 local host_empty = cache :get (tl_ops_constant_balance .cache_key .host_empty )
3028 if not host_empty then
31- tl_ops_utils_func :set_ngx_req_return_ok (tl_ops_rt .not_found , " not found host_empty" , _ );
32- return ;
29+ return tl_ops_rt .not_found , " not found host_empty" , _
3330 end
3431
3532 local host_pass = cache :get (tl_ops_constant_balance .cache_key .host_pass )
3633 if not host_pass then
37- tl_ops_utils_func :set_ngx_req_return_ok (tl_ops_rt .not_found , " not found host_pass" , _ );
38- return ;
34+ return tl_ops_rt .not_found , " not found host_pass" , _
3935 end
4036
4137 local token_limit = cache :get (tl_ops_constant_balance .cache_key .token_limit )
4238 if not token_limit then
43- tl_ops_utils_func :set_ngx_req_return_ok (tl_ops_rt .not_found , " not found token_limit" , _ );
44- return ;
39+ return tl_ops_rt .not_found , " not found token_limit" , _
4540 end
4641
4742 local leak_limit = cache :get (tl_ops_constant_balance .cache_key .leak_limit )
4843 if not leak_limit then
49- tl_ops_utils_func :set_ngx_req_return_ok (tl_ops_rt .not_found , " not found leak_limit" , _ );
50- return ;
44+ return tl_ops_rt .not_found , " not found leak_limit" , _
5145 end
5246
5347 local offline = cache :get (tl_ops_constant_balance .cache_key .offline )
5448 if not offline then
55- tl_ops_utils_func :set_ngx_req_return_ok (tl_ops_rt .not_found , " not found offline" , _ );
56- return ;
49+ return tl_ops_rt .not_found , " not found offline" , _
5750 end
5851
5952 local res_data = {
@@ -66,7 +59,15 @@ local Router = function()
6659 offline = cjson .decode (offline )
6760 }
6861
69- tl_ops_utils_func : set_ngx_req_return_ok ( tl_ops_rt .ok , " success" , res_data );
62+ return tl_ops_rt .ok , " success" , res_data
7063end
7164
72- return Router
65+
66+ local Router = function ()
67+ tl_ops_utils_func :set_ngx_req_return_ok (Handler ())
68+ end
69+
70+ return {
71+ Handler = Handler ,
72+ Router = Router
73+ }
0 commit comments