上传代码
This commit is contained in:
parent
cafc95a48b
commit
bf8bd075ac
@ -98,6 +98,7 @@ const (
|
|||||||
ModuleStone core.M_Modules = "stonehenge" //巨石秘境
|
ModuleStone core.M_Modules = "stonehenge" //巨石秘境
|
||||||
ModuleKFTask core.M_Modules = "kftask" //开服任务
|
ModuleKFTask core.M_Modules = "kftask" //开服任务
|
||||||
ModuleHeroTask core.M_Modules = "herotask" //守护者任务
|
ModuleHeroTask core.M_Modules = "herotask" //守护者任务
|
||||||
|
ModuleShopCenter core.M_Modules = "shopcenter" //购物中心
|
||||||
)
|
)
|
||||||
|
|
||||||
// 数据表名定义处
|
// 数据表名定义处
|
||||||
|
@ -26,6 +26,10 @@ type (
|
|||||||
IActivityNotice interface {
|
IActivityNotice interface {
|
||||||
ActivityNotice(hdlist *pb.DBHuodong)
|
ActivityNotice(hdlist *pb.DBHuodong)
|
||||||
}
|
}
|
||||||
|
//支付发布接口
|
||||||
|
IPayDelivery interface {
|
||||||
|
Delivery(session IUserSession, pId string) (errdata *pb.ErrorData, items []*pb.UserAssets)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -396,7 +400,7 @@ type (
|
|||||||
}
|
}
|
||||||
IPrivilege interface {
|
IPrivilege interface {
|
||||||
// 创建一个新的特权卡
|
// 创建一个新的特权卡
|
||||||
Delivery(session IUserSession, pId string) (errdata *pb.ErrorData, items []*pb.UserAssets)
|
IPayDelivery
|
||||||
// 续费特权卡
|
// 续费特权卡
|
||||||
RenewPrivilegeCard(session IUserSession, cId string) (errdata *pb.ErrorData)
|
RenewPrivilegeCard(session IUserSession, cId string) (errdata *pb.ErrorData)
|
||||||
// 检查特权 参数 计费点 返回值 是否有特权
|
// 检查特权 参数 计费点 返回值 是否有特权
|
||||||
@ -465,10 +469,6 @@ type (
|
|||||||
ModulePayDelivery(session IUserSession, Productid string, Price int32) (errdata *pb.ErrorData)
|
ModulePayDelivery(session IUserSession, Productid string, Price int32) (errdata *pb.ErrorData)
|
||||||
IActivityNotice
|
IActivityNotice
|
||||||
}
|
}
|
||||||
//支付发货
|
|
||||||
IPayDelivery interface {
|
|
||||||
Delivery(session IUserSession, pid string) (errdata *pb.ErrorData, items []*pb.UserAssets)
|
|
||||||
}
|
|
||||||
|
|
||||||
//实时Pvp
|
//实时Pvp
|
||||||
IPvp interface {
|
IPvp interface {
|
||||||
@ -586,7 +586,7 @@ type (
|
|||||||
}
|
}
|
||||||
//战令
|
//战令
|
||||||
IWarorder interface {
|
IWarorder interface {
|
||||||
Delivery(session IUserSession, pid string) (errdata *pb.ErrorData, items []*pb.UserAssets)
|
IPayDelivery
|
||||||
IActivityNotice
|
IActivityNotice
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,4 +616,9 @@ type (
|
|||||||
///红点
|
///红点
|
||||||
IGetReddot
|
IGetReddot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//购物中心
|
||||||
|
IShopcenter interface {
|
||||||
|
IPayDelivery
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
@ -33,7 +33,7 @@ func (this *apiComp) ClearCD(session comm.IUserSession, req *pb.PassonClearCDReq
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if errdata = this.module.DispenseRes(session, []*cfg.Gameatn{conf.Remake}, true); errdata != nil {
|
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{conf.Remake}, true); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ type Pay struct {
|
|||||||
modelActivity *modelActivityComp //活动礼包
|
modelActivity *modelActivityComp //活动礼包
|
||||||
privilege comm.IPayDelivery //月卡
|
privilege comm.IPayDelivery //月卡
|
||||||
warorder comm.IWarorder //战令
|
warorder comm.IWarorder //战令
|
||||||
|
shopcenter comm.IPayDelivery //购物中心
|
||||||
configure *configureComp
|
configure *configureComp
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +60,10 @@ func (this *Pay) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.warorder = module.(comm.IWarorder)
|
this.warorder = module.(comm.IWarorder)
|
||||||
|
if module, err = this.service.GetModule(comm.ModuleShopCenter); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.shopcenter = module.(comm.IPayDelivery)
|
||||||
this.service.RegisterFunctionName(string(comm.Rpc_ModulePayDelivery), this.Rpc_ModulePayDelivery)
|
this.service.RegisterFunctionName(string(comm.Rpc_ModulePayDelivery), this.Rpc_ModulePayDelivery)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -155,6 +160,12 @@ func (this *Pay) Rpc_ModulePayDelivery(ctx context.Context, args *pb.PayDelivery
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
case 6:
|
||||||
|
if errdata, items = this.shopcenter.Delivery(session, args.Productid); errdata != nil {
|
||||||
|
reply.Code = errdata.Code
|
||||||
|
return
|
||||||
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
for _, v := range res {
|
for _, v := range res {
|
||||||
items = append(items, &pb.UserAssets{A: v.A, T: v.T, N: v.N})
|
items = append(items, &pb.UserAssets{A: v.A, T: v.T, N: v.N})
|
||||||
@ -251,6 +262,10 @@ func (this *Pay) ModulePayDelivery(session comm.IUserSession, Productid string,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
case 6: //购物中心
|
||||||
|
if errdata, items = this.shopcenter.Delivery(session, Productid); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for _, v := range res {
|
for _, v := range res {
|
||||||
items = append(items, &pb.UserAssets{A: v.A, T: v.T, N: v.N})
|
items = append(items, &pb.UserAssets{A: v.A, T: v.T, N: v.N})
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package shopcenter
|
package shopcenter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
@ -20,6 +21,9 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
|||||||
fconf *cfg.GameShopCenterFundData
|
fconf *cfg.GameShopCenterFundData
|
||||||
info *pb.DBShopCenter
|
info *pb.DBShopCenter
|
||||||
item *pb.DBShopCenterItem
|
item *pb.DBShopCenterItem
|
||||||
|
user *pb.DBUser
|
||||||
|
drop int32
|
||||||
|
items []*cfg.Gameatn
|
||||||
ok bool
|
ok bool
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
@ -68,7 +72,14 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
|||||||
Message: "activity is close",
|
Message: "activity is close",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: "no found user!",
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
switch conf.Type {
|
switch conf.Type {
|
||||||
case 1:
|
case 1:
|
||||||
if pconf, err = this.module.configure.getGameShopCenterSubmeter(req.Pid); err != nil {
|
if pconf, err = this.module.configure.getGameShopCenterSubmeter(req.Pid); err != nil {
|
||||||
@ -88,6 +99,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
drop = pconf.Group
|
||||||
case 2, 3, 4, 5:
|
case 2, 3, 4, 5:
|
||||||
if fconf, err = this.module.configure.getGameShopCenterFund(req.Pid); err != nil {
|
if fconf, err = this.module.configure.getGameShopCenterFund(req.Pid); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
@ -98,27 +110,38 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if conf.Type == 2 { //等级基金
|
if conf.Type == 2 { //等级基金
|
||||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
if user.Lv < fconf.Unlock { //没有达到目标等级
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_ReqParameterError,
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||||
Message: "no found user!",
|
Message: "user lv no achieve",
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
if user.Lv < fconf.Unlock { //没有达到目标等级
|
|
||||||
errdata = &pb.ErrorData{
|
|
||||||
Code: pb.ErrorCode_ReqParameterError,
|
|
||||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
|
||||||
Message: "user lv no achieve",
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
drop = fconf.Group
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item.Record[req.Pid] = true
|
||||||
|
if items = this.module.ModuleTools.GetGroupDataByLottery(drop, user.Vip, user.Lv); len(items) == 0 {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
|
Message: fmt.Sprintf("掉落组未找到:%d", drop),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if errdata = this.module.DispenseRes(session, items, true); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err = this.module.modelshop.Change(session.GetUserId(), map[string]interface{}{
|
||||||
|
"item": item,
|
||||||
|
}); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
session.SendMsg(string(this.module.GetType()), "receive", &pb.ShopCenterReceiveResp{})
|
session.SendMsg(string(this.module.GetType()), "receive", &pb.ShopCenterReceiveResp{})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,19 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取活跃度奖励配置
|
||||||
|
func (this *configureComp) getGameShopCenterControls() (confs []*cfg.GameShopCenterControlData, err error) {
|
||||||
|
var (
|
||||||
|
v interface{}
|
||||||
|
)
|
||||||
|
if v, err = this.GetConfigure(game_shopcentercontrol); err != nil {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
confs = v.(*cfg.GameShopCenterControl).GetDataList()
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 获取活跃度奖励配置
|
// 获取活跃度奖励配置
|
||||||
func (this *configureComp) getGameShopCenterControl(fid int32) (conf *cfg.GameShopCenterControlData, err error) {
|
func (this *configureComp) getGameShopCenterControl(fid int32) (conf *cfg.GameShopCenterControlData, err error) {
|
||||||
var (
|
var (
|
||||||
|
@ -14,7 +14,8 @@ import (
|
|||||||
|
|
||||||
type ModelShop struct {
|
type ModelShop struct {
|
||||||
modules.MCompModel
|
modules.MCompModel
|
||||||
module *ShopCenter
|
module *ShopCenter
|
||||||
|
activitys map[int32]*pb.DBHuodong
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelShop) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *ModelShop) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package shopcenter
|
package shopcenter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ShopCenter struct {
|
type ShopCenter struct {
|
||||||
@ -62,3 +64,62 @@ func (this *ShopCenter) ActivityNotice(hdlist *pb.DBHuodong) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 发货
|
||||||
|
func (this *ShopCenter) Delivery(session comm.IUserSession, pid string) (errdata *pb.ErrorData, items []*pb.UserAssets) {
|
||||||
|
var (
|
||||||
|
confs []*cfg.GameShopCenterControlData
|
||||||
|
conf *cfg.GameShopCenterControlData
|
||||||
|
info *pb.DBShopCenter
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if confs, err = this.configure.getGameShopCenterControls(); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.String(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range confs {
|
||||||
|
if v.Point == pid {
|
||||||
|
conf = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if conf == nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.String(),
|
||||||
|
Message: fmt.Sprintf("no found Point:%s", pid),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if info, err = this.modelshop.getUserShopCenter(session.GetUserId()); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
info.Item[conf.Id] = &pb.DBShopCenterItem{
|
||||||
|
Id: conf.Id,
|
||||||
|
Vip: true,
|
||||||
|
Open: true,
|
||||||
|
Record: make(map[int32]bool),
|
||||||
|
}
|
||||||
|
items = make([]*pb.UserAssets, 0)
|
||||||
|
if err = this.modelshop.Change(session.GetUserId(), map[string]interface{}{
|
||||||
|
"item": info.Item,
|
||||||
|
}); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user