Merge pull request 'by Robin at 20240507; set is_hided for zone third partner' (#406) from feat-IRONFANS-112-Robin into test
Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/406
This commit is contained in:
commit
03b00506dc
|
@ -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())
|
||||
apiZoneThirdPartnerGroup.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)
|
||||
}
|
||||
|
|
|
@ -4797,6 +4797,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)
|
||||
|
|
|
@ -137,3 +137,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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue