一个余额

This commit is contained in:
苏尹岚
2020-10-19 10:38:39 +08:00
parent 793669a976
commit 5a95250bcd
4 changed files with 30 additions and 23 deletions

View File

@@ -43,15 +43,15 @@ func OnPayFinished(order *model.Order) (err error) {
}
//根据订单类型来操作账户
switch order.Type {
case model.OrderTypeDeposit:
//如果是发布任务的保证金
case model.OrderTypeAccount:
//如果是账户充值(发布任务等)
//1、账户收入表增加一条保证金记录
if err = AddBillIncome(db, billID, order.Type, order.PayPrice); err != nil {
dao.Rollback(db)
}
//2、账户表保证金总额增加相应值
userBill.DepositBalance += order.PayPrice
if _, err = dao.UpdateEntity(db, userBill, "DepositBalance"); err != nil {
userBill.AccountBalance += order.PayPrice
if _, err = dao.UpdateEntity(db, userBill, "AccountBalance"); err != nil {
dao.Rollback(db)
}
default: