by Robin at 20240912; add streamer cancel proc
This commit is contained in:
parent
42cb2fb2ea
commit
73f634279e
|
@ -2871,6 +2871,22 @@ func (m *Mongo) GetStreamerList(ctx *gin.Context, req *streamerproto.OpListReq)
|
||||||
return list, err
|
return list, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Mongo) UpdateStreamerByMids(ctx *gin.Context, streamer *dbstruct.Streamer, mids []int64) error {
|
||||||
|
col := m.getColStreamer()
|
||||||
|
set := util.EntityToM(streamer)
|
||||||
|
set["ut"] = time.Now().Unix()
|
||||||
|
filter := qmgo.M{
|
||||||
|
"mid": qmgo.M{
|
||||||
|
"$in": mids,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
up := qmgo.M{
|
||||||
|
"$set": set,
|
||||||
|
}
|
||||||
|
_, err := col.UpdateAll(ctx, filter, up)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Mongo) CreateBatchStreamer(ctx *gin.Context, streamers []*dbstruct.Streamer) error {
|
func (m *Mongo) CreateBatchStreamer(ctx *gin.Context, streamers []*dbstruct.Streamer) error {
|
||||||
col := m.getColStreamer()
|
col := m.getColStreamer()
|
||||||
_, err := col.InsertMany(ctx, streamers)
|
_, err := col.InsertMany(ctx, streamers)
|
||||||
|
|
|
@ -138,3 +138,12 @@ func (p *Streamer) OpCreateBatch(ctx *gin.Context, req *streamerproto.OpCreateBa
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Streamer) OpUpdateByMids(ctx *gin.Context, streamer *dbstruct.Streamer, mids []int64) error {
|
||||||
|
err := p.store.UpdateStreamerByMids(ctx, streamer, mids)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("UpdateStreamerByMids fail, err: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
@ -626,6 +626,31 @@ func (s *Service) utilCancelAccountByMids(ctx *gin.Context, midList []int64) err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 针对主播账户,隐藏streamer,并从es表中删除
|
||||||
|
streamerMids := make([]int64, 0)
|
||||||
|
for _, acct := range accounts {
|
||||||
|
if acct.GetRole() == consts.Streamer {
|
||||||
|
streamerMids = append(streamerMids, acct.GetMid())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(streamerMids) > 0 {
|
||||||
|
err = _DefaultStreamer.OpUpdateByMids(ctx, &dbstruct.Streamer{
|
||||||
|
IsHided: goproto.Int64(consts.IsHided_Yes),
|
||||||
|
}, streamerMids)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("_DefaultStreamer OpUpdateByMids fail, err: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = _DefaultStreamerAcct.OpUpdateSelectivelyByMids(ctx, &dbstruct.EsStreamerAcctUpdater{
|
||||||
|
DelFlag: goproto.Int64(consts.Deleted),
|
||||||
|
}, streamerMids)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("_DefaultStreamerAcct OpUpdateSelectivelyByMids fail, err: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,11 @@ type EsStreamerAcctUpdater struct {
|
||||||
City *string `json:"city" bson:"city"` // 所在城市
|
City *string `json:"city" bson:"city"` // 所在城市
|
||||||
Constellation *string `json:"constellation" bson:"constellation"` // 星座
|
Constellation *string `json:"constellation" bson:"constellation"` // 星座
|
||||||
LastZoneMomentCreateDayStart *int64 `json:"last_zone_moment_create_day_start" bson:"last_zone_moment_create_day_start"` // 最后空间动态创建日始整点
|
LastZoneMomentCreateDayStart *int64 `json:"last_zone_moment_create_day_start" bson:"last_zone_moment_create_day_start"` // 最后空间动态创建日始整点
|
||||||
WechatCoinPrice *int64 `json:"wechat_coin_price"` // 微信金币价格
|
WechatCoinPrice *int64 `json:"wechat_coin_price" bson:"wechat_coin_price"` // 微信金币价格
|
||||||
ZoneAdmissionPrice *int64 `json:"zone_admission_price"` // 空间解锁价格, 单位: 分
|
ZoneAdmissionPrice *int64 `json:"zone_admission_price" bson:"zone_admission_price"`
|
||||||
|
Ct *int64 `json:"ct" bson:"ct"`
|
||||||
|
Ut *int64 `json:"ut" bson:"ut"`
|
||||||
|
DelFlag *int64 `json:"del_flag" bson:"del_flag"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *EsStreamerAcctUpdater) GetMid() int64 {
|
func (p *EsStreamerAcctUpdater) GetMid() int64 {
|
||||||
|
|
Loading…
Reference in New Issue