diff --git a/app/admin/hdl/hdl_audit_center.go b/app/admin/hdl/hdl_audit_center.go index 24bea00..381650c 100644 --- a/app/admin/hdl/hdl_audit_center.go +++ b/app/admin/hdl/hdl_audit_center.go @@ -147,6 +147,7 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context) { e.OutErr(c, e.ERR, err.Error()) return } + defer rabbitMqCh.Release() //TODO:: 加锁 Redis 锁,防并发 getString, _ := cache.GetString(md.AuditLockKeyForCentralKitchenLockKey) diff --git a/app/admin/hdl/hdl_demo.go b/app/admin/hdl/hdl_demo.go index 8d9a5bb..5f71885 100644 --- a/app/admin/hdl/hdl_demo.go +++ b/app/admin/hdl/hdl_demo.go @@ -12,6 +12,7 @@ import ( "applet/app/enum" svc3 "applet/app/svc" "applet/app/utils" + "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" "fmt" "github.com/gin-gonic/gin" "github.com/wechatpay-apiv3/wechatpay-go/core" @@ -22,6 +23,15 @@ import ( // Demo 测试 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 var mm []model.CentralKitchenForSchoolWithSpec if err1 := eg.Asc("id").Find(&mm); err1 != nil { diff --git a/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go b/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go index 7ce2865..10541e5 100644 --- a/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go +++ b/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go @@ -1554,6 +1554,7 @@ func CentralKitchenForSchoolOrdRefund(req md.CentralKitchenForSchoolOrdRefundReq if err != nil { return } + defer rabbitMqCh.Release() if len(m) > 0 { //2、更改 `central_kitchen_for_school_user_with_day` 的 state 为 退款中 @@ -1611,6 +1612,7 @@ func CentralKitchenForSchoolBatchAskForLeaveBySchool(req md.CentralKitchenForSch if err != nil { return } + defer rabbitMqCh.Release() for _, v := range req.EnterpriseIds { //1、查询学校 @@ -1892,6 +1894,7 @@ func CentralKitchenForSchoolBatchAskForLeaveByGrade(req md.CentralKitchenForScho if err != nil { return } + defer rabbitMqCh.Release() classDb := db.ClassDb{} var classWithUser *[]model.ClassWithUser @@ -2189,6 +2192,7 @@ func CentralKitchenForSchoolBatchAskForLeaveByClass(req md.CentralKitchenForScho if err != nil { return } + defer rabbitMqCh.Release() var classWithUser *[]model.ClassWithUser for _, v := range req.ClassIds { diff --git a/app/admin/svc/order/svc_central_kitchen_for_school_order.go b/app/admin/svc/order/svc_central_kitchen_for_school_order.go index 85013c7..5913fda 100644 --- a/app/admin/svc/order/svc_central_kitchen_for_school_order.go +++ b/app/admin/svc/order/svc_central_kitchen_for_school_order.go @@ -353,6 +353,7 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch if err != nil { return } + defer rabbitMqCh.Release() //调用支付宝进行退款 for k, v := range dealReturnOrdMap { diff --git a/app/customer/svc/order/svc_central_kitchen_for_school_order.go b/app/customer/svc/order/svc_central_kitchen_for_school_order.go index d0372d0..5619c2f 100644 --- a/app/customer/svc/order/svc_central_kitchen_for_school_order.go +++ b/app/customer/svc/order/svc_central_kitchen_for_school_order.go @@ -152,6 +152,8 @@ func CentralKitchenForSchoolOrderRefund(req md.CentralKitchenForSchoolOrderRefun if err != nil { return } + defer rabbitMqCh.Release() + err = svc.JudgePackageOrdOrdState(req.OutTradeNo, rabbitMqCh) if err != nil { return err