summaryrefslogtreecommitdiff
path: root/server/apps/agentcomm.py
diff options
context:
space:
mode:
authorhandingkang <[email protected]>2024-04-18 17:22:05 +0800
committerhandingkang <[email protected]>2024-04-18 17:22:05 +0800
commitf2a3d11fb8606733f46d5e88ed86957433db3eea (patch)
treea63fe6666a4afd6d420424a19e952a978afca10e /server/apps/agentcomm.py
parent00002e3d2ae25db396e33899c6baa9e6c77ff865 (diff)
代理删除接口完善
Diffstat (limited to 'server/apps/agentcomm.py')
-rw-r--r--server/apps/agentcomm.py10
1 files changed, 7 insertions, 3 deletions
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