优化日志

This commit is contained in:
wh_zcy 2023-03-06 18:05:28 +08:00
parent 91fd8382f7
commit 05344dfa81
4 changed files with 18 additions and 34 deletions

View File

@ -234,14 +234,14 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T
return return
} }
this.Debug("任务事件触发", // this.Debug("任务事件触发",
log.Field{Key: "uid", Value: uid}, // log.Field{Key: "uid", Value: uid},
log.Field{Key: "taskType", Value: rtaskType}, // log.Field{Key: "taskType", Value: rtaskType},
log.Field{Key: "params", Value: params}, // log.Field{Key: "params", Value: params},
) // )
var ( var (
err error // err error
condiId int32 // condiId int32
condis []*rtaskCondi condis []*rtaskCondi
) )
@ -264,11 +264,11 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T
return return
} }
if condiId, err = v.find(codiConf, params...); condiId == 0 { if condiId, _ := v.find(codiConf, params...); condiId != 0 {
if err != nil { // if err != nil {
this.Warnln(errors.WithMessage(err, uid).Error()) // this.Warnln(errors.WithMessage(err, uid).Error())
} // }
} else { // } else {
v.condId = codiConf.Id v.condId = codiConf.Id
condis = append(condis, v) condis = append(condis, v)
} }

View File

@ -2,8 +2,6 @@
package rtask package rtask
import ( import (
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"go_dreamfactory/sys/configure" "go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
@ -109,12 +107,12 @@ func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData
} }
err = this.Change(uid, update) err = this.Change(uid, update)
} }
log.Debug("累计次数更新", // log.Debug("累计次数更新",
log.Field{Key: "uid", Value: uid}, // log.Field{Key: "uid", Value: uid},
log.Field{Key: "condiId", Value: cfg.Id}, // log.Field{Key: "condiId", Value: cfg.Id},
log.Field{Key: "params", Value: vals}, // log.Field{Key: "params", Value: vals},
log.Field{Key: "updated", Value: record.Vals[cfg.Id]}, // log.Field{Key: "updated", Value: record.Vals[cfg.Id]},
) // )
return return
} }

View File

@ -154,7 +154,6 @@ func (this *ModelRtask) verifyRtype3(uid string, cfg *cfg.GameRdtaskCondiData) (
// 指定英雄等级 // 指定英雄等级
func (this *ModelRtask) verifyRtype4(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) { func (this *ModelRtask) verifyRtype4(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
defer printCondiLog(uid, cfg)
m, err := this.service.GetModule(comm.ModuleHero) m, err := this.service.GetModule(comm.ModuleHero)
if err != nil { if err != nil {
return return
@ -182,7 +181,6 @@ func (this *ModelRtask) verifyRtype4(uid string, cfg *cfg.GameRdtaskCondiData) (
// 指定英雄的指定装备数量 // 指定英雄的指定装备数量
func (this *ModelRtask) verifyRtype5(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) { func (this *ModelRtask) verifyRtype5(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
defer printCondiLog(uid, cfg)
m, err := this.service.GetModule(comm.ModuleHero) m, err := this.service.GetModule(comm.ModuleHero)
if err != nil { if err != nil {
return return
@ -220,7 +218,6 @@ func (this *ModelRtask) verifyRtype5(uid string, cfg *cfg.GameRdtaskCondiData) (
// 指定英雄星级 // 指定英雄星级
func (this *ModelRtask) verifyRtype6(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) { func (this *ModelRtask) verifyRtype6(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
defer printCondiLog(uid, cfg)
m, err := this.service.GetModule(comm.ModuleHero) m, err := this.service.GetModule(comm.ModuleHero)
if err != nil { if err != nil {
return return
@ -247,7 +244,6 @@ func (this *ModelRtask) verifyRtype6(uid string, cfg *cfg.GameRdtaskCondiData) (
// 日常登录一次 // 日常登录一次
func (this *ModelRtask) verfiyRtype7(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) { func (this *ModelRtask) verfiyRtype7(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
defer printCondiLog(uid, cfg)
userModule, err := this.service.GetModule(comm.ModuleUser) userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil { if err != nil {
return return
@ -263,7 +259,6 @@ func (this *ModelRtask) verfiyRtype7(uid string, cfg *cfg.GameRdtaskCondiData) (
// 累计登陆xx天 // 累计登陆xx天
func (this *ModelRtask) verfiyRtype8(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) { func (this *ModelRtask) verfiyRtype8(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
defer printCondiLog(uid, cfg)
userModule, err := this.service.GetModule(comm.ModuleUser) userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil { if err != nil {
return return
@ -281,7 +276,6 @@ func (this *ModelRtask) verfiyRtype8(uid string, cfg *cfg.GameRdtaskCondiData) (
// 连续登陆xx天 // 连续登陆xx天
func (this *ModelRtask) verfiyRtype9(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) { func (this *ModelRtask) verfiyRtype9(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
defer printCondiLog(uid, cfg)
userModule, err := this.service.GetModule(comm.ModuleUser) userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil { if err != nil {
return return
@ -299,7 +293,6 @@ func (this *ModelRtask) verfiyRtype9(uid string, cfg *cfg.GameRdtaskCondiData) (
// 拥有xx个好友 // 拥有xx个好友
func (this *ModelRtask) verfiyRtype10(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) { func (this *ModelRtask) verfiyRtype10(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
defer printCondiLog(uid, cfg)
m, err := this.service.GetModule(comm.ModuleFriend) m, err := this.service.GetModule(comm.ModuleFriend)
if err != nil { if err != nil {
return return
@ -314,7 +307,6 @@ func (this *ModelRtask) verfiyRtype10(uid string, cfg *cfg.GameRdtaskCondiData)
// 用户等级达到xx级 // 用户等级达到xx级
func (this *ModelRtask) verifyRtype20(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) { func (this *ModelRtask) verifyRtype20(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
defer printCondiLog(uid, cfg)
userModule, err := this.service.GetModule(comm.ModuleUser) userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil { if err != nil {
return return

View File

@ -11,8 +11,6 @@ import (
"go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
"time"
) )
var _ comm.ITask = (*ModuleTask)(nil) var _ comm.ITask = (*ModuleTask)(nil)
@ -59,10 +57,6 @@ func (this *ModuleTask) Start() (err error) {
// 初始化日常、周常、成就 // 初始化日常、周常、成就
func (this *ModuleTask) InitTaskAll(uid string) { func (this *ModuleTask) InitTaskAll(uid string) {
t := configure.Now()
defer func() {
log.Debugf("初始化任务 耗时:%v", time.Since(t))
}()
this.modelTask.initTask(uid, comm.TASK_DAILY) this.modelTask.initTask(uid, comm.TASK_DAILY)
this.modelTask.initTask(uid, comm.TASK_WEEKLY) this.modelTask.initTask(uid, comm.TASK_WEEKLY)
this.modelTask.initTask(uid, comm.TASK_ACHIEVE) this.modelTask.initTask(uid, comm.TASK_ACHIEVE)