Merge pull request 'conf' (#467) from conf into test
Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/467
This commit is contained in:
commit
bea44c5e3b
|
@ -4,11 +4,25 @@ import (
|
|||
"service/library/validator"
|
||||
)
|
||||
|
||||
func (p *OpSetIsHidedReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
||||
func (p *OpCreateReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
||||
params = make([]*validator.JsonParam, 0)
|
||||
params = append(params, validator.NewInt64PtrParam("请填写空间id!", p.ZoneThirdPartner.Zid))
|
||||
params = append(params, validator.NewInt64PtrParam("请填写代运营用户id!", p.ZoneThirdPartner.ThirdPartnerMid))
|
||||
params = append(params, validator.NewFloat64PtrParam("请填写分成比例!", p.ZoneThirdPartner.SharingRatio))
|
||||
return
|
||||
}
|
||||
|
||||
func (p *OpUpdateReq) ProvideNotNullValue() (params []*validator.JsonParam) {
|
||||
params = make([]*validator.JsonParam, 0)
|
||||
|
||||
params = append(params, validator.NewInt64PtrParam("请填写空间id!", p.Zid))
|
||||
return
|
||||
}
|
||||
|
||||
func (p *OpDeleteReq) 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
|
||||
}
|
||||
|
||||
|
|
|
@ -61,18 +61,3 @@ 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"`
|
||||
}
|
||||
|
|
|
@ -522,7 +522,6 @@ func Init(r *gin.Engine) {
|
|||
opZoneThirdPartnerGroup.POST("update", middleware.JSONParamValidator(zone_third_partner_proto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateZoneThirdPartner)
|
||||
opZoneThirdPartnerGroup.POST("delete", middleware.JSONParamValidator(zone_third_partner_proto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDeleteZoneThirdPartner)
|
||||
opZoneThirdPartnerGroup.POST("list", middleware.JSONParamValidator(zone_third_partner_proto.OpListReq{}), middleware.JwtAuthenticator(), OpGetZoneThirdPartnerList)
|
||||
opZoneThirdPartnerGroup.POST("set_is_hided", middleware.JSONParamValidator(zone_third_partner_proto.OpSetIsHidedReq{}), middleware.JwtAuthenticator(), OpSetIsHidedZoneThirdPartner)
|
||||
|
||||
// 空间相关每日报表
|
||||
opDailyStatementZoneInfoGroup := r.Group("/op/daily_statement_zone_info", PrepareOp())
|
||||
|
|
|
@ -67,15 +67,3 @@ func OpGetZoneThirdPartnerList(ctx *gin.Context) {
|
|||
}
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -4685,6 +4685,14 @@ func (m *Mongo) GetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_partne
|
|||
return zoneThirdPartner, err
|
||||
}
|
||||
|
||||
func (m *Mongo) DeleteZoneThirdPartnerByZid(ctx *gin.Context, zid int64) error {
|
||||
col := m.getColZoneThirdPartner()
|
||||
err := col.Remove(ctx, qmgo.M{
|
||||
"zid": zid,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *Mongo) GetZoneThirdPartnerListByTpMid(ctx *gin.Context, tp_mid int64) ([]*dbstruct.ZoneThirdPartner, error) {
|
||||
list := make([]*dbstruct.ZoneThirdPartner, 0)
|
||||
col := m.getColZoneThirdPartner()
|
||||
|
@ -4745,21 +4753,6 @@ 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)
|
||||
|
|
|
@ -2120,6 +2120,7 @@ func (s *Service) ApiCreateZone(ctx *gin.Context, req *zoneproto.ApiCreateReq) (
|
|||
req.Zone.ZoneMomentCount = goproto.Int64(0)
|
||||
req.Zone.ImageCount = goproto.Int64(0)
|
||||
req.Zone.VideoCount = goproto.Int64(0)
|
||||
req.Zone.IsZoneThirdPartnerHided = goproto.Int64(consts.IsHided_No)
|
||||
err, zid := _DefaultZone.OpCreate(ctx, &zoneproto.OpCreateReq{
|
||||
Zone: req.Zone,
|
||||
})
|
||||
|
@ -3044,6 +3045,29 @@ func (s *Service) ApiCreateZoneThirdPartner(ctx *gin.Context, req *zone_third_pa
|
|||
|
||||
func (s *Service) ApiGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_partner_proto.ApiListReq) (vo *zone_third_partner_proto.ZoneThirdPartnerApiVO, ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeZoneThirdPartnerSrvOk
|
||||
|
||||
zone, err := _DefaultZone.GetById(ctx, util.DerefInt64(req.Zid))
|
||||
if err != nil {
|
||||
logger.Error("_DefaultZone GetById fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeZoneSrvFail
|
||||
return
|
||||
}
|
||||
if zone == nil {
|
||||
vo = nil
|
||||
return
|
||||
}
|
||||
|
||||
if zone.GetIsZoneThirdPartnerHided() == consts.IsHided_Yes {
|
||||
vo = &zone_third_partner_proto.ZoneThirdPartnerApiVO{
|
||||
ZoneThirdPartner: &dbstruct.ZoneThirdPartner{
|
||||
Zid: req.Zid,
|
||||
ThirdPartnerMid: nil,
|
||||
SharingRatio: nil,
|
||||
},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
zoneThirdPartner, err := _DefaultZoneThirdPartner.OpList(ctx, &zone_third_partner_proto.OpListReq{
|
||||
BaseRequest: req.BaseRequest,
|
||||
Zid: req.Zid,
|
||||
|
@ -3057,14 +3081,6 @@ 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,7 +31,6 @@ 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)
|
||||
|
@ -139,12 +138,3 @@ 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
|
||||
}
|
||||
|
|
|
@ -3215,6 +3215,7 @@ func (s *Service) OpGetTerminatedAccountPunishmentList(ctx *gin.Context, req *ac
|
|||
// Zone
|
||||
func (s *Service) OpCreateZone(ctx *gin.Context, req *zoneproto.OpCreateReq) (ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeZoneSrvOk
|
||||
req.Zone.IsZoneThirdPartnerHided = goproto.Int64(consts.IsHided_No)
|
||||
err, _ := _DefaultZone.OpCreate(ctx, req)
|
||||
if err != nil {
|
||||
logger.Error("OpCreate fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
|
@ -3889,22 +3890,6 @@ func (s *Service) OpGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_pa
|
|||
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
|
||||
}
|
||||
|
||||
// ZoneCollaborator
|
||||
func (s *Service) OpCreateZoneCollaborator(ctx *gin.Context, req *zone_collaborator_proto.OpCreateReq) (ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeZoneCollaboratorSrvOk
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
package dbstruct
|
||||
|
||||
type Zone struct {
|
||||
Id *int64 `json:"id" bson:"_id"` // 空间表id
|
||||
Mid *int64 `json:"mid" bson:"mid"` // 用户表id
|
||||
Profile *string `json:"profile" bson:"profile"` // 空间简介
|
||||
LastZoneMomentCt *int64 `json:"last_zone_moment_ct" bson:"last_zone_moment_ct"` // 最后空间动态创建时间
|
||||
ZoneMomentCount *int64 `json:"zone_moment_count" bson:"zone_moment_count"` // 空间内动态总数
|
||||
ImageCount *int64 `json:"image_count" bson:"image_count"` // 空间内图片总数
|
||||
VideoCount *int64 `json:"video_count" bson:"video_count"` // 空间内视频总数
|
||||
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
|
||||
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
|
||||
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
|
||||
Id *int64 `json:"id" bson:"_id"` // 空间表id
|
||||
Mid *int64 `json:"mid" bson:"mid"` // 用户表id
|
||||
Profile *string `json:"profile" bson:"profile"` // 空间简介
|
||||
LastZoneMomentCt *int64 `json:"last_zone_moment_ct" bson:"last_zone_moment_ct"` // 最后空间动态创建时间
|
||||
ZoneMomentCount *int64 `json:"zone_moment_count" bson:"zone_moment_count"` // 空间内动态总数
|
||||
ImageCount *int64 `json:"image_count" bson:"image_count"` // 空间内图片总数
|
||||
VideoCount *int64 `json:"video_count" bson:"video_count"` // 空间内视频总数
|
||||
IsZoneThirdPartnerHided *int64 `json:"is_zone_third_partner_hided" bson:"is_zone_third_partner_hided"` // 是否隐藏空间代运营
|
||||
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
|
||||
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
|
||||
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
|
||||
}
|
||||
|
||||
func (p *Zone) GetId() int64 {
|
||||
|
@ -33,3 +34,10 @@ func (p *Zone) GetLastZoneMomentCt() int64 {
|
|||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (p *Zone) GetIsZoneThirdPartnerHided() int64 {
|
||||
if p != nil && p.IsZoneThirdPartnerHided != nil {
|
||||
return *p.IsZoneThirdPartnerHided
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ 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"` // 删除标记
|
||||
|
@ -32,10 +31,3 @@ 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