上传代码
This commit is contained in:
parent
cafc95a48b
commit
bf8bd075ac
@ -98,6 +98,7 @@ const (
|
||||
ModuleStone core.M_Modules = "stonehenge" //巨石秘境
|
||||
ModuleKFTask core.M_Modules = "kftask" //开服任务
|
||||
ModuleHeroTask core.M_Modules = "herotask" //守护者任务
|
||||
ModuleShopCenter core.M_Modules = "shopcenter" //购物中心
|
||||
)
|
||||
|
||||
// 数据表名定义处
|
||||
|
@ -26,6 +26,10 @@ type (
|
||||
IActivityNotice interface {
|
||||
ActivityNotice(hdlist *pb.DBHuodong)
|
||||
}
|
||||
//支付发布接口
|
||||
IPayDelivery interface {
|
||||
Delivery(session IUserSession, pId string) (errdata *pb.ErrorData, items []*pb.UserAssets)
|
||||
}
|
||||
)
|
||||
|
||||
/*
|
||||
@ -396,7 +400,7 @@ type (
|
||||
}
|
||||
IPrivilege interface {
|
||||
// 创建一个新的特权卡
|
||||
Delivery(session IUserSession, pId string) (errdata *pb.ErrorData, items []*pb.UserAssets)
|
||||
IPayDelivery
|
||||
// 续费特权卡
|
||||
RenewPrivilegeCard(session IUserSession, cId string) (errdata *pb.ErrorData)
|
||||
// 检查特权 参数 计费点 返回值 是否有特权
|
||||
@ -465,10 +469,6 @@ type (
|
||||
ModulePayDelivery(session IUserSession, Productid string, Price int32) (errdata *pb.ErrorData)
|
||||
IActivityNotice
|
||||
}
|
||||
//支付发货
|
||||
IPayDelivery interface {
|
||||
Delivery(session IUserSession, pid string) (errdata *pb.ErrorData, items []*pb.UserAssets)
|
||||
}
|
||||
|
||||
//实时Pvp
|
||||
IPvp interface {
|
||||
@ -586,7 +586,7 @@ type (
|
||||
}
|
||||
//战令
|
||||
IWarorder interface {
|
||||
Delivery(session IUserSession, pid string) (errdata *pb.ErrorData, items []*pb.UserAssets)
|
||||
IPayDelivery
|
||||
IActivityNotice
|
||||
}
|
||||
|
||||
@ -616,4 +616,9 @@ type (
|
||||
///红点
|
||||
IGetReddot
|
||||
}
|
||||
|
||||
//购物中心
|
||||
IShopcenter interface {
|
||||
IPayDelivery
|
||||
}
|
||||
)
|
||||
|
@ -33,7 +33,7 @@ func (this *apiComp) ClearCD(session comm.IUserSession, req *pb.PassonClearCDReq
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ type Pay struct {
|
||||
modelActivity *modelActivityComp //活动礼包
|
||||
privilege comm.IPayDelivery //月卡
|
||||
warorder comm.IWarorder //战令
|
||||
shopcenter comm.IPayDelivery //购物中心
|
||||
configure *configureComp
|
||||
}
|
||||
|
||||
@ -59,6 +60,10 @@ func (this *Pay) Start() (err error) {
|
||||
return
|
||||
}
|
||||
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)
|
||||
return
|
||||
}
|
||||
@ -155,6 +160,12 @@ func (this *Pay) Rpc_ModulePayDelivery(ctx context.Context, args *pb.PayDelivery
|
||||
return
|
||||
}
|
||||
break
|
||||
case 6:
|
||||
if errdata, items = this.shopcenter.Delivery(session, args.Productid); errdata != nil {
|
||||
reply.Code = errdata.Code
|
||||
return
|
||||
}
|
||||
break
|
||||
}
|
||||
for _, v := range res {
|
||||
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
|
||||
}
|
||||
break
|
||||
case 6: //购物中心
|
||||
if errdata, items = this.shopcenter.Delivery(session, Productid); errdata != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
for _, v := range res {
|
||||
items = append(items, &pb.UserAssets{A: v.A, T: v.T, N: v.N})
|
||||
|
@ -1,6 +1,7 @@
|
||||
package shopcenter
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -20,6 +21,9 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
||||
fconf *cfg.GameShopCenterFundData
|
||||
info *pb.DBShopCenter
|
||||
item *pb.DBShopCenterItem
|
||||
user *pb.DBUser
|
||||
drop int32
|
||||
items []*cfg.Gameatn
|
||||
ok bool
|
||||
err error
|
||||
)
|
||||
@ -68,7 +72,14 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
||||
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 {
|
||||
case 1:
|
||||
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
|
||||
}
|
||||
drop = pconf.Group
|
||||
case 2, 3, 4, 5:
|
||||
if fconf, err = this.module.configure.getGameShopCenterFund(req.Pid); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -98,14 +110,6 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
||||
return
|
||||
}
|
||||
if conf.Type == 2 { //等级基金
|
||||
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
|
||||
} else {
|
||||
if user.Lv < fconf.Unlock { //没有达到目标等级
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
@ -114,11 +118,30 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.ShopCenterReceiv
|
||||
}
|
||||
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{})
|
||||
return
|
||||
}
|
||||
|
@ -33,6 +33,19 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
||||
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) {
|
||||
var (
|
||||
|
@ -15,6 +15,7 @@ import (
|
||||
type ModelShop struct {
|
||||
modules.MCompModel
|
||||
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) {
|
||||
|
@ -1,10 +1,12 @@
|
||||
package shopcenter
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
type ShopCenter struct {
|
||||
@ -62,3 +64,62 @@ func (this *ShopCenter) ActivityNotice(hdlist *pb.DBHuodong) {
|
||||
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