Merge branch 'feat-IRONFANS-70' into test

This commit is contained in:
lwl0608 2024-04-16 21:13:39 +08:00
commit 563e007d92
6 changed files with 35 additions and 30 deletions

View File

@ -247,3 +247,17 @@ type ZoneFreeJoinResp struct {
base.BaseResponse base.BaseResponse
Data *ZoneFreeJoinData `json:"data"` Data *ZoneFreeJoinData `json:"data"`
} }
// 退出空间
type ZoneExitReq struct {
base.BaseRequest
Zid int64 `json:"zid"` // 空间id
}
type ZoneExitData struct {
}
type ZoneExitResp struct {
base.BaseResponse
Data *ZoneFreeJoinData `json:"data"`
}

View File

@ -151,7 +151,7 @@ func ApiGetZoneListByUserIdFromOutside(ctx *gin.Context) {
req.Limit = consts.DefaultPageSize req.Limit = consts.DefaultPageSize
} }
list, ec := service.DefaultService.ApiGetZoneListByUserIdFromOutside(ctx, req) refundEnable, list, ec := service.DefaultService.ApiGetZoneListByUserIdFromOutside(ctx, req)
if ec != errcode.ErrCodeZoneSrvOk { if ec != errcode.ErrCodeZoneSrvOk {
logger.Error("ApiGetZoneListByUserIdFromOutside fail, req: %v, ec: %v", util.ToJson(req), ec) logger.Error("ApiGetZoneListByUserIdFromOutside fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec) ReplyErrCodeMsg(ctx, ec)
@ -171,6 +171,7 @@ func ApiGetZoneListByUserIdFromOutside(ctx *gin.Context) {
data := &zoneproto.ApiListByMidData{ data := &zoneproto.ApiListByMidData{
List: list, List: list,
Offset: req.Offset + len(list), Offset: req.Offset + len(list),
RefundEnable: refundEnable,
} }
if len(list) >= req.Limit { if len(list) >= req.Limit {
data.More = 1 data.More = 1

View File

@ -2282,7 +2282,7 @@ func (s *Service) ApiGetZoneListByVisitorMid(ctx *gin.Context, req *zoneproto.Ap
return return
} }
func (s *Service) ApiGetZoneListByUserIdFromOutside(ctx *gin.Context, req *zoneproto.ApiListByUserIdFromOutsideReq) (volist []*zoneproto.ApiZoneVO, ec errcode.ErrCode) { func (s *Service) ApiGetZoneListByUserIdFromOutside(ctx *gin.Context, req *zoneproto.ApiListByUserIdFromOutsideReq) (refundEnable int, volist []*zoneproto.ApiZoneVO, ec errcode.ErrCode) {
ec = errcode.ErrCodeZoneSrvOk ec = errcode.ErrCodeZoneSrvOk
volist = make([]*zoneproto.ApiZoneVO, 0) volist = make([]*zoneproto.ApiZoneVO, 0)
@ -2329,6 +2329,16 @@ func (s *Service) ApiGetZoneListByUserIdFromOutside(ctx *gin.Context, req *zonep
volist = append(volist, vo) volist = append(volist, vo)
} }
// 是否能退款
if len(list) < 1 {
return
}
zid := list[0].GetId()
zidZuMap, _ := _DefaultVas.GetZoneUnlockMapByMidZids(ctx, mid, []int64{zid})
if zu, ok := zidZuMap[zid]; ok && (time.Now().Unix()-zu.GetAdmissionCt() < 3600*2) {
refundEnable = 1
}
return return
} }

View File

@ -1536,7 +1536,7 @@ func (s *Service) utilFillZonesWithApiVOInfo(ctx *gin.Context, list []*dbstruct.
// 填充访客身份 // 填充访客身份
vo.VisitorRole = consts.Zone_Outsider vo.VisitorRole = consts.Zone_Outsider
if zidZuMap[zid] != nil { // 访客已解锁空间是否有该zid if zidZuMap[zid].IsUnlockAdmission() { // 访客已解锁空间是否有该zid
vo.VisitorRole = consts.Zone_Visitor vo.VisitorRole = consts.Zone_Visitor
} else if zoneZidMap[zid] != nil { // 访客创建的空间是否有该zid } else if zoneZidMap[zid] != nil { // 访客创建的空间是否有该zid
vo.VisitorRole = consts.Zone_Creater vo.VisitorRole = consts.Zone_Creater

View File

@ -219,10 +219,8 @@ CREATE TABLE `vas_zone_member`
`id` bigint AUTO_INCREMENT COMMENT 'id', `id` bigint AUTO_INCREMENT COMMENT 'id',
`mid` bigint NOT NULL COMMENT '用户id', `mid` bigint NOT NULL COMMENT '用户id',
`zid` bigint NOT NULL COMMENT '空间id', `zid` bigint NOT NULL COMMENT '空间id',
`consume` bigint DEFAULT 0 COMMENT '单笔消费', `member_type` int DEFAULT 0 COMMENT '空间成员类型',
`ct` bigint DEFAULT 0 COMMENT '解锁时间', `ct` bigint DEFAULT 0 COMMENT '解锁时间',
`order_id` varchar(128) DEFAULT NULL COMMENT '绑定的订单id',
`product_id` varchar(128) DEFAULT NULL COMMENT '商品id',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
); );

View File

@ -962,12 +962,6 @@ type ZoneUnlock struct {
} }
func (p *ZoneUnlock) IsUnlockAdmission() bool { func (p *ZoneUnlock) IsUnlockAdmission() bool {
if p == nil {
return false
}
if p.AdmissionCt == nil {
return false
}
if p.GetAdmissionUntil() == -1 || p.GetAdmissionUntil() < time.Now().Unix() { if p.GetAdmissionUntil() == -1 || p.GetAdmissionUntil() < time.Now().Unix() {
return true return true
} }
@ -975,12 +969,6 @@ func (p *ZoneUnlock) IsUnlockAdmission() bool {
} }
func (p *ZoneUnlock) IsUnlockIronfanship() bool { func (p *ZoneUnlock) IsUnlockIronfanship() bool {
if p == nil {
return false
}
if p.IronfanshipCt == nil {
return false
}
if p.GetIronfanshipUntil() == -1 || p.GetIronfanshipUntil() < time.Now().Unix() { if p.GetIronfanshipUntil() == -1 || p.GetIronfanshipUntil() < time.Now().Unix() {
return true return true
} }
@ -988,12 +976,6 @@ func (p *ZoneUnlock) IsUnlockIronfanship() bool {
} }
func (p *ZoneUnlock) IsUnlockSuperfanship() bool { func (p *ZoneUnlock) IsUnlockSuperfanship() bool {
if p == nil {
return false
}
if p.SuperfanshipCt == nil {
return false
}
if p.GetSuperfanshipUntil() == -1 || p.GetSuperfanshipUntil() < time.Now().Unix() { if p.GetSuperfanshipUntil() == -1 || p.GetSuperfanshipUntil() < time.Now().Unix() {
return true return true
} }