DengBiao před 10 měsíci
rodič
revize
09e856bac1
5 změnil soubory, kde provedl 55 přidání a 18 odebrání
  1. +16
    -10
      app/admin/hdl/hdl_audit_center.go
  2. +5
    -6
      app/admin/hdl/hdl_demo.go
  3. +2
    -2
      app/admin/svc/order/svc_central_kitchen_for_school_order.go
  4. +16
    -0
      app/db/db_central_kitchen_for_school_user_refund_day.go
  5. +16
    -0
      app/db/db_central_kitchen_for_school_user_with_day.go

+ 16
- 10
app/admin/hdl/hdl_audit_center.go Zobrazit soubor

@@ -6,6 +6,7 @@ import (
svc "applet/app/admin/svc/enterprise_manage"
svc2 "applet/app/admin/svc/order"
"applet/app/db"
"applet/app/db/model"
"applet/app/e"
"applet/app/enum"
"applet/app/utils"
@@ -105,8 +106,6 @@ func CentralKitchenForSchoolOrderRefundList(c *gin.Context) {
}

func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context) {
e.OutSuc(c, "success", nil)
return
var req md.CentralKitchenForSchoolOrderRefundAuditReq
err := c.ShouldBindJSON(&req)
if err != nil {
@@ -213,14 +212,21 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context) {
return
}

go func() {
err1 := svc2.CentralKitchenForSchoolOrderRefundAudit(c, req)
if err1 != nil {
logx.Error(err1)
println("<<<<CentralKitchenForSchoolOrderRefundAudit>>>>>Error:::", err1.Error())
}
cache.Del(md.AuditLockKeyForCentralKitchenLockKey)
}()
if req.State == 1 {
//TODO::审核通过,进行退款处理
go func() {
err1 := svc2.CentralKitchenForSchoolOrderRefundAudit(c, req)
if err1 != nil {
logx.Error(err1)
println("<<<<CentralKitchenForSchoolOrderRefundAudit>>>>>Error:::", err1.Error())
var m model.CentralKitchenForSchoolUserRefundDay
m.Memo = "退款处理失败:(" + err1.Error() + ")"
m.State = enum.CentralKitchenForSchoolUserRefundDayStateForAuditing
db.Db.In("id", req.Ids).Cols("memo", "state").Update(&m)
}
cache.Del(md.AuditLockKeyForCentralKitchenLockKey)
}()
}

e.OutSuc(c, "success", nil)
return


+ 5
- 6
app/admin/hdl/hdl_demo.go Zobrazit soubor

@@ -6,7 +6,6 @@ import (
"applet/app/db"
"applet/app/e"
"applet/app/enum"
"applet/app/utils"
"fmt"
"github.com/gin-gonic/gin"
"time"
@@ -29,11 +28,11 @@ func Demo(c *gin.Context) {
PayAliPrivateKey: sysCfg[enum.OpenAlipayAppPrivateKey],
PayAliPublicKey: sysCfg[enum.OpenAlipayPublicKey],
},
OutTradeNo: "SMIT1D20238140046521695702623232",
RefundAmount: "2.00",
RefundReason: "测试刷脸支付退款",
OutRequestNo: utils.OrderUUID(1997),
AppAuthToken: "202309BB893c46c0d6214c16913fb2268e5bdE03",
OutTradeNo: "800169659125681442",
RefundAmount: "180.00",
RefundReason: "央厨订餐退款",
OutRequestNo: "r_800169659125681442_1705546121",
AppAuthToken: "202308BB8ef30019cd8d4a40a3853192c397dX35",
})
if err6 != nil {
fmt.Println(err6.Error())


+ 2
- 2
app/admin/svc/order/svc_central_kitchen_for_school_order.go Zobrazit soubor

@@ -259,7 +259,7 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch
returnDay.RefundDate = time.Now().Format("2006-01-02 15:04:05")

returnDay.Memo = req.Memo
updateAck, err2 := centralKitchenForSchoolUserRefundDayDb.CentralKitchenForSchoolUserRefundDayUpdate(returnDay.Id, returnDay, "state", "memo", "refund_date", "out_request_no")
updateAck, err2 := centralKitchenForSchoolUserRefundDayDb.CentralKitchenForSchoolUserRefundDayUpdateBySess(session, returnDay.Id, returnDay, "state", "memo", "refund_date", "out_request_no")
if err2 != nil {
_ = session.Rollback()
return err2
@@ -270,7 +270,7 @@ func CentralKitchenForSchoolOrderRefundAudit(c *gin.Context, req md.CentralKitch
return
}

updateAck1, err4 := centralKitchenForSchoolUserWithDayDb.CentralKitchenForSchoolUserWithDayUpdate(userWithDay.Id, userWithDay, "state")
updateAck1, err4 := centralKitchenForSchoolUserWithDayDb.CentralKitchenForSchoolUserWithDayUpdateBySess(session, userWithDay.Id, userWithDay, "state")
if err4 != nil {
_ = session.Rollback()
return err4


+ 16
- 0
app/db/db_central_kitchen_for_school_user_refund_day.go Zobrazit soubor

@@ -85,6 +85,22 @@ func (centralKitchenForSchoolUserRefundDayDb *CentralKitchenForSchoolUserRefundD
return affected, nil
}

func (centralKitchenForSchoolUserRefundDayDb *CentralKitchenForSchoolUserRefundDayDb) CentralKitchenForSchoolUserRefundDayUpdateBySess(sess *xorm.Session, id interface{}, m *model.CentralKitchenForSchoolUserRefundDay, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = sess.Where("id=?", id).Cols(forceColums...).Update(m)
} else {
affected, err = sess.Where("id=?", id).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

type CentralKitchenForSchoolUserRefundDayWithCentralKitchenForSchoolUserWithDay struct {
model.CentralKitchenForSchoolUserRefundDay `xorm:"extends"`
model.CentralKitchenForSchoolUserWithDay `xorm:"extends"`


+ 16
- 0
app/db/db_central_kitchen_for_school_user_with_day.go Zobrazit soubor

@@ -205,6 +205,22 @@ func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb
return affected, nil
}

func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CentralKitchenForSchoolUserWithDayUpdateBySess(sess *xorm.Session, id interface{}, m *model.CentralKitchenForSchoolUserWithDay, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = sess.Where("id=?", id).Cols(forceColums...).Update(m)
} else {
affected, err = sess.Where("id=?", id).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CentralKitchenForSchoolUserWithDayBatchUpdate(ids interface{}, m []*model.CentralKitchenForSchoolUserWithDay) (int64, error) {
var (
affected int64


Načítá se…
Zrušit
Uložit