From 4301327ce9668979f106c19dea103723b4302ef8 Mon Sep 17 00:00:00 2001 From: jiangyong27 Date: Wed, 15 Jan 2025 12:27:44 +0800 Subject: [PATCH] HandleRefund --- server/controller/qyweixin.go | 6 +++++- server/server.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/controller/qyweixin.go b/server/controller/qyweixin.go index 7536e7e..b22f029 100644 --- a/server/controller/qyweixin.go +++ b/server/controller/qyweixin.go @@ -4,6 +4,7 @@ import ( "enterprise/common/config" "enterprise/common/dao" "enterprise/common/global" + "enterprise/common/model" "enterprise/server/service" "enterprise/server/session" "fmt" @@ -42,7 +43,7 @@ func (q *QyWeixin) Approve(ctx *gin.Context) { qyApp.Callback(ctx) } -func (q *QyWeixin) ApproveRefund(ctx *gin.Context) { +func (q *QyWeixin) HandleRefund(ctx *gin.Context) { id := cast.ToInt64(ctx.Query("id")) approve, err := dao.NewApprovalRefundDao().Get(id) if err != nil { @@ -51,6 +52,9 @@ func (q *QyWeixin) ApproveRefund(ctx *gin.Context) { if approve == nil { panic("没有数据") } + if approve.Status == model.ApprovalRefundStatusPayed { + panic("已支付") + } corp, err := dao.NewCorpDao().Get(approve.CorpId) if err != nil { panic(config.ErrDb.New().Append(err)) diff --git a/server/server.go b/server/server.go index 85fd0b2..21aaff6 100644 --- a/server/server.go +++ b/server/server.go @@ -16,7 +16,7 @@ func initRoutge(engine *gin.Engine) { group.Use(base.Recovery) apiGroup.Any("/qyweixin/approve/:cid", qyweixin.Approve) apiGroup.Any("/qyweixin/pay/:cid", qyweixin.Pay) - apiGroup.Any("/qyweixin/pay/refund", qyweixin.ApproveRefund) + apiGroup.Any("/qyweixin/handle/refund", qyweixin.HandleRefund) group.GET("/staff/salary", staff.Salary) group.GET("/staff/salary/history", staff.SalaryHistory)