Commit 17568c47 authored by xianyang's avatar xianyang

优化账户config_key重复报错

parent 823c2f32
...@@ -126,8 +126,10 @@ def create_account(param): ...@@ -126,8 +126,10 @@ def create_account(param):
account = LinkMysql(env.DB_3YV2).perform_mysql(sql) account = LinkMysql(env.DB_3YV2).perform_mysql(sql)
except Exception as e: except Exception as e:
print(e) print(e)
if 'config_key' in str(e):
return 'config_key重复'
return e
return '' return ''
return account
def update_account_info(old_data): def update_account_info(old_data):
......
...@@ -17,9 +17,9 @@ def create_account(data: schemas.AccountCreate, token=Depends(login_required)): ...@@ -17,9 +17,9 @@ def create_account(data: schemas.AccountCreate, token=Depends(login_required)):
if db_info: if db_info:
return HttpResultResponse(code=400, msg=HttpMessage.ACCOUNT_EXIST) return HttpResultResponse(code=400, msg=HttpMessage.ACCOUNT_EXIST)
res = crud.create_account(data) res = crud.create_account(data)
if not res: if res:
return HttpResultResponse(code=500, msg=res) return HttpResultResponse(code=500, msg=res)
return HttpResultResponse(data=res) return HttpResultResponse()
@router.get("/list") @router.get("/list")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment