From 63369d7e9f4be8beb9b36bef0cf44d33eb2a4d40 Mon Sep 17 00:00:00 2001 From: xiongyi <827523911@qq.com> Date: Wed, 28 Jan 2026 14:49:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=A4=84=E7=90=86=E6=9C=80?= =?UTF-8?q?=E5=90=8E=E4=B8=80=E4=B8=AA=EF=BC=8C=E4=BF=AE=E6=94=B9api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API/client.py | 5 +++-- config/settings.py | 2 +- main.py | 2 ++ services/task_service.py | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/API/client.py b/API/client.py index 3700f3b..80069ca 100644 --- a/API/client.py +++ b/API/client.py @@ -14,6 +14,7 @@ class APIClient: self.not_pour_info_url =f"{BASE_URL}/api/ext/mould/not_pour_rfid" #f"{BASE_URL}/api/ext/artifact/not_pour"#调试修改 self.app_id = None + def hash_password(self, password): """计算SHA256密码""" return password @@ -34,7 +35,7 @@ class APIClient: print(f"登录请求异常: {e}") except Exception as e: print(f"登录过程中发生未知错误: {e}") - + print("登录失败,无法获取AppID") return None @@ -98,6 +99,6 @@ class APIClient: print(f"获取未浇筑信息请求异常: {e}") except Exception as e: print(f"获取未浇筑信息过程中发生未知错误: {e}") - + print("获取未浇筑信息失败") return None \ No newline at end of file diff --git a/config/settings.py b/config/settings.py index 28eb6fb..769cae5 100644 --- a/config/settings.py +++ b/config/settings.py @@ -2,7 +2,7 @@ import os # API配置 -BASE_URL = "http://10.6.60.153:9155"#替换"http://127.0.0.1:5000"#https://www.shnthy.com:9154 +BASE_URL = "https://www.shnthy.com:9154"#替换"http://127.0.0.1:5000"#https://www.shnthy.com:9154 LOGIN_DATA = { "Program": 11, "SC": "1000000001", diff --git a/main.py b/main.py index 7ab2338..15481c9 100644 --- a/main.py +++ b/main.py @@ -51,11 +51,13 @@ def main(): # 步骤1:获取AppID app_id = api_client.login() + if app_id is None: print("无法获取AppID,将在稍后重试...") else: task_service.api_client.app_id = app_id + # 存储上次获取的所有ArtifactID last_artifact_ids = set() last_artifact_list = [] # 用于存储上一次的完整artifact_list diff --git a/services/task_service.py b/services/task_service.py index 52f93e0..6ce8e7e 100644 --- a/services/task_service.py +++ b/services/task_service.py @@ -37,7 +37,7 @@ class TaskService: f_positions = f_blocks_info["f_positions"] # 处理当前任务 - current_task = self._process_current_task(artifact_list[0]) + current_task = self._process_current_task(artifact_list[-1]) # 如果获取任务信息失败,则返回空结果 if current_task is None: