Merge pull request 'feat-IRONFANS-70' (#240) from feat-IRONFANS-70 into test
Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/240
This commit is contained in:
commit
580e55829a
|
@ -5,7 +5,7 @@ import (
|
|||
)
|
||||
|
||||
func (p *ApiCreateReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
||||
params = make([]*validator.JsonParam, 3)
|
||||
params = make([]*validator.JsonParam, 0)
|
||||
|
||||
params = append(params, validator.NewInt64PtrParam("请填写空间id!", p.ZoneCollaborator.Zid))
|
||||
params = append(params, validator.NewInt64PtrParam("请填写协作者用户id!", p.ZoneCollaborator.CollaboratorMid))
|
||||
|
@ -14,21 +14,21 @@ func (p *ApiCreateReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
|||
}
|
||||
|
||||
func (p *ApiUpdateReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
||||
params = make([]*validator.JsonParam, 3)
|
||||
params = make([]*validator.JsonParam, 0)
|
||||
|
||||
params = append(params, validator.NewInt64PtrParam("请填写协作者表id!", p.ZoneCollaborator.Id))
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ApiDeleteReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
||||
params = make([]*validator.JsonParam, 3)
|
||||
params = make([]*validator.JsonParam, 0)
|
||||
|
||||
params = append(params, validator.NewInt64PtrParam("请填写协作者表id!", p.Id))
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ApiListReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
||||
params = make([]*validator.JsonParam, 3)
|
||||
params = make([]*validator.JsonParam, 0)
|
||||
|
||||
params = append(params, validator.NewInt64PtrParam("请填写空间id!", p.Zid))
|
||||
return
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
)
|
||||
|
||||
func (p *ApiCreateReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
||||
params = make([]*validator.JsonParam, 3)
|
||||
params = make([]*validator.JsonParam, 0)
|
||||
|
||||
params = append(params, validator.NewStringParam("请填写您的手机号!", p.MobilePhone))
|
||||
params = append(params, validator.NewStringParam("请确认用户的国家区号!", p.RegionCode))
|
||||
|
@ -17,7 +17,7 @@ func (p *ApiCreateReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
|||
}
|
||||
|
||||
func (p *ApiListReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
||||
params = make([]*validator.JsonParam, 3)
|
||||
params = make([]*validator.JsonParam, 0)
|
||||
|
||||
params = append(params, validator.NewInt64PtrParam("请填写空间id!", p.Zid))
|
||||
return
|
||||
|
|
|
@ -30,6 +30,29 @@ func (p *ApiCreateReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
|||
return
|
||||
}
|
||||
|
||||
func (p *ApiUpdateReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
||||
params = make([]*validator.JsonParam, 0)
|
||||
|
||||
params = append(params, validator.NewInt64PtrParam("请确认创建动态的可见范围!", p.ZoneMoment.CType))
|
||||
params = append(params, validator.NewInt64PtrParam("请确认创建动态的媒体类型!", p.ZoneMoment.MType))
|
||||
params = append(params, validator.NewStringPtrParam("请确认创建动态的文案!", p.Text))
|
||||
params = append(params, validator.NewStructPtrParam("请确认创建动态的媒体!", p.MediaComp))
|
||||
|
||||
switch util.DerefInt64(p.ZoneMoment.CType) {
|
||||
case consts.ZoneMomentCType_Paid:
|
||||
params = append(params, validator.NewInt64PtrParam("请确认创建动态的文字可见范围!", p.ZoneMoment.TextVisibleRange))
|
||||
params = append(params, validator.NewInt64PtrParam("请确认创建动态的价格!", p.ZoneMoment.Price))
|
||||
switch util.DerefInt64(p.ZoneMoment.MType) {
|
||||
case consts.MediaTypeImg:
|
||||
params = append(params, validator.NewInt64PtrParam("请确认创建动态的媒体可见范围!", p.ZoneMoment.MediaVisibleRange))
|
||||
case consts.MediaTypeVideo:
|
||||
params = append(params, validator.NewInt64PtrParam("请确认创建动态是否要模糊封面!", p.ZoneMoment.IsBlurringCover))
|
||||
}
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ApiDeleteReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
||||
params = make([]*validator.JsonParam, 0)
|
||||
|
||||
|
@ -53,9 +76,5 @@ func (p *ApiListByZidReq) ProvideNotNullValue() (params []*validator.JsonParam)
|
|||
params = append(params, validator.NewInt64PtrParam("请确认创建动态的所属空间id!", p.Zid))
|
||||
//params = append(params, validator.NewInt64PtrParam("请确认创建动态的媒体类型!", p.MType))
|
||||
|
||||
switch util.DerefInt64(p.CType) {
|
||||
case consts.ZoneMomentCType_Paid:
|
||||
params = append(params, validator.NewInt64PtrParam("请确认是否铁粉可见!", p.IsIronfanVisible))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -101,6 +101,7 @@ type ApiListByZidReq struct {
|
|||
CtLowerBound *int64 `json:"ct_lower_bound"` // 创建时间下界,开区间,可为0
|
||||
Offset int `json:"offset"`
|
||||
Limit int `json:"limit"`
|
||||
Status *int64
|
||||
}
|
||||
|
||||
type ApiListByZidData struct {
|
||||
|
|
|
@ -125,6 +125,7 @@ type OpListByZidReq struct {
|
|||
CtLowerBound *int64 `json:"ct_lower_bound"` // 创建时间下界,开区间,可为0
|
||||
Offset int `json:"offset"`
|
||||
Limit int `json:"limit"`
|
||||
Status *int64
|
||||
}
|
||||
|
||||
type OpListByZidData struct {
|
||||
|
|
|
@ -3933,7 +3933,6 @@ func (m *Mongo) GetZoneMomentListByZid(ctx *gin.Context, req *zonemomentproto.Op
|
|||
col := m.getColZoneMoment()
|
||||
query := qmgo.M{
|
||||
"zid": util.DerefInt64(req.Zid),
|
||||
"status": consts.ZoneMoment_Public,
|
||||
"del_flag": 0,
|
||||
}
|
||||
if req.MType != nil {
|
||||
|
@ -3945,6 +3944,9 @@ func (m *Mongo) GetZoneMomentListByZid(ctx *gin.Context, req *zonemomentproto.Op
|
|||
if req.IsIronfanVisible != nil {
|
||||
query["is_ironfan_visible"] = util.DerefInt64(req.IsIronfanVisible)
|
||||
}
|
||||
if req.Status != nil {
|
||||
query["status"] = util.DerefInt64(req.Status)
|
||||
}
|
||||
ctClause := qmgo.M{}
|
||||
if req.CtLowerBound != nil {
|
||||
ctClause["$gt"] = util.DerefInt64(req.CtLowerBound)
|
||||
|
@ -4495,7 +4497,7 @@ func (m *Mongo) GetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_partne
|
|||
err := col.Find(ctx, query).One(&zoneThirdPartner)
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
err = nil
|
||||
return zoneThirdPartner, err
|
||||
return nil, err
|
||||
}
|
||||
return zoneThirdPartner, err
|
||||
}
|
||||
|
|
|
@ -2466,7 +2466,23 @@ func (s *Service) ApiGetZoneMomentListByVisitorMid(ctx *gin.Context, req *zonemo
|
|||
func (s *Service) ApiGetZoneMomentListByZid(ctx *gin.Context, req *zonemomentproto.ApiListByZidReq) (volist []*zonemomentproto.ApiZoneMomentVO, ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeZoneMomentSrvOk
|
||||
|
||||
// 1.根据关注的zids查询得到这一轮的动态基底
|
||||
// 1.查询访客是否是空间创建者,不是创建者,则只查询公开动态
|
||||
zoneMap, err := _DefaultZone.GetZoneMapByMids(ctx, []int64{req.BaseRequest.Mid})
|
||||
if err != nil {
|
||||
logger.Error("_DefaultZone GetZoneMapByMids fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeZoneSrvFail
|
||||
return
|
||||
}
|
||||
zones := zoneMap[req.BaseRequest.Mid]
|
||||
zoneZidMap := make(map[int64]*dbstruct.Zone, 0)
|
||||
for _, zone := range zones {
|
||||
zoneZidMap[util.DerefInt64(zone.Id)] = zone
|
||||
}
|
||||
if zoneZidMap[util.DerefInt64(req.Zid)] == nil {
|
||||
req.Status = goproto.Int64(consts.ZoneMoment_Public)
|
||||
}
|
||||
|
||||
// 2.根据关注的zids查询得到这一轮的动态基底
|
||||
list, err := _DefaultZoneMoment.OpListByZid(ctx, &zonemomentproto.OpListByZidReq{
|
||||
Zid: req.Zid,
|
||||
MType: req.MType,
|
||||
|
@ -2476,6 +2492,7 @@ func (s *Service) ApiGetZoneMomentListByZid(ctx *gin.Context, req *zonemomentpro
|
|||
CtLowerBound: req.CtLowerBound,
|
||||
Offset: req.Offset,
|
||||
Limit: req.Limit,
|
||||
Status: req.Status,
|
||||
})
|
||||
if err != nil {
|
||||
logger.Error("ApiGetZoneMomentListByZid fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
|
@ -2576,6 +2593,7 @@ func (s *Service) ApiGetZoneMomentListByCreaterMid(ctx *gin.Context, req *zonemo
|
|||
}
|
||||
streamerExt := streamerExtMap[req.GetBaseRequest().Mid]
|
||||
|
||||
volist = make([]*zonemomentproto.ApiZoneMomentVO, 0)
|
||||
// 3.填充所有信息
|
||||
for _, zonemoment := range list {
|
||||
vo := &zonemomentproto.ApiZoneMomentVO{
|
||||
|
@ -2719,6 +2737,9 @@ func (s *Service) ApiGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_p
|
|||
ec = errcode.ErrCodeZoneThirdPartnerSrvFail
|
||||
return
|
||||
}
|
||||
if zoneThirdPartner == nil {
|
||||
return &zone_third_partner_proto.ZoneThirdPartnerApiVO{}, errcode.ErrCodeZoneThirdPartnerNotExist
|
||||
}
|
||||
|
||||
account, err := _DefaultAccount.OpListByMid(ctx, &accountproto.OpListByMidReq{
|
||||
Mid: zoneThirdPartner.ThirdPartnerMid,
|
||||
|
@ -2799,6 +2820,9 @@ func (s *Service) ApiGetZoneCollaboratorList(ctx *gin.Context, req *zone_collabo
|
|||
ec = errcode.ErrCodeZoneCollaboratorSrvFail
|
||||
return
|
||||
}
|
||||
if len(list) == 0 {
|
||||
return make([]*zone_collaborator_proto.ZoneCollaboratorApiVO, 0), errcode.ErrCodeZoneCollaboratorNotExist
|
||||
}
|
||||
|
||||
midSet := make(map[int64]*dbstruct.Moment)
|
||||
mids := make([]int64, 0)
|
||||
|
|
|
@ -115,7 +115,9 @@ func (p *Account) GetAccountMapByMids(ctx *gin.Context, mids []int64) (map[int64
|
|||
logger.Error("GetAccountListByMid fail, err: %v", err)
|
||||
return make(map[int64]*dbstruct.Account), err
|
||||
}
|
||||
list = append(list, account)
|
||||
if account != nil {
|
||||
list = append(list, account)
|
||||
}
|
||||
} else {
|
||||
accounts, err := p.store.GetAccountListByMids(ctx, &accountproto.OpListByMidsReq{
|
||||
Mids: mids,
|
||||
|
|
|
@ -93,7 +93,9 @@ func (p *Streamer) GetStreamerMapByMids(ctx *gin.Context, mids []int64) (map[int
|
|||
logger.Error("GetStreamerListByMids fail, err: %v", err)
|
||||
return make(map[int64]*dbstruct.Streamer), err
|
||||
}
|
||||
list = append(list, streamer)
|
||||
if streamer != nil {
|
||||
list = append(list, streamer)
|
||||
}
|
||||
} else {
|
||||
streamers, err := p.store.GetStreamerListByMids(ctx, &streamerproto.OpListByMidsReq{
|
||||
Mids: mids,
|
||||
|
|
|
@ -120,7 +120,7 @@ func (p *Zone) GetById(ctx *gin.Context, id int64) (*dbstruct.Zone, error) {
|
|||
func (p *Zone) GetZoneMapByMids(ctx *gin.Context, mids []int64) (map[int64][]*dbstruct.Zone, error) {
|
||||
_map := make(map[int64][]*dbstruct.Zone)
|
||||
list := make([]*dbstruct.Zone, 0)
|
||||
if len(mids) == 0 {
|
||||
if len(mids) == 1 {
|
||||
zones, err := p.store.GetZoneListByMid(ctx, &zoneproto.OpListByMidReq{
|
||||
Uid: goproto.Int64(mids[0]),
|
||||
})
|
||||
|
|
|
@ -1493,7 +1493,7 @@ func (s *Service) utilFillZonesWithApiVOInfo(ctx *gin.Context, list []*dbstruct.
|
|||
|
||||
// 填充访客身份
|
||||
vo.VisitorRole = consts.Zone_Visitor
|
||||
if zoneZidMap[visitorMid] != nil {
|
||||
if zoneZidMap[util.DerefInt64(vo.Zone.Id)] != nil {
|
||||
vo.VisitorRole = consts.Zone_Creater
|
||||
} else if tpZoneMap[visitorMid] != nil {
|
||||
vo.VisitorRole = consts.Zone_ThridPartner
|
||||
|
|
Loading…
Reference in New Issue