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 f16b930..2185198 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 @@ -855,34 +855,35 @@ func JudgePackageOrdOrdState(outTradeNo string) (err error) { } //1、判断是否有 `待就餐` - count, err := db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.CentralKitchenForSchoolUserWithDayStateForWait).Count(&m) + count1, err := db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.CentralKitchenForSchoolUserWithDayStateForWait).Count(&m) if err != nil { return } - if count == 0 { + if count1 == 0 { ordState = enum2.CentralKitchenForSchoolPackageOrdOrdStateForComplete } else { ordState = enum2.CentralKitchenForSchoolPackageOrdOrdStateForSuccess } //2、判断是否有 `已退款` / `部分退款` - count, err = db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.CentralKitchenForSchoolUserWithDayStateForCancel).Count(&m) + count2, err := db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.CentralKitchenForSchoolUserWithDayStateForCancel).Count(&m) if err != nil { return } - if count > 0 && count < total { + //if count2 > 0 && count2 < total && count1 > 0 { + if count2 > 0 && count2 < total { ordState = enum2.CentralKitchenForSchoolPackageOrdOrdStateForPartRefunded } - if count > 0 && count != total { + if count2 > 0 && count2 == total { ordState = enum2.CentralKitchenForSchoolPackageOrdOrdStateForRefunded } //3、判断是否有 `退款中` - count, err = db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.CentralKitchenForSchoolUserWithDayStateForCanceling).Count(&m) + count3, err := db.Db.Where("ord_no =?", outTradeNo).And("state =?", enum2.CentralKitchenForSchoolUserWithDayStateForCanceling).Count(&m) if err != nil { return } - if count > 0 { + if count3 > 0 { ordState = enum2.CentralKitchenForSchoolPackageOrdOrdStateForRefunding } 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 7496bbf..70b058f 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 @@ -155,7 +155,7 @@ func CentralKitchenForSchoolOrderRefundAudit(req md.CentralKitchenForSchoolOrder if req.State == 1 { returnDay.State = enum.CentralKitchenForSchoolUserRefundDayStateForAuditPass userWithDay.State = enum.CentralKitchenForSchoolUserWithDayStateForCancel - + time.Sleep(1 * time.Second) //TODO::避免频繁调用 //调用支付宝进行退款 err6, _ := svc2.CurlAlipayTradeRefund(md2.CurlAlipayTradeRefundReq{ Config: struct { diff --git a/app/customer/hdl/hdl_demo.go b/app/customer/hdl/hdl_demo.go index 9e10df0..d07def2 100644 --- a/app/customer/hdl/hdl_demo.go +++ b/app/customer/hdl/hdl_demo.go @@ -2,6 +2,7 @@ package hdl import ( "applet/app/admin/lib/validate" + svc2 "applet/app/admin/svc/enterprise_manage" "applet/app/customer/md" "applet/app/customer/svc" "applet/app/e" @@ -25,3 +26,10 @@ func CurlAlipayPlanetEcocampusApiRosterSignUpInfo(c *gin.Context) { e.OutSuc(c, resp, nil) return } + +func Demo(c *gin.Context) { + ordNo := c.DefaultQuery("ord_no", "") + svc2.JudgePackageOrdOrdState(ordNo) + e.OutSuc(c, nil, nil) + return +} diff --git a/app/router/customer_router.go b/app/router/customer_router.go index f8bb66c..e2fe36c 100644 --- a/app/router/customer_router.go +++ b/app/router/customer_router.go @@ -14,6 +14,7 @@ func CustomerInit(r *gin.RouterGroup) { rSelfSupportForSchool(r.Group("/selfSupportForSchool")) rUserIdentity(r.Group("/userIdentity")) + r.POST("/test", hdl.Demo) r.POST("/curlAlipayPlanetEcocampusApiRosterSignUpInfoTest", hdl.CurlAlipayPlanetEcocampusApiRosterSignUpInfo) r.POST("/login", hdl.Login)