@@ -147,6 +147,7 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context) { | |||||
e.OutErr(c, e.ERR, err.Error()) | e.OutErr(c, e.ERR, err.Error()) | ||||
return | return | ||||
} | } | ||||
defer rabbitMqCh.Release() | |||||
//TODO:: 加锁 Redis 锁,防并发 | //TODO:: 加锁 Redis 锁,防并发 | ||||
getString, _ := cache.GetString(md.AuditLockKeyForCentralKitchenLockKey) | getString, _ := cache.GetString(md.AuditLockKeyForCentralKitchenLockKey) | ||||
@@ -12,6 +12,7 @@ import ( | |||||
"applet/app/enum" | "applet/app/enum" | ||||
svc3 "applet/app/svc" | svc3 "applet/app/svc" | ||||
"applet/app/utils" | "applet/app/utils" | ||||
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" | |||||
"fmt" | "fmt" | ||||
"github.com/gin-gonic/gin" | "github.com/gin-gonic/gin" | ||||
"github.com/wechatpay-apiv3/wechatpay-go/core" | "github.com/wechatpay-apiv3/wechatpay-go/core" | ||||
@@ -22,6 +23,15 @@ import ( | |||||
// Demo 测试 | // Demo 测试 | ||||
func Demo(c *gin.Context) { | func Demo(c *gin.Context) { | ||||
rabbitMqCh, err := rabbit.Cfg.Pool.GetChannel() | |||||
if err != nil { | |||||
e.OutErr(c, e.ERR, err.Error()) | |||||
return | |||||
} | |||||
defer rabbitMqCh.Release() | |||||
e.OutSuc(c, rabbitMqCh, nil) | |||||
return | |||||
eg := db.Db | eg := db.Db | ||||
var mm []model.CentralKitchenForSchoolWithSpec | var mm []model.CentralKitchenForSchoolWithSpec | ||||
if err1 := eg.Asc("id").Find(&mm); err1 != nil { | if err1 := eg.Asc("id").Find(&mm); err1 != nil { | ||||
@@ -1554,6 +1554,7 @@ func CentralKitchenForSchoolOrdRefund(req md.CentralKitchenForSchoolOrdRefundReq | |||||
if err != nil { | if err != nil { | ||||
return | return | ||||
} | } | ||||
defer rabbitMqCh.Release() | |||||
if len(m) > 0 { | if len(m) > 0 { | ||||
//2、更改 `central_kitchen_for_school_user_with_day` 的 state 为 退款中 | //2、更改 `central_kitchen_for_school_user_with_day` 的 state 为 退款中 | ||||
@@ -1611,6 +1612,7 @@ func CentralKitchenForSchoolBatchAskForLeaveBySchool(req md.CentralKitchenForSch | |||||
if err != nil { | if err != nil { | ||||
return | return | ||||
} | } | ||||
defer rabbitMqCh.Release() | |||||
for _, v := range req.EnterpriseIds { | for _, v := range req.EnterpriseIds { | ||||
//1、查询学校 | //1、查询学校 | ||||
@@ -1892,6 +1894,7 @@ func CentralKitchenForSchoolBatchAskForLeaveByGrade(req md.CentralKitchenForScho | |||||
if err != nil { | if err != nil { | ||||
return | return | ||||
} | } | ||||
defer rabbitMqCh.Release() | |||||
classDb := db.ClassDb{} | classDb := db.ClassDb{} | ||||
var classWithUser *[]model.ClassWithUser | var classWithUser *[]model.ClassWithUser | ||||
@@ -2189,6 +2192,7 @@ func CentralKitchenForSchoolBatchAskForLeaveByClass(req md.CentralKitchenForScho | |||||
if err != nil { | if err != nil { | ||||
return | return | ||||
} | } | ||||
defer rabbitMqCh.Release() | |||||
var classWithUser *[]model.ClassWithUser | var classWithUser *[]model.ClassWithUser | ||||
for _, v := range req.ClassIds { | for _, v := range req.ClassIds { | ||||
@@ -353,6 +353,7 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch | |||||
if err != nil { | if err != nil { | ||||
return | return | ||||
} | } | ||||
defer rabbitMqCh.Release() | |||||
//调用支付宝进行退款 | //调用支付宝进行退款 | ||||
for k, v := range dealReturnOrdMap { | for k, v := range dealReturnOrdMap { | ||||
@@ -152,6 +152,8 @@ func CentralKitchenForSchoolOrderRefund(req md.CentralKitchenForSchoolOrderRefun | |||||
if err != nil { | if err != nil { | ||||
return | return | ||||
} | } | ||||
defer rabbitMqCh.Release() | |||||
err = svc.JudgePackageOrdOrdState(req.OutTradeNo, rabbitMqCh) | err = svc.JudgePackageOrdOrdState(req.OutTradeNo, rabbitMqCh) | ||||
if err != nil { | if err != nil { | ||||
return err | return err | ||||