From fe57e8a76e752d7e71e0ed5f2d02b021e357d259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 17 Nov 2020 13:54:48 +0800 Subject: [PATCH] cash --- business/jxstore/financial/financial.go | 9 +++++++-- business/jxstore/financial/pay.go | 4 ++-- business/model/order.go | 6 ++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/business/jxstore/financial/financial.go b/business/jxstore/financial/financial.go index e563ba82a..e49a1d9de 100644 --- a/business/jxstore/financial/financial.go +++ b/business/jxstore/financial/financial.go @@ -161,8 +161,13 @@ func (p *PayHandler) CreateRefund() (err error) { } else { return err2 } - } else { - + } else if p.VendorPayType == model.VendorPayTypeTransferAccount { + p.Order.PayFinishedAt = time.Now() + p.Order.Comment = "手动转账" + p.Order.Status = model.OrderStatusFinished + if _, err := dao.UpdateEntity(dao.GetDB(), p.Order); err == nil { + err = OnCashFinished(p.Order) + } } } return err diff --git a/business/jxstore/financial/pay.go b/business/jxstore/financial/pay.go index 80fb2343e..4fb27d99a 100644 --- a/business/jxstore/financial/pay.go +++ b/business/jxstore/financial/pay.go @@ -55,7 +55,7 @@ func OnPayFinished(order *model.Order) (err error) { } //根据订单类型来操作账户 switch order.Type { - case model.OrderTypeAccount: + case model.OrderTypePay: //如果是账户充值(发布任务等) //账户收入 if err = AddIncomeUpdateAccount(db, userBill, model.BillTypeInvest, order.PayPrice); err != nil { @@ -90,7 +90,7 @@ func OnCashFinished(order *model.Order) (err error) { } //根据订单类型来操作账户 switch order.Type { - case model.OrderTypeAccount: + case model.OrderTypeCash: //如果是账户提现 //账户支出 if err = AddExpendUpdateAccount(db, userBill, model.BillTypeCash, order.PayPrice); err != nil { diff --git a/business/model/order.go b/business/model/order.go index f838c9a69..1ae4fd81e 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -16,7 +16,8 @@ const ( RefundStatusYes = 1 RefundStatusFailed = 2 - VendorPayTypeCompanyPay = "companyPay" //企业付款 + VendorPayTypeCompanyPay = "companyPay" //企业付款 + VendorPayTypeTransferAccount = "transferAccount" //手动转账 ) const ( @@ -26,7 +27,8 @@ const ( OrderTypeSupplyGoods = 2 //进货订单 OrderTypeDefendPrice = 3 //守价订单 - OrderTypeAccount = 1 //账户余额 + OrderTypePay = 1 //支付 + OrderTypeCash = 2 //提现 ) var (