Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
3dfa4db7a3
@ -50,7 +50,7 @@ func (this *MCompModel) Start() (err error) {
|
||||
if conn, err = db.Local(); err != nil {
|
||||
return
|
||||
}
|
||||
this.DBModel = db.NewDBModel(this.service.GetId(), this.TableName, conn)
|
||||
this.DBModel = db.NewDBModel(this.service.GetTag(), this.TableName, conn)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -603,7 +603,7 @@ func (this *ModuleBase) GetDBNodule(session comm.IUserSession, tableName string,
|
||||
return
|
||||
}
|
||||
}
|
||||
model = db.NewDBModel(this.service.GetId(), tableName, conn)
|
||||
model = db.NewDBModel(this.service.GetTag(), tableName, conn)
|
||||
return
|
||||
}
|
||||
|
||||
@ -621,7 +621,7 @@ func (this *ModuleBase) GetCrossDBModel(tableName string) (model *db.DBModel, er
|
||||
return
|
||||
}
|
||||
}
|
||||
model = db.NewDBModel(this.service.GetId(), tableName, conn)
|
||||
model = db.NewDBModel(this.service.GetTag(), tableName, conn)
|
||||
return
|
||||
}
|
||||
|
||||
@ -643,7 +643,7 @@ func (this *ModuleBase) GetDBModelByUid(uid, tableName string) (model *db.DBMode
|
||||
return
|
||||
}
|
||||
}
|
||||
model = db.NewDBModel(this.service.GetId(), tableName, conn)
|
||||
model = db.NewDBModel(this.service.GetTag(), tableName, conn)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -19,13 +19,16 @@ func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.ShopCenterR
|
||||
func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiveReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
conf *cfg.GameShopCenterControlData
|
||||
pconfs []*cfg.GameShopCenterSubmeterData
|
||||
pconf *cfg.GameShopCenterSubmeterData
|
||||
fconf *cfg.GameShopCenterFundData
|
||||
fconfs []*cfg.GameShopCenterFundData
|
||||
info *pb.DBShopCenter
|
||||
item *pb.DBShopCenterItem
|
||||
user *pb.DBUser
|
||||
drop int32
|
||||
drop []int32
|
||||
items []*cfg.Gameatn
|
||||
itemsgroup []*cfg.Gameatn
|
||||
award []*pb.UserAtno
|
||||
ok bool
|
||||
err error
|
||||
@ -85,6 +88,15 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
||||
}
|
||||
switch conf.Type {
|
||||
case 1:
|
||||
if req.Pid != 0 {
|
||||
if _, ok = item.Record[req.Pid]; ok {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
Message: "Received!",
|
||||
}
|
||||
return
|
||||
}
|
||||
if pconf, err = this.module.configure.getGameShopCenterSubmeter(req.Pid); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
@ -102,8 +114,37 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
||||
}
|
||||
return
|
||||
}
|
||||
drop = pconf.Group
|
||||
drop = append(drop, pconf.Group)
|
||||
item.Record[req.Pid] = true
|
||||
} else {
|
||||
if pconfs, err = this.module.configure.getGameShopCenterSubmeters(); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
level := this.module.mainline.InquireMainLinePassLevel(session.GetUserId())
|
||||
for _, v := range pconfs {
|
||||
if _, ok = item.Record[v.Id]; !ok {
|
||||
if _, ok = level[v.Mianlevel]; ok {
|
||||
drop = append(drop, pconf.Group)
|
||||
item.Record[v.Id] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case 2, 3, 4, 5:
|
||||
if req.Pid != 0 {
|
||||
if _, ok = item.Record[req.Pid]; ok {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
Message: "Received!",
|
||||
}
|
||||
return
|
||||
}
|
||||
if fconf, err = this.module.configure.getGameShopCenterFund(req.Pid); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
@ -122,9 +163,39 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
||||
return
|
||||
}
|
||||
}
|
||||
drop = fconf.Group
|
||||
drop = append(drop, fconf.Group)
|
||||
item.Record[req.Pid] = true
|
||||
} else {
|
||||
if fconfs, err = this.module.configure.getGameShopCenterFunds(); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
for _, v := range fconfs {
|
||||
if _, ok = item.Record[v.Id]; !ok {
|
||||
if conf.Type == 2 { //等级基金
|
||||
if user.Lv >= v.Unlock { //没有达到目标等级
|
||||
drop = append(drop, fconf.Group)
|
||||
item.Record[v.Id] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
case 6, 7, 8:
|
||||
if req.Pid != 0 {
|
||||
if _, ok = item.Record[req.Pid]; ok {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
Message: "Received!",
|
||||
}
|
||||
return
|
||||
}
|
||||
if fconf, err = this.module.configure.getGameShopCenterFund(req.Pid); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
@ -142,11 +213,32 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
||||
}
|
||||
return
|
||||
}
|
||||
drop = fconf.Group
|
||||
drop = append(drop, fconf.Group)
|
||||
item.Record[req.Pid] = true
|
||||
} else {
|
||||
if fconfs, err = this.module.configure.getGameShopCenterFunds(); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
days := int32(utils.DiffDays(configure.Now().Unix(), item.Buytime)) + 1
|
||||
for _, v := range fconfs {
|
||||
if _, ok = item.Record[v.Id]; !ok {
|
||||
if days >= v.Unlock { //没有达到目标等级
|
||||
drop = append(drop, fconf.Group)
|
||||
item.Record[v.Id] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
item.Record[req.Pid] = true
|
||||
if items = this.module.ModuleTools.GetGroupDataByLottery(drop, user.Vip, user.Lv); len(items) == 0 {
|
||||
|
||||
for _, v := range drop {
|
||||
if items = this.module.ModuleTools.GetGroupDataByLottery(v, user.Vip, user.Lv); len(items) == 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
@ -154,7 +246,10 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
||||
}
|
||||
return
|
||||
}
|
||||
if errdata, award = this.module.DispenseAtno(session, items, true); errdata != nil {
|
||||
itemsgroup = append(itemsgroup, items...)
|
||||
}
|
||||
|
||||
if errdata, award = this.module.DispenseAtno(session, itemsgroup, true); errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,19 @@ func (this *configureComp) getGameShopCenterFund(pid int32) (conf *cfg.GameShopC
|
||||
return
|
||||
}
|
||||
|
||||
// 获取活跃度奖励配置
|
||||
func (this *configureComp) getGameShopCenterFunds() (confs []*cfg.GameShopCenterFundData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
)
|
||||
if v, err = this.GetConfigure(game_shopcenterfund); err != nil {
|
||||
return
|
||||
} else {
|
||||
confs = v.(*cfg.GameShopCenterFund).GetDataList()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 获取活跃度奖励配置
|
||||
func (this *configureComp) getGameShopCenterSubmeter(pid int32) (conf *cfg.GameShopCenterSubmeterData, err error) {
|
||||
var (
|
||||
@ -99,3 +112,16 @@ func (this *configureComp) getGameShopCenterSubmeter(pid int32) (conf *cfg.GameS
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 获取活跃度奖励配置
|
||||
func (this *configureComp) getGameShopCenterSubmeters() (confs []*cfg.GameShopCenterSubmeterData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
)
|
||||
if v, err = this.GetConfigure(game_shopcentersubmeter); err != nil {
|
||||
return
|
||||
} else {
|
||||
confs = v.(*cfg.GameShopCenterSubmeter).GetDataList()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user