资源整理
This commit is contained in:
parent
f793d76503
commit
dcc921ff91
@ -150,8 +150,31 @@ func GetLotterConfById(id int32) (data *cfg.GameLotteryData) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type t20190107 struct {
|
||||||
|
v int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t t20190107) F() int {
|
||||||
|
return t.v
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t t20190107) A(a int) int {
|
||||||
|
return t.v + a
|
||||||
|
}
|
||||||
func Test_Main(t *testing.T) {
|
func Test_Main(t *testing.T) {
|
||||||
|
|
||||||
|
i := t20190107{678}
|
||||||
|
t1 := reflect.TypeOf(i)
|
||||||
|
for it := 0; it < t1.NumMethod(); it++ {
|
||||||
|
fmt.Println(t1.Method(it).Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
f1, _ := t1.MethodByName("F")
|
||||||
|
fmt.Println(f1.Name)
|
||||||
|
|
||||||
|
r := f1.Func.Call([]reflect.Value{reflect.ValueOf(i), reflect.ValueOf(1)})[0].Int()
|
||||||
|
fmt.Println(r)
|
||||||
|
|
||||||
sz := make(map[string]*pb.DBHero)
|
sz := make(map[string]*pb.DBHero)
|
||||||
fmt.Printf("%v", sz["1"])
|
fmt.Printf("%v", sz["1"])
|
||||||
hero := &pb.DBHero{}
|
hero := &pb.DBHero{}
|
||||||
|
@ -46,6 +46,7 @@ func (this *modelUserLog) AddUserLog(uid string, itype int32, tag string, data i
|
|||||||
jsonStr []byte
|
jsonStr []byte
|
||||||
logType string
|
logType string
|
||||||
)
|
)
|
||||||
|
|
||||||
if jsonStr, err = json.Marshal(data); err != nil {
|
if jsonStr, err = json.Marshal(data); err != nil {
|
||||||
log.Errorln(err)
|
log.Errorln(err)
|
||||||
return
|
return
|
||||||
|
@ -26,6 +26,8 @@ func (this *apiComp) MinerKey(session comm.IUserSession, req *pb.UiGameMinerKeyR
|
|||||||
var (
|
var (
|
||||||
atno []*pb.UserAtno
|
atno []*pb.UserAtno
|
||||||
res []*cfg.Gameatn
|
res []*cfg.Gameatn
|
||||||
|
conf *cfg.GameUiGameConsumData
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
list, _ := this.module.modelMiner.getMinerList(session.GetUserId(), req.Hdid)
|
list, _ := this.module.modelMiner.getMinerList(session.GetUserId(), req.Hdid)
|
||||||
if _, ok := list.Gotarr[req.Cid]; ok { // 重复拼图
|
if _, ok := list.Gotarr[req.Cid]; ok { // 重复拼图
|
||||||
@ -33,7 +35,7 @@ func (this *apiComp) MinerKey(session comm.IUserSession, req *pb.UiGameMinerKeyR
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 校验消耗
|
// 校验消耗
|
||||||
if conf, err := this.module.configure.GetMinerConsumConf(); err == nil {
|
if conf, err = this.module.configure.GetMinerConsumConf(); err == nil {
|
||||||
if conf.Cost.N > 0 {
|
if conf.Cost.N > 0 {
|
||||||
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{conf.Cost}, true); errdata != nil {
|
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{conf.Cost}, true); errdata != nil {
|
||||||
return
|
return
|
||||||
@ -62,6 +64,7 @@ func (this *apiComp) MinerKey(session comm.IUserSession, req *pb.UiGameMinerKeyR
|
|||||||
})
|
})
|
||||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||||
this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "UiGameMinerKeyReq", atno)
|
this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "UiGameMinerKeyReq", atno)
|
||||||
|
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "UiGameMinerKeyReq", conf.Cost)
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,10 @@ func (this *apiComp) PuzzleGrid(session comm.IUserSession, req *pb.UiGamePuzzleG
|
|||||||
return // 参数校验失败直接返回
|
return // 参数校验失败直接返回
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
|
conf *cfg.GameUiGameConsumData
|
||||||
atno []*pb.UserAtno
|
atno []*pb.UserAtno
|
||||||
res []*cfg.Gameatn
|
res []*cfg.Gameatn
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
list, _ := this.module.modelPuzzle.getPuzzleList(session.GetUserId(), req.Hdid)
|
list, _ := this.module.modelPuzzle.getPuzzleList(session.GetUserId(), req.Hdid)
|
||||||
if _, ok := list.Puzzle[req.Grid]; ok { // 重复拼图
|
if _, ok := list.Puzzle[req.Grid]; ok { // 重复拼图
|
||||||
@ -33,7 +35,7 @@ func (this *apiComp) PuzzleGrid(session comm.IUserSession, req *pb.UiGamePuzzleG
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 校验消耗
|
// 校验消耗
|
||||||
if conf, err := this.module.configure.GetPuzzleConsumConf(); err == nil {
|
if conf, err = this.module.configure.GetPuzzleConsumConf(); err == nil {
|
||||||
if conf.Cost.N > 0 {
|
if conf.Cost.N > 0 {
|
||||||
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{conf.Cost}, true); errdata != nil {
|
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{conf.Cost}, true); errdata != nil {
|
||||||
return
|
return
|
||||||
@ -68,6 +70,7 @@ func (this *apiComp) PuzzleGrid(session comm.IUserSession, req *pb.UiGamePuzzleG
|
|||||||
|
|
||||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||||
this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "UiGamePuzzleGridReq", atno)
|
this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "UiGamePuzzleGridReq", atno)
|
||||||
|
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "UiGamePuzzleGridReq", conf.Cost)
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,14 @@ func (this *apiComp) ChangeTipsCheck(session comm.IUserSession, req *pb.UserChan
|
|||||||
|
|
||||||
// 修改提示次数
|
// 修改提示次数
|
||||||
func (this *apiComp) ChangeTips(session comm.IUserSession, req *pb.UserChangeTipsReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) ChangeTips(session comm.IUserSession, req *pb.UserChangeTipsReq) (errdata *pb.ErrorData) {
|
||||||
|
var (
|
||||||
|
consume *cfg.Gameatn
|
||||||
|
)
|
||||||
update := make(map[string]interface{}, 0)
|
update := make(map[string]interface{}, 0)
|
||||||
if sign, err := this.module.modelSign.GetUserSign(session.GetUserId()); err == nil {
|
if sign, err := this.module.modelSign.GetUserSign(session.GetUserId()); err == nil {
|
||||||
|
|
||||||
if conf := this.module.ModuleTools.GetGlobalConf().DailyTips; conf.N > 0 {
|
if consume = this.module.ModuleTools.GetGlobalConf().DailyTips; consume.N > 0 {
|
||||||
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{conf}, true); errdata != nil {
|
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{consume}, true); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,6 +33,9 @@ func (this *apiComp) ChangeTips(session comm.IUserSession, req *pb.UserChangeTip
|
|||||||
session.SendMsg(string(this.module.GetType()), "changetips", &pb.UserChangeTipsResp{
|
session.SendMsg(string(this.module.GetType()), "changetips", &pb.UserChangeTipsResp{
|
||||||
Data: sign,
|
Data: sign,
|
||||||
})
|
})
|
||||||
|
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||||
|
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "UserChangeTipsReq", consume)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -98,6 +98,8 @@ func (this *apiComp) Modifyname(session comm.IUserSession, req *pb.UserModifynam
|
|||||||
|
|
||||||
//resp.Count = uint32(left)
|
//resp.Count = uint32(left)
|
||||||
this.sendMsg(session, UserSubTypeModifyName, resp)
|
this.sendMsg(session, UserSubTypeModifyName, resp)
|
||||||
|
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||||
|
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "UserModifynameReq", this.module.globalConf.ChangeName)
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -129,5 +129,16 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng
|
|||||||
BossId: req.BossId,
|
BossId: req.BossId,
|
||||||
Difficulty: req.Difficulty,
|
Difficulty: req.Difficulty,
|
||||||
})
|
})
|
||||||
|
if ps > 0 {
|
||||||
|
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||||
|
psAnt := &cfg.Gameatn{ // 构建一个atn 对象
|
||||||
|
A: "attr",
|
||||||
|
T: "ps",
|
||||||
|
N: ps,
|
||||||
|
}
|
||||||
|
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "VikingChallengeReq", psAnt)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ func (this *apiComp) BuyLv(session comm.IUserSession, req *pb.WarorderBuyLvReq)
|
|||||||
exp int32
|
exp int32
|
||||||
err error
|
err error
|
||||||
ok bool
|
ok bool
|
||||||
|
consum *cfg.Gameatn
|
||||||
)
|
)
|
||||||
if errdata = this.BuyLvCheck(session, req); errdata != nil {
|
if errdata = this.BuyLvCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
@ -73,7 +74,8 @@ func (this *apiComp) BuyLv(session comm.IUserSession, req *pb.WarorderBuyLvReq)
|
|||||||
|
|
||||||
need := this.module.ModuleTools.GetGlobalConf().Passcheck4GetLvCos
|
need := this.module.ModuleTools.GetGlobalConf().Passcheck4GetLvCos
|
||||||
lv := req.Lv - dwarorder.Lv
|
lv := req.Lv - dwarorder.Lv
|
||||||
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{{A: need.A, T: need.T, N: need.N * lv}}, true); errdata != nil {
|
consum = &cfg.Gameatn{A: need.A, T: need.T, N: need.N * lv}
|
||||||
|
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{consum}, true); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,5 +108,8 @@ func (this *apiComp) BuyLv(session comm.IUserSession, req *pb.WarorderBuyLvReq)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), "buylv", &pb.WarorderBuyLvResp{Rtype: req.Rtype, Lv: req.Lv, Info: dwarorder})
|
session.SendMsg(string(this.module.GetType()), "buylv", &pb.WarorderBuyLvResp{Rtype: req.Rtype, Lv: req.Lv, Info: dwarorder})
|
||||||
|
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||||
|
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "WarorderBuyLvReq", consum)
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,7 @@ func (this *apiComp) Exchange(session comm.IUserSession, req *pb.WTaskExchangeRe
|
|||||||
|
|
||||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||||
this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "WTaskExchangeReq", award)
|
this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "WTaskExchangeReq", award)
|
||||||
|
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "WTaskExchangeReq", money)
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -153,6 +153,7 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WTaskFinishReq) (
|
|||||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||||
this.module.ModuleSys.CheckOpenCond(session.Clone(), comm.OpencondTypeWorldtaskid, req.Tid)
|
this.module.ModuleSys.CheckOpenCond(session.Clone(), comm.OpencondTypeWorldtaskid, req.Tid)
|
||||||
this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "WTaskFinishReq", award)
|
this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "WTaskFinishReq", award)
|
||||||
|
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "WTaskFinishReq", conf.TaskendRemoveitem)
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user