Merge branch 'feat-IRONFANS-70' into test

This commit is contained in:
lwl0608 2024-04-23 19:08:54 +08:00
commit b62ead3be5
5 changed files with 51 additions and 5 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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)

View File

@ -28,6 +28,14 @@ const (
ProductIdH5ZoneSuperfanship = "h5_zone_superfanship" // 空间超粉
)
var ProductIdDescMap = map[string]string{
ProductIdContactWechat: "解锁微信",
ProductIdMembership: "永久会员",
ProductIdH5ZoneMoment: "空间动态",
ProductIdH5ZoneAdmission: "解锁空间",
ProductIdH5ZoneSuperfanship: "解锁超粉",
}
// 商品类型
const (
ProductTypeCoins = "coins" // 商品类型:金币

View File

@ -541,7 +541,7 @@ const (
CHSTypeIncomeRefundContactWechat = 30004 // 收入明细,微信退款
CHSTypeIncomeThirdPartner = 30005 // 收入明细,代运营
CHSTypeIncomeCollaborator = 30006 // 收入明细,协作者
CHSTypeIncomeZoneMoment = 30007 // 收入明细,空间分成
CHSTypeIncomeZone = 30007 // 收入明细,空间分成
CHSTypeIncomeMembership = 30008 // 收入明细,会员
CHSTypeIncomeRefundZoneAdmission = 30009 // 收入明细,空间普通会员分成退款