资源整理

This commit is contained in:
meixiongfeng 2023-12-01 17:33:30 +08:00
parent f793d76503
commit dcc921ff91
10 changed files with 62 additions and 7 deletions

View File

@ -150,8 +150,31 @@ func GetLotterConfById(id int32) (data *cfg.GameLotteryData) {
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) {
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)
fmt.Printf("%v", sz["1"])
hero := &pb.DBHero{}

View File

@ -46,6 +46,7 @@ func (this *modelUserLog) AddUserLog(uid string, itype int32, tag string, data i
jsonStr []byte
logType string
)
if jsonStr, err = json.Marshal(data); err != nil {
log.Errorln(err)
return

View File

@ -26,6 +26,8 @@ func (this *apiComp) MinerKey(session comm.IUserSession, req *pb.UiGameMinerKeyR
var (
atno []*pb.UserAtno
res []*cfg.Gameatn
conf *cfg.GameUiGameConsumData
err error
)
list, _ := this.module.modelMiner.getMinerList(session.GetUserId(), req.Hdid)
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 errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{conf.Cost}, true); errdata != nil {
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) {
this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "UiGameMinerKeyReq", atno)
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "UiGameMinerKeyReq", conf.Cost)
})
return
}

View File

@ -24,8 +24,10 @@ func (this *apiComp) PuzzleGrid(session comm.IUserSession, req *pb.UiGamePuzzleG
return // 参数校验失败直接返回
}
var (
conf *cfg.GameUiGameConsumData
atno []*pb.UserAtno
res []*cfg.Gameatn
err error
)
list, _ := this.module.modelPuzzle.getPuzzleList(session.GetUserId(), req.Hdid)
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 errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{conf.Cost}, true); errdata != nil {
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) {
this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "UiGamePuzzleGridReq", atno)
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "UiGamePuzzleGridReq", conf.Cost)
})
return
}

View File

@ -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) {
var (
consume *cfg.Gameatn
)
update := make(map[string]interface{}, 0)
if sign, err := this.module.modelSign.GetUserSign(session.GetUserId()); err == nil {
if conf := this.module.ModuleTools.GetGlobalConf().DailyTips; conf.N > 0 {
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{conf}, true); errdata != nil {
if consume = this.module.ModuleTools.GetGlobalConf().DailyTips; consume.N > 0 {
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{consume}, true); errdata != nil {
return
}
}
@ -31,6 +33,9 @@ func (this *apiComp) ChangeTips(session comm.IUserSession, req *pb.UserChangeTip
session.SendMsg(string(this.module.GetType()), "changetips", &pb.UserChangeTipsResp{
Data: sign,
})
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "UserChangeTipsReq", consume)
})
}
return

View File

@ -98,6 +98,8 @@ func (this *apiComp) Modifyname(session comm.IUserSession, req *pb.UserModifynam
//resp.Count = uint32(left)
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
}

View File

@ -129,5 +129,16 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng
BossId: req.BossId,
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
}

View File

@ -22,6 +22,7 @@ func (this *apiComp) BuyLv(session comm.IUserSession, req *pb.WarorderBuyLvReq)
exp int32
err error
ok bool
consum *cfg.Gameatn
)
if errdata = this.BuyLvCheck(session, req); errdata != nil {
return
@ -73,7 +74,8 @@ func (this *apiComp) BuyLv(session comm.IUserSession, req *pb.WarorderBuyLvReq)
need := this.module.ModuleTools.GetGlobalConf().Passcheck4GetLvCos
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
}
@ -106,5 +108,8 @@ func (this *apiComp) BuyLv(session comm.IUserSession, req *pb.WarorderBuyLvReq)
return
}
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
}

View File

@ -88,6 +88,7 @@ func (this *apiComp) Exchange(session comm.IUserSession, req *pb.WTaskExchangeRe
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.GMResDelType, "WTaskExchangeReq", money)
})
return
}

View File

@ -153,6 +153,7 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WTaskFinishReq) (
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
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.GMResDelType, "WTaskFinishReq", conf.TaskendRemoveitem)
})
return
}