From 166b9ca52c5d4ec3c9450dc0dea4ffcbd4851831 Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期四, 24 十月 2024 17:47:53 +0800
Subject: [PATCH] 接口调整/扫入策略参数调整

---
 api/outside_api_command_callback.py |   34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/api/outside_api_command_callback.py b/api/outside_api_command_callback.py
index 5f800bc..6e14ae5 100644
--- a/api/outside_api_command_callback.py
+++ b/api/outside_api_command_callback.py
@@ -1,3 +1,4 @@
+import base64
 import concurrent.futures
 import copy
 import json
@@ -45,7 +46,7 @@
 from third_data.third_blocks_manager import CodeThirdBlocksManager, SOURCE_TYPE_KPL, BlockMapManager
 from trade import trade_manager, l2_trade_util, trade_data_manager, trade_constant
 import l2_data_util as l2_data_util_old
-from trade.buy_money_count_setting import BuyMoneyAndCountSetting
+from trade.buy_money_count_setting import BuyMoneyAndCountSetting, RadicalBuyBlockCodeCountManager
 
 from trade.huaxin import huaxin_trade_api, huaxin_trade_data_update, \
     huaxin_trade_record_manager, huaxin_trade_order_processor, huaxin_sell_util
@@ -383,6 +384,7 @@
             elif code_list_type == outside_api_command_manager.CODE_LIST_GREEN:
                 if operate == outside_api_command_manager.OPERRATE_SET:
                     gpcode_manager.GreenListCodeManager().add_code(code)
+                    gpcode_manager.WantBuyCodesManager().add_code(code)
                     name = gpcode_manager.get_code_name(code)
                     if not name:
                         results = HistoryKDatasUtils.get_gp_codes_names([code])
@@ -390,6 +392,7 @@
                             gpcode_manager.CodesNameManager.add_first_code_name(code, results[code])
                 elif operate == outside_api_command_manager.OPERRATE_DELETE:
                     gpcode_manager.GreenListCodeManager().remove_code(code)
+                    gpcode_manager.WantBuyCodesManager().remove_code(code)
                 elif operate == outside_api_command_manager.OPERRATE_GET:
                     codes = gpcode_manager.GreenListCodeManager().list_codes_cache()
                     datas = []
@@ -458,7 +461,6 @@
                 desc_list.append("銆愮孩鍚嶅崟銆�")
             if green:
                 desc_list.append("銆愮豢鍚嶅崟銆�")
-
 
             result = {"code": 0, "data": {"code_info": (code, code_name), "desc": "".join(desc_list)}}
             self.send_response(result, client_id, request_id)
@@ -1104,6 +1106,14 @@
                             except:
                                 pass
 
+                            try:
+                                if order_begin_pos:
+                                    fdata['mode'] = order_begin_pos.mode
+                                else:
+                                    fdata['mode'] = -1
+                            except:
+                                pass
+
                             fdatas.append(fdata)
                         except Exception as e:
                             logger_debug.exception(e)
@@ -1183,6 +1193,8 @@
                 kpl_data_manager.PullTask.repaire_pull_task()
                 # 淇鏁版嵁鏈嶅姟
                 server_util.repaire_data_server()
+                # 浠诲姟淇
+                huaxin_trade_data_update.repaire_task()
                 self.send_response({"code": 0, "data": {}}, client_id, request_id)
             elif ctype == "get_trade_queue":
                 code = data["code"]
@@ -1284,11 +1296,27 @@
                 data = {
                     "normal": BuyMoneyAndCountSetting().get_normal_buy_setting(),
                     "radical": BuyMoneyAndCountSetting().get_radical_buy_setting(),
-                    "moneys":constant.AVAILABLE_BUY_MONEYS
+                    "moneys": constant.AVAILABLE_BUY_MONEYS
                 }
                 self.send_response({"code": 0, "data": data, "msg": f""},
                                    client_id,
                                    request_id)
+            elif ctype == "set_radical_buy_block_count_setting":
+                # 璁剧疆涔板叆閲戦鍜屾暟閲�
+                data_str = data["data"]
+                data_str = base64.b64decode(data_str).decode('utf-8')
+                setting = json.loads(data_str)
+                RadicalBuyBlockCodeCountManager().set_block_code_count(setting)
+                self.send_response({"code": 0, "data": setting, "msg": f""},
+                                   client_id,
+                                   request_id)
+            elif ctype == "get_radical_buy_block_count_setting":
+                # 璁剧疆涔板叆閲戦鍜屾暟閲�
+                data = RadicalBuyBlockCodeCountManager().get_block_code_count_settings()
+                self.send_response({"code": 0, "data": data, "msg": f""},
+                                   client_id,
+                                   request_id)
+
         except Exception as e:
             logging.exception(e)
             logger_debug.exception(e)

--
Gitblit v1.8.0