diff --git a/cmd/v2/ui/views/sociaty_mine.go b/cmd/v2/ui/views/sociaty_mine.go index e95c2dc53..074c1c80e 100644 --- a/cmd/v2/ui/views/sociaty_mine.go +++ b/cmd/v2/ui/views/sociaty_mine.go @@ -180,6 +180,10 @@ func (this *SociatyMineView) CreateView(t *model.TestCase) fyne.CanvasObject { return } + if this.master == nil { + logrus.Errorf("会长数据是空,公会ID:%v", this.sociaty.Id) + return + } //会长信息 pName := widget.NewEntry() pName.Text = this.master.Name diff --git a/modules/dispatch/model_dispatch.go b/modules/dispatch/model_dispatch.go index cd0dc6b11..b42e1fc12 100644 --- a/modules/dispatch/model_dispatch.go +++ b/modules/dispatch/model_dispatch.go @@ -427,6 +427,7 @@ func (this *modelDispatch) updateNotice(uid string, dispatch *pb.DBDispatch) err } if nextConf != nil { dispatch.Nb.Lv++ + dispatch.Nb.TaskCount = 0 } } //累计任务数 diff --git a/modules/practice/api_expulsion.go b/modules/practice/api_expulsion.go index 4a741e3ac..9d383dad5 100644 --- a/modules/practice/api_expulsion.go +++ b/modules/practice/api_expulsion.go @@ -30,6 +30,7 @@ func (this *apiComp) Expulsion(session comm.IUserSession, req *pb.PracticeExpuls tconfigure *cfg.GamePandamasJxData pconfigure *cfg.GamePandamasJxData _session comm.IUserSession + minutes int32 filed string exp int32 exp1 int32 @@ -66,10 +67,10 @@ func (this *apiComp) Expulsion(session comm.IUserSession, req *pb.PracticeExpuls //计算经验收益 if configure.Now().After(time.Unix(pillar.Expend, 0)) { - minutes := int32(time.Unix(pillar.Expend, 0).Sub(time.Unix(pillar.Start, 0)).Minutes()) + minutes = int32(time.Unix(pillar.Expend, 0).Sub(time.Unix(pillar.Start, 0)).Minutes()) exp = minutes * pillarconfigure.MinExp } else { - minutes := int32(configure.Now().Sub(time.Unix(pillar.Start, 0)).Minutes()) + minutes = int32(configure.Now().Sub(time.Unix(pillar.Start, 0)).Minutes()) exp = minutes * pillarconfigure.MinExp } exp1 += exp @@ -83,7 +84,7 @@ func (this *apiComp) Expulsion(session comm.IUserSession, req *pb.PracticeExpuls if hero, code := this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), pillar.Hero); code == pb.ErrorCode_Success { if heroconf := this.module.configure.GetHeroConfig(hero.HeroID); heroconf != nil { if (conf.Camp == 0 || (conf.Camp != 0 && heroconf.Race == conf.Camp)) && (conf.Occupation == 0 || (conf.Occupation != 0 && heroconf.Job == conf.Occupation)) { - exp1 += int32(math.Floor(float64(v/conf.Register) * float64(conf.ExpBonus) / float64(100) * float64(exp))) + exp1 += minutes * int32(math.Floor(float64(v/conf.Register)*float64(conf.ExpBonus))) * exp } } } diff --git a/modules/practice/api_receive.go b/modules/practice/api_receive.go index 093cc1c5e..950edb73e 100644 --- a/modules/practice/api_receive.go +++ b/modules/practice/api_receive.go @@ -29,6 +29,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR pillarconfigure *cfg.GamePandamasMzData tconfigure *cfg.GamePandamasJxData pconfigure *cfg.GamePandamasJxData + minutes int32 filed string exp int32 exp1 int32 @@ -93,10 +94,10 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR } //计算经验收益 if configure.Now().After(time.Unix(pillar.Expend, 0)) { - minutes := int32(time.Unix(pillar.Expend, 0).Sub(time.Unix(pillar.Start, 0)).Minutes()) + minutes = int32(time.Unix(pillar.Expend, 0).Sub(time.Unix(pillar.Start, 0)).Minutes()) exp = minutes * pillarconfigure.MinExp } else { - minutes := int32(configure.Now().Sub(time.Unix(pillar.Start, 0)).Minutes()) + minutes = int32(configure.Now().Sub(time.Unix(pillar.Start, 0)).Minutes()) exp = minutes * pillarconfigure.MinExp } exp1 += exp @@ -110,7 +111,8 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR if hero, code := this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), pillar.Hero); code == pb.ErrorCode_Success { if heroconf := this.module.configure.GetHeroConfig(hero.HeroID); heroconf != nil { if (conf.Camp == 0 || (conf.Camp != 0 && heroconf.Race == conf.Camp)) && (conf.Occupation == 0 || (conf.Occupation != 0 && heroconf.Job == conf.Occupation)) { - exp1 += int32(math.Floor(float64(v/conf.Register) * float64(conf.ExpBonus) / float64(100) * float64(exp))) + // exp1 += int32(math.Floor(float64(v/conf.Register) * float64(conf.ExpBonus) / float64(100) * float64(exp))) + exp1 += minutes * int32(math.Floor(float64(v/conf.Register)*float64(conf.ExpBonus))) * exp } } } diff --git a/modules/reddot/api_get.go b/modules/reddot/api_get.go index 99e7c1b77..77867a99b 100644 --- a/modules/reddot/api_get.go +++ b/modules/reddot/api_get.go @@ -49,10 +49,10 @@ func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (code for k, v := range this.module.arena.Reddot(session, _rid) { reddot[int32(k)] = v } - case comm.Reddot23, comm.Reddot24, comm.Reddot25: - for k, v := range this.module.martialhall.Reddot(session, _rid) { - reddot[int32(k)] = v - } + // case comm.Reddot23, comm.Reddot24, comm.Reddot25: + // for k, v := range this.module.martialhall.Reddot(session, _rid) { + // reddot[int32(k)] = v + // } case comm.Reddot20, comm.Reddot21, comm.Reddot22: for k, v := range this.module.gourmet.Reddot(session, _rid) { reddot[int32(k)] = v diff --git a/modules/reddot/api_getall.go b/modules/reddot/api_getall.go index bf19a8792..384be0dc3 100644 --- a/modules/reddot/api_getall.go +++ b/modules/reddot/api_getall.go @@ -34,9 +34,9 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq) for k, v := range this.module.horoscope.Reddot(session, comm.Reddot17) { reddot[int32(k)] = v } - for k, v := range this.module.martialhall.Reddot(session, comm.Reddot23, comm.Reddot24, comm.Reddot25) { - reddot[int32(k)] = v - } + // for k, v := range this.module.martialhall.Reddot(session, comm.Reddot23, comm.Reddot24, comm.Reddot25) { + // reddot[int32(k)] = v + // } for k, v := range this.module.arena.Reddot(session, comm.Reddot19) { reddot[int32(k)] = v } diff --git a/modules/reddot/module.go b/modules/reddot/module.go index e5939c342..1c0da7f11 100644 --- a/modules/reddot/module.go +++ b/modules/reddot/module.go @@ -21,17 +21,17 @@ type Reddot struct { modules.ModuleBase service base.IRPCXService - pagoda comm.IPagoda - martialhall comm.IMartialhall - horoscope comm.IHoroscope - arena comm.IArena - gourmet comm.IGourmet - sociaty comm.ISociaty - mail comm.Imail - viking comm.IViking - hunting comm.IHunting - api_comp *apiComp - mline comm.IMline + pagoda comm.IPagoda + // martialhall comm.IMartialhall + horoscope comm.IHoroscope + arena comm.IArena + gourmet comm.IGourmet + sociaty comm.ISociaty + mail comm.Imail + viking comm.IViking + hunting comm.IHunting + api_comp *apiComp + mline comm.IMline } //模块名 @@ -56,10 +56,10 @@ func (this *Reddot) Start() (err error) { return } this.pagoda = module.(comm.IPagoda) - if module, err = this.service.GetModule(comm.ModuleMartialhall); err != nil { - return - } - this.martialhall = module.(comm.IMartialhall) + // if module, err = this.service.GetModule(comm.ModuleMartialhall); err != nil { + // return + // } + // this.martialhall = module.(comm.IMartialhall) if module, err = this.service.GetModule(comm.ModuleHoroscope); err != nil { return } diff --git a/modules/user/model_session.go b/modules/user/model_session.go index 4f17209e6..8a83231f7 100644 --- a/modules/user/model_session.go +++ b/modules/user/model_session.go @@ -31,7 +31,7 @@ func (this *ModelSession) Start() (err error) { return } -//获取用户 +// 获取用户 func (this *ModelSession) getUserSession(uid string) (user *pb.CacheUser) { user = &pb.CacheUser{} if err := this.GetListObj(comm.RDS_EMPTY, uid, user); err != nil { @@ -43,14 +43,21 @@ func (this *ModelSession) getUserSession(uid string) (user *pb.CacheUser) { return user } -//设置用户session +// 设置用户session func (this *ModelSession) addUserSession(uid string, session comm.IUserSession) (err error) { - if err = this.AddList(comm.RDS_EMPTY, uid, map[string]interface{}{ - "uid": uid, - "sessionId": session.GetSessionId(), - "serviceTag": session.GetServiecTag(), - "gatewayServiceId": session.GetGatewayServiceId(), - "ip": session.GetIP(), + // if err = this.AddList(comm.RDS_EMPTY, uid, map[string]interface{}{ + // "uid": uid, + // "sessionId": session.GetSessionId(), + // "serviceTag": session.GetServiecTag(), + // "gatewayServiceId": session.GetGatewayServiceId(), + // "ip": session.GetIP(), + // }, db.SetDBMgoLog(false)); err != nil { + if err = this.AddList(comm.RDS_EMPTY, uid, &pb.CacheUser{ + Uid: uid, + SessionId: session.GetSessionId(), + ServiceTag: session.GetServiecTag(), + GatewayServiceId: session.GetGatewayServiceId(), + Ip: session.GetIP(), }, db.SetDBMgoLog(false)); err != nil { log.Debug("setUserSession err:%v", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err}) return diff --git a/modules/user/module.go b/modules/user/module.go index 44a057cdc..136ad8e75 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -110,7 +110,7 @@ func (this *User) GetUser(uid string) (user *pb.DBUser) { if this.IsCross() { user, err = this.getRemoteUser(uid) if err != nil { - this.Errorln("查询远程玩家信息", err) + this.Errorf("查询远程玩家信息 tag:%v err:%v", this.service.GetTag(), err) return nil } } else { diff --git a/services/comp_gateroute.go b/services/comp_gateroute.go index 4d50f80a5..91454d586 100644 --- a/services/comp_gateroute.go +++ b/services/comp_gateroute.go @@ -22,14 +22,14 @@ import ( "google.golang.org/protobuf/types/known/anypb" ) -//用户协议处理函数注册的反射对象 +// 用户协议处理函数注册的反射对象 type msghandle struct { rcvr reflect.Value msgType reflect.Type //消息请求类型 handle reflect.Method //处理函数 } -//组件参数 +// 组件参数 type CompOptions struct { } @@ -49,7 +49,7 @@ func NewGateRouteComp() comm.ISC_GateRouteComp { return comp } -//服务网关组件 +// 服务网关组件 type SCompGateRoute struct { cbase.ServiceCompBase options *CompOptions @@ -59,7 +59,7 @@ type SCompGateRoute struct { pools sync.Pool } -//设置服务组件名称 方便业务模块中获取此组件对象 +// 设置服务组件名称 方便业务模块中获取此组件对象 func (this *SCompGateRoute) GetName() core.S_Comps { return comm.SC_ServiceGateRouteComp } @@ -68,7 +68,7 @@ func (this *SCompGateRoute) NewOptions() (options core.ICompOptions) { return new(CompOptions) } -//组件初始化函数 +// 组件初始化函数 func (this *SCompGateRoute) Init(service core.IService, comp core.IServiceComp, options core.ICompOptions) (err error) { err = this.ServiceCompBase.Init(service, comp, options) this.options = options.(*CompOptions) @@ -83,7 +83,7 @@ func (this *SCompGateRoute) Init(service core.IService, comp core.IServiceComp, return err } // -//组件启动时注册rpc服务监听 +// 组件启动时注册rpc服务监听 func (this *SCompGateRoute) Start() (err error) { this.service.RegisterFunctionName(string(comm.Rpc_GatewayRoute), this.ReceiveMsg) //注册网关路由接收接口 this.service.RegisterFunctionName(string(comm.Rpc_GatewayNoticeUserLogin), this.NoticeUserLogin) //注册用户登录通知 @@ -96,7 +96,7 @@ func (this *SCompGateRoute) Start() (err error) { return } -//业务模块注册用户消息处理路由 +// 业务模块注册用户消息处理路由 func (this *SCompGateRoute) RegisterRoute(methodName string, comp reflect.Value, msg reflect.Type, handele reflect.Method) { //log.Debugf("注册用户路由【%s】", methodName) this.mrlock.RLock() @@ -115,7 +115,7 @@ func (this *SCompGateRoute) RegisterRoute(methodName string, comp reflect.Value, this.mrlock.Unlock() } -//Rpc_GatewayRoute服务接口的接收函数 +// Rpc_GatewayRoute服务接口的接收函数 func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessage, reply *pb.RPCMessageReply) (err error) { method := fmt.Sprintf("%s.%s", args.MainType, args.SubType) // defer func() { //程序异常 收集异常信息传递给前端显示 @@ -188,7 +188,7 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag return nil } -//RPC_NoticeUserClose 接收用户登录通知 +// RPC_NoticeUserClose 接收用户登录通知 func (this *SCompGateRoute) NoticeUserLogin(ctx context.Context, args *pb.NoticeUserLoginReq, reply *pb.RPCMessageReply) error { conn, err := db.Local() if err != nil { @@ -196,12 +196,19 @@ func (this *SCompGateRoute) NoticeUserLogin(ctx context.Context, args *pb.Notice return err } model := db.NewDBModel(comm.TableSession, 0, conn) - model.AddList(comm.RDS_EMPTY, args.UserId, map[string]interface{}{ - "uid": args.UserId, - "sessionId": args.UserSessionId, - "serviceTag": args.ServiceTag, - "gatewayServiceId": args.GatewayServiceId, - "ip": args.Ip, + // model.AddList(comm.RDS_EMPTY, args.UserId, map[string]interface{}{ + // "uid": args.UserId, + // "sessionId": args.UserSessionId, + // "serviceTag": args.ServiceTag, + // "gatewayServiceId": args.GatewayServiceId, + // "ip": args.Ip, + // }, db.SetDBMgoLog(false)) + model.AddList(comm.RDS_EMPTY, args.UserId, &pb.CacheUser{ + Uid: args.UserId, + SessionId: args.UserSessionId, + ServiceTag: args.ServiceTag, + GatewayServiceId: args.GatewayServiceId, + Ip: args.Ip, }, db.SetDBMgoLog(false)) session := this.pools.Get().(comm.IUserSession) session.SetSession(args.Ip, args.UserSessionId, args.ServiceTag, args.GatewayServiceId, args.UserId) @@ -209,7 +216,7 @@ func (this *SCompGateRoute) NoticeUserLogin(ctx context.Context, args *pb.Notice return nil } -//RPC_NoticeUserClose 接收用户离线通知 +// RPC_NoticeUserClose 接收用户离线通知 func (this *SCompGateRoute) NoticeUserClose(ctx context.Context, args *pb.NoticeUserCloseReq, reply *pb.RPCMessageReply) error { session := this.pools.Get().(comm.IUserSession) session.SetSession(args.Ip, args.UserSessionId, args.ServiceTag, args.GatewayServiceId, args.UserId) @@ -217,28 +224,28 @@ func (this *SCompGateRoute) NoticeUserClose(ctx context.Context, args *pb.Notice return nil } -//RPC_ConfigureUpDate 接收配置更新消息 +// RPC_ConfigureUpDate 接收配置更新消息 func (this *SCompGateRoute) ConfigureUpDate(ctx context.Context, args *pb.EmptyReq, reply *pb.EmptyResp) error { log.Debugln("RPC_ConfigureUpDate") configure.Update() return nil } -//RPC_DBSyncCross 接收配置更新消息 +// RPC_DBSyncCross 接收配置更新消息 func (this *SCompGateRoute) DBSyncCross(ctx context.Context, args *pb.EmptyReq, reply *pb.EmptyResp) (err error) { log.Debugln("RPC_DBSyncCross") err = db.SyncServiceList() return } -//获取用户的会话对象 +// 获取用户的会话对象 func (this *SCompGateRoute) GetUserSession(udata *pb.CacheUser) (session comm.IUserSession) { session = this.pools.Get().(comm.IUserSession) session.SetSession(udata.Ip, udata.SessionId, udata.ServiceTag, udata.GatewayServiceId, udata.Uid) return } -//获取用户的会话对象 +// 获取用户的会话对象 func (this *SCompGateRoute) PutUserSession(session comm.IUserSession) { this.pools.Put(session) return diff --git a/services/worker/main.go b/services/worker/main.go index 5d4fbe863..49a5ccb78 100644 --- a/services/worker/main.go +++ b/services/worker/main.go @@ -24,7 +24,6 @@ import ( "go_dreamfactory/modules/library" "go_dreamfactory/modules/linestory" "go_dreamfactory/modules/mail" - "go_dreamfactory/modules/martialhall" "go_dreamfactory/modules/mline" "go_dreamfactory/modules/moonfantasy" "go_dreamfactory/modules/notify" @@ -90,7 +89,7 @@ func main() { forum.NewModule(), pagoda.NewModule(), gourmet.NewModule(), - martialhall.NewModule(), + // martialhall.NewModule(), rtask.NewModule(), viking.NewModule(), smithy.NewModule(), diff --git a/sys/db/db.go b/sys/db/db.go index 5da54feba..9febbd88d 100644 --- a/sys/db/db.go +++ b/sys/db/db.go @@ -175,7 +175,6 @@ func (this *DB) ServerDBConn(stage string) (conn *DBConn, err error) { if !ok { err = fmt.Errorf("DBConn:%s on init", stage) } - log.Debug("servers", log.Field{Key: stage, Value: this.servers[stage]}) return }