1、去掉限流
Some checks failed
Build / build (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
build / Build (push) Has been cancelled
GitHub Actions Mirror / mirror_to_gitee (push) Has been cancelled
GitHub Actions Mirror / mirror_to_gitlab (push) Has been cancelled
Issue Close Require / issue-close-require (push) Has been cancelled
Issue Check Inactive / issue-check-inactive (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
build / Build (push) Has been cancelled
GitHub Actions Mirror / mirror_to_gitee (push) Has been cancelled
GitHub Actions Mirror / mirror_to_gitlab (push) Has been cancelled
Issue Close Require / issue-close-require (push) Has been cancelled
Issue Check Inactive / issue-check-inactive (push) Has been cancelled
2、支付回调
This commit is contained in:
@ -367,6 +367,14 @@ func (e *TmRechargeLog) PayCallBack(logs *[]dto.TmRechargeCallbackReq) error {
|
||||
continue
|
||||
}
|
||||
|
||||
var count int64
|
||||
e.Orm.Model(&models.TmRechargeLog{}).Where("tx_hash = ?", log.TxHash).Count(&count)
|
||||
|
||||
if count > 0 {
|
||||
e.Log.Errorf("订单已存在:%s \r\n", log.TxHash)
|
||||
continue
|
||||
}
|
||||
|
||||
var data models.TmRechargeLog
|
||||
if err := e.Orm.Model(&models.TmRechargeLog{}).Where("order_no = ?", orderNo).First(&data).Error; err != nil {
|
||||
e.Log.Errorf("获取充值记录失败 error:%s \r\n", err)
|
||||
@ -398,7 +406,7 @@ func (e *TmRechargeLog) PayCallBack(logs *[]dto.TmRechargeCallbackReq) error {
|
||||
ExpireAt: data.ExpireAt.Unix(),
|
||||
}
|
||||
err = e.Orm.Transaction(func(tx *gorm.DB) error {
|
||||
if err1 := e.Orm.Model(&models.TmRechargeLog{}).Where("id =?", data.Id).Updates(map[string]interface{}{"tx_hash": log.TxHash, "status": 2, "pay_time": now}).Error; err1 != nil {
|
||||
if err1 := tx.Model(&models.TmRechargeLog{}).Where("id =?", data.Id).Updates(map[string]interface{}{"tx_hash": log.TxHash, "status": 2, "pay_time": now}).Error; err1 != nil {
|
||||
e.Log.Errorf("发起充值记录失败 error:%s \r\n", err1)
|
||||
return err1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user