This commit is contained in:
parent
5dedd4fd27
commit
03fdc98f3d
|
@ -247,3 +247,17 @@ type ZoneFreeJoinResp struct {
|
|||
base.BaseResponse
|
||||
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"`
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ func ApiGetZoneListByUserIdFromOutside(ctx *gin.Context) {
|
|||
req.Limit = consts.DefaultPageSize
|
||||
}
|
||||
|
||||
list, ec := service.DefaultService.ApiGetZoneListByUserIdFromOutside(ctx, req)
|
||||
refundEnable, list, ec := service.DefaultService.ApiGetZoneListByUserIdFromOutside(ctx, req)
|
||||
if ec != errcode.ErrCodeZoneSrvOk {
|
||||
logger.Error("ApiGetZoneListByUserIdFromOutside fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||||
ReplyErrCodeMsg(ctx, ec)
|
||||
|
@ -169,8 +169,9 @@ func ApiGetZoneListByUserIdFromOutside(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,
|
||||
}
|
||||
if len(list) >= req.Limit {
|
||||
data.More = 1
|
||||
|
|
|
@ -2282,7 +2282,7 @@ func (s *Service) ApiGetZoneListByVisitorMid(ctx *gin.Context, req *zoneproto.Ap
|
|||
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
|
||||
|
||||
volist = make([]*zoneproto.ApiZoneVO, 0)
|
||||
|
@ -2329,6 +2329,16 @@ func (s *Service) ApiGetZoneListByUserIdFromOutside(ctx *gin.Context, req *zonep
|
|||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -1536,7 +1536,7 @@ func (s *Service) utilFillZonesWithApiVOInfo(ctx *gin.Context, list []*dbstruct.
|
|||
|
||||
// 填充访客身份
|
||||
vo.VisitorRole = consts.Zone_Outsider
|
||||
if zidZuMap[zid] != nil { // 访客已解锁空间是否有该zid
|
||||
if zidZuMap[zid].IsUnlockAdmission() { // 访客已解锁空间是否有该zid
|
||||
vo.VisitorRole = consts.Zone_Visitor
|
||||
} else if zoneZidMap[zid] != nil { // 访客创建的空间是否有该zid
|
||||
vo.VisitorRole = consts.Zone_Creater
|
||||
|
|
|
@ -216,13 +216,11 @@ CREATE TABLE `vas_zone_ch`
|
|||
-- 空间成员列表
|
||||
CREATE TABLE `vas_zone_member`
|
||||
(
|
||||
`id` bigint AUTO_INCREMENT COMMENT 'id',
|
||||
`mid` bigint NOT NULL COMMENT '用户id',
|
||||
`zid` bigint NOT NULL COMMENT '空间id',
|
||||
`consume` 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',
|
||||
`id` bigint AUTO_INCREMENT COMMENT 'id',
|
||||
`mid` bigint NOT NULL COMMENT '用户id',
|
||||
`zid` bigint NOT NULL COMMENT '空间id',
|
||||
`member_type` int DEFAULT 0 COMMENT '空间成员类型',
|
||||
`ct` bigint DEFAULT 0 COMMENT '解锁时间',
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
|
|
|
@ -962,12 +962,6 @@ type ZoneUnlock struct {
|
|||
}
|
||||
|
||||
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() {
|
||||
return true
|
||||
}
|
||||
|
@ -975,12 +969,6 @@ func (p *ZoneUnlock) IsUnlockAdmission() 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() {
|
||||
return true
|
||||
}
|
||||
|
@ -988,12 +976,6 @@ func (p *ZoneUnlock) IsUnlockIronfanship() 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() {
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue