Merge pull request 'by Robin at 20240501' (#396) from feat-IRONFANS-70 into test

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/396
This commit is contained in:
chenhao 2024-05-01 03:53:15 +08:00
commit 83b4ed0320
4 changed files with 83 additions and 50 deletions

View File

@ -37,6 +37,12 @@ type OpDeleteResp struct {
type OpUpdateReq struct { type OpUpdateReq struct {
base.BaseRequest base.BaseRequest
*dbstruct.Zone *dbstruct.Zone
AdmissionPrice int64 `json:"admission_price"` // 空间解锁价格, 单位: 分
IronfanshipPrice int64 `json:"ironfanship_price"` // 铁粉解锁价格, 单位: 分
IsSuperfanshipEnabled int `json:"is_superfanship_enabled"` // 是否开启超粉空间 0: 关闭, 1: 开启
SuperfanshipPrice int64 `json:"superfanship_price"` // 超粉价格, 单位: 分
SuperfanshipValidPeriod int `json:"superfanship_valid_period"` // 超粉有效期类型, SuperfanshipValidPeriod*
IsSuperfanshipGiveWechat int `json:"is_superfanship_give_wechat"` // 是否开启超粉空间赠送微信 0: 不赠送, 1: 赠送
} }
type OpUpdateData struct { type OpUpdateData struct {

View File

@ -2654,8 +2654,10 @@ func (s *Service) ApiDeleteZoneMoment(ctx *gin.Context, req *zonemomentproto.Api
} }
// 查看空间最后更新时间是否需要回退 // 查看空间最后更新时间是否需要回退
if zonemoment.GetStatus() == consts.ZoneMoment_Public {
list, err := _DefaultZoneMoment.OpListByMid(ctx, &zonemomentproto.OpListByMidReq{ list, err := _DefaultZoneMoment.OpListByMid(ctx, &zonemomentproto.OpListByMidReq{
BaseRequest: req.BaseRequest, BaseRequest: req.BaseRequest,
Status: goproto.Int64(consts.ZoneMoment_Public),
Limit: 1, Limit: 1,
Sort: []string{"-ut"}, Sort: []string{"-ut"},
}) })
@ -2695,6 +2697,7 @@ func (s *Service) ApiDeleteZoneMoment(ctx *gin.Context, req *zonemomentproto.Api
} }
} }
} }
}
// 回退空间内统计总数,只回退公开的情况 // 回退空间内统计总数,只回退公开的情况
if zonemoment.GetStatus() == consts.ZoneMoment_Public { if zonemoment.GetStatus() == consts.ZoneMoment_Public {

View File

@ -37,6 +37,7 @@ func (p *Zone) OpCreate(ctx *gin.Context, req *zoneproto.OpCreateReq) (error, in
req.Zone.Ct = goproto.Int64(time.Now().Unix()) req.Zone.Ct = goproto.Int64(time.Now().Unix())
req.Zone.Ut = goproto.Int64(time.Now().Unix()) req.Zone.Ut = goproto.Int64(time.Now().Unix())
req.Zone.DelFlag = goproto.Int64(consts.Exist) req.Zone.DelFlag = goproto.Int64(consts.Exist)
req.Zone.LastZoneMomentCt = goproto.Int64(0)
err = p.store.CreateZone(ctx, req.Zone) err = p.store.CreateZone(ctx, req.Zone)
if err != nil { if err != nil {
logger.Error("CreateZone fail, err: %v", err) logger.Error("CreateZone fail, err: %v", err)

View File

@ -3181,6 +3181,26 @@ func (s *Service) OpUpdateZone(ctx *gin.Context, req *zoneproto.OpUpdateReq) (ec
ec = errcode.ErrCodeZoneSrvFail ec = errcode.ErrCodeZoneSrvFail
return return
} }
err = _DefaultVas.UpdateZoneVasInfo(ctx, &vasproto.UpdateZoneVasReq{
ZoneVas: &dbstruct.ZoneVas{
Zid: *req.Zone.Id,
Mid: req.BaseRequest.Mid,
Ct: time.Now().Unix(),
Ut: time.Now().Unix(),
AdmissionPrice: req.AdmissionPrice,
IronfanshipPrice: req.IronfanshipPrice,
IsSuperfanshipEnabled: req.IsSuperfanshipEnabled,
SuperfanshipPrice: req.SuperfanshipPrice,
SuperfanshipValidPeriod: req.SuperfanshipValidPeriod,
IsSuperfanshipGiveWechat: req.IsSuperfanshipGiveWechat,
},
})
if err != nil {
logger.Error("UpdateZoneVasInfo fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneSrvFail
return
}
return return
} }
@ -3397,8 +3417,10 @@ func (s *Service) OpDeleteZoneMoment(ctx *gin.Context, req *zonemomentproto.OpDe
} }
// 查看空间最后更新时间是否需要回退 // 查看空间最后更新时间是否需要回退
if zonemoment.GetStatus() == consts.ZoneMoment_Public {
list, err := _DefaultZoneMoment.OpListByMid(ctx, &zonemomentproto.OpListByMidReq{ list, err := _DefaultZoneMoment.OpListByMid(ctx, &zonemomentproto.OpListByMidReq{
BaseRequest: req.BaseRequest, BaseRequest: req.BaseRequest,
Status: goproto.Int64(consts.ZoneMoment_Public),
Limit: 1, Limit: 1,
Sort: []string{"-ut"}, Sort: []string{"-ut"},
}) })
@ -3438,6 +3460,7 @@ func (s *Service) OpDeleteZoneMoment(ctx *gin.Context, req *zonemomentproto.OpDe
} }
} }
} }
}
// 回退空间内统计总数,只回退公开的情况 // 回退空间内统计总数,只回退公开的情况
if zonemoment.GetStatus() == consts.ZoneMoment_Public { if zonemoment.GetStatus() == consts.ZoneMoment_Public {