From 920b0a8450845b909a7e3a627cf90ff9231a181f Mon Sep 17 00:00:00 2001 From: li Date: Tue, 1 Aug 2023 10:23:00 +0800 Subject: [PATCH] fix: --- controller/user.go | 6 ++++++ lib/status/status.go | 37 ++++++++++++++++++++----------------- model/mall.go | 5 +++-- router/router_app.go | 2 +- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/controller/user.go b/controller/user.go index f8d0dee..36fa180 100644 --- a/controller/user.go +++ b/controller/user.go @@ -371,6 +371,12 @@ func UpgradeMember(c *gin.Context) { // RespJson(c, status.InternalServerError, nil) // return //} + + if user.Gender != 0 { + logger.Error("user member genre err:") + RespJson(c, status.ShortMemberNotUpgradeMember, nil) + return + } if req.MemberGenre == 0 { req.MemberGenre = model.GetMemberGenreFromLevel(req.MemberLevel) } diff --git a/lib/status/status.go b/lib/status/status.go index 81f340c..fe26348 100644 --- a/lib/status/status.go +++ b/lib/status/status.go @@ -7,7 +7,7 @@ package status //40x 客户端请求问题 //50x 服务器错误。 -//错误码的前3位是http status code +// 错误码的前3位是http status code const ( //10x 消息 @@ -108,6 +108,7 @@ const ( CouponReceived = 500525 // 你已兑换过该券 CouponPromotionalUnused = 500526 // 您有未使用的专属续费券 DepositRestraint = 500527 // 押金受限 + ShortMemberNotUpgradeMember = 500530 // 短期会员暂不升级 ToastErr = 600 // 报错 ) @@ -173,16 +174,17 @@ var statusDesc = map[int]string{ AwardOffShelves: "奖品已下架", AwardExchangeOut: "奖品已兑完", - GoodsNotSale: "商品已下架", - StateNotCancel: "状态不能取消", - UserFocusHasCoupon: "你已经兑换了优惠券", - UserApplyDepositRefund: "你有退保证金申请,不能借卡", - UserNotMember: "仅开通过会员的用户可兑换", - CouponReceived: "你已兑换过该券", - CouponPromotionalUnused: "您有未使用的专属续费券", - DepositRestraint: "押金受限", - NotMember: "非会员", - HadReceiveReward: "已经领取过了", + GoodsNotSale: "商品已下架", + StateNotCancel: "状态不能取消", + UserFocusHasCoupon: "你已经兑换了优惠券", + UserApplyDepositRefund: "你有退保证金申请,不能借卡", + UserNotMember: "仅开通过会员的用户可兑换", + CouponReceived: "你已兑换过该券", + CouponPromotionalUnused: "您有未使用的专属续费券", + DepositRestraint: "押金受限", + NotMember: "非会员", + HadReceiveReward: "已经领取过了", + ShortMemberNotUpgradeMember: "短期会员暂不支持升级", } var statusMsg = map[int]string{ @@ -249,12 +251,13 @@ var statusMsg = map[int]string{ MoneySufficient: "余额不足", UserVmNotEnough: "积分余额不足", - UserFocusHasCoupon: "你已经兑换了优惠券", - UserApplyDepositRefund: "你有退保证金申请,不能借卡", - UserNotMember: "仅开通过会员的用户可兑换", - CouponReceived: "你已兑换过该券", - CouponPromotionalUnused: "您有未使用的专属续费券", - DepositRestraint: "押金受限", + UserFocusHasCoupon: "你已经兑换了优惠券", + UserApplyDepositRefund: "你有退保证金申请,不能借卡", + UserNotMember: "仅开通过会员的用户可兑换", + CouponReceived: "你已兑换过该券", + CouponPromotionalUnused: "您有未使用的专属续费券", + DepositRestraint: "押金受限", + ShortMemberNotUpgradeMember: "短期会员暂不支持升级", AwardOffShelves: "奖品已下架", AwardExchangeOut: "奖品已兑完", diff --git a/model/mall.go b/model/mall.go index 261df3b..4ebb3e4 100644 --- a/model/mall.go +++ b/model/mall.go @@ -45,8 +45,9 @@ const ( ) // 商品 -//go:generate goqueryset -in mall.go // gen:qs +// +//go:generate goqueryset -in mall.go type Goods struct { Model @@ -69,7 +70,7 @@ type Goods struct { DiscountList string `json:"discount_list" gorm:"type:text;"` // 折扣 SpecIndex string `json:"spec_index" gorm:"index"` // 1_3 - //PriceVm uint32 `json:"price_vm"` // 积分价格 + PriceVm uint32 `json:"price_vm"` // 积分价格 PriceRm uint32 `json:"price_rm"` // 人民币价格 PriceOriginal uint32 `json:"price_original"` // 市场价 DeliveryFee uint32 `json:"delivery_fee"` // 邮费 diff --git a/router/router_app.go b/router/router_app.go index 161b1b8..e484f6a 100644 --- a/router/router_app.go +++ b/router/router_app.go @@ -32,7 +32,7 @@ func ConfigAppRouter(r gin.IRouter) { // //api.POST("upload_user_info", controller.UploadUserInfo) // 上传用户信息 //api.POST("wxpay/notice", controller.PushWXPayNotice) // 微信推送支付通知 // TODO两边都改 - api.GET("wxpay/notice", controller.HmPushWXPayNotice) // 河马推送支付通知 + api.GET("wxpay/notice", controller.HmPushWXPayNotice) // 推送支付通知 api.POST("wxpay/notice", controller.PushWXPayNotice) // 微信推送支付通知 api.POST("wxpay_refund/notice", controller.PushWXPayRefundNotice) // 微信推送支付退款通知 api.POST("aliyun/sts_token", controller.AliyunStsTokenGet) // 阿里云上传图片token