Browse Source

update

tmp
DengBiao 10 months ago
parent
commit
b73d774d79
1 changed files with 25 additions and 5 deletions
  1. +25
    -5
      app/admin/svc/order/svc_central_kitchen_for_school_order.go

+ 25
- 5
app/admin/svc/order/svc_central_kitchen_for_school_order.go View File

@@ -202,6 +202,8 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch
WxMchId string `json:"wx_mch_id"`
}{}

var dealReturnOrd = map[string][]string{}

outRequestNoSuffix := "_" + utils.Int64ToStr(time.Now().Unix())

companyWithWxpayInfoDb := db.CompanyWithWxpayInfoDb{}
@@ -274,6 +276,8 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch
}{OutRequestNo: outRequestNo, Amount: dealReturnOrdMapForWx[returnDay.OutTradeNo].Amount + utils.StrToFloat64(returnDay.Amount), Total: ord.TotalPrice, WxMchId: wxMchId})
}

dealReturnOrd[returnDay.OutTradeNo] = append(dealReturnOrd[returnDay.OutTradeNo], utils.IntToStr(returnDay.RecordsId))

returnDay.OutRequestNo = outRequestNo
returnDay.State = enum.CentralKitchenForSchoolUserRefundDayStateForAuditComplete
returnDay.RefundDate = time.Now().Format("2006-01-02 15:04:05")
@@ -347,9 +351,17 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch
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)

//TODO::2、将 central_kitchen_for_school_user_with_day 修改状态为退款中
sql1 := "update central_kitchen_for_school_user_with_day set state = %d where id In (%s)"
idsStr := strings.Join(dealReturnOrd[k], ",")
sql1 = fmt.Sprintf(sql, enum.CentralKitchenForSchoolUserWithDayStateForCanceling, idsStr)
db.ExecuteOriginalSql(db.Db, sql1)

utils.FilePutContents("dealReturnOrdMap_ERR", utils.SerializeStr(map[string]interface{}{
"sql": sql,
"err": err6.Error(),
"sql": sql,
"sql1": sql1,
"err": err6.Error(),
}))
} else {
//TODO::处理订单状态
@@ -391,7 +403,7 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch
if err6 != nil {
if err6 != nil {
fmt.Println("dealReturnOrdMapForWx_ERR::::", err6.Error())
//TODO::1、将审核状态修改为`退款中`
//TODO::1、将 central_kitchen_for_school_user_refund_day 审核状态修改为`退款中`
var sql string
parts := strings.Split(err6.Error(), "Message: ")
if len(parts) > 1 {
@@ -402,9 +414,17 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch
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)

//TODO::2、将 central_kitchen_for_school_user_with_day 修改状态为退款中
sql1 := "update central_kitchen_for_school_user_with_day set state = %d where id In (%s)"
idsStr := strings.Join(dealReturnOrd[k], ",")
sql1 = fmt.Sprintf(sql, enum.CentralKitchenForSchoolUserWithDayStateForCanceling, idsStr)
db.ExecuteOriginalSql(db.Db, sql1)

utils.FilePutContents("dealReturnOrdMapForWx_ERR", utils.SerializeStr(map[string]interface{}{
"sql": sql,
"err": err6.Error(),
"sql": sql,
"sql1": sql1,
"err": err6.Error(),
}))
}
} else {


Loading…
Cancel
Save