vas
This commit is contained in:
parent
953fb01d89
commit
d6217c6f39
|
@ -120,6 +120,7 @@ type WithdrawApplyData struct {
|
|||
|
||||
// 空间收银台
|
||||
type ZoneGetCashierReq struct {
|
||||
base.BaseRequest
|
||||
Zid int64 `json:"zid"` // 空间id
|
||||
MomentId int64 `json:"moment_id"` // 动态id
|
||||
ProductId string `json:"product_id"` // 商品id,ProductIdH5Zone*
|
||||
|
|
|
@ -108,6 +108,7 @@ type ApiListByMidData struct {
|
|||
Offset int `json:"offset"`
|
||||
More int `json:"more"`
|
||||
RefundEnable int `json:"refund_enable"` // 1: 能退款,0: 不能退款
|
||||
RefundStatus int `json:"refund_status"` // 1: 退款中,2: 已退款
|
||||
}
|
||||
|
||||
type ApiListByMidResp struct {
|
||||
|
|
|
@ -666,13 +666,25 @@ func (s *Service) ZoneCreateOrder(ctx *gin.Context, req *vasproto.ZoneCreateOrde
|
|||
|
||||
func (s *Service) ZoneGetCashier(ctx *gin.Context, req *vasproto.ZoneGetCashierReq) (data *vasproto.ZoneGetCashierData, ec errcode.ErrCode, err error) {
|
||||
ec = errcode.ErrCodeVasSrvOk
|
||||
|
||||
data = new(vasproto.ZoneGetCashierData)
|
||||
data.Validity = "永久"
|
||||
zv, _ := _DefaultVas.GetZoneVasInfo(ctx, req.Zid)
|
||||
|
||||
zid := req.Zid
|
||||
zv, _ := _DefaultVas.GetZoneVasInfo(ctx, zid)
|
||||
|
||||
switch req.ProductId {
|
||||
case dbstruct.ProductIdH5ZoneMoment:
|
||||
// 判断是否已解锁该动态
|
||||
zmuMap, err := _DefaultVas.GetZoneMomentUnlockMapByMidMomentIds(ctx, req.Mid, []int64{req.MomentId})
|
||||
if err != nil {
|
||||
ec = errcode.ErrCodeVasSrvFail
|
||||
logger.Error("GetZoneMomentUnlockMapByMidMomentIds fail, mid: %v, momentId: %v", req.Mid, req.MomentId)
|
||||
return nil, ec, fmt.Errorf("无法获取动态解锁记录")
|
||||
}
|
||||
if _, ok := zmuMap[req.MomentId]; ok {
|
||||
ec = errcode.ErrCodeVasSrvFail
|
||||
return nil, ec, fmt.Errorf("已解锁该动态,请勿重复购买")
|
||||
}
|
||||
data.Name = "付费动态"
|
||||
// 获取动态价格
|
||||
zmp, _ := _DefaultVas.GetZoneMomentPriceById(ctx, req.MomentId)
|
||||
|
@ -680,6 +692,13 @@ func (s *Service) ZoneGetCashier(ctx *gin.Context, req *vasproto.ZoneGetCashierR
|
|||
data.Price = zmp.Price
|
||||
}
|
||||
case dbstruct.ProductIdH5ZoneAdmission:
|
||||
// 判断主播是否开通空间
|
||||
zone, err := _DefaultZone.GetById(ctx, zid)
|
||||
if err != nil || zone == nil {
|
||||
ec = errcode.ErrCodeVasSrvFail
|
||||
logger.Error("GetById fail, mid: %v, zid: %v, erR: %v", req.Mid, zid, err)
|
||||
return nil, ec, fmt.Errorf("无法获取主播动态")
|
||||
}
|
||||
data.Name = "空间会员"
|
||||
if zv == nil {
|
||||
ec = errcode.ErrCodeVasSrvFail
|
||||
|
@ -692,14 +711,19 @@ func (s *Service) ZoneGetCashier(ctx *gin.Context, req *vasproto.ZoneGetCashierR
|
|||
ec = errcode.ErrCodeVasSrvFail
|
||||
return nil, ec, fmt.Errorf("该主播未设置空间价格")
|
||||
}
|
||||
data.Price = zv.AdmissionPrice
|
||||
data.Price = zv.IronfanshipPrice
|
||||
case dbstruct.ProductIdH5ZoneSuperfanship:
|
||||
// 判断是否开启超粉
|
||||
if zv.IsSuperfanshipEnabled != 1 {
|
||||
ec = errcode.ErrCodeVasSrvFail
|
||||
return nil, ec, fmt.Errorf("该主播未开启超粉空间")
|
||||
}
|
||||
data.Name = "超粉"
|
||||
if zv == nil {
|
||||
ec = errcode.ErrCodeVasSrvFail
|
||||
return nil, ec, fmt.Errorf("该主播未设置空间价格")
|
||||
}
|
||||
data.Price = zv.AdmissionPrice
|
||||
data.Price = zv.SuperfanshipPrice
|
||||
data.Validity = zv.GetSuperfanshipDurationDesc()
|
||||
}
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue