feat-IRONFANS-112-Robin #448
|
@ -232,6 +232,12 @@ const (
|
|||
IsHeaded_Yes = 1 //是
|
||||
)
|
||||
|
||||
// 是否隐藏
|
||||
const (
|
||||
IsHided_No = 0 //否
|
||||
IsHided_Yes = 1 //是
|
||||
)
|
||||
|
||||
// 从未更新的时间跨度
|
||||
const (
|
||||
DaysElapsedSinceTheLastZonesUpdate_Never = -1
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package proto
|
||||
|
||||
import (
|
||||
"service/library/validator"
|
||||
)
|
||||
|
||||
func (p *OpSetIsHidedReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
||||
params = make([]*validator.JsonParam, 0)
|
||||
|
||||
params = append(params, validator.NewInt64PtrParam("请填写空间id!", p.Zid))
|
||||
params = append(params, validator.NewInt64PtrParam("请填写是否隐藏!", p.IsHided))
|
||||
return
|
||||
}
|
|
@ -54,10 +54,25 @@ type OpListReq struct {
|
|||
}
|
||||
|
||||
type OpListData struct {
|
||||
ZoneThirdPartner *dbstruct.ZoneThirdPartner `json:"zone_third_partner"`
|
||||
ZoneThirdPartner *ZoneThirdPartnerOpVO `json:"zone_third_partner"`
|
||||
}
|
||||
|
||||
type OpListResp struct {
|
||||
base.BaseResponse
|
||||
Data *OpListData `json:"data"`
|
||||
}
|
||||
|
||||
// op 更新
|
||||
type OpSetIsHidedReq struct {
|
||||
base.BaseRequest
|
||||
Zid *int64 `json:"zid"`
|
||||
IsHided *int64 `json:"is_hided"`
|
||||
}
|
||||
|
||||
type OpSetIsHidedData struct {
|
||||
}
|
||||
|
||||
type OpSetIsHidedResp struct {
|
||||
base.BaseResponse
|
||||
Data *OpSetIsHidedData `json:"data"`
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package proto
|
||||
|
||||
import (
|
||||
accountproto "service/api/proto/account/proto"
|
||||
"service/dbstruct"
|
||||
)
|
||||
|
||||
type ZoneThirdPartnerOpVO struct {
|
||||
*dbstruct.ZoneThirdPartner
|
||||
Account *accountproto.OpListOthersVO `json:"third_partner_account"`
|
||||
}
|
|
@ -515,6 +515,11 @@ func Init(r *gin.Engine) {
|
|||
opZoneMomentGroup.POST("head", middleware.JSONParamValidator(zonemomentproto.OpHeadReq{}), middleware.JwtAuthenticator(), OpHeadZoneMoment)
|
||||
opZoneMomentGroup.POST("set_private", middleware.JSONParamValidator(zonemomentproto.OpSetPrivateReq{}), middleware.JwtAuthenticator(), OpSetPrivateZoneMoment)
|
||||
|
||||
// 空间代运营表
|
||||
opZoneThirdPartnerGroup := r.Group("/op/zone_third_partner", PrepareOp())
|
||||
opZoneThirdPartnerGroup.POST("set_is_hided", middleware.JSONParamValidator(zone_third_partner_proto.OpSetIsHidedReq{}), middleware.JwtAuthenticator(), OpSetIsHidedZoneThirdPartner)
|
||||
opZoneThirdPartnerGroup.POST("list", middleware.JSONParamValidator(zone_third_partner_proto.ApiListReq{}), middleware.JwtAuthenticator(), OpGetZoneThirdPartnerList)
|
||||
|
||||
// 视频审核callback
|
||||
extVideoModerationGroup := r.Group("/ext/video_moderation")
|
||||
extVideoModerationGroup.POST("callback", middleware.FORMParamValidator(video_moderation_proto.ExtVideoModerationReq{}), VideoModerationCallback)
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"service/app/mix/service"
|
||||
"service/bizcommon/util"
|
||||
"service/library/logger"
|
||||
"service/library/mediafiller"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
@ -56,8 +57,25 @@ func OpGetZoneThirdPartnerList(ctx *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
//填充媒体切片
|
||||
if zoneThirdPartner != nil && zoneThirdPartner.Account != nil && zoneThirdPartner.Account.Avatar != nil {
|
||||
mediafiller.FillEntity(ctx, zoneThirdPartner.Account.Avatar)
|
||||
}
|
||||
|
||||
data := &zone_third_partnerproto.OpListData{
|
||||
ZoneThirdPartner: zoneThirdPartner,
|
||||
}
|
||||
ReplyOk(ctx, data)
|
||||
}
|
||||
|
||||
func OpSetIsHidedZoneThirdPartner(ctx *gin.Context) {
|
||||
req := ctx.MustGet("client_req").(*zone_third_partnerproto.OpSetIsHidedReq)
|
||||
ec := service.DefaultService.OpSetIsHidedZoneThirdPartner(ctx, req)
|
||||
if ec != errcode.ErrCodeZoneThirdPartnerSrvOk {
|
||||
logger.Error("OpSetIsHidedZoneThirdPartner fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||||
ReplyErrCodeMsg(ctx, ec)
|
||||
return
|
||||
}
|
||||
|
||||
ReplyOk(ctx, nil)
|
||||
}
|
||||
|
|
|
@ -4795,6 +4795,21 @@ func (m *Mongo) GetZoneThirdPartnerById(ctx *gin.Context, id int64) (*dbstruct.Z
|
|||
return &one, err
|
||||
}
|
||||
|
||||
func (m *Mongo) SetIsHidedForZoneThirdPartner(ctx *gin.Context, req *zone_third_partner_proto.OpSetIsHidedReq) error {
|
||||
col := m.getColZoneThirdPartner()
|
||||
up := qmgo.M{
|
||||
"$set": qmgo.M{
|
||||
"is_hided": util.DerefInt64(req.IsHided),
|
||||
"ut": time.Now().Unix(),
|
||||
},
|
||||
}
|
||||
filter := qmgo.M{
|
||||
"zid": util.DerefInt64(req.Zid),
|
||||
}
|
||||
err := col.UpdateOne(ctx, filter, up)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *Mongo) CreateZoneThirdPartnerHis(ctx *gin.Context, zone_third_partner *dbstruct.ZoneThirdPartner) error {
|
||||
col := m.getColZoneThirdPartnerHis()
|
||||
_, err := col.InsertOne(ctx, zone_third_partner)
|
||||
|
|
|
@ -3119,6 +3119,14 @@ func (s *Service) ApiGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_p
|
|||
vo = nil
|
||||
return
|
||||
}
|
||||
if zoneThirdPartner.GetIsHided() == consts.IsHided_Yes {
|
||||
zoneThirdPartner.ThirdPartnerMid = nil
|
||||
zoneThirdPartner.SharingRatio = nil
|
||||
vo = &zone_third_partner_proto.ZoneThirdPartnerApiVO{
|
||||
ZoneThirdPartner: zoneThirdPartner,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
acct, err := _DefaultAccount.OpListByMid(ctx, &accountproto.OpListByMidReq{
|
||||
Mid: zoneThirdPartner.ThirdPartnerMid,
|
||||
|
|
|
@ -31,6 +31,7 @@ func (p *ZoneThirdPartner) OpCreate(ctx *gin.Context, req *zone_third_partner_pr
|
|||
req.ZoneThirdPartner.Ct = goproto.Int64(time.Now().Unix())
|
||||
req.ZoneThirdPartner.Ut = goproto.Int64(time.Now().Unix())
|
||||
req.ZoneThirdPartner.DelFlag = goproto.Int64(consts.Exist)
|
||||
req.ZoneThirdPartner.IsHided = goproto.Int64(consts.IsHided_No)
|
||||
err := p.store.CreateZoneThirdPartner(ctx, req.ZoneThirdPartner)
|
||||
if err != nil {
|
||||
logger.Error("CreateZoneThirdPartner fail, err: %v", err)
|
||||
|
@ -137,3 +138,12 @@ func (p *ZoneThirdPartner) GetZoneThirdPartnerMapByZids(ctx *gin.Context, zids [
|
|||
|
||||
return mp, nil
|
||||
}
|
||||
|
||||
func (p *ZoneThirdPartner) OpSetIsHided(ctx *gin.Context, req *zone_third_partner_proto.OpSetIsHidedReq) error {
|
||||
err := p.store.SetIsHidedForZoneThirdPartner(ctx, req)
|
||||
if err != nil {
|
||||
logger.Error("SetIsHidedZoneThirdPartner fail, err: %v", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -3803,7 +3803,7 @@ func (s *Service) OpDeleteZoneThirdPartner(ctx *gin.Context, id int64) (ec errco
|
|||
return
|
||||
}
|
||||
|
||||
func (s *Service) OpGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_partner_proto.OpListReq) (zoneThirdPartner *dbstruct.ZoneThirdPartner, ec errcode.ErrCode) {
|
||||
func (s *Service) OpGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_partner_proto.OpListReq) (vo *zone_third_partner_proto.ZoneThirdPartnerOpVO, ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeZoneThirdPartnerSrvOk
|
||||
zoneThirdPartner, err := _DefaultZoneThirdPartner.OpList(ctx, req)
|
||||
if err != nil {
|
||||
|
@ -3811,6 +3811,48 @@ func (s *Service) OpGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_pa
|
|||
ec = errcode.ErrCodeZoneThirdPartnerSrvFail
|
||||
return
|
||||
}
|
||||
if zoneThirdPartner == nil {
|
||||
vo = nil
|
||||
return
|
||||
}
|
||||
|
||||
acct, err := _DefaultAccount.OpListByMid(ctx, &accountproto.OpListByMidReq{
|
||||
Mid: zoneThirdPartner.ThirdPartnerMid,
|
||||
})
|
||||
if err != nil {
|
||||
logger.Error("_DefaultAccount OpListByMid fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeAccountSrvFail
|
||||
return
|
||||
}
|
||||
if acct == nil {
|
||||
logger.Error("No account entity was found, req: %v", util.ToJson(req))
|
||||
ec = errcode.ErrCodeAccountNotExist
|
||||
return
|
||||
}
|
||||
acctVO := &accountproto.OpListOthersVO{}
|
||||
acctVO.CopyAccount(acct)
|
||||
|
||||
vo = &zone_third_partner_proto.ZoneThirdPartnerOpVO{
|
||||
ZoneThirdPartner: zoneThirdPartner,
|
||||
Account: acctVO,
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Service) OpSetIsHidedZoneThirdPartner(ctx *gin.Context, req *zone_third_partner_proto.OpSetIsHidedReq) (ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeZoneThirdPartnerSrvOk
|
||||
err := _DefaultZoneThirdPartner.OpSetIsHided(ctx, req)
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
ec = errcode.ErrCodeZoneThirdPartnerNotExist
|
||||
err = nil
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
logger.Error("OpSetIsHided fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeZoneThirdPartnerSrvFail
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ type ZoneThirdPartner struct {
|
|||
Zid *int64 `json:"zid" bson:"zid"` // 空间id
|
||||
ThirdPartnerMid *int64 `json:"third_partner_mid" bson:"third_partner_mid"` // 代运营用户id
|
||||
SharingRatio *float64 `json:"sharing_ratio" bson:"sharing_ratio"` // 分成比例
|
||||
IsHided *int64 `json:"is_hided" bson:"is_hided"` // 是否隐藏
|
||||
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
|
||||
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
|
||||
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
|
||||
|
@ -31,3 +32,10 @@ func (p *ZoneThirdPartner) GetSharingRatio() float64 {
|
|||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (p *ZoneThirdPartner) GetIsHided() int64 {
|
||||
if p != nil && p.IsHided != nil {
|
||||
return *p.IsHided
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue