上传协议

This commit is contained in:
liwei1dao 2023-08-15 16:54:14 +08:00
parent a464e3be40
commit 1e0e55ac0e
2 changed files with 23 additions and 35 deletions

View File

@ -16,8 +16,9 @@ func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.ShopCenterInfo
func (this *apiComp) Info(session comm.IUserSession, req *pb.ShopCenterInfoReq) (errdata *pb.ErrorData) { func (this *apiComp) Info(session comm.IUserSession, req *pb.ShopCenterInfoReq) (errdata *pb.ErrorData) {
var ( var (
info *pb.DBShopCenter info *pb.DBShopCenter
conf *cfg.GameShopCenterControlData confs []*cfg.GameShopCenterControlData
activitys map[pb.HdType]*pb.DBHuodong activitys map[pb.HdType]*pb.DBHuodong
activity *pb.DBShopCenterItem
ok bool ok bool
err error err error
) )
@ -33,30 +34,34 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.ShopCenterInfoReq)
} }
return return
} }
if confs, err = this.module.configure.getGameShopCenterControls(); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(),
}
return
}
for _, v := range info.Item { for _, v := range confs {
if conf, err = this.module.configure.getGameShopCenterControl(v.Id); err != nil { if activity, ok = info.Item[v.Id]; !ok {
errdata = &pb.ErrorData{ if v.On == 0 {
Code: pb.ErrorCode_ConfigNoFound, info.Item[v.Id] = &pb.DBShopCenterItem{Id: v.Id, Open: true, Record: make(map[int32]bool)}
Title: pb.ErrorCode_ConfigNoFound.ToString(), } else {
Message: err.Error(), info.Item[v.Id] = &pb.DBShopCenterItem{Id: v.Id, Open: false, Record: make(map[int32]bool)}
} }
return activity = info.Item[v.Id]
} }
if conf.Type == 1 || conf.Type == 2 || conf.Type == 5 || conf.Type == 6 || conf.Type == 7 { if _, ok = activitys[pb.HdType_XSFundPhysical]; ok && v.Type == 3 {
v.Open = true activity.Open = true
continue continue
} }
if _, ok = activitys[pb.HdType_XSFundPhysical]; ok && conf.Type == 3 { if _, ok = activitys[pb.HdType_XSFundRecruit]; ok && v.Type == 4 {
v.Open = true activity.Open = true
continue continue
} }
if _, ok = activitys[pb.HdType_XSFundRecruit]; ok && conf.Type == 4 { if _, ok = activitys[pb.HdType_XSFundRecruit]; ok && v.Type == 5 {
v.Open = true activity.Open = true
continue
}
if _, ok = activitys[pb.HdType_XSFundRecruit]; ok && conf.Type == 5 {
v.Open = true
continue continue
} }
} }

View File

@ -6,7 +6,6 @@ import (
"go_dreamfactory/lego/sys/mgo" "go_dreamfactory/lego/sys/mgo"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"sync" "sync"
"go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/bson/primitive"
@ -50,33 +49,17 @@ func (this *ModelShop) getactivity() map[pb.HdType]*pb.DBHuodong {
// 获取用户全部的埋点数据 // 获取用户全部的埋点数据
func (this *ModelShop) getUserShopCenter(uid string) (results *pb.DBShopCenter, err error) { func (this *ModelShop) getUserShopCenter(uid string) (results *pb.DBShopCenter, err error) {
var (
confs []*cfg.GameShopCenterControlData
)
results = &pb.DBShopCenter{} results = &pb.DBShopCenter{}
if err = this.Get(uid, results); err != nil && err != mgo.MongodbNil { if err = this.Get(uid, results); err != nil && err != mgo.MongodbNil {
this.module.Errorln(err) this.module.Errorln(err)
return return
} }
if err == mgo.MongodbNil { if err == mgo.MongodbNil {
if confs, err = this.module.configure.getGameShopCenterControls(); err != nil {
return
}
results = &pb.DBShopCenter{ results = &pb.DBShopCenter{
Id: primitive.NewObjectID().Hex(), Id: primitive.NewObjectID().Hex(),
Uid: uid, Uid: uid,
Item: make(map[int32]*pb.DBShopCenterItem), Item: make(map[int32]*pb.DBShopCenterItem),
} }
for _, v := range confs {
if v.On == 0 {
results.Item[v.Id] = &pb.DBShopCenterItem{
Id: v.Id,
Open: true,
Record: make(map[int32]bool),
}
}
}
err = this.Add(uid, results) err = this.Add(uid, results)
} }
return return