上传代码
This commit is contained in:
parent
61832ddff0
commit
c9faf5d6b5
@ -50,7 +50,7 @@ func (this *MCompModel) Start() (err error) {
|
|||||||
if conn, err = db.Local(); err != nil {
|
if conn, err = db.Local(); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.DBModel = db.NewDBModel(this.service.GetId(), this.TableName, conn)
|
this.DBModel = db.NewDBModel(this.service.GetTag(), this.TableName, conn)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ func (this *ModuleBase) GetDBNodule(session comm.IUserSession, tableName string,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model = db.NewDBModel(this.service.GetId(), tableName, conn)
|
model = db.NewDBModel(this.service.GetTag(), tableName, conn)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -621,7 +621,7 @@ func (this *ModuleBase) GetCrossDBModel(tableName string) (model *db.DBModel, er
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model = db.NewDBModel(this.service.GetId(), tableName, conn)
|
model = db.NewDBModel(this.service.GetTag(), tableName, conn)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,7 +643,7 @@ func (this *ModuleBase) GetDBModelByUid(uid, tableName string) (model *db.DBMode
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model = db.NewDBModel(this.service.GetId(), tableName, conn)
|
model = db.NewDBModel(this.service.GetTag(), tableName, conn)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,17 +18,20 @@ func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.ShopCenterR
|
|||||||
// /获取自己的排行榜信息
|
// /获取自己的排行榜信息
|
||||||
func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiveReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiveReq) (errdata *pb.ErrorData) {
|
||||||
var (
|
var (
|
||||||
conf *cfg.GameShopCenterControlData
|
conf *cfg.GameShopCenterControlData
|
||||||
pconf *cfg.GameShopCenterSubmeterData
|
pconfs []*cfg.GameShopCenterSubmeterData
|
||||||
fconf *cfg.GameShopCenterFundData
|
pconf *cfg.GameShopCenterSubmeterData
|
||||||
info *pb.DBShopCenter
|
fconf *cfg.GameShopCenterFundData
|
||||||
item *pb.DBShopCenterItem
|
fconfs []*cfg.GameShopCenterFundData
|
||||||
user *pb.DBUser
|
info *pb.DBShopCenter
|
||||||
drop int32
|
item *pb.DBShopCenterItem
|
||||||
items []*cfg.Gameatn
|
user *pb.DBUser
|
||||||
award []*pb.UserAtno
|
drop []int32
|
||||||
ok bool
|
items []*cfg.Gameatn
|
||||||
err error
|
itemsgroup []*cfg.Gameatn
|
||||||
|
award []*pb.UserAtno
|
||||||
|
ok bool
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
if errdata = this.ReceiveCheck(session, req); errdata != nil {
|
if errdata = this.ReceiveCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
@ -85,76 +88,168 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
|||||||
}
|
}
|
||||||
switch conf.Type {
|
switch conf.Type {
|
||||||
case 1:
|
case 1:
|
||||||
if pconf, err = this.module.configure.getGameShopCenterSubmeter(req.Pid); err != nil {
|
if req.Pid != 0 {
|
||||||
errdata = &pb.ErrorData{
|
if _, ok = item.Record[req.Pid]; ok {
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
|
||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
level := this.module.mainline.InquireMainLinePassLevel(session.GetUserId())
|
|
||||||
if _, ok = level[pconf.Mianlevel]; !ok {
|
|
||||||
errdata = &pb.ErrorData{
|
|
||||||
Code: pb.ErrorCode_ReqParameterError,
|
|
||||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
|
||||||
Message: "mainline no pass",
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
drop = pconf.Group
|
|
||||||
case 2, 3, 4, 5:
|
|
||||||
if fconf, err = this.module.configure.getGameShopCenterFund(req.Pid); err != nil {
|
|
||||||
errdata = &pb.ErrorData{
|
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
|
||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if conf.Type == 2 { //等级基金
|
|
||||||
if user.Lv < fconf.Unlock { //没有达到目标等级
|
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ReqParameterError,
|
Code: pb.ErrorCode_ReqParameterError,
|
||||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||||
Message: "user lv no achieve",
|
Message: "Received!",
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if pconf, err = this.module.configure.getGameShopCenterSubmeter(req.Pid); 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())
|
||||||
|
if _, ok = level[pconf.Mianlevel]; !ok {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ReqParameterError,
|
||||||
|
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||||
|
Message: "mainline no pass",
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
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,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if conf.Type == 2 { //等级基金
|
||||||
|
if user.Lv < fconf.Unlock { //没有达到目标等级
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ReqParameterError,
|
||||||
|
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||||
|
Message: "user lv no achieve",
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
drop = fconf.Group
|
|
||||||
break
|
break
|
||||||
case 6, 7, 8:
|
case 6, 7, 8:
|
||||||
if fconf, err = this.module.configure.getGameShopCenterFund(req.Pid); err != nil {
|
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,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
days := int32(utils.DiffDays(configure.Now().Unix(), item.Buytime)) + 1
|
||||||
|
if days < fconf.Unlock {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ReqParameterError,
|
||||||
|
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||||
|
Message: fmt.Sprintf("days:%d no achieve", days),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range drop {
|
||||||
|
if items = this.module.ModuleTools.GetGroupDataByLottery(v, user.Vip, user.Lv); len(items) == 0 {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
Message: fmt.Sprintf("掉落组未找到:%d", drop),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
days := int32(utils.DiffDays(configure.Now().Unix(), item.Buytime)) + 1
|
itemsgroup = append(itemsgroup, items...)
|
||||||
if days < fconf.Unlock {
|
|
||||||
errdata = &pb.ErrorData{
|
|
||||||
Code: pb.ErrorCode_ReqParameterError,
|
|
||||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
|
||||||
Message: fmt.Sprintf("days:%d no achieve", days),
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
drop = fconf.Group
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
item.Record[req.Pid] = true
|
|
||||||
if items = this.module.ModuleTools.GetGroupDataByLottery(drop, user.Vip, user.Lv); len(items) == 0 {
|
if errdata, award = this.module.DispenseAtno(session, itemsgroup, true); errdata != nil {
|
||||||
errdata = &pb.ErrorData{
|
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
|
||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
|
||||||
Message: fmt.Sprintf("掉落组未找到:%d", drop),
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if errdata, award = this.module.DispenseAtno(session, items, true); errdata != nil {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +82,19 @@ func (this *configureComp) getGameShopCenterFund(pid int32) (conf *cfg.GameShopC
|
|||||||
return
|
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) {
|
func (this *configureComp) getGameShopCenterSubmeter(pid int32) (conf *cfg.GameShopCenterSubmeterData, err error) {
|
||||||
var (
|
var (
|
||||||
@ -99,3 +112,16 @@ func (this *configureComp) getGameShopCenterSubmeter(pid int32) (conf *cfg.GameS
|
|||||||
}
|
}
|
||||||
return
|
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