bx4
This commit is contained in:
parent
00346c2212
commit
bd04e1b9f0
|
@ -75,7 +75,17 @@ func (a *Approve) handleRefund(spNo string) {
|
|||
return
|
||||
}
|
||||
|
||||
var refund model.ApprovalRefund
|
||||
refund, err := dao.NewApprovalRefundDao().GetBySpNo(spNo)
|
||||
if err != nil {
|
||||
log.Errorf("db error :%s", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
isUpdate := true
|
||||
if refund == nil {
|
||||
refund = new(model.ApprovalRefund)
|
||||
isUpdate = false
|
||||
}
|
||||
refund.Username = detail.Applyer.Userid
|
||||
refund.SpNo = detail.SpNo
|
||||
refund.ApplyTime = detail.ApplyTime
|
||||
|
@ -104,7 +114,12 @@ func (a *Approve) handleRefund(spNo string) {
|
|||
refund.RefundRemark = value
|
||||
}
|
||||
}
|
||||
if _, err := dao.NewApprovalRefundDao().Create(&refund); err != nil {
|
||||
if isUpdate {
|
||||
err = dao.NewApprovalRefundDao().Update(refund)
|
||||
} else {
|
||||
_, err = dao.NewApprovalRefundDao().Create(refund)
|
||||
}
|
||||
if err != nil {
|
||||
log.Errorf("db error :%s", err.Error())
|
||||
return
|
||||
}
|
||||
|
@ -131,7 +146,7 @@ func (a *Approve) handleRefund(spNo string) {
|
|||
}
|
||||
|
||||
refund.Status = model.ApprovalRefundStatusPayed
|
||||
if err := dao.NewApprovalRefundDao().Update(&refund); err != nil {
|
||||
if err := dao.NewApprovalRefundDao().Update(refund); err != nil {
|
||||
log.Errorf("db error :%s", err.Error())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue