From 932fcf597f9e0feb06c0ba1aff9d8ccb991daf79 Mon Sep 17 00:00:00 2001 From: li Date: Tue, 13 Dec 2022 14:11:54 +0800 Subject: [PATCH] fix: --- controller/order.go | 6 +++--- controller/user.go | 2 +- lib/wxpay/wx_pay.go | 16 ++++++++-------- model/model_test.go | 17 ++++++++++------- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/controller/order.go b/controller/order.go index 970d89d..73648f4 100644 --- a/controller/order.go +++ b/controller/order.go @@ -249,9 +249,9 @@ func RentCardOrderCreate(c *gin.Context) { rentCard = &model.UserRentCard{LevelRentCount: memberConfig.CardMax, CanRentCount: memberConfig.CardMax} } - if uc.Uid == 15304136 || uc.Uid == 45935373 { - rentCard.CanRentCount -= 1 - } + //if uc.Uid == 45935373 { + // rentCard.CanRentCount -= 1 + //} if cardCount > rentCard.CanRentCount { logger.Error("GetMemberConfig err:", err) RespJson(c, status.OrderOutRentCount, nil) diff --git a/controller/user.go b/controller/user.go index cb3f51c..8f988dd 100644 --- a/controller/user.go +++ b/controller/user.go @@ -437,7 +437,7 @@ func UpgradeMember(c *gin.Context) { RespJson(c, status.InternalServerError, nil) return } - + if req.UserCouponId != 0 { var coupon model.UserCoupon err = model.NewUserCouponQuerySet(model.DB).IDEq(req.UserCouponId).One(&coupon) diff --git a/lib/wxpay/wx_pay.go b/lib/wxpay/wx_pay.go index 26f9d2f..0374d34 100644 --- a/lib/wxpay/wx_pay.go +++ b/lib/wxpay/wx_pay.go @@ -1074,7 +1074,7 @@ type HmPayBizContent struct { // AccessPartyCode string `json:"access_party_code"` //} `json:"extend_params"` //GoodsDetails []HmPayGoodsDetails `json:"goods_details"` - LimitPay string `json:"limit_pay"` + //LimitPay string `json:"limit_pay"` NotifyUrl string `json:"notify_url"` //OperatorId string `json:"operator_id"` OutOrderNo string `json:"out_order_no"` @@ -1157,13 +1157,13 @@ func HmJsPayUnifiedOrder(orderId string, totalFee uint32, openId, notifyUrl stri } biz := HmPayBizContent{ - Body: "服务费", - MerAppId: WxAppId, - MerBuyerId: openId, - CreateIp: clientIp, - CreateTime: strTime, - ExpireTime: strExpireTime, - LimitPay: "NO_CREDIT", + Body: "服务费", + MerAppId: WxAppId, + MerBuyerId: openId, + CreateIp: clientIp, + CreateTime: strTime, + ExpireTime: strExpireTime, + //LimitPay: "NO_CREDIT", NotifyUrl: notifyUrl, OutOrderNo: orderId, PayType: "JSAPI", diff --git a/model/model_test.go b/model/model_test.go index e98c71d..7c3c9f8 100644 --- a/model/model_test.go +++ b/model/model_test.go @@ -1057,14 +1057,17 @@ func TestOrderCancelId(t *testing.T) { //} func TestGameCardGoodsStockInspection(t *testing.T) { - GameCardGoodsStockInspection() + InitDBProd() + ids := []uint32{12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26} + for i, _ := range ids { + GameCardGoodsStockInspection(ids[i]) + } + } -func GameCardGoodsStockInspection() { - InitDBProd() - +func GameCardGoodsStockInspection(id uint32) { var gameCardGoodses []GameCardGoods - err := NewGameCardGoodsQuerySet(DBProd).StoreIdEq(16).All(&gameCardGoodses) + err := NewGameCardGoodsQuerySet(DBProd).StoreIdEq(uint64(id)).All(&gameCardGoodses) if err != nil { logger.Error("err:", err) } @@ -1076,12 +1079,12 @@ func GameCardGoodsStockInspection() { //rentMap[uint32(gameCard.StoreId)] += 1 rentMap[uint32(gameCard.GameCardId)] += 1 } - if gameCard.Status == 3 { + if gameCard.Status == 3 || gameCard.Status == 2 { holdMap[uint32(gameCard.GameCardId)] += 1 } } var gameCardGoodsStocks []GameCardGoodsStock - err = NewGameCardGoodsStockQuerySet(DBProd).StoreIdEq(16).All(&gameCardGoodsStocks) + err = NewGameCardGoodsStockQuerySet(DBProd).StoreIdEq(uint64(id)).All(&gameCardGoodsStocks) if err != nil { logger.Error("err:", err) }