From ae64f11a0d515c9231053a619a2c28a65528e4e7 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 23 Feb 2024 14:02:38 +0800 Subject: [PATCH] update --- app/admin/hdl/hdl_audit_center.go | 8 +++ .../svc_central_kitchen_for_school_order.go | 52 ++++++++++++------- ...tral_kitchen_for_school_user_refund_day.go | 3 ++ 3 files changed, 44 insertions(+), 19 deletions(-) diff --git a/app/admin/hdl/hdl_audit_center.go b/app/admin/hdl/hdl_audit_center.go index 0d92249..5f27986 100644 --- a/app/admin/hdl/hdl_audit_center.go +++ b/app/admin/hdl/hdl_audit_center.go @@ -89,6 +89,10 @@ func CentralKitchenForSchoolOrderRefundList(c *gin.Context) { "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForRefundIng), "value": enum.CentralKitchenForSchoolUserRefundDayStateForRefundIng, }, + { + "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForRefundErr), + "value": enum.CentralKitchenForSchoolUserRefundDayStateForRefundErr, + }, }, "user_identity_kind_list": []map[string]interface{}{ { @@ -328,6 +332,10 @@ func NursingHomeOrderRefundList(c *gin.Context) { "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForRefundIng), "value": enum.CentralKitchenForSchoolUserRefundDayStateForRefundIng, }, + { + "name": enum.CentralKitchenForSchoolUserRefundDayState.String(enum.CentralKitchenForSchoolUserRefundDayStateForRefundErr), + "value": enum.CentralKitchenForSchoolUserRefundDayStateForRefundErr, + }, }, "user_identity_kind_list": []map[string]interface{}{ { 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 700cc02..f9ab337 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 @@ -344,14 +344,24 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch if err6 != nil { fmt.Println("dealReturnOrdMap_ERR::::", err6.Error()) //TODO::1、将 central_kitchen_for_school_user_refund_day 审核状态修改为`退款中` - sql := fmt.Sprintf("update central_kitchen_for_school_user_refund_day set state =5, memo = '%s' where out_request_no = '%s'", err6.Error(), v.OutRequestNo) + var sql string + sql = fmt.Sprintf("update central_kitchen_for_school_user_refund_day set state =5, memo = '%s' where out_request_no = '%s'", err6.Error(), v.OutRequestNo) db.ExecuteOriginalSql(db.Db, sql) utils.FilePutContents("dealReturnOrdMap_ERR", utils.SerializeStr(map[string]interface{}{ "sql": sql, "err": err6.Error(), })) + } else { + //TODO::处理订单状态 + err = svc.JudgePackageOrdOrdState(k) + if err != nil { + utils.FilePutContents("dealReturnOrdMap_judge_packageOrdState_ERR", utils.SerializeStr(map[string]interface{}{ + "err": err.Error(), + })) + } } - time.Sleep(100 * time.Millisecond) //TODO::避免频繁调用 + + time.Sleep(10 * time.Millisecond) //TODO::避免频繁调用 } //调用微信进行退款 @@ -376,36 +386,40 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch }, }, ) + fmt.Println(">>>>wxRefund<<<<", resp.Status) + if err6 != nil { if err6 != nil { fmt.Println("dealReturnOrdMapForWx_ERR::::", err6.Error()) //TODO::1、将审核状态修改为`退款中` - sql := fmt.Sprintf("update central_kitchen_for_school_user_refund_day set state =5, memo = '%s' where out_request_no = '%s'", err6.Error(), v.OutRequestNo) + var sql string + parts := strings.Split(err6.Error(), "Message: ") + if len(parts) > 1 { + // 去除"Message:"后面的换行符和空格 + message := strings.TrimSpace(parts[1]) + sql = fmt.Sprintf("update central_kitchen_for_school_user_refund_day set state =5, memo = '%s' where out_request_no = '%s'", message, v.OutRequestNo) + } else { + sql = fmt.Sprintf("update central_kitchen_for_school_user_refund_day set state =5, memo = '%s' where out_request_no = '%s'", err6.Error(), v.OutRequestNo) + } db.ExecuteOriginalSql(db.Db, sql) utils.FilePutContents("dealReturnOrdMapForWx_ERR", utils.SerializeStr(map[string]interface{}{ "sql": sql, "err": err6.Error(), })) - + } + } else { + //TODO::处理订单状态 + err = svc.JudgePackageOrdOrdState(k) + if err != nil { + utils.FilePutContents("dealReturnOrdMapForWx_judge_packageOrdState_ERR", utils.SerializeStr(map[string]interface{}{ + "err": err.Error(), + })) } } - fmt.Println(">>>>wxRefund<<<<", resp.Status) - time.Sleep(100 * time.Millisecond) //TODO::避免频繁调用 + + time.Sleep(10 * time.Millisecond) //TODO::避免频繁调用 } //} - //TODO:: 处理订单状态 - for k, _ := range dealReturnOrdMap { - err = svc.JudgePackageOrdOrdState(k) - if err != nil { - return err - } - } - for k, _ := range dealReturnOrdMapForWx { - err = svc.JudgePackageOrdOrdState(k) - if err != nil { - return err - } - } return } diff --git a/app/enum/enum_central_kitchen_for_school_user_refund_day.go b/app/enum/enum_central_kitchen_for_school_user_refund_day.go index 46ff369..b5b4766 100644 --- a/app/enum/enum_central_kitchen_for_school_user_refund_day.go +++ b/app/enum/enum_central_kitchen_for_school_user_refund_day.go @@ -8,6 +8,7 @@ const ( CentralKitchenForSchoolUserRefundDayStateForAuditReject = 3 CentralKitchenForSchoolUserRefundDayStateForAuditComplete = 4 CentralKitchenForSchoolUserRefundDayStateForRefundIng = 5 + CentralKitchenForSchoolUserRefundDayStateForRefundErr = 6 ) func (gt CentralKitchenForSchoolUserRefundDayState) String() string { @@ -22,6 +23,8 @@ func (gt CentralKitchenForSchoolUserRefundDayState) String() string { return "退款已完成" case CentralKitchenForSchoolUserRefundDayStateForRefundIng: return "退款中" + case CentralKitchenForSchoolUserRefundDayStateForRefundErr: + return "退款失败" default: return "未知" }