Browse Source

update

tmp
DengBiao 10 months ago
parent
commit
8a27923351
2 changed files with 39 additions and 22 deletions
  1. +37
    -22
      app/admin/svc/order/svc_central_kitchen_for_school_order.go
  2. +2
    -0
      app/customer/hdl/hdl_call_back.go

+ 37
- 22
app/admin/svc/order/svc_central_kitchen_for_school_order.go View File

@@ -307,6 +307,24 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch
}
}

session.Commit()

if len(isAlreadyReturnDayId) > 0 {
//更改 `central_kitchen_for_school_user_refund_day` 的 memo
sql := "update central_kitchen_for_school_user_refund_day set memo = '当前退款申请记录,已有其他退款申请完成退款!' where id In (%s)"
idsStr := strings.Join(req.Ids, ",")
sql = fmt.Sprintf(sql, idsStr)
fmt.Println(sql)
_, err = db.ExecuteOriginalSql(db.Db, sql)
if err != nil {
utils.FilePutContents("isAlreadyReturnDayId_ERR", utils.SerializeStr(map[string]interface{}{
"sql": sql,
"err": err.Error(),
}))
fmt.Println("isAlreadyReturnDayId_ERR::::::::::::::", err.Error())
}
}

//调用支付宝进行退款
for k, v := range dealReturnOrdMap {
err6, _ := svc2.CurlAlipayTradeRefund(md2.CurlAlipayTradeRefundReq{
@@ -326,8 +344,14 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch
AppAuthToken: sysCfg[enum.JsapiPayAppAutToken],
})
if err6 != nil {
_ = session.Rollback()
return err6
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 = 3, memo = %s where out_request_no = '%s'", v.OutRequestNo, err6.Error())
db.ExecuteOriginalSql(db.Db, sql)
utils.FilePutContents("dealReturnOrdMap_ERR", utils.SerializeStr(map[string]interface{}{
"sql": sql,
"err": err6.Error(),
}))
}
time.Sleep(100 * time.Millisecond) //TODO::避免频繁调用
}
@@ -336,7 +360,6 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch
//if !cfg.Prd { //TODO::正式环境暂不开启微信退款
client, err1 := svc3.NewWxPayClient(c) //初始化微信连接
if err1 != nil {
_ = session.Rollback()
return err1
}
wxSvc := refunddomestic.RefundsApiService{Client: client}
@@ -356,31 +379,23 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch
},
)
if err6 != nil {
_ = session.Rollback()
return err6
if err6 != nil {
fmt.Println("dealReturnOrdMapForWx_ERR::::", err6.Error())
//TODO::1、将审核状态修改为`退款中`
sql := fmt.Sprintf("update central_kitchen_for_school_user_refund_day set state = 3, memo = %s where out_request_no = '%s'", v.OutRequestNo, err6.Error())
db.ExecuteOriginalSql(db.Db, sql)
utils.FilePutContents("dealReturnOrdMapForWx_ERR", utils.SerializeStr(map[string]interface{}{
"sql": sql,
"err": err6.Error(),
}))

}
}
fmt.Println(">>>>wxRefund<<<<", resp.Status)
time.Sleep(100 * time.Millisecond) //TODO::避免频繁调用
}
//}

session.Commit()

if len(isAlreadyReturnDayId) > 0 {
//更改 `central_kitchen_for_school_user_with_day` 的 memo
sql := "update central_kitchen_for_school_user_with_day set memo = '当前退款申请记录,已有其他退款申请完成退款!' where id In (%s)"
idsStr := strings.Join(req.Ids, ",")
sql = fmt.Sprintf(sql, idsStr)
fmt.Println(sql)
_, err = db.ExecuteOriginalSql(db.Db, sql)
if err != nil {
utils.FilePutContents("isAlreadyReturnDayId_ERR", utils.SerializeStr(map[string]interface{}{
"sql": sql,
"err": err.Error(),
}))
fmt.Println("isAlreadyReturnDayId_ERR::::::::::::::", err.Error())
}
}
//TODO:: 处理订单状态
for k, _ := range dealReturnOrdMap {
err = svc.JudgePackageOrdOrdState(k)


+ 2
- 0
app/customer/hdl/hdl_call_back.go View File

@@ -7,6 +7,7 @@ import (
"applet/app/db"
"applet/app/e"
"applet/app/enum"
utils2 "applet/app/utils"
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
@@ -99,6 +100,7 @@ func WxRefundApiCallBack(c *gin.Context) {
}

fmt.Println(">>>>>>>>>>WxRefundApiCallBack<<<<<<<<<", decryptString)
utils2.FilePutContents("WxRefundApiCallBack", decryptString)
//var resp md.WxPayCallback
//err = json.Unmarshal([]byte(decryptString), &resp)
//if err != nil {


Loading…
Cancel
Save