4444
This commit is contained in:
parent
18c7ac3ae0
commit
b5631c2ffb
@ -76,7 +76,7 @@ func CancelUnPayOrder(msg amqp091.Delivery) {
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
utils.LogJsonErr("consumer.CancelUnPayOrder:", "订单异常")
|
||||
_ = msg.Ack(false)
|
||||
_ = msg.Reject(false)
|
||||
return
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ func CancelUnPayOrder(msg amqp091.Delivery) {
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
utils.LogJsonErr("consumer.CancelUnPayOrder:", "订单异常")
|
||||
_ = msg.Ack(false)
|
||||
_ = msg.Reject(false)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,37 @@
|
||||
package consumer
|
||||
|
||||
func checkHandleNumber(key string) {
|
||||
import (
|
||||
"context"
|
||||
"hepa-calc-api/global"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 检测执行次数
|
||||
func checkHandleNumber(key string) bool {
|
||||
c := context.Background()
|
||||
res, _ := global.Redis.Get(c, key).Result()
|
||||
if res == "" {
|
||||
// 添加缓存
|
||||
_, _ = global.Redis.Set(c, key, 1, (60*60*2)*time.Second).Result()
|
||||
return true
|
||||
}
|
||||
|
||||
// string转int
|
||||
handleNum, err := strconv.Atoi(res)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if handleNum > 3 {
|
||||
// 加入短信队列,通知管理员
|
||||
|
||||
// 返回false,删除掉缓存
|
||||
global.Redis.Del(c, key)
|
||||
}
|
||||
|
||||
// 增加1次
|
||||
global.Redis.Incr(c, key)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@ -61,6 +61,8 @@ func (b *UserCollection) GetUserCollectionPage(c *gin.Context) {
|
||||
|
||||
// PutUserCollection 收藏题目
|
||||
func (r *UserCollection) PutUserCollection(c *gin.Context) {
|
||||
utils.LogJsonInfo("test", "1222333")
|
||||
|
||||
userCollectionRequest := requests.UserCollectionRequest{}
|
||||
req := userCollectionRequest.PutUserCollection
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
|
||||
@ -226,6 +226,7 @@ func (r *OrderSingleService) AddOrderSingle(tx *gorm.DB, UserId, QuestionId int6
|
||||
utils.LogJsonErr("添加处理取消未支付订单队列失败:", err.Error())
|
||||
return nil, errors.New("订单创建失败")
|
||||
}
|
||||
fmt.Println("添加队列成功")
|
||||
}
|
||||
|
||||
// 会员支付
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user