From 964a4e638feee3e541f008f56c15d5c5d3627547 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 06 六月 2023 18:11:58 +0800 Subject: [PATCH] 看盘端html文件融入/华鑫接口接入 --- kp_html/kp/js/http.js | 213 ++++++++++++++++++++++++++++++---------------------- 1 files changed, 122 insertions(+), 91 deletions(-) diff --git a/kp_html/kp/js/http.js b/kp_html/kp/js/http.js index 08c0d50..de02c85 100644 --- a/kp_html/kp/js/http.js +++ b/kp_html/kp/js/http.js @@ -1,124 +1,155 @@ -var http_util={ - request_callback:{}, - getQueryString:function(name) { - var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); - var r = window.location.search.substr(1).match(reg); - if (r != null) { - return unescape(decodeURI(r[2])); - } - return null; +var http_util = { + request_callback: {}, + getQueryString: function(name) { + var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); + var r = window.location.search.substr(1).match(reg); + if (r != null) { + return unescape(decodeURI(r[2])); + } + return null; }, - http_request_result:function(key,data){ - console.log("http璇锋眰鍥炶皟","key锛�"+key); + http_request_result: function(key, data) { + console.log("http璇锋眰鍥炶皟", "key锛�" + key); http_util.request_callback[key](data); delete http_util.request_callback[key]; }, - http_request:function(path,data,callback){ - key ="http_callback_"+ new Date().getTime() + "_" + Math.round(Math.random() * 100000000); + http_request: function(path, data, callback) { + key = "http_callback_" + new Date().getTime() + "_" + Math.round(Math.random() * 100000000); http_util.request_callback[key] = callback; - pyjs.http_request(path,JSON.stringify(data),JSON.stringify(["http_util.http_request_result",key])); + pyjs.http_request(path, JSON.stringify(data), JSON.stringify(["http_util.http_request_result", key])); }, - - - get_score_data:function(code,name,callback){ - params={code:code} - if(name){ - params.name=name; + + + get_score_data: function(code, name, callback) { + params = { + code: code } - http_util.http_request("/get_score_info",params,callback); + if (name) { + params.name = name; + } + http_util.http_request("/get_score_info", params, callback); }, - - get_kpl_data:function(callback){ - http_util.http_request("/get_kpl_data",{},callback); + + get_kpl_data: function(callback) { + http_util.http_request("/get_kpl_data", {}, callback); }, - - - get_market_data:function(type,callback){ - http_util.http_request("/kpl/get_market_data",{type:type},callback); + + + get_market_data: function(type, callback) { + http_util.http_request("/kpl/get_market_data", { + type: type + }, callback); }, - - get_limit_up_list:function(code,callback){ - http_util.http_request("/kpl/get_limit_up_list",{code:code},callback); + + get_limit_up_list: function(code, callback) { + http_util.http_request("/kpl/get_limit_up_list", { + code: code + }, callback); }, - - get_plate_info:function(code,callback){ - http_util.http_request("/kpl/get_plate_info",{code:code},callback); + + get_plate_info: function(code, callback) { + http_util.http_request("/kpl/get_plate_info", { + code: code + }, callback); }, - - add_ignore_code:function(type,code,callback){ - http_util.http_request("/kpl/add_ignore_code",{code:code,type:type},callback); - + + add_ignore_code: function(type, code, callback) { + http_util.http_request("/kpl/add_ignore_code", { + code: code, + type: type + }, callback); + }, - - do_action_for_code:function(code,plate,type,callback){ - var data={"data":{"codes":[code]}}; - var type_desc=""; - switch(type){ + + do_action_for_code: function(code, plate, type, callback) { + var data = { + "data": { + "codes": [code] + } + }; + var type_desc = ""; + switch (type) { case 0: - //鍔犲叆榛戝悕鍗� - data.type=201; - type_desc="鍔犲叆榛戝悕鍗�" - break; - //绉婚櫎榛戝悕鍗� + //鍔犲叆榛戝悕鍗� + data.type = 201; + type_desc = "鍔犲叆榛戝悕鍗�" + break; + //绉婚櫎榛戝悕鍗� case 1: - data.type=203; - type_desc="绉婚櫎榛戝悕鍗�" - break; + data.type = 203; + type_desc = "绉婚櫎榛戝悕鍗�" + break; case 2: - //鍔犺嚜閫� - data.type=601; - type_desc="鍔犺嚜閫�" - break; + //鍔犺嚜閫� + data.type = 601; + type_desc = "鍔犺嚜閫�" + break; case 3: - //绉婚櫎鑷�� - data.type=602; - type_desc="绉婚櫎鑷��" - - break; + //绉婚櫎鑷�� + data.type = 602; + type_desc = "绉婚櫎鑷��" + + break; case 4: - data.type=401; - data.data.plates=[plate] - type_desc="鍔犳兂涔�" - //鍔犳兂涔� - break; + data.type = 401; + data.data.plates = [plate] + type_desc = "鍔犳兂涔�" + //鍔犳兂涔� + break; case 5: - data.type=402; - type_desc="绉婚櫎鎯充拱" - //绉婚櫎鎯充拱 - break; + data.type = 402; + type_desc = "绉婚櫎鎯充拱" + //绉婚櫎鎯充拱 + break; } - - console.log("socket璇锋眰",data) - - pyjs.socket_request(JSON.stringify(data),function(result){ - result=JSON.parse(result); - if(result.code==0){ + + console.log("socket璇锋眰", data) + + pyjs.socket_request(JSON.stringify(data), function(result) { + result = JSON.parse(result); + if (result.code == 0) { // pyjs.show_info(type_desc +"鎴愬姛"); - layer.msg(type_desc +"鎴愬姛") + layer.msg(type_desc + "鎴愬姛") } callback(result); }); }, - - get_want_codes:function(plate,callback){ - pyjs.socket_request(JSON.stringify({type:403,plate:plate}),function(result){ - result=JSON.parse(result); - if(result.code==0){ + + get_want_codes: function(plate, callback) { + pyjs.socket_request(JSON.stringify({ + type: 403, + plate: plate + }), function(result) { + result = JSON.parse(result); + if (result.code == 0) { callback(result); } }); }, - - cancel_order:function(code,success){ - var data = {"type": 80, "data": {"code": code}}; - pyjs.socket_request(JSON.stringify(data),function(result){ - result=JSON.parse(result); - if(result.code==0){ + + cancel_order: function(code, success) { + var data = { + "type": 80, + "data": { + "code": code + } + }; + pyjs.socket_request(JSON.stringify(data), function(result) { + result = JSON.parse(result); + if (result.code == 0) { success() } }); + }, + forbidden_plate: function(plate, callback) { + http_util.http_request("/kpl/forbidden_plate", { + plate: plate + }, callback); + }, + // 鑾峰彇鏉垮潡涓嬬殑浠g爜 + get_plate_codes: function(plate, callback) { + http_util.http_request("/kpl/get_plate_codes", { + plate: plate + }, callback); } - - - -}; \ No newline at end of file +}; -- Gitblit v1.8.0