From 6dca251071c99103a4bfe6152ebba530710cfe99 Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Thu, 25 Apr 2024 17:48:52 +0800 Subject: [PATCH] fix income stype --- app/mix/service/logic/vas.go | 8 ++++ app/mix/service/logic/vas_zone.go | 6 +-- app/mix/service/vasservice.go | 76 +++++++++++++++++++++++++++---- dbstruct/vas_mysql.go | 5 +- 4 files changed, 82 insertions(+), 13 deletions(-) diff --git a/app/mix/service/logic/vas.go b/app/mix/service/logic/vas.go index 014b93c7..23865c4d 100644 --- a/app/mix/service/logic/vas.go +++ b/app/mix/service/logic/vas.go @@ -2669,6 +2669,14 @@ func (v *Vas) refundZoneAdmission(ctx *gin.Context, order *dbstruct.Order, req * After: goproto.Int64(wallet.GetDiamonds() - change), Ct: goproto.Int64(time.Now().Unix()), } + switch ch.GetSType() { + case dbstruct.CHSTypeIncomeThirdPartner: + chNew.SType = goproto.Int32(dbstruct.CHSTypeIncomeRefundThirdPartner) + case dbstruct.CHSTypeIncomeCollaborator: + chNew.SType = goproto.Int32(dbstruct.CHSTypeIncomeRefundCollaborator) + case dbstruct.CHSTypeIncomeZoneStreamer: + chNew.SType = goproto.Int32(dbstruct.CHSTypeIncomeRefundZoneStreamer) + } err = v.store.CreateConsumeHistory(ctx, tx, chNew) if err != nil { logger.Error("CreateConsumeHistory fail, ch: %v, err: %v", util.ToJson(chNew), err) diff --git a/app/mix/service/logic/vas_zone.go b/app/mix/service/logic/vas_zone.go index 982361e2..e77ec6d7 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.CHSTypeIncomeZone) + incomeList, err := v.calcAndUpdateIncome(ctx, tx, order.GetUid(), mid, order.GetDid(), orderId, order.GetProductId(), totalDias, dbstruct.CHSTypeIncomeZoneStreamer) 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.CHSTypeIncomeZone) + incomeList, err := v.calcAndUpdateIncome(ctx, tx, order.GetUid(), mid, order.GetDid(), orderId, order.GetProductId(), totalDias, dbstruct.CHSTypeIncomeZoneStreamer) 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.CHSTypeIncomeZone) + incomeList, err := v.calcAndUpdateIncome(ctx, tx, order.GetUid(), mid, order.GetDid(), orderId, order.GetProductId(), totalDias, dbstruct.CHSTypeIncomeZoneStreamer) 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 32963d47..6e3bdd4c 100644 --- a/app/mix/service/vasservice.go +++ b/app/mix/service/vasservice.go @@ -294,17 +294,17 @@ func (s *Service) chListCharge(ctx *gin.Context, chList []*dbstruct.ConsumeHisto item.Desc = "微信联系方式退款" item.Change = fmt.Sprintf("%d金币", chDB.GetChange()) case dbstruct.CHSTypeChargeZoneMoment: - item.Desc = "解锁动态" - item.Change = fmt.Sprintf("-%.2f元", float64(util.AbsInt64(chDB.GetChange()))/100.0) + item.Desc = "解锁空间动态" + item.Change = fmt.Sprintf("-%.1f元", float64(util.AbsInt64(chDB.GetChange()))/100.0) case dbstruct.CHSTypeChargeZoneAdmission: - item.Desc = "解锁空间会员" - item.Change = fmt.Sprintf("-%.2f元", float64(util.AbsInt64(chDB.GetChange()))/100.0) + item.Desc = "加入空间" + item.Change = fmt.Sprintf("-%.1f元", float64(util.AbsInt64(chDB.GetChange()))/100.0) case dbstruct.CHSTypeChargeZoneSuperfanship: item.Desc = "解锁空间超粉" - item.Change = fmt.Sprintf("-%.2f元", float64(util.AbsInt64(chDB.GetChange()))/100.0) + item.Change = fmt.Sprintf("-%.1f元", float64(util.AbsInt64(chDB.GetChange()))/100.0) case dbstruct.CHSTypeChargeZoneRefundAdmission: - item.Desc = "空间会员退款" - item.Change = fmt.Sprintf("+%.2f元", float64(util.AbsInt64(chDB.GetChange()))/100.0) + item.Desc = "加入空间退款" + item.Change = fmt.Sprintf("+%.1f元", float64(util.AbsInt64(chDB.GetChange()))/100.0) } list = append(list, item) @@ -338,19 +338,77 @@ func (s *Service) chListIncome(ctx *gin.Context, chList []*dbstruct.ConsumeHisto item.Change = fmt.Sprintf("%d钻石", chDB.GetChange()) case dbstruct.CHSTypeIncomeThirdPartner: item.Desc = "代运营收益" + getTypeIdDesc(chDB.GetTypeId()) + switch chDB.GetTypeId() { + case dbstruct.ProductIdH5ZoneAdmission: + item.Desc = "代运营(空间成员)" + case dbstruct.ProductIdH5ZoneMoment: + item.Desc = "代运营(空间动态)" + case dbstruct.ProductIdH5ZoneSuperfanship: + item.Desc = "代运营(空间超粉)" + } item.Change = changeMark + fmt.Sprintf("%d钻石", chDB.GetChange()) case dbstruct.CHSTypeIncomeCollaborator: item.Desc = "协作收益" + getTypeIdDesc(chDB.GetTypeId()) + switch chDB.GetTypeId() { + case dbstruct.ProductIdH5ZoneAdmission: + item.Desc = "合伙人(空间成员)" + case dbstruct.ProductIdH5ZoneMoment: + item.Desc = "合伙人(空间动态)" + case dbstruct.ProductIdH5ZoneSuperfanship: + item.Desc = "合伙人(空间超粉)" + } item.Change = changeMark + fmt.Sprintf("%d钻石", chDB.GetChange()) - case dbstruct.CHSTypeIncomeZone: + case dbstruct.CHSTypeIncomeZoneStreamer: item.Desc = "空间收益" + getTypeIdDesc(chDB.GetTypeId()) + switch chDB.GetTypeId() { + case dbstruct.ProductIdH5ZoneAdmission: + item.Desc = "空间成员" + case dbstruct.ProductIdH5ZoneMoment: + item.Desc = "空间动态" + case dbstruct.ProductIdH5ZoneSuperfanship: + item.Desc = "空间超粉" + } item.Change = changeMark + fmt.Sprintf("%d钻石", chDB.GetChange()) case dbstruct.CHSTypeIncomeMembership: item.Desc = "永久会员收益" + getTypeIdDesc(chDB.GetTypeId()) item.Change = changeMark + fmt.Sprintf("%d钻石", chDB.GetChange()) case dbstruct.CHSTypeIncomeRefundZoneAdmission: - item.Desc = "空会员退款" + getTypeIdDesc(chDB.GetTypeId()) + item.Desc = "(旧)空间退款" + getTypeIdDesc(chDB.GetTypeId()) item.Change = fmt.Sprintf("%d钻石", chDB.GetChange()) + case dbstruct.CHSTypeIncomeRefundThirdPartner: + item.Desc = "代运营空间退款" + getTypeIdDesc(chDB.GetTypeId()) + switch chDB.GetTypeId() { + case dbstruct.ProductIdH5ZoneAdmission: + item.Desc = "代运营(空间成员退款)" + case dbstruct.ProductIdH5ZoneMoment: + item.Desc = "代运营(空间动态退款)" + case dbstruct.ProductIdH5ZoneSuperfanship: + item.Desc = "代运营(空间超粉退款)" + } + item.Change = fmt.Sprintf("%d钻石", chDB.GetChange()) + case dbstruct.CHSTypeIncomeRefundCollaborator: + item.Desc = "合伙人空间退款" + getTypeIdDesc(chDB.GetTypeId()) + switch chDB.GetTypeId() { + case dbstruct.ProductIdH5ZoneAdmission: + item.Desc = "合伙人(空间成员退款)" + case dbstruct.ProductIdH5ZoneMoment: + item.Desc = "合伙人(空间动态退款)" + case dbstruct.ProductIdH5ZoneSuperfanship: + item.Desc = "合伙人(空间超粉退款)" + } + item.Change = fmt.Sprintf("%d钻石", chDB.GetChange()) + case dbstruct.CHSTypeIncomeRefundZoneStreamer: + item.Desc = "空间退款" + getTypeIdDesc(chDB.GetTypeId()) + switch chDB.GetTypeId() { + case dbstruct.ProductIdH5ZoneAdmission: + item.Desc = "空间成员(用户退款)" + case dbstruct.ProductIdH5ZoneMoment: + item.Desc = "空间动态(用户退款)" + case dbstruct.ProductIdH5ZoneSuperfanship: + item.Desc = "空间超粉(用户退款)" + } + item.Change = fmt.Sprintf("%d钻石", chDB.GetChange()) + } list = append(list, item) } diff --git a/dbstruct/vas_mysql.go b/dbstruct/vas_mysql.go index 869315b0..73905815 100644 --- a/dbstruct/vas_mysql.go +++ b/dbstruct/vas_mysql.go @@ -541,9 +541,12 @@ const ( CHSTypeIncomeRefundContactWechat = 30004 // 收入明细,微信退款 CHSTypeIncomeThirdPartner = 30005 // 收入明细,代运营 CHSTypeIncomeCollaborator = 30006 // 收入明细,协作者 - CHSTypeIncomeZone = 30007 // 收入明细,空间分成 + CHSTypeIncomeZoneStreamer = 30007 // 收入明细,主播空间收益 CHSTypeIncomeMembership = 30008 // 收入明细,会员 CHSTypeIncomeRefundZoneAdmission = 30009 // 收入明细,空间普通会员分成退款 + CHSTypeIncomeRefundThirdPartner = 30010 // 收入明细,代运营 + CHSTypeIncomeRefundCollaborator = 30011 // 收入明细,协作者 + CHSTypeIncomeRefundZoneStreamer = 30012 // 收入明细,主播空间收益 CHSTypeWithdrawDiamondAuto = 40001 // 自动提现明细 )