上传底层资源接口
This commit is contained in:
parent
fd45636a30
commit
d4f1df7e77
@ -646,17 +646,28 @@ func (this *ModuleBase) Panicln(args ...interface{}) {
|
|||||||
// 发放资源
|
// 发放资源
|
||||||
func (this *ModuleBase) DispenseAtno(session comm.IUserSession, res []*cfg.Gameatn, bPush bool) (errdata *pb.ErrorData, atno []*pb.UserAtno) {
|
func (this *ModuleBase) DispenseAtno(session comm.IUserSession, res []*cfg.Gameatn, bPush bool) (errdata *pb.ErrorData, atno []*pb.UserAtno) {
|
||||||
var (
|
var (
|
||||||
items map[string]int32 // 道具背包 批量处理
|
items map[string]int32 // 道具背包 批量处理
|
||||||
heros map[string]int32 // 英雄
|
heros map[string]int32 // 英雄
|
||||||
attrs map[string]int32 // 属性
|
attrs map[string]int32 // 属性
|
||||||
equips map[string]uint32 // 装备
|
equips map[string]uint32 // 装备
|
||||||
vip map[string]int32 // vip
|
vip map[string]int32 // vip
|
||||||
|
atlas map[string]int32 // 铁匠铺资源
|
||||||
|
panda map[string]int32 // 熊猫武馆资源
|
||||||
|
mts map[string]int32 // 捕羊大赛资源
|
||||||
|
per map[string]int32 // 捕羊大赛资源
|
||||||
|
equipschange []*pb.DB_Equipment
|
||||||
|
heroschange []*pb.UserAtno
|
||||||
|
itemschange []*pb.UserAtno
|
||||||
)
|
)
|
||||||
items = make(map[string]int32, 0)
|
items = make(map[string]int32, 0)
|
||||||
heros = make(map[string]int32, 0)
|
heros = make(map[string]int32, 0)
|
||||||
attrs = make(map[string]int32, 0)
|
attrs = make(map[string]int32, 0)
|
||||||
equips = make(map[string]uint32, 0)
|
equips = make(map[string]uint32, 0)
|
||||||
vip = make(map[string]int32, 0)
|
vip = make(map[string]int32, 0)
|
||||||
|
atlas = make(map[string]int32, 0)
|
||||||
|
panda = make(map[string]int32, 0)
|
||||||
|
mts = make(map[string]int32, 0)
|
||||||
|
per = make(map[string]int32, 0)
|
||||||
|
|
||||||
for _, v := range res {
|
for _, v := range res {
|
||||||
switch v.A {
|
switch v.A {
|
||||||
@ -672,38 +683,52 @@ func (this *ModuleBase) DispenseAtno(session comm.IUserSession, res []*cfg.Gamea
|
|||||||
}
|
}
|
||||||
case comm.VipType:
|
case comm.VipType:
|
||||||
vip[v.T] += v.N
|
vip[v.T] += v.N
|
||||||
|
case comm.AtlasType:
|
||||||
|
atlas[v.T] = 1
|
||||||
|
case comm.PandaType:
|
||||||
|
panda[v.T] = 1
|
||||||
|
case comm.MountsType:
|
||||||
|
mts[v.T] = 1
|
||||||
|
case comm.PerType:
|
||||||
|
per[v.T] = 1
|
||||||
default:
|
default:
|
||||||
this.Error("not found res type", log.Field{Key: "Type", Value: v.A}) // 找不到资源类型
|
this.Error("not found res type", log.Field{Key: "Type", Value: v.A}) // 找不到资源类型
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(attrs) > 0 { //用户属性资源
|
if len(attrs) > 0 { //用户属性资源
|
||||||
errdata = this.ModuleUser.AddAttributeValues(session, attrs, bPush)
|
if errdata = this.ModuleUser.AddAttributeValues(session, attrs, bPush); errdata != nil {
|
||||||
this.Debugf("发放用户资源: %v [%v]", attrs, errdata)
|
return
|
||||||
|
}
|
||||||
for k, v := range attrs {
|
for k, v := range attrs {
|
||||||
atno = append(atno, &pb.UserAtno{
|
atno = append(atno, &pb.UserAtno{
|
||||||
A: "attr",
|
A: comm.AttrType,
|
||||||
T: k,
|
T: k,
|
||||||
N: v,
|
N: v,
|
||||||
O: "",
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
this.Debugf("发放用户资源: %v errdata: %v", attrs, errdata)
|
||||||
|
|
||||||
}
|
}
|
||||||
if len(items) > 0 { //道具资源
|
if len(items) > 0 { //道具资源
|
||||||
_atno, code := this.ModuleItems.AddItems(session, items, bPush)
|
if itemschange, errdata = this.ModuleItems.AddItems(session, items, bPush); errdata != nil {
|
||||||
errdata = code
|
return
|
||||||
atno = append(atno, _atno...)
|
}
|
||||||
this.Debugf("发放道具资源: %v [%v]", _atno, code)
|
atno = append(atno, itemschange...)
|
||||||
|
this.Debugf("发放道具资源: %v errdata: %v", items, errdata)
|
||||||
}
|
}
|
||||||
if len(heros) > 0 { //卡片资源
|
if len(heros) > 0 { //卡片资源
|
||||||
hero, atn, code := this.ModuleHero.CreateRepeatHeros(session, heros, bPush)
|
if _, heroschange, errdata = this.ModuleHero.CreateRepeatHeros(session, heros, bPush); errdata != nil {
|
||||||
this.Debugf("发放英雄资源: %v [%v]", hero, code)
|
return
|
||||||
atno = append(atno, atn...)
|
}
|
||||||
|
atno = append(atno, heroschange...)
|
||||||
|
this.Debugf("发放英雄资源: %v errdata: %v", heros, errdata)
|
||||||
}
|
}
|
||||||
if len(equips) > 0 {
|
if len(equips) > 0 {
|
||||||
change, code := this.ModuleEquipment.AddNewEquipments(session, equips, bPush)
|
if equipschange, errdata = this.ModuleEquipment.AddNewEquipments(session, equips, bPush); errdata != nil {
|
||||||
this.Debugf("发放装备资源: %v [%v]", equips, code)
|
return
|
||||||
for _, v := range change {
|
}
|
||||||
|
for _, v := range equipschange {
|
||||||
atno = append(atno, &pb.UserAtno{
|
atno = append(atno, &pb.UserAtno{
|
||||||
A: "equi",
|
A: "equi",
|
||||||
T: v.CId,
|
T: v.CId,
|
||||||
@ -711,13 +736,72 @@ func (this *ModuleBase) DispenseAtno(session comm.IUserSession, res []*cfg.Gamea
|
|||||||
O: v.Id,
|
O: v.Id,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
this.Debugf("发放装备资源: %v errdata: %v", equips, errdata)
|
||||||
}
|
}
|
||||||
if len(vip) > 0 { //卡片资源
|
if len(vip) > 0 { //卡片资源
|
||||||
for k := range vip {
|
for k := range vip {
|
||||||
errdata, _ = this.ModulePrivilege.Delivery(session, k)
|
errdata, _ = this.ModulePrivilege.Delivery(session, k)
|
||||||
this.Debugf("发放月卡资源: %v [%v]", k, errdata)
|
this.Debugf("发放月卡资源: %v errdata: %v", k, errdata)
|
||||||
}
|
}
|
||||||
|
for k, v := range vip {
|
||||||
|
atno = append(atno, &pb.UserAtno{
|
||||||
|
A: comm.VipType,
|
||||||
|
T: k,
|
||||||
|
N: v,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(atlas) > 0 {
|
||||||
|
for k := range atlas {
|
||||||
|
this.ModuleSmithy.CheckActivateAtlasCollect(session.GetUserId(), k)
|
||||||
|
this.Debugf("发放图鉴资源: %v errdata: %v", k, errdata)
|
||||||
|
}
|
||||||
|
for k, v := range atlas {
|
||||||
|
atno = append(atno, &pb.UserAtno{
|
||||||
|
A: comm.AtlasType,
|
||||||
|
T: k,
|
||||||
|
N: v,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(panda) > 0 {
|
||||||
|
if errdata = this.ModulePractice.AddItems(session, panda, bPush); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for k, v := range panda {
|
||||||
|
atno = append(atno, &pb.UserAtno{
|
||||||
|
A: comm.PandaType,
|
||||||
|
T: k,
|
||||||
|
N: v,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.Debugf("发放武馆资源: %v errdata: %v", panda, errdata)
|
||||||
|
}
|
||||||
|
if len(mts) > 0 {
|
||||||
|
if errdata = this.ModuleParkour.AddMounts(session, mts, bPush); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for k, v := range mts {
|
||||||
|
atno = append(atno, &pb.UserAtno{
|
||||||
|
A: comm.MountsType,
|
||||||
|
T: k,
|
||||||
|
N: v,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.Debugf("发放捕羊大赛资源: %v errdata: %v", mts, errdata)
|
||||||
|
}
|
||||||
|
if len(per) > 0 {
|
||||||
|
if errdata = this.ModuleUser.AddPer(session, per, bPush); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for k, v := range per {
|
||||||
|
atno = append(atno, &pb.UserAtno{
|
||||||
|
A: comm.PerType,
|
||||||
|
T: k,
|
||||||
|
N: v,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.Debugf("发放用户皮肤资源资源: %v errdata: %v", mts, errdata)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user