From 99baf50984af1f361ebd1d3a43746c678c9cd43d Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Mon, 3 Jun 2024 10:08:15 +0800 Subject: [PATCH 1/4] t --- library/redis/lock.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 library/redis/lock.go diff --git a/library/redis/lock.go b/library/redis/lock.go new file mode 100644 index 00000000..65414cec --- /dev/null +++ b/library/redis/lock.go @@ -0,0 +1,17 @@ +package redis + +//import ( +// "github.com/bsm/redislock" +//) +// +//func T() { +// client := redis.NewClient(&redis.Options{ +// Network: "tcp", +// Addr: "127.0.0.1:6379", +// }) +// defer client.Close() +// +// // Create a new lock client. +// locker := redislock.New(client) +// +//} From f6018b19d68f58d6a569f92b318de92ee67bcbd4 Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Fri, 14 Jun 2024 17:59:46 +0800 Subject: [PATCH 2/4] add yeepay cfg --- etc/mix/mix-prod.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/etc/mix/mix-prod.yaml b/etc/mix/mix-prod.yaml index 8ac9daad..17c6ac6b 100644 --- a/etc/mix/mix-prod.yaml +++ b/etc/mix/mix-prod.yaml @@ -148,6 +148,14 @@ elastic_search: password: "Wishpal@2024" sniff: false +yeepay: + appid: "app_10090316660" + parent_merchant_no: "10090316660" + merchant_no: "10090326142" + notify_url: "https://api.tiefen.fun/ext/vas/yeepay_callback" + private_key: "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC8Zfd0RVnpmPuodc0N8XLLI8DWT4hTAyOlwbE5LLiiguG5W0AghvddreO73T51BGK4V05Taxdpv7j7KNl39OUzKA0tpmoLwC4f6II1Op4tY05NnUgOFbno01vE7cN5BWLwVA35dfgQm1jtzXECdTufavYH/qPCzpvd7OTbmdHonMVjanjz+XOfnFowxq8ap3F63ocF4LR3KalsC/cTvW7LYnendjjiFGbMm7DlLEUtHRZ0EzrmM6SVxXRcibKZd7Dy6QpNXLu615cJL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FBIzcQdYPkguq3ue9gFtNCXqI8/7gpwFE4LWmUtbnpAW3/AoGAW9ma4+4+QfGOGb9N38IyzHcXiyAkteQMX72Hxb0HK+nz9QwGXObqFvwnJ7IV8aJ0ZAUGDUfTToorNRSnmPdnq4BG5uKisIONp5pe0ZchlhXAEgKZnCgVmrEHgtzv3U8ffOfbNjoTufI/ZZoyl+7Kr1+o32VikquuMxeNpR9T6Fw=" + + sd: host: "http://172.31.37.68:8500" service_name: "mix_online" From 8e4e6087b66659c4511aaf46bff2cb805cc8eccc Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Fri, 14 Jun 2024 18:37:42 +0800 Subject: [PATCH 3/4] fix --- app/mix/controller/zone_vas_api.go | 3 ++- app/mix/service/logic/vas.go | 4 ++++ app/mix/service/logic/vas_zone.go | 5 ++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/mix/controller/zone_vas_api.go b/app/mix/controller/zone_vas_api.go index b0dec7e4..43310297 100644 --- a/app/mix/controller/zone_vas_api.go +++ b/app/mix/controller/zone_vas_api.go @@ -80,6 +80,8 @@ func ZoneRefund(ctx *gin.Context) { ReplyErrCodeMsg(ctx, errcode.ErrCodeBadParam) return } + ReplyOk(ctx, nil) + ec, err := service.DefaultService.ZoneRefund(ctx, req) if ec != errcode.ErrCodeVasSrvOk { logger.Error("ZoneRefund fail, req: %v, ec: %v", util.ToJson(req), ec) @@ -90,7 +92,6 @@ func ZoneRefund(ctx *gin.Context) { ReplyErrCodeMsg(ctx, ec) return } - ReplyOk(ctx, nil) } func ZoneMemberList(ctx *gin.Context) { diff --git a/app/mix/service/logic/vas.go b/app/mix/service/logic/vas.go index 9607875e..ac8ffe50 100644 --- a/app/mix/service/logic/vas.go +++ b/app/mix/service/logic/vas.go @@ -2204,6 +2204,10 @@ func (v *Vas) UnlockMembership(ctx *gin.Context, tx *sqlx.Tx, mid int64, product return } +func getRefundLockKey(orderId string) string { + return fmt.Sprintf("refund_%s", orderId) +} + // 订单退款,只退充值 func (v *Vas) RefundOrder(ctx *gin.Context, req *vasproto.RefundOrderReq, opt *vasproto.RefundOrderOpt) error { // 获取订单 diff --git a/app/mix/service/logic/vas_zone.go b/app/mix/service/logic/vas_zone.go index e3cb67e5..c7289d3b 100644 --- a/app/mix/service/logic/vas_zone.go +++ b/app/mix/service/logic/vas_zone.go @@ -921,6 +921,8 @@ func (v *Vas) ZoneRefund(ctx *gin.Context, req *vasproto.ZoneRefundReq) error { if time.Now().Unix()-t < 3600*12 { return fmt.Errorf("12小时内您最多只能进行1次退款") } + // redis记录退款时间 + _ = redisCli.Set(redisKey, time.Now().Unix(), 86400) // 获取解锁信息 zv, err := v.store.GetZoneUnlock(ctx, nil, req.Mid, req.Zid) @@ -961,9 +963,6 @@ func (v *Vas) ZoneRefund(ctx *gin.Context, req *vasproto.ZoneRefundReq) error { return err } - // redis记录退款时间 - _ = redisCli.Set(redisKey, time.Now().Unix(), 86400) - return nil } From ba0a6c25fb0a5bd5402e6c71fb767bb2d14bc86e Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Fri, 14 Jun 2024 18:37:50 +0800 Subject: [PATCH 4/4] fix refund --- app/mix/controller/vas.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/mix/controller/vas.go b/app/mix/controller/vas.go index 840ada60..29e7a32e 100644 --- a/app/mix/controller/vas.go +++ b/app/mix/controller/vas.go @@ -334,6 +334,8 @@ func DealOneOrder(ctx *gin.Context) { // 订单退款 func RefundOrder(ctx *gin.Context) { req := ctx.MustGet("client_req").(*vasproto.RefundOrderReq) + ReplyOk(ctx, nil) + ec, err := service.DefaultService.RefundOrder(ctx, req) if ec != errcode.ErrCodeVasSrvOk { logger.Error("RefundOrder fail, req: %v, ec: %v", util.ToJson(req), ec) @@ -344,7 +346,6 @@ func RefundOrder(ctx *gin.Context) { ReplyErrCodeMsg(ctx, ec) return } - ReplyOk(ctx, nil) } // 金币订单退款