From f2a3d11fb8606733f46d5e88ed86957433db3eea Mon Sep 17 00:00:00 2001 From: handingkang <18791985373@163.com> Date: Thu, 18 Apr 2024 17:22:05 +0800 Subject: 代理删除接口完善 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/apps/agentcomm.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'server') diff --git a/server/apps/agentcomm.py b/server/apps/agentcomm.py index a3876f7..51af7f3 100644 --- a/server/apps/agentcomm.py +++ b/server/apps/agentcomm.py @@ -183,13 +183,14 @@ def agent_info(query_data): # TODO: 实现 def del_agent(json_data): print(json_data) - sql = """DELETE FROM %s WHERE id = %s + sql = """DELETE FROM %s WHERE AGENT_ID = '%s' """ % (MYSQL_TAB_AGENT, json_data["id"]) try: da.cursor.execute(sql) da.conn.commit() except Exception as e: error(message=str(e)) + return {"code": 500, "msg": str(e)} return {"code": 200, "msg": "ok"} @@ -219,6 +220,9 @@ def insert_agent(param: dict): %(status)s, %(mem)s, %(idle)s);""" % param - da.cursor.execute(sql) - da.conn.commit() + try: + da.cursor.execute(sql) + da.conn.commit() + except Exception as e: + error(message=str(e)) return None -- cgit v1.2.3