This commit is contained in:
meixiongfeng 2023-08-15 17:44:01 +08:00
commit 1a31f4d61a
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) {
var (
info *pb.DBShopCenter
conf *cfg.GameShopCenterControlData
confs []*cfg.GameShopCenterControlData
activitys map[pb.HdType]*pb.DBHuodong
activity *pb.DBShopCenterItem
ok bool
err error
)
@ -33,30 +34,34 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.ShopCenterInfoReq)
}
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 {
if conf, err = this.module.configure.getGameShopCenterControl(v.Id); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(),
for _, v := range confs {
if activity, ok = info.Item[v.Id]; !ok {
if v.On == 0 {
info.Item[v.Id] = &pb.DBShopCenterItem{Id: v.Id, Open: true, Record: make(map[int32]bool)}
} else {
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 {
v.Open = true
if _, ok = activitys[pb.HdType_XSFundPhysical]; ok && v.Type == 3 {
activity.Open = true
continue
}
if _, ok = activitys[pb.HdType_XSFundPhysical]; ok && conf.Type == 3 {
v.Open = true
if _, ok = activitys[pb.HdType_XSFundRecruit]; ok && v.Type == 4 {
activity.Open = true
continue
}
if _, ok = activitys[pb.HdType_XSFundRecruit]; ok && conf.Type == 4 {
v.Open = true
continue
}
if _, ok = activitys[pb.HdType_XSFundRecruit]; ok && conf.Type == 5 {
v.Open = true
if _, ok = activitys[pb.HdType_XSFundRecruit]; ok && v.Type == 5 {
activity.Open = true
continue
}
}

View File

@ -6,7 +6,6 @@ import (
"go_dreamfactory/lego/sys/mgo"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"sync"
"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) {
var (
confs []*cfg.GameShopCenterControlData
)
results = &pb.DBShopCenter{}
if err = this.Get(uid, results); err != nil && err != mgo.MongodbNil {
this.module.Errorln(err)
return
}
if err == mgo.MongodbNil {
if confs, err = this.module.configure.getGameShopCenterControls(); err != nil {
return
}
results = &pb.DBShopCenter{
Id: primitive.NewObjectID().Hex(),
Uid: uid,
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)
}
return