Commit ea0276fd authored by xianyang's avatar xianyang

优化账户修改

parent 3a593bb3
......@@ -80,17 +80,10 @@ def create_account(db: Session, param: schemas.AccountCreate):
def update_account_info(db: Session, old_data):
"""修改"""
if old_data.name:
db.query(models.Account).filter(models.Account.id == old_data.id).update(
{models.Account.name: old_data.name})
if old_data.remark:
db.query(models.Account).filter(models.Account.id == old_data.id).update(
{models.Account.remark: old_data.remark})
if old_data.income:
db.query(models.Account).filter(models.Account.id == old_data.id).update(
{models.Account.income: ','.join(map(str, old_data.income))})
if old_data.output:
db.query(models.Account).filter(models.Account.id == old_data.id).update(
{models.Account.name: old_data.name},
{models.Account.remark: old_data.remark},
{models.Account.income: ','.join(map(str, old_data.income))},
{models.Account.output: ','.join(map(str, old_data.output))})
db.commit()
......
......@@ -37,6 +37,8 @@ def gift_type_list(db: Session = Depends(get_db)):
@router.post("/update")
def read_account(data: schemas.AccountUpdate, db: Session = Depends(get_db)):
"""账户修改"""
if not data.name:
return HttpResultResponse(code=500, msg="账户名不能为空")
crud.update_account_info(db, data)
return HttpResultResponse()
......
......@@ -61,7 +61,6 @@ class GuildSet(object):
else:
guild_info = self.query_guild_data(db)
except Exception as e:
print(e)
return [], 0
# 判断是列表还是导出接口
guild_info.reverse()
......@@ -180,7 +179,6 @@ def transfer_money(db: Session, param, h_list):
db.commit()
db.refresh(present)
except Exception as e:
print(e)
return {}
return present
......@@ -198,6 +196,5 @@ def create_fix_table(db: Session, param, h_list):
db.commit()
db.refresh(present)
except Exception as e:
print(e)
return {}
return present
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