上传充值月卡问题
This commit is contained in:
parent
01202296ee
commit
356c42614e
@ -20,11 +20,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
itemuse_nouse int32 = 1 //不可使用
|
itemuse_nouse int32 = 1 //不可使用
|
||||||
itemuse_jump int32 = 2 //跳转
|
itemuse_jump int32 = 2 //跳转
|
||||||
itemuse_exchange int32 = 3 //合成/分解(体力,兑换)
|
itemuse_exchange int32 = 3 //合成/分解(体力,兑换)
|
||||||
itemuse_optionalbox int32 = 4 //自选宝箱
|
itemuse_optionalbox int32 = 4 //自选宝箱
|
||||||
itemuse_randombox int32 = 5 //随机宝箱
|
itemuse_randombox int32 = 5 //随机宝箱
|
||||||
|
itemuse_staminapotion int32 = 6 //体力药剂使用
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -35,7 +36,7 @@ var (
|
|||||||
GirdAmountUpper = errors.New("grid amount upper!") //格子容量达到上限
|
GirdAmountUpper = errors.New("grid amount upper!") //格子容量达到上限
|
||||||
)
|
)
|
||||||
|
|
||||||
//随机权重宝箱
|
// 随机权重宝箱
|
||||||
func RandomProps(group []*cfg.GameDropData) (prop *cfg.GameDropData) {
|
func RandomProps(group []*cfg.GameDropData) (prop *cfg.GameDropData) {
|
||||||
if group == nil || len(group) == 0 {
|
if group == nil || len(group) == 0 {
|
||||||
return
|
return
|
||||||
|
@ -771,6 +771,49 @@ func (this *ModelItemsComp) useitem(session comm.IUserSession, gid string, amoun
|
|||||||
if errdata = this.module.DispenseRes(session, sale, true); errdata != nil {
|
if errdata = this.module.DispenseRes(session, sale, true); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
case itemuse_staminapotion: //体力药剂使用
|
||||||
|
if itemcf.DecomposeGet == nil || len(itemcf.DecomposeGet) == 0 {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
|
Message: fmt.Sprintf("道具分解未配置! 道具id:%s ", itemcf.Id),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if itemcf.SynthetizeNum*int32(amount) > int32(item.Amount) { //碎片数量不够
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ItemsNoEnough,
|
||||||
|
Title: pb.ErrorCode_ItemsNoEnough.ToString(),
|
||||||
|
Message: fmt.Sprintf("道具Id:%s", itemcf.Id),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
sale := make([]*cfg.Gameatn, 0, len(itemcf.DecomposeDeplete))
|
||||||
|
for _, v := range itemcf.DecomposeDeplete {
|
||||||
|
sale = append(sale, &cfg.Gameatn{
|
||||||
|
A: v.A,
|
||||||
|
T: v.T,
|
||||||
|
N: v.N * int32(amount),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if errdata = this.module.ConsumeRes(session, sale, true); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if errdata = this.module.AddItemforGrid(session, gid, -1*int32(amount), true); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
sale = make([]*cfg.Gameatn, len(itemcf.Sale))
|
||||||
|
for i, v := range itemcf.DecomposeGet {
|
||||||
|
temp := *v
|
||||||
|
sale[i] = &temp
|
||||||
|
sale[i].N = v.N * int32(amount)
|
||||||
|
}
|
||||||
|
if errdata = this.module.DispenseRes(session, sale, true); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ItemsUseNotSupported,
|
Code: pb.ErrorCode_ItemsUseNotSupported,
|
||||||
|
@ -8,13 +8,13 @@ import (
|
|||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
)
|
)
|
||||||
|
|
||||||
//参数校验
|
// 参数校验
|
||||||
func (this *apiComp) DeliveryCheck(session comm.IUserSession, req *pb.PayDeliveryReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) DeliveryCheck(session comm.IUserSession, req *pb.PayDeliveryReq) (errdata *pb.ErrorData) {
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
///模拟充值
|
// /模拟充值
|
||||||
func (this *apiComp) Delivery(session comm.IUserSession, req *pb.PayDeliveryReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) Delivery(session comm.IUserSession, req *pb.PayDeliveryReq) (errdata *pb.ErrorData) {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
|
@ -17,7 +17,7 @@ const (
|
|||||||
game_privilege = "game_privilege.json"
|
game_privilege = "game_privilege.json"
|
||||||
)
|
)
|
||||||
|
|
||||||
///背包配置管理组件
|
// /背包配置管理组件
|
||||||
type configureComp struct {
|
type configureComp struct {
|
||||||
modules.MCompConfigure
|
modules.MCompConfigure
|
||||||
module *Privilege
|
module *Privilege
|
||||||
@ -25,7 +25,7 @@ type configureComp struct {
|
|||||||
_privilegeMap map[int32]map[int32]int32
|
_privilegeMap map[int32]map[int32]int32
|
||||||
}
|
}
|
||||||
|
|
||||||
//组件初始化接口
|
// 组件初始化接口
|
||||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
this.MCompConfigure.Init(service, module, comp, options)
|
this.MCompConfigure.Init(service, module, comp, options)
|
||||||
this.module = module.(*Privilege)
|
this.module = module.(*Privilege)
|
||||||
@ -58,7 +58,7 @@ func (this *configureComp) GetPrivilegeCard(id string) (data *cfg.GamePrivilegeC
|
|||||||
v interface{}
|
v interface{}
|
||||||
)
|
)
|
||||||
if v, err = this.GetConfigure(game_privilegecard); err == nil {
|
if v, err = this.GetConfigure(game_privilegecard); err == nil {
|
||||||
if configure, ok := v.(*cfg.GamePrivilegeCard); !ok {
|
if configure, ok := v.(*cfg.GamePrivilegeCard); ok {
|
||||||
if data = configure.Get(id); data != nil {
|
if data = configure.Get(id); data != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user