From 53086cde6c894f5f8bac778f9501d953d9bcc08f Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Thu, 21 Mar 2024 20:27:42 +0800 Subject: [PATCH] fix recover --- app/mix/controller/init.go | 1 - app/mix/controller/vas.go | 7 ------- app/mix/controller/vas_op.go | 2 -- library/middleware/recover.go | 12 ------------ 4 files changed, 22 deletions(-) delete mode 100644 library/middleware/recover.go diff --git a/app/mix/controller/init.go b/app/mix/controller/init.go index 2f53f076..2a9705dd 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -529,7 +529,6 @@ func Prepare() gin.HandlerFunc { func PrepareToC() gin.HandlerFunc { return func(ctx *gin.Context) { - defer logger.Recover() // if !wsign.CheckSignature(ctx) { // ReplyErrCodeMsg(ctx, errcode.ErrCodeCheckSignatureFail) // return diff --git a/app/mix/controller/vas.go b/app/mix/controller/vas.go index cf8088fc..92aafdd6 100644 --- a/app/mix/controller/vas.go +++ b/app/mix/controller/vas.go @@ -44,7 +44,6 @@ func GetMembershipProductList(ctx *gin.Context) { // 充值 创建订单 func CreateOrder(ctx *gin.Context) { - defer logger.Recover() req := ctx.MustGet("client_req").(*vasproto.CreateOrderReq) if !req.IsValid() || len(req.PayType) <= 0 || len(req.ProductId) <= 0 { logger.Error("CreateOrder, invalid param, req: %v", util.ToJson(req)) @@ -80,7 +79,6 @@ func OpCreateOrder(ctx *gin.Context) { // 一键解锁 func OneStepUnlock(ctx *gin.Context) { - defer logger.Recover() req := ctx.MustGet("client_req").(*vasproto.OneStepUnlockContactReq) if !req.IsValid() || req.Uid <= 0 || len(req.ContactProductId) <= 0 { logger.Error("OneStepUnlock, invalid param, req: %v", util.ToJson(req)) @@ -98,7 +96,6 @@ func OneStepUnlock(ctx *gin.Context) { // 填写地址 func ConsumerFillContact(ctx *gin.Context) { - defer logger.Recover() req := ctx.MustGet("client_req").(*vasproto.ConsumerFillContactReq) if req.Mid <= 0 || len(req.OrderId) <= 0 { logger.Error("ConsumerFillContact, invalid param, req: %v", util.ToJson(req)) @@ -116,7 +113,6 @@ func ConsumerFillContact(ctx *gin.Context) { // 待添加微信列表 func GetAddWechatList(ctx *gin.Context) { - defer logger.Recover() req := ctx.MustGet("client_req").(*vasproto.GetAddWechatListReq) if !req.IsValid() { logger.Error("GetAddWechatList, invalid param, req: %v", util.ToJson(req)) @@ -134,7 +130,6 @@ func GetAddWechatList(ctx *gin.Context) { // 完成添加微信 func ConfirmAddWechat(ctx *gin.Context) { - defer logger.Recover() req := ctx.MustGet("client_req").(*vasproto.ConfirmAddWechatReq) if !req.IsValid() { logger.Error("ConfirmAddWechat, invalid param, req: %v", util.ToJson(req)) @@ -152,7 +147,6 @@ func ConfirmAddWechat(ctx *gin.Context) { // 已解锁微信列表 func GetUnlockWechatList(ctx *gin.Context) { - defer logger.Recover() req := ctx.MustGet("client_req").(*vasproto.GetUnlockWechatListReq) if req.Mid <= 0 { logger.Error("GetUnlockWechatList, invalid param, req: %v", util.ToJson(req)) @@ -170,7 +164,6 @@ func GetUnlockWechatList(ctx *gin.Context) { // 明细 func GetCHList(ctx *gin.Context) { - defer logger.Recover() req := ctx.MustGet("client_req").(*vasproto.GetCHListReq) if !req.IsValid() { logger.Error("GetCHList, invalid param, req: %v", util.ToJson(req)) diff --git a/app/mix/controller/vas_op.go b/app/mix/controller/vas_op.go index 6b614c9e..5769853b 100644 --- a/app/mix/controller/vas_op.go +++ b/app/mix/controller/vas_op.go @@ -10,7 +10,6 @@ import ( ) func OpCoinOrderList(ctx *gin.Context) { - //defer logger.Recover() req := ctx.MustGet("client_req").(*vasproto.OpCoinOrderListReq) if req.Limit <= 0 { req.Limit = 1000 @@ -28,7 +27,6 @@ func OpCoinOrderList(ctx *gin.Context) { } func OpOrderList(ctx *gin.Context) { - //defer logger.Recover() req := ctx.MustGet("client_req").(*vasproto.OpOrderListReq) if req.Limit <= 0 { req.Limit = 1000 diff --git a/library/middleware/recover.go b/library/middleware/recover.go deleted file mode 100644 index d66b0d36..00000000 --- a/library/middleware/recover.go +++ /dev/null @@ -1,12 +0,0 @@ -package middleware - -import ( - "github.com/gin-gonic/gin" - "service/library/logger" -) - -func RecoverMiddleware() gin.HandlerFunc { - return func(c *gin.Context) { - defer logger.Recover() - } -}