This commit is contained in:
lwl0608 2024-04-18 22:53:25 +08:00
parent 43aa1516be
commit b4d52e3a2c
3 changed files with 28 additions and 4 deletions

View File

@ -116,7 +116,7 @@ func ApiGetZoneListByMid(ctx *gin.Context) {
req.Limit = consts.DefaultPageSize
}
list, ec := service.DefaultService.ApiGetZoneListByMid(ctx, req)
refundEnable, refundStatus, list, ec := service.DefaultService.ApiGetZoneListByMid(ctx, req)
if ec != errcode.ErrCodeZoneSrvOk {
logger.Error("ApiGetZoneListByMid fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
@ -134,8 +134,10 @@ func ApiGetZoneListByMid(ctx *gin.Context) {
mediafiller.FillList(ctx, mediaFillableList)
data := &zoneproto.ApiListByMidData{
List: list,
Offset: req.Offset + len(list),
List: list,
Offset: req.Offset + len(list),
RefundEnable: refundEnable,
RefundStatus: refundStatus,
}
if len(list) >= req.Limit {
data.More = 1

View File

@ -2215,7 +2215,7 @@ func (s *Service) ApiGetZoneList(ctx *gin.Context, req *zoneproto.ApiListReq) (l
return
}
func (s *Service) ApiGetZoneListByMid(ctx *gin.Context, req *zoneproto.ApiListByMidReq) (volist []*zoneproto.ApiZoneVO, ec errcode.ErrCode) {
func (s *Service) ApiGetZoneListByMid(ctx *gin.Context, req *zoneproto.ApiListByMidReq) (refundEnable int, refundStatus int, volist []*zoneproto.ApiZoneVO, ec errcode.ErrCode) {
ec = errcode.ErrCodeZoneSrvOk
// 若uid为空则判断为主播查自己的空间
@ -2251,6 +2251,25 @@ func (s *Service) ApiGetZoneListByMid(ctx *gin.Context, req *zoneproto.ApiListBy
return
}
// 是否能退款
if len(list) < 1 {
return
}
zid := list[0].GetId()
if zu, ok := zidZuMap[zid]; ok && (time.Now().Unix()-zu.GetAdmissionCt() < 3600*2) {
refundEnable = 1
}
// 退款状态
if _, ok := zidZuMap[zid]; !ok {
return
}
admissionOrderId := zidZuMap[zid].GetAdmissionOrderId()
order, _ := _DefaultVas.GetOrderById(ctx, nil, admissionOrderId)
if order.GetOrderStatus() == dbstruct.VasOrderStatusRefund {
refundStatus = zoneproto.AdmissionRefundStatusFinish
}
return
}

View File

@ -698,6 +698,7 @@ func (s *Service) ZoneGetCashier(ctx *gin.Context, req *vasproto.ZoneGetCashierR
case dbstruct.ProductIdH5ZoneAdmission:
// 是否解锁了空间普通会员
zuMap, _ := _DefaultVas.GetZoneUnlockMapByMidZids(ctx, mid, []int64{zid})
logger.Info("GetZoneUnlockMapByMidZids, mid: %v, zid: %v, zuMap: %v", mid, zid, util.ToJson(zuMap))
if zu, ok := zuMap[mid]; ok && zu.IsUnlockAdmission() {
ec = errcode.ErrCodeVasSrvOk
data.HasBought = 1
@ -783,9 +784,11 @@ func (s *Service) ZoneMemberList(ctx *gin.Context, req *vasproto.GetZoneMemberLi
for _, zm := range zmList {
mids = append(mids, zm.GetMid())
}
logger.Info("ZoneMemberList, zid: %v, typ: %v, mids: %v, zmList: %v", req.Zid, req.MemType, mids, util.ToJson(zmList))
// 获取用户信息
acntMap, _ := _DefaultAccount.GetAccountMapByMids(ctx, mids)
logger.Info("GetAccountMapByMids, zid: %v, typ: %v, acntMap: %v", req.Zid, req.MemType, util.ToJson(acntMap))
for _, zm := range zmList {
mid := zm.GetMid()
tmp := &vasproto.ZoneMemberVo{