From ec060ce444cdd1c48a54686cadbc8950478eedcf Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 22 八月 2025 16:27:34 +0800 Subject: [PATCH] 网页内容修改 --- kp_html/kp/js/http.js | 720 ++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 630 insertions(+), 90 deletions(-) diff --git a/kp_html/kp/js/http.js b/kp_html/kp/js/http.js index 08c0d50..920de9c 100644 --- a/kp_html/kp/js/http.js +++ b/kp_html/kp/js/http.js @@ -1,124 +1,664 @@ -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; +function is_trade_time() { + var nowdate = new Date(); + h = nowdate.getHours(); + m = nowdate.getMinutes(); + total_m = h * 60 + m; + if ((total_m >= (9 * 60 + 25) && total_m <= (11 * 60 + 30)) || (total_m >= 13 * 60 && total_m <= 15 * + 60)) { + return true; + } else { + return false; + } +} + +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) { + data = atob(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])); + + console.log("http璇锋眰璺緞", path, 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; + socket_request: function(data, callback) { + key = "http_callback_" + new Date().getTime() + "_" + Math.round(Math.random() * 100000000); + http_util.request_callback[key] = callback; + pyjs.socket_request(data, JSON.stringify(["http_util.http_request_result", key])); + }, + + + get_score_data: function(code, name, date, callback) { + var params = { + code: code } - http_util.http_request("/get_score_info",params,callback); + if (name) { + params.name = name; + } + if (date) { + params.date = date; + } + 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_blocks_in_money_info: function(type, callback) { + http_util.http_request("/get_blocks_in_money_info", { + type: type + }, callback); }, - - get_plate_info:function(code,callback){ - http_util.http_request("/kpl/get_plate_info",{code:code},callback); + + get_place_order_records: function(day, callback) { + http_util.http_request("/get_place_order_records", { + day: day + }, callback); }, - - add_ignore_code:function(type,code,callback){ - http_util.http_request("/kpl/add_ignore_code",{code:code,type:type},callback); - + + get_limit_up_list: function(code, day, callback) { + var params = { + code: code + }; + if (day) { + params.day = day; + } + + + http_util.http_request("/kpl/get_limit_up_list", params, callback); }, - - do_action_for_code:function(code,plate,type,callback){ - var data={"data":{"codes":[code]}}; - var type_desc=""; - switch(type){ + + get_limit_up_statistic_infos: function(day, callback) { + var params = {}; + if (day) { + params.day = day; + } + http_util.http_request("/kpl/get_limit_up_statistic_infos", params, 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); + + }, + + 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; + case 6: + data.type = 411; + data.data.plates = [plate] + type_desc = "鍔犳殏涓嶄拱" + //鍔犳兂涔� + break; + case 7: + data.type = 412; + type_desc = "绉婚櫎鏆備笉涔�" + //绉婚櫎鎯充拱 + break; + case 8: + data.type = 441; + data.data.plates = [plate] + type_desc = "鍔犵豢" + break; + case 9: + data.type = 442; + type_desc = "绉荤豢" + break; } - - 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 +"鎴愬姛") + + console.log("socket璇锋眰", data) + + + var sign = http_util.get_sign(data); + data['sign'] = sign; + console.log("鍙傛暟锛�", data); + http_util.socket_request(JSON.stringify(data), function(result) { + console.log("鎾ゅ崟缁撴灉", result) + result = JSON.parse(result); + if (result.code == 0) { + 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) { + http_util.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){ + get_green_codes: function(callback) { + var data = { + type: 443 + }; + var sign = http_util.get_sign(data); + data['sign'] = sign; + http_util.socket_request(JSON.stringify(data), function(result) { + console.log("缁撴灉锛�", result); + result = JSON.parse(result); + if (result.code == 0) { + callback(result); + } + }); + }, + get_sign: function(data) { + var params = new Array(); + for (key in data) { + if (data[key] instanceof Object || data[key] instanceof Array) { + console.log(typeof data[key]) + params.push(key + "=" + JSON.stringify(data[key])) + } else { + params.push(key + "=" + data[key]) + } + } + params.sort() + params.push("%Yeshi2014@#.") + var params_str = "" + params.forEach(function(re) { + params_str += re + "&"; + }); + if (params_str.endsWith("&")) { + params_str = params_str.substring(0, params_str.length - 1); + } + + console.log(params_str) + + md5Hash = md5(params_str); + return md5Hash; + }, + // 鎾ゅ崟 + cancel_order: function(code, success) { + var data = { + type: "cancel_order", + data: { + "code": code + } + }; + + http_util.socket_request(JSON.stringify(data), function(result) { + console.log("鎾ゅ崟缁撴灉", result) + result = JSON.parse(result); + if (result.code == 0) { success() } }); - } + }, + // 鍚屾浜ゆ槗鏁版嵁 + sync_trade_data: function(type, success) { + var data = { + type: "sync_trade_data", + data: { + "type": type + } + }; + + http_util.socket_request(JSON.stringify(data), function(result) { + result = JSON.parse(result); + success(result); + }); + }, + + + forbidden_plate: function(plate, callback) { + http_util.http_request("/kpl/forbidden_plate", { + plate: plate + }, callback); + }, + delete_forbidden_plate: function(plate, callback) { + http_util.http_request("/kpl/del_forbidden_plate", { + plate: plate + }, callback); + }, + list_forbidden_plate: function(callback) { + http_util.http_request("/kpl/list_forbidden_plate", {}, callback); + }, + list_deleted_forbidden_plate: function(callback) { + http_util.http_request("/kpl/list_deleted_forbidden_plate", {}, callback); + }, + // 鑾峰彇鏉垮潡涓嬬殑浠g爜 + get_plate_codes: function(plate, day, callback) { + var params = { + plate: plate + }; + if (day) { + params.day = day; + } + + http_util.http_request("/kpl/get_plate_codes", params, callback); + }, + get_plate_codes_new: function(plate, day, callback) { + var params = { + plate: plate + }; + if (day) { + params.day = day; + } + + http_util.http_request("/kpl/get_plate_codes_new", params, callback); + }, + + get_open_limit_up_count_rank(code, callback) { + var params = {} + if (code) { + params.code = code; + } + http_util.http_request("/kpl/get_open_limit_up_count_rank", params, callback); + + }, + get_h_cancel_data: function(code, callback) { + http_util.http_request("/get_h_cancel_data", { + code: code + }, callback); + }, + // 鑾峰彇娑堟伅鍒楄〃 + list_msg: function(callback) { + http_util.http_request("/list_kp_client_msg", {}, callback); + }, + //涓婁釜浜ゆ槗鏃ョ浉鍚屾定鍋滃師鍥犵殑浠g爜鍒楄〃 + get_last_trade_day_reasons: function(code, callback) { + http_util.http_request("/get_last_trade_day_reasons", { + code: code + }, callback); + }, + + //鑾峰彇L2鐨勬暟鎹� + get_l2_datas: function(code, date, end_index, fast_mode, callback) { + var params = { + code: code, + fast: fast_mode + } + if (date) { + params['date'] = date + } + if (end_index != null && end_index) { + params['end_index'] = parseInt(end_index) + } + + console.log("L2鍙傛暟", params); + + http_util.http_request("/get_l2_datas", params, callback); + }, + //鑾峰彇L2鐨勬暟鎹� + get_trade_progress: function(code, callback) { + http_util.http_request("/get_trade_progress", { + code: code + }, callback); + }, + //鑾峰彇L2鐨勬暟鎹� + get_l2_l_cancel_datas: function(code, buy_single_index, date, callback) { + var params = { + code: code + } + if (buy_single_index >= 0) { + params["buy_single_index"] = buy_single_index; + } + if (date) { + params.date = date; + } + + + http_util.http_request("/get_l_cancel_datas", params, callback); + }, + get_l2_h_cancel_datas: function(code, buy_single_index, callback) { + var params = { + code: code + } + if (buy_single_index >= 0) { + params["buy_single_index"] = buy_single_index; + } + http_util.http_request("/get_h_cancel_datas", params, callback); + }, + get_kpl_block_info: function(code, callback) { + var params = { + code: code + } + http_util.http_request("/get_kpl_block_info", params, callback); + }, + // 鑾峰彇宸叉寕涔板崟鐨勪俊鎭� + get_delegated_buy_code_infos: function(callback) { + data = { + type: "common", + data: { + ctype: "get_delegated_buy_code_infos_v2" + }, + sign: '' + } + http_util.socket_request(JSON.stringify(data), function(result) { + result = JSON.parse(result); + callback(result); + }); + }, + get_xgb_limit_up_reasons: function(code, callback) { + var params = { + code: code + } + http_util.http_request("/get_xgb_limit_up_reasons", params, callback); + }, + set_real_place_order_index: function(code, index, callback) { + data = { + type: "common", + data: { + ctype: "set_real_place_order_index", + code: code, + index: index + }, + sign: '' + } + http_util.socket_request(JSON.stringify(data), function(result) { + result = JSON.parse(result); + callback(result); + }); + }, + get_l2_cant_buy_reasons: function(code, callback) { + var params = { + code: code + } + console.log("鍙傛暟", params) + http_util.http_request("/get_l2_cant_buy_reasons", params, callback); + }, + get_latest_cancel_orders: function(callback) { + var params = { + type: "get_latest_cancel_orders", + data: {}, + sign: '' + } + http_util.socket_request(JSON.stringify(params), function(result) { + result = JSON.parse(result); + callback(result); + }); + }, + get_kpl_market_feelings: function(callback) { + var params = {} + http_util.http_request("/get_kpl_market_feelings", params, callback); + }, + get_cb_list(callback) { + var params = {} + http_util.http_request("/get_cb_list", params, callback); + }, + + get_new_blocks(callback) { + var params = {} + http_util.http_request("/get_new_blocks", params, callback); + }, + + + buy_by_ths(code, callback) { + var params = { + "code": code + } + http_util.http_request("/buy_by_ths", params, callback); + }, + + statistic_latest_limit_up_block(code, callback) { + var params = { + "code": code + } + http_util.http_request("/statistic_latest_limit_up_block", params, callback); + }, + // 鑾峰彇璺濈缁欏畾鏃堕棿鏈�杩戠殑寮�鐩樺暒娑ㄥ仠鏁版嵁 + get_kpl_latest_limit_up_queue_by_time(time, callback) { + var params = { + "time": time, + } + http_util.http_request("/kpl/get_latest_limit_up_queue", params, callback); + }, + + get_account_commission_detail(callback) { + http_util.http_request("/get_account_commission_detail", {}, callback); + }, + + get_code_third_blocks: function(code, callback) { + var params = { + type: "common", + data: { + ctype: "get_code_third_blocks", + code: code + }, + sign: '' + } + http_util.socket_request(JSON.stringify(params), function(result) { + result = JSON.parse(result); + callback(result); + }); + }, + + get_block_codes_with_money: function(block, desc, callback) { + http_util.http_request("/get_block_codes_with_money", { + block: block, + desc: desc + }, callback); + }, + // 鑾峰彇鎵�鏈塋2璁㈤槄鐨勫垪琛� + get_l2_subscript_codes: function(callback) { + // var params = { + // type: "get_huaxin_subscript_codes", + // data: {}, + // sign: '' + // } + // http_util.socket_request(JSON.stringify(params), function(result) { + // result = JSON.parse(result); + // callback(result); + // }); + http_util.http_request("/get_l2_subscript_codes", {}, callback); + }, + + get_big_order_deal_info: function(code, callback) { + http_util.http_request("/get_l2_subscript_codes", { + code: code + }, callback); + }, + + get_all_special_codes: function(callback) { + http_util.http_request("/get_all_special_codes", {}, callback); + }, + get_new_blocks_special_codes: function(callback) { + http_util.http_request("/get_new_blocks_special_codes", {}, callback); + }, + // 璁剧疆绱鎴愪氦澶у崟鐨勯槇鍊� + set_total_deal_big_order_threshold_money: function(code, money, callback) { + var params = { + type: "common", + data: { + ctype: "set_total_deal_big_order_threshold_money", + code: code, + money: money + }, + sign: '' + } + http_util.socket_request(JSON.stringify(params), function(result) { + result = JSON.parse(result); + callback(result); + }); + }, + + // 璁剧疆L鍚庢挙鍗曟瘮渚� + set_l_down_rate: function(code, rate, callback) { + let data = { + type: "common", + data: { + ctype: "set_l_down_rate", + code: code, + rate: rate + }, + sign: '' + } + console.log("璇锋眰鍏冩暟鎹細", data) + console.log("璇锋眰json鏁版嵁锛�", JSON.stringify(data)) + http_util.socket_request(JSON.stringify(data), function(result) { + result = JSON.parse(result); + callback(result); + }); + }, + remove_l_down_rate: function(code, callback) { + let data = { + type: "common", + data: { + ctype: "remove_l_down_rate", + code: code + + }, + sign: '' + } + console.log("璇锋眰鍏冩暟鎹細", data) + console.log("璇锋眰json鏁版嵁锛�", JSON.stringify(data)) + http_util.socket_request(JSON.stringify(data), function(result) { + result = JSON.parse(result); + callback(result); + }); + }, + + + // 鑾峰彇濮旀墭闃熷垪 + get_trade_queue: function(code, callback) { + let data = { + type: "common", + data: { + ctype: "get_trade_queue", + code: code + }, + sign: '' + } + http_util.socket_request(JSON.stringify(data), function(result) { + result = JSON.parse(result); + callback(result); + }); + }, + // 鑾峰彇宸叉垚浜ょ殑澶у崟 + get_deal_big_money_list: function(code, callback) { + let data = { + type: "common", + data: { + ctype: "get_deal_big_money_list", + code: code + }, + sign: '' + } + http_util.socket_request(JSON.stringify(data), function(result) { + result = JSON.parse(result); + callback(result); + }); + }, + + get_want_buy_detail_list: function(callback) { + var params = { + } + http_util.http_request("/get_want_buy_detail_list", params, callback); + }, + + get_l_down_watch_index_overview: function(code, callback) { + var params = { + code:code + }; + http_util.http_request("/get_l_down_watch_index_overview", params, callback); + }, + + + list_delegate_records: function(updateTime, callback) { + var params = { + update_time: updateTime, + } + http_util.http_request("/get_all_delegate_list", params, callback); + }, + list_deal_records: function(updateTime, callback) { + let data = { + type: "deal_list", + data: { + update_time: updateTime + }, + sign: '' + }; + http_util.socket_request(JSON.stringify(data), function(result) { + result = JSON.parse(result); + callback(result); + }); + }, -}; \ No newline at end of file + + + + + + + + + + +}; -- Gitblit v1.8.0