From 6e83930c9e7e536a95d15cd8d325c093323f2117 Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Tue, 23 Apr 2024 19:08:39 +0800 Subject: [PATCH] fix --- app/mix/service/logic/vas.go | 4 ++++ app/mix/service/logic/vas_zone.go | 6 +++--- app/mix/service/vasservice.go | 36 ++++++++++++++++++++++++++++++- dbstruct/product.go | 8 +++++++ dbstruct/vas_mysql.go | 2 +- 5 files changed, 51 insertions(+), 5 deletions(-) diff --git a/app/mix/service/logic/vas.go b/app/mix/service/logic/vas.go index f94eced0..58e157cb 100644 --- a/app/mix/service/logic/vas.go +++ b/app/mix/service/logic/vas.go @@ -1257,12 +1257,16 @@ func (v *Vas) PayCallback(ctx *gin.Context, p *vasproto.PayCallbackParamIn) { switch product.Id { case dbstruct.ProductIdMembership: ch.SType = goproto.Int32(dbstruct.CHSTypeChargeMembership) + ch.Change = goproto.Int64(order.GetPayAmount()) case dbstruct.ProductIdH5ZoneMoment: ch.SType = goproto.Int32(dbstruct.CHSTypeChargeZoneMoment) + ch.Change = goproto.Int64(order.GetPayAmount()) case dbstruct.ProductIdH5ZoneAdmission: ch.SType = goproto.Int32(dbstruct.CHSTypeChargeZoneAdmission) + ch.Change = goproto.Int64(order.GetPayAmount()) case dbstruct.ProductIdH5ZoneSuperfanship: ch.SType = goproto.Int32(dbstruct.CHSTypeChargeZoneSuperfanship) + ch.Change = goproto.Int64(order.GetPayAmount()) } err = v.store.CreateConsumeHistory(ctx, tx, ch) if err != nil { diff --git a/app/mix/service/logic/vas_zone.go b/app/mix/service/logic/vas_zone.go index a4965402..d6719ff1 100644 --- a/app/mix/service/logic/vas_zone.go +++ b/app/mix/service/logic/vas_zone.go @@ -223,7 +223,7 @@ func (v *Vas) UnlockZoneMoment(ctx *gin.Context, tx *sqlx.Tx, order *dbstruct.Or // 计算收入 totalDias := int64(float64(order.GetPayAmount()) / 100.0 * 10.0) - incomeList, err := v.calcAndUpdateIncome(ctx, tx, order.GetUid(), mid, order.GetDid(), orderId, order.GetProductId(), totalDias, dbstruct.CHSTypeIncomeZoneMoment) + incomeList, err := v.calcAndUpdateIncome(ctx, tx, order.GetUid(), mid, order.GetDid(), orderId, order.GetProductId(), totalDias, dbstruct.CHSTypeIncomeZone) if err != nil { logger.Error("calcAndUpdateIncome fail, order: %v, err: %v", util.ToJson(order), err) return err @@ -303,7 +303,7 @@ func (v *Vas) UnlockZoneAdmission(ctx *gin.Context, tx *sqlx.Tx, order *dbstruct // 计算收入 totalDias := int64(float64(order.GetPayAmount()) / 100.0 * 10.0) - incomeList, err := v.calcAndUpdateIncome(ctx, tx, order.GetUid(), mid, order.GetDid(), orderId, order.GetProductId(), totalDias, dbstruct.CHSTypeIncomeZoneMoment) + incomeList, err := v.calcAndUpdateIncome(ctx, tx, order.GetUid(), mid, order.GetDid(), orderId, order.GetProductId(), totalDias, dbstruct.CHSTypeIncomeZone) if err != nil { logger.Error("calcAndUpdateIncome fail, order: %v, err: %v", util.ToJson(order), err) return err @@ -353,7 +353,7 @@ func (v *Vas) UnlockZoneSuperfanship(ctx *gin.Context, tx *sqlx.Tx, order *dbstr // 计算收入 totalDias := int64(float64(order.GetPayAmount()) / 100.0 * 10.0) - incomeList, err := v.calcAndUpdateIncome(ctx, tx, order.GetUid(), mid, order.GetDid(), orderId, order.GetProductId(), totalDias, dbstruct.CHSTypeIncomeZoneMoment) + incomeList, err := v.calcAndUpdateIncome(ctx, tx, order.GetUid(), mid, order.GetDid(), orderId, order.GetProductId(), totalDias, dbstruct.CHSTypeIncomeZone) if err != nil { logger.Error("calcAndUpdateIncome fail, order: %v, err: %v", util.ToJson(order), err) return err diff --git a/app/mix/service/vasservice.go b/app/mix/service/vasservice.go index d51a9a19..78295f4d 100644 --- a/app/mix/service/vasservice.go +++ b/app/mix/service/vasservice.go @@ -292,7 +292,19 @@ func (s *Service) chListCharge(ctx *gin.Context, chList []*dbstruct.ConsumeHisto item.Change = changeMark + fmt.Sprintf("%d金币", chDB.GetChange()) case dbstruct.CHSTypeChargeRefundContactWechat: item.Desc = "微信联系方式退款" - item.Change = fmt.Sprintf("%d金币", chDB.GetChange()) + item.Change = fmt.Sprintf("消费%d金币", chDB.GetChange()) + case dbstruct.CHSTypeChargeZoneMoment: + item.Desc = "解锁动态" + item.Change = fmt.Sprintf("消费%2f元", float64(util.AbsInt64(chDB.GetChange()))/100.0) + case dbstruct.CHSTypeChargeZoneAdmission: + item.Desc = "解锁空间会员" + item.Change = fmt.Sprintf("消费%2f元", float64(util.AbsInt64(chDB.GetChange()))/100.0) + case dbstruct.CHSTypeChargeZoneSuperfanship: + item.Desc = "解锁空间超粉" + item.Change = fmt.Sprintf("消费%2f元", float64(util.AbsInt64(chDB.GetChange()))/100.0) + case dbstruct.CHSTypeChargeZoneRefundAdmission: + item.Desc = "空间会员退款" + item.Change = fmt.Sprintf("退款%2f元", float64(util.AbsInt64(chDB.GetChange()))/100.0) } list = append(list, item) @@ -324,12 +336,34 @@ func (s *Service) chListIncome(ctx *gin.Context, chList []*dbstruct.ConsumeHisto case dbstruct.CHSTypeIncomeRefundContactWechat: item.Desc = "用户微信退款" item.Change = fmt.Sprintf("%d钻石", chDB.GetChange()) + case dbstruct.CHSTypeIncomeThirdPartner: + item.Desc = "代运营收益" + getTypeIdDesc(chDB.GetTypeId()) + item.Change = fmt.Sprintf("%d钻石", chDB.GetChange()) + case dbstruct.CHSTypeIncomeCollaborator: + item.Desc = "协作收益" + getTypeIdDesc(chDB.GetTypeId()) + item.Change = fmt.Sprintf("%d钻石", chDB.GetChange()) + case dbstruct.CHSTypeIncomeZone: + item.Desc = "空间收益" + getTypeIdDesc(chDB.GetTypeId()) + item.Change = fmt.Sprintf("%d钻石", chDB.GetChange()) + case dbstruct.CHSTypeIncomeMembership: + item.Desc = "永久会员收益" + getTypeIdDesc(chDB.GetTypeId()) + item.Change = fmt.Sprintf("%d钻石", chDB.GetChange()) + case dbstruct.CHSTypeIncomeRefundZoneAdmission: + item.Desc = "空会员退款" + getTypeIdDesc(chDB.GetTypeId()) + item.Change = fmt.Sprintf("%d钻石", chDB.GetChange()) } list = append(list, item) } return } +func getTypeIdDesc(typeId string) string { + if v, ok := dbstruct.ProductIdDescMap[typeId]; ok { + return fmt.Sprintf("(%s)", v) + } + return "" +} + func (s *Service) chListWithdraw(ctx *gin.Context, chList []*dbstruct.ConsumeHistory) (list []*vasproto.CHSt) { // 组装 list = make([]*vasproto.CHSt, 0) diff --git a/dbstruct/product.go b/dbstruct/product.go index 4d5e0dab..c310cd9d 100644 --- a/dbstruct/product.go +++ b/dbstruct/product.go @@ -28,6 +28,14 @@ const ( ProductIdH5ZoneSuperfanship = "h5_zone_superfanship" // 空间超粉 ) +var ProductIdDescMap = map[string]string{ + ProductIdContactWechat: "解锁微信", + ProductIdMembership: "永久会员", + ProductIdH5ZoneMoment: "空间动态", + ProductIdH5ZoneAdmission: "解锁空间", + ProductIdH5ZoneSuperfanship: "解锁超粉", +} + // 商品类型 const ( ProductTypeCoins = "coins" // 商品类型:金币 diff --git a/dbstruct/vas_mysql.go b/dbstruct/vas_mysql.go index 85f9ab50..869315b0 100644 --- a/dbstruct/vas_mysql.go +++ b/dbstruct/vas_mysql.go @@ -541,7 +541,7 @@ const ( CHSTypeIncomeRefundContactWechat = 30004 // 收入明细,微信退款 CHSTypeIncomeThirdPartner = 30005 // 收入明细,代运营 CHSTypeIncomeCollaborator = 30006 // 收入明细,协作者 - CHSTypeIncomeZoneMoment = 30007 // 收入明细,空间分成 + CHSTypeIncomeZone = 30007 // 收入明细,空间分成 CHSTypeIncomeMembership = 30008 // 收入明细,会员 CHSTypeIncomeRefundZoneAdmission = 30009 // 收入明细,空间普通会员分成退款