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
|
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
|
var data models.TmRechargeLog
|
||||||
if err := e.Orm.Model(&models.TmRechargeLog{}).Where("order_no = ?", orderNo).First(&data).Error; err != nil {
|
if err := e.Orm.Model(&models.TmRechargeLog{}).Where("order_no = ?", orderNo).First(&data).Error; err != nil {
|
||||||
e.Log.Errorf("获取充值记录失败 error:%s \r\n", err)
|
e.Log.Errorf("获取充值记录失败 error:%s \r\n", err)
|
||||||
@ -398,7 +406,7 @@ func (e *TmRechargeLog) PayCallBack(logs *[]dto.TmRechargeCallbackReq) error {
|
|||||||
ExpireAt: data.ExpireAt.Unix(),
|
ExpireAt: data.ExpireAt.Unix(),
|
||||||
}
|
}
|
||||||
err = e.Orm.Transaction(func(tx *gorm.DB) error {
|
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)
|
e.Log.Errorf("发起充值记录失败 error:%s \r\n", err1)
|
||||||
return err1
|
return err1
|
||||||
}
|
}
|
||||||
|
|||||||
@ -227,8 +227,8 @@ func initRouter() {
|
|||||||
r.Use(handler.TlsHandler())
|
r.Use(handler.TlsHandler())
|
||||||
}
|
}
|
||||||
//r.Use(middleware.Metrics())
|
//r.Use(middleware.Metrics())
|
||||||
r.Use(common.Sentinel()).
|
// r.Use(common.Sentinel()).
|
||||||
Use(common.RequestId(pkg.TrafficKey)).
|
r.Use(common.RequestId(pkg.TrafficKey)).
|
||||||
Use(api.SetRequestLogger)
|
Use(api.SetRequestLogger)
|
||||||
|
|
||||||
common.InitMiddleware(r)
|
common.InitMiddleware(r)
|
||||||
|
|||||||
Reference in New Issue
Block a user