diff --git a/.gitignore b/.gitignore index 7d55a4ad9..5261d6338 100644 --- a/.gitignore +++ b/.gitignore @@ -15,8 +15,10 @@ bin/conf .vscode/ ./bin/conf ./bin/log +./bin/mainte ./bin/gateway ./bin/worker +./bin/vsdebug* ~$*.xlsx *.pid cmd/luban/ \ No newline at end of file diff --git a/bin/build_linux.bat b/bin/build_linux.bat new file mode 100644 index 000000000..0bb2cf755 --- /dev/null +++ b/bin/build_linux.bat @@ -0,0 +1,8 @@ +set GOOS=linux +set CGO_ENABLED=0 +cd ../ +del bin/mainte,bin/gateway,bin/worker +go build -o ./bin/mainte ./services/mainte/main.go +go build -o ./bin/gateway ./services/gateway/main.go +go build -o ./bin/worker ./services/worker/main.go +REM pause \ No newline at end of file diff --git a/linux_bulid.sh b/bin/build_linux.sh similarity index 71% rename from linux_bulid.sh rename to bin/build_linux.sh index b5cf64532..723a9639d 100755 --- a/linux_bulid.sh +++ b/bin/build_linux.sh @@ -1,6 +1,7 @@ CGO_ENABLED=0 GO111MODULE=on GOOS=linux -go build -o ./bin/dbservice ./services/dbservice/main.go +cd ../ +go build -o ./bin/mainte ./services/mainte/main.go go build -o ./bin/gateway ./services/gateway/main.go go build -o ./bin/worker ./services/worker/main.go \ No newline at end of file diff --git a/build.bat b/bin/build_windows.bat similarity index 97% rename from build.bat rename to bin/build_windows.bat index bfedb4229..5b08cc40a 100644 --- a/build.bat +++ b/bin/build_windows.bat @@ -1,6 +1,7 @@ SET CGO_ENABLED=0 SET GOOS=windows SET GOARCH=amd64 +cd ../ go build -o build/gateway.exe services/gateway/main.go go build -o build/worker.exe services/worker/main.go go build -o build/web.exe services/web/main.go diff --git a/bin/dbservice b/bin/dbservice deleted file mode 100755 index cc4ee108e..000000000 Binary files a/bin/dbservice and /dev/null differ diff --git a/bin/gateway b/bin/gateway deleted file mode 100755 index 5690b2c4f..000000000 Binary files a/bin/gateway and /dev/null differ diff --git a/bin/worker b/bin/worker deleted file mode 100755 index 1e392f822..000000000 Binary files a/bin/worker and /dev/null differ diff --git a/bin/编译部署文档.md b/bin/编译部署文档.md new file mode 100644 index 000000000..16dc57b68 --- /dev/null +++ b/bin/编译部署文档.md @@ -0,0 +1,89 @@ +## 梦工厂编译部署文档 + +### 梦工厂外网测试服 +1. DB服务:119.3.105.109 账号:root 密码:l2qMQigN4xOA MongoDB和Rides 的地址 + - MongoDB 账号:root 密码:iamciniao + - Rides 密码:kujqweiasd +2. 程序运行服:119.3.89.14 账号:root 密码:l2qMQigN4xOA + + +### 编译项目代码 +1. 拉取git仓库代码:git clone http://git.legu.cc/liwei_3d/go_dreamfactory.git +2. 进入 go_dreamfactory 目录 执行:go mod tidy (需要安装golang 版本 go1.18.2以上环境:https://www.jianshu.com/p/35a161738d83) +3. 进入 go_dreamfactory/bin 目录下,执行 bulid_linux.sh 脚本 编译执行文件 +4. 拷贝bin目录作为发布文件 + +### 安装部署依赖环境 +1. 安装 MongoDB 教程 https://segmentfault.com/a/1190000039268500 +2. 安装 Redis 教程 + - 单节点 https://segmentfault.com/a/1190000023178516 + - 集群:https://blog.csdn.net/jiang1986829/article/details/108667854 +3. 安装 Consul https://blog.csdn.net/jeikerxiao/article/details/78114413 + +### 修改配置文件 +1. 进入发布文件(bin 目录) 下 conf 目录 +2. 修改配置文件中 MongoDB,Redis,Consul 相关配置 +``` + rpcx: #rpcx 系统配置 + Debug: true + AutoConnect: true #自动连接到集群服务节点 + RpcxStartType: 1 #0 服务端 1是客户端 + ConsulServers: ["10.0.0.9:8500"] #Consul 服务地址 + cache: #缓存系统 + Redis_IsCluster: false #是否是集群 + Redis_Addr: ["10.0.0.9:6986"] #Redis 服务地址 + Redis_Password: "li13451234" #Redis 服务密码 + Redis_DB: 6 #Redis 数据存储db + db: #存储系统 + MongodbUrl: "mongodb://10.0.0.9:27019" #Mongodb服务地址 + MongodbDatabase: "dreamfactory" #梦工厂数据库名 +``` +3. 修改区服id +``` + tag : "dreamfactory_liwei" #服务集群标签 在梦工厂中作为区服id 同区服内的服务可以互相通信,不同区服的不能互相通信 +``` +4. 配置跨服服务器 此配置只在gateway服务器上 +``` + gateway: + Debug: true + SpanServiceTag: "dreamfactory_span" #服务服务集群 + ListenPort: 7891 +``` +5. 配置多个worker服务 + - 配置多个worker 只需要拷贝 worker_1.yaml 文件到 worker_2.yaml 文件 + - 修改 worker_2.yaml 下配置文件中 + ``` + id: "worker_1" #修改worker_1 到worker_2, 服务的唯一id 在同一集群下唯一即可 + ip: "127.0.0.1" #运行主机Ip 保证同集群下服务可以通过此ip互相访问 + port: 9569 #rpc通信端口 不被占用即可 + + log: #日志系统 + FileName: "./log/worker_1.log" #修改日志文件地址 以免和其他worker冲突 日志文件存放地址 + ``` + +### 部署梦工厂服务 +1. 将修改完毕的发布文件(bin 目录)考本到目标主机服务器上,选择适合目录保存 +2. 进入发布文件 执行 ./start.sh 脚本 正常执行 +``` + [root@master bin]# ./start.sh + starting mainte... + start success + starting worker_1... + start success + starting gateway_1... + start success +``` +3. 程序启动后会自动生成 log目录,进入log 目录 查看各个服务文件启动日志是否正常 ,每个服务会对应一个日志文件 日志文件名在 服务配置中有配置,正常启动 +``` +2022/07/22 11:45:56.681 INFO rpcx/service.go:80 Sys log Init success ! +2022/07/22 11:45:56.682 INFO rpcx/service.go:86 Sys event Init success ! +2022/07/22 11:45:56.682 INFO rpcx/service.go:92 Sys codec Init success ! +2022/07/22 11:45:56.682 INFO rpcx/service.go:98 Sys rpcx Init success ! +2022/07/22 11:45:56.682 INFO services/servicebase.go:24 init sys.configure success! +2022/07/22 11:45:56.682 INFO cbase/servicebase.go:66 服务[gateway_1] 初始化完成! +2022/07/22 11:45:56.682 INFO cbase/servicebase.go:89 服务[gateway_1:1.0.0.0] 启动完成! +2022/07/22 11:45:56.682 INFO cbase/servicebase.go:109 注册模块【gateway】 + +``` +4. 是同网页工具以及客户端 测试服务是否正常 +1. 网页工具 http://10.0.1.11:8848/#/protocol/index 修改页面中服务器连接地址 点击连接,测试user.login协议 diff --git a/cmd/robot/hero.go b/cmd/robot/hero.go index 57adbb869..a2bdae0dc 100644 --- a/cmd/robot/hero.go +++ b/cmd/robot/hero.go @@ -27,26 +27,21 @@ var ( // enabled: true, next: func(robot *Robot, rsp proto.Message) { tcs := []*TestCase{} - if r, ok := rsp.(*pb.HeroListResp); ok { - for _, v := range r.List { - heroId := v.Id - tc := &TestCase{ - desc: "英雄详情", - mainType: string(comm.ModuleHero), - subType: hero.HeroSubTypeInfo, - req: &pb.HeroInfoReq{ - HeroId: heroId, + if _, ok := rsp.(*pb.HeroListResp); ok { + tc := &TestCase{ + desc: "英雄升级", + mainType: string(comm.ModuleHero), + subType: hero.StrengthenUplv, + req: &pb.HeroStrengthenUplvReq{ + HeroObjID: "62da0353ebe27f9446dd4a1d", + ExpCards: map[string]int32{ + "62da19017944b60fd473df61": 1, }, - rsp: &pb.HeroInfoResp{}, - // enabled: true, - // print: func(rsp proto.Message) { - // r := rsp.(*pb.HeroInfoResp) - // fmt.Printf("%v\n", r) - // }, - - } - tcs = append(tcs, tc) + }, + rsp: &pb.HeroStrengthenUplvResp{}, + // enabled: true, } + tcs = append(tcs, tc) } robot.addBuilders(tcs) }, @@ -103,7 +98,7 @@ var ( req: &pb.HeroStrengthenUplvReq{ HeroObjID: heroId, ExpCards: map[string]int32{ - heroId: 1, + "62da19017944b60fd473df61": 1, }, }, rsp: &pb.HeroStrengthenUplvResp{}, diff --git a/cmd/robot/story.go b/cmd/robot/story.go index c3a06664b..a0defceb1 100644 --- a/cmd/robot/story.go +++ b/cmd/robot/story.go @@ -29,7 +29,7 @@ var ( mainType: string(comm.ModuleMainline), subType: mainline.MainlineChallengeResp, req: &pb.MainlineChallengeReq{ - ChapterId: 1, + MainlineId: 1, }, rsp: &pb.MainlineChallengeResp{}, diff --git a/cmd/robot/task.go b/cmd/robot/task.go index ef25c5ae9..c6a2d1c5e 100644 --- a/cmd/robot/task.go +++ b/cmd/robot/task.go @@ -29,7 +29,7 @@ var ( fmt.Printf("%v \n", v) } }, - // enabled: true, + enabled: true, next: func(robot *Robot, rsp proto.Message) { tcs := []*TestCase{} if v, ok := rsp.(*pb.TaskListResp); ok { diff --git a/cmd/robot/user.go b/cmd/robot/user.go index 4030573eb..f5602f399 100644 --- a/cmd/robot/user.go +++ b/cmd/robot/user.go @@ -41,11 +41,11 @@ var user_builders = []*TestCase{ req: &pb.UserAddResReq{ Res: &pb.UserAssets{ A: "hero", - T: "43001", + T: "42911", N: 1, }, }, - rsp: &pb.UserAddResResp{}, + rsp: &pb.UserAddResResp{}, // enabled: true, }, { desc: "获取配置", diff --git a/comm/const.go b/comm/const.go index 5ff2c5b58..c362064c0 100644 --- a/comm/const.go +++ b/comm/const.go @@ -48,14 +48,17 @@ const ( //RPC服务接口定义处 const ( //Rpc - Rpc_GatewayRoute core.Rpc_Key = "Rpc_GatewayRoute" //网关路由 - Rpc_GatewayAgentBind core.Rpc_Key = "Rpc_GatewayAgentBind" //代理绑定 绑定用户Id - Rpc_GatewayAgentUnBind core.Rpc_Key = "Rpc_GatewayAgentUnBind" //代理解绑 解绑用户Id - Rpc_GatewayAgentSendMsg core.Rpc_Key = "Rpc_GatewayAgentSendMsg" //代理发送消息 向用户发送消息 - Rpc_GatewaySendBatchMsg core.Rpc_Key = "Rpc_GatewaySendBatchMsg" //向多个用户发送消息 - Rpc_GatewaySendRadioMsg core.Rpc_Key = "Rpc_GatewaySendRadioMsg" //广播消息 - Rpc_GatewayAgentClose core.Rpc_Key = "Rpc_GatewayAgentClose" //代理关闭 关闭用户连接 - Rpc_NoticeUserClose core.Rpc_Key = "Rpc_NoticeUserClose" //通知用户离线 + //Gateway + Rpc_GatewayRoute core.Rpc_Key = "Rpc_GatewayRoute" //网关路由 + Rpc_GatewayAgentBind core.Rpc_Key = "Rpc_GatewayAgentBind" //代理绑定 绑定用户Id + Rpc_GatewayAgentUnBind core.Rpc_Key = "Rpc_GatewayAgentUnBind" //代理解绑 解绑用户Id + Rpc_GatewayAgentSendMsg core.Rpc_Key = "Rpc_GatewayAgentSendMsg" //代理发送消息 向用户发送消息 + Rpc_GatewaySendBatchMsg core.Rpc_Key = "Rpc_GatewaySendBatchMsg" //向多个用户发送消息 + Rpc_GatewaySendRadioMsg core.Rpc_Key = "Rpc_GatewaySendRadioMsg" //广播消息 + Rpc_GatewayAgentClose core.Rpc_Key = "Rpc_GatewayAgentClose" //代理关闭 关闭用户连接 + Rpc_GatewayNoticeUserClose core.Rpc_Key = "Rpc_NoticeUserClose" //通知用户离线 + //Chat + Rpc_ReleaseSystemMessage core.Rpc_Key = "Rpc_ReleaseSystemMessage" //发布系统消息 ) //事件类型定义处 diff --git a/lego/sys/codec/utils/float.go b/lego/sys/codec/utils/float.go index 58c1a2b8d..012184cdd 100644 --- a/lego/sys/codec/utils/float.go +++ b/lego/sys/codec/utils/float.go @@ -52,6 +52,7 @@ func ReadBigFloatForString(buf []byte) (ret *big.Float, n int, err error) { func ReadFloat32ForString(buf []byte) (ret float32, n int, err error) { if buf[0] == '-' { ret, n, err = readPositiveFloat32(buf[1:]) + n++ ret = -ret return } @@ -60,6 +61,7 @@ func ReadFloat32ForString(buf []byte) (ret float32, n int, err error) { func ReadFloat64ForString(buf []byte) (ret float64, n int, err error) { if buf[0] == '-' { ret, n, err = readPositiveFloat64(buf[1:]) + n++ ret = -ret return } diff --git a/lego/sys/codec/utils/int.go b/lego/sys/codec/utils/int.go index 8eb08960b..01a27bc44 100644 --- a/lego/sys/codec/utils/int.go +++ b/lego/sys/codec/utils/int.go @@ -41,6 +41,7 @@ func ReadInt8ForString(buf []byte) (ret int8, n int, err error) { c := buf[0] if c == '-' { val, n, err = ReadUint32ForString(buf[1:]) + n++ if val > math.MaxInt8+1 { err = errors.New("ReadInt8ForString overflow: " + strconv.FormatInt(int64(val), 10)) return @@ -64,6 +65,7 @@ func ReadInt16ForString(buf []byte) (ret int16, n int, err error) { c := buf[0] if c == '-' { val, n, err = ReadUint32ForString(buf[1:]) + n++ if val > math.MaxInt16+1 { err = errors.New("ReadInt16ForString overflow: " + strconv.FormatInt(int64(val), 10)) return @@ -87,6 +89,7 @@ func ReadInt32ForString(buf []byte) (ret int32, n int, err error) { c := buf[0] if c == '-' { val, n, err = ReadUint32ForString(buf[1:]) + n++ if val > math.MaxInt32+1 { err = errors.New("ReadInt32ForString overflow: " + strconv.FormatInt(int64(val), 10)) return @@ -110,6 +113,7 @@ func ReadInt64ForString(buf []byte) (ret int64, n int, err error) { c := buf[0] if c == '-' { val, n, err = ReadUint64ForString(buf[1:]) + n++ if val > math.MaxInt64+1 { err = errors.New("ReadInt64ForString overflow: " + strconv.FormatInt(int64(val), 10)) return @@ -154,6 +158,7 @@ func ReadUint16ForString(buf []byte) (ret uint16, n int, err error) { func ReadUint32ForString(buf []byte) (ret uint32, n int, err error) { ind := intDigits[buf[0]] + n = 1 if ind == 0 { err = assertInteger(buf[1:]) return @@ -163,7 +168,6 @@ func ReadUint32ForString(buf []byte) (ret uint32, n int, err error) { return } ret = uint32(ind) - n = 1 if len(buf) > 10 { i := 1 ind2 := intDigits[buf[i]] @@ -252,6 +256,7 @@ func ReadUint32ForString(buf []byte) (ret uint32, n int, err error) { func ReadUint64ForString(buf []byte) (ret uint64, n int, err error) { ind := intDigits[buf[0]] + n = 1 if ind == 0 { err = assertInteger(buf[1:]) return @@ -261,7 +266,6 @@ func ReadUint64ForString(buf []byte) (ret uint64, n int, err error) { return } ret = uint64(ind) - n = 1 if len(buf) > 10 { i := 0 ind2 := intDigits[buf[i]] diff --git a/lego/sys/rpcx/service.go b/lego/sys/rpcx/service.go index c1c9c40f6..408e958e5 100644 --- a/lego/sys/rpcx/service.go +++ b/lego/sys/rpcx/service.go @@ -46,16 +46,17 @@ func newService(options *Options) (sys *Service, err error) { } type Service struct { - options *Options - metadata string - server *server.Server - selectors map[string]ISelector - clientmutex sync.RWMutex - clients map[string]net.Conn - clientmeta map[string]string - mutex sync.Mutex // protects following - seq uint64 - pending map[uint64]*client.Call + options *Options + metadata string + server *server.Server + selectormutex sync.RWMutex + selectors map[string]ISelector + clientmutex sync.RWMutex + clients map[string]net.Conn + clientmeta map[string]string + mutex sync.Mutex // protects following + seq uint64 + pending map[uint64]*client.Call } //RPC 服务启动 @@ -194,90 +195,27 @@ func (this *Service) ClusterBroadcast(ctx context.Context, servicePath string, s return } -// func (this *Service) PreReadRequest(ctx context.Context) error { -// var ( -// stag string -// selector client.Selector -// ok bool -// ) -// req_metadata, ok := ctx.Value(share.ReqMetaDataKey).(map[string]string) -// this.Debugf("PreReadRequest Meta:%v ", ctx.Value(share.ReqMetaDataKey)) -// if stag, ok = req_metadata[ServiceClusterTag]; ok { -// if selector, ok = this.selectors[stag]; !ok { -// this.selectors[stag] = newSelector(nil) -// selector = this.selectors[stag] -// } -// if addr, ok := req_metadata[ServiceAddrKey]; ok { -// if _, ok = this.clientmeta[addr]; !ok { -// if smeta, ok := req_metadata[ServiceMetaKey]; ok { -// servers := make(map[string]string) -// this.clientmutex.Lock() -// this.clientmeta[addr] = smeta -// this.clients[addr] = ctx.Value(server.RemoteConnContextKey).(net.Conn) -// for k, v := range this.clientmeta { -// servers[k] = v -// } -// this.clientmutex.Unlock() -// selector.UpdateServer(servers) -// this.Debugf("fond new node addr:%s smeta:%s \n", addr, smeta) -// } -// } -// } -// } -// return nil -// } - -//监听客户端链接到服务上 保存客户端的连接对象 -// func (this *Service) PreHandleRequest(ctx context.Context, r *protocol.Message) error { -// var ( -// stag string -// selector client.Selector -// ok bool -// ) -// req_metadata := ctx.Value(share.ReqMetaDataKey).(map[string]string) -// this.Debugf("PreHandleRequest ServicePath:%s ServiceMethod:%s Meta:%v ", r.ServicePath, r.ServiceMethod, ctx.Value(share.ReqMetaDataKey)) -// if stag, ok = req_metadata[ServiceClusterTag]; ok { -// if selector, ok = this.selectors[stag]; !ok { -// this.selectors[stag] = newSelector(nil) -// selector = this.selectors[stag] -// } -// if addr, ok := req_metadata[ServiceAddrKey]; ok { -// if _, ok = this.clientmeta[addr]; !ok { -// if smeta, ok := req_metadata[ServiceMetaKey]; ok { -// servers := make(map[string]string) -// this.clientmutex.Lock() -// this.clientmeta[addr] = smeta -// this.clients[addr] = ctx.Value(server.RemoteConnContextKey).(net.Conn) -// for k, v := range this.clientmeta { -// servers[k] = v -// } -// this.clientmutex.Unlock() -// selector.UpdateServer(servers) -// this.Debugf("fond new node addr:%s smeta:%s \n", addr, smeta) -// } -// } -// } -// } -// return nil -// } - //监控rpc连接收到的请求消息 处理消息回调请求 func (this *Service) PostReadRequest(ctx context.Context, r *protocol.Message, e error) error { if isCallMessage := (r.MessageType() == protocol.Request); isCallMessage { var ( stag string - selector client.Selector + selector ISelector ok bool ) req_metadata := r.Metadata this.Debugf("PreReadRequest ServicePath:%s ServicePath:%s Metadata:%v ", r.ServicePath, r.ServiceMethod, r.Metadata) if stag, ok = req_metadata[ServiceClusterTag]; ok { - if selector, ok = this.selectors[stag]; !ok { - this.mutex.Lock() - this.selectors[stag] = newSelector(nil) - selector = this.selectors[stag] - this.mutex.Unlock() + this.selectormutex.RLock() + selector, ok = this.selectors[stag] + this.selectormutex.RUnlock() + if !ok { + selector = newSelector(nil) + this.selectormutex.Lock() + this.selectors[stag] = selector + this.selectormutex.Unlock() } + if addr, ok := req_metadata[ServiceAddrKey]; ok { if _, ok = this.clientmeta[addr]; !ok { if smeta, ok := req_metadata[ServiceMetaKey]; ok { @@ -407,21 +345,25 @@ func (this *Service) call(ctx context.Context, clusterTag string, servicePath st ServiceAddrKey: "tcp@" + this.options.ServiceAddr, ServiceMetaKey: this.metadata, }) - if selector, ok = this.selectors[clusterTag]; !ok { + this.selectormutex.RLock() + selector, ok = this.selectors[clusterTag] + this.selectormutex.RUnlock() + if !ok { err = fmt.Errorf("on found serviceTag:%s", clusterTag) + return } - this.clientmutex.RLock() + if clientaddr = selector.Select(ctx, spath[0], serviceMethod, args); clientaddr == "" { err = fmt.Errorf("on found servicePath:%s", servicePath) + return + } + this.clientmutex.RLock() + if conn, ok = this.clients[clientaddr]; !ok { + err = fmt.Errorf("on found clientaddr:%s", clientaddr) this.clientmutex.RUnlock() return } this.clientmutex.RUnlock() - if conn, ok = this.clients[clientaddr]; !ok { - err = fmt.Errorf("on found clientaddr:%s", clientaddr) - return - } - _call = new(client.Call) _call.ServicePath = servicePath _call.ServiceMethod = serviceMethod @@ -464,7 +406,10 @@ func (this *Service) broadcast(ctx context.Context, clusterTag string, servicePa ServiceAddrKey: "tcp@" + this.options.ServiceAddr, ServiceMetaKey: this.metadata, }) - if selector, ok = this.selectors[clusterTag]; !ok { + this.selectormutex.RLock() + selector, ok = this.selectors[clusterTag] + this.selectormutex.RUnlock() + if !ok { err = fmt.Errorf("on found serviceTag:%s", clusterTag) } if clientaddrs = selector.Find(ctx, spath[0], serviceMethod, args); clientaddrs == nil || len(clientaddrs) == 0 { @@ -558,6 +503,7 @@ func (this *Service) clusterbroadcast(ctx context.Context, servicePath string, s ServiceMetaKey: this.metadata, }) addrs := make(map[string]struct{}) + this.selectormutex.RLock() for _, v := range this.selectors { if clientaddrs = v.Find(ctx, spath[0], serviceMethod, args); clientaddrs != nil && len(clientaddrs) >= 0 { for _, v1 := range clientaddrs { @@ -565,6 +511,7 @@ func (this *Service) clusterbroadcast(ctx context.Context, servicePath string, s } } } + this.selectormutex.RUnlock() if len(addrs) == 0 { err = fmt.Errorf("on found service:%s", spath[0]) return diff --git a/linux-build.bat b/linux-build.bat deleted file mode 100644 index 3500766cc..000000000 --- a/linux-build.bat +++ /dev/null @@ -1,6 +0,0 @@ -set GOOS=linux -set CGO_ENABLED=0 -del bin/gateway,bin/worker -go build -o bin/gateway services/gateway/main.go -go build -o bin/worker services/worker/main.go -REM pause \ No newline at end of file diff --git a/modules/comp_gate.go b/modules/comp_gate.go index 135938dae..0a3fbb23f 100644 --- a/modules/comp_gate.go +++ b/modules/comp_gate.go @@ -100,13 +100,6 @@ func (this *MCompGate) reflectionRouteHandle(typ reflect.Type, method reflect.Me log.Panicf("反射注册用户处理函数错误 [%s-%s] Api接口格式错误", this.module.GetType(), mname) return } - // if agrType.Kind() != reflect.Ptr { - // return - // } - // if !this.isExportedOrBuiltinType(agrType) { - // return - // } - if mtype.NumOut() != 2 { log.Panicf("反射注册用户处理函数错误 [%s-%s] Api接口格式错误", this.module.GetType(), mname) return diff --git a/modules/equipment/api_equip.go b/modules/equipment/api_equip.go index d77745832..3b0516db5 100644 --- a/modules/equipment/api_equip.go +++ b/modules/equipment/api_equip.go @@ -46,6 +46,8 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq) code = pb.ErrorCode_EquipmentOnFoundEquipment return } + } else { + equipments[i] = nil } } //获取英雄数据 @@ -96,6 +98,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq) } else { subsit = false //辅套装没有 } + hero.EquipID[i] = "" } } @@ -112,13 +115,16 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq) } } //更新装备数据加成 - if code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments); code == pb.ErrorCode_Success { - if err = this.module.modelEquipment.UpdateByHeroId(session.GetUserId(), updatequipment...); err != nil { - log.Errorf("Equip err%v", err) - code = pb.ErrorCode_SystemError - return - } + if code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments); code != pb.ErrorCode_Success { + log.Errorf("Equip ModuleHero UpdateEquipment code%v", code) + return } - session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: equipments}) + //同步数据 + if err = this.module.modelEquipment.UpdateByHeroId(session.GetUserId(), updatequipment...); err != nil { + log.Errorf("Equip err%v", err) + code = pb.ErrorCode_SystemError + return + } + session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: updatequipment}) return } diff --git a/modules/friend/api_apply.go b/modules/friend/api_apply.go index 87e28a8d2..d611ea676 100644 --- a/modules/friend/api_apply.go +++ b/modules/friend/api_apply.go @@ -18,7 +18,7 @@ func (this *apiComp) ApplyCheck(session comm.IUserSession, req *pb.FriendApplyRe //好友申请 func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (code pb.ErrorCode, data proto.Message) { - if code = this.ApplyCheck(session, req); code != pb.ErrorCode_Success { + if code = this.ApplyCheck(session, req); code != pb.ErrorCode_Success { return } @@ -30,7 +30,8 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c ) defer func() { - utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), FriendSubTypeApply, req, Resp) + + // utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), FriendSubTypeApply, req, Resp) }() defer func() { diff --git a/modules/gateway/agentmgr_comp.go b/modules/gateway/agentmgr_comp.go index 6aeb48fa6..a36c5bf0f 100644 --- a/modules/gateway/agentmgr_comp.go +++ b/modules/gateway/agentmgr_comp.go @@ -44,7 +44,7 @@ func (this *AgentMgrComp) DisConnect(a IAgent) { this.agents.Delete(a.SessionId()) if a.UserId() != "" { //登录用户 通知业务服务处理玩家离线相关 reply := &pb.RPCMessageReply{} - if _, err := this.service.RpcGo(context.Background(), fmt.Sprintf("%s/%s", comm.Service_Worker, a.WorkerId()), string(comm.Rpc_NoticeUserClose), &pb.NoticeUserCloseReq{ + if _, err := this.service.RpcGo(context.Background(), fmt.Sprintf("%s/%s", comm.Service_Worker, a.WorkerId()), string(comm.Rpc_GatewayNoticeUserClose), &pb.NoticeUserCloseReq{ Ip: a.IP(), ServiceTag: this.service.GetTag(), GatewayServiceId: this.service.GetId(), @@ -54,7 +54,7 @@ func (this *AgentMgrComp) DisConnect(a IAgent) { log.Errorf("uId:%s Rpc_NoticeUserClose err:%v", a.UserId(), err) } //推送跨服集群处理 - if _, err := this.service.AcrossClusterRpcGo(context.Background(), this.options.SpanServiceTag, comm.Service_Worker, string(comm.Rpc_NoticeUserClose), &pb.NoticeUserCloseReq{ + if _, err := this.service.AcrossClusterRpcGo(context.Background(), this.options.SpanServiceTag, comm.Service_Worker, string(comm.Rpc_GatewayNoticeUserClose), &pb.NoticeUserCloseReq{ Ip: a.IP(), ServiceTag: this.service.GetTag(), GatewayServiceId: this.service.GetId(), diff --git a/modules/gm/api.go b/modules/gm/api.go index 6e140a486..2ec464dd4 100644 --- a/modules/gm/api.go +++ b/modules/gm/api.go @@ -4,6 +4,9 @@ import ( "go_dreamfactory/lego/core" "go_dreamfactory/lego/core/cbase" "go_dreamfactory/lego/sys/gin" + "go_dreamfactory/lego/sys/gin/engine" + "reflect" + "strings" ) /* @@ -22,8 +25,30 @@ func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core this.options = options.(*Options) this.module = module.(*GM) this.gin, err = gin.NewSys(gin.SetListenPort(this.options.Port)) - this.gin.POST("/register", this.Register) - this.gin.GET("/serverlist", this.ServerList) - this.gin.GET("/createnotify", this.CreateNotify) + this.suitableMethods() //发射注册api return } + +func (this *Api_Comp) suitableMethods() { + typ := reflect.TypeOf(this) + vof := reflect.ValueOf(this) + for m := 0; m < typ.NumMethod(); m++ { + method := typ.Method(m) + mname := method.Name + mtype := method.Type + if method.PkgPath != "" { + continue + } + if mtype.NumIn() != 2 { + continue + } + context := mtype.In(1) + if context.String() != "*engine.Context" { + continue + } + if mtype.NumOut() != 0 { + continue + } + this.gin.POST(strings.ToLower(mname), vof.MethodByName(mname).Interface().(func(*engine.Context))) + } +} diff --git a/modules/hero/api_chouka.go b/modules/hero/api_chouka.go index a310f149b..b96cd75a7 100644 --- a/modules/hero/api_chouka.go +++ b/modules/hero/api_chouka.go @@ -3,7 +3,6 @@ package hero import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -23,7 +22,6 @@ func (this *apiComp) Chouka(session comm.IUserSession, req *pb.HeroChoukaReq) (c code = pb.ErrorCode_SystemError return } - utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), HeroSubTypeChouka, req, rsp) }() heroCfgIds := req.HeroIds diff --git a/modules/hero/api_info.go b/modules/hero/api_info.go index 05b1af607..2d998e893 100644 --- a/modules/hero/api_info.go +++ b/modules/hero/api_info.go @@ -4,7 +4,6 @@ import ( "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -29,7 +28,7 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.HeroInfoReq) (code code = pb.ErrorCode_SystemError return } - utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), HeroSubTypeInfo, req, rsp) + // utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), HeroSubTypeInfo, req, rsp) }() hero := this.module.modelHero.getOneHero(session.GetUserId(), req.HeroId) diff --git a/modules/hero/api_list.go b/modules/hero/api_list.go index 57b1f5cf8..6f6c99bcd 100644 --- a/modules/hero/api_list.go +++ b/modules/hero/api_list.go @@ -3,7 +3,6 @@ package hero import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -21,7 +20,7 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.HeroListReq) (code if err != nil { code = pb.ErrorCode_SystemError } - utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), HeroSubTypeList, req, rsp) + // utils.TraceFunc(session.GetUserId(), string(this.module.GetType()), HeroSubTypeList, req, rsp) }() rsp.List = this.module.GetHeroList(session.GetUserId()) diff --git a/modules/hero/api_strengthenUplv.go b/modules/hero/api_strengthenUplv.go index 46bd47ca0..0b3aa9fde 100644 --- a/modules/hero/api_strengthenUplv.go +++ b/modules/hero/api_strengthenUplv.go @@ -35,7 +35,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren _expHero *pb.DBHero // 消耗英雄 minAddExp int32 _costHero []*pb.DBHero // 删除的英雄 - bLvUp bool // 是否升级 + iLvUp int32 // 当前升级次数 ) code = this.StrengthenUplvCheck(session, req) // check @@ -127,7 +127,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren curLv -= 1 break } - bLvUp = true + iLvUp++ } } } else { @@ -181,8 +181,8 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren _hero.Property = m session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: []*pb.DBHero{_hero}}) session.SendMsg(string(this.module.GetType()), StrengthenUplv, &pb.HeroStrengthenUplvResp{Hero: _hero}) - if bLvUp { // 升级了 统计任务 - this.module.ModuleTask.SendToTask(session, comm.TaskTypeUpHeroLevel, &pb.TaskParam{First: _hero.Lv}) + if iLvUp > 0 { // 升级了 统计任务 + this.module.ModuleTask.SendToTask(session, comm.TaskTypeUpHeroLevel, &pb.TaskParam{First: iLvUp}) } return diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 02f4aaa22..ffff648bc 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -101,6 +101,20 @@ func (this *ModelHero) createOneHero(uid string, heroCfgId int32) (hero *pb.DBHe func (this *ModelHero) initHeroOverlying(uid string, heroCfgId, count int32) (hero *pb.DBHero, err error) { hero = this.initHero(uid, heroCfgId) if hero != nil { + // 添加图鉴 + if result, err1 := this.GetUserExpand(uid); err1 == nil { + sz := make(map[int32]bool, 0) + for k := range result.GetTujian() { + sz[k] = true + } + if _, ok := result.GetTujian()[heroCfgId]; !ok { + sz[heroCfgId] = true + initUpdate := map[string]interface{}{ + "tujian": sz, + } + this.ChanageUserExpand(uid, initUpdate) + } + } hero.SameCount += count if err = this.moduleHero.modelHero.AddList(uid, hero.Id, hero); err != nil { this.moduleHero.Errorf("%v", err) diff --git a/modules/mail/api_delmail.go b/modules/mail/api_delmail.go index f26a60989..d49fbb069 100644 --- a/modules/mail/api_delmail.go +++ b/modules/mail/api_delmail.go @@ -18,27 +18,15 @@ func (this *apiComp) DelMailCheck(session comm.IUserSession, req *pb.MailDelMail // 删除邮件 func (this *apiComp) DelMail(session comm.IUserSession, req *pb.MailDelMailReq) (code pb.ErrorCode, data proto.Message) { - - var err error - mailinfo := make([]*pb.DBMailData, 0) - defer func() { - session.SendMsg(string(this.module.GetType()), "delmail", &pb.MailDelMailResp{Mail: mailinfo}) - }() code = this.DelMailCheck(session, req) // check if code != pb.ErrorCode_Success { return } bRet := this.module.modelMail.Mail_DelUserMail(req.ObjID) if !bRet { - code = pb.ErrorCode_DBError + code = pb.ErrorCode_MailErr // 邮件不存在 return } - - if mailinfo, err = this.module.modelMail.Mail_QueryUserMail(session.GetUserId()); err != nil { - this.module.Errorf("QueryUserMailResp err:%v", err) - code = pb.ErrorCode_CacheReadError - return - } - + session.SendMsg(string(this.module.GetType()), "delmail", &pb.MailDelMailResp{ObjID: req.ObjID}) return } diff --git a/modules/mail/api_getAttachment.go b/modules/mail/api_getAttachment.go index 478796cca..ec04a087a 100644 --- a/modules/mail/api_getAttachment.go +++ b/modules/mail/api_getAttachment.go @@ -18,19 +18,16 @@ func (this *apiComp) GetUserMailAttachmentCheck(session comm.IUserSession, req * // 领取附件 func (this *apiComp) GetUserMailAttachment(session comm.IUserSession, req *pb.MailGetUserMailAttachmentReq) (code pb.ErrorCode, data proto.Message) { - var ( - mail *pb.DBMailData - ) - defer func() { - session.SendMsg(string(this.module.GetType()), "getusermailattachment", &pb.MailGetUserMailAttachmentResp{Mail: mail}) - }() - code = this.GetUserMailAttachmentCheck(session, req) // check if code != pb.ErrorCode_Success { return } - _bGet := this.module.modelMail.Mail_GetMailAttachmentState(req.ObjID) - if !_bGet { + mail, err := this.module.modelMail.Mail_GetMailAttachmentState(req.ObjID, session.GetUserId()) + if err != nil { + code = pb.ErrorCode_MailErr + return + } + if mail.Reward || len(mail.GetItems()) == 0 || mail.Uid != session.GetUserId() { code = pb.ErrorCode_StateInvalid return } @@ -46,7 +43,7 @@ func (this *apiComp) GetUserMailAttachment(session comm.IUserSession, req *pb.Ma } res = append(res, d) } - code = this.module.api.module.ConsumeRes(session, res, true) // 领取附件 + code = this.module.api.module.DispenseRes(session, res, true) // 领取附件 if code == pb.ErrorCode_Success { // 修改状态 this.module.modelMail.Mail_UpdateMailAttachmentState(req.ObjID) @@ -55,6 +52,7 @@ func (this *apiComp) GetUserMailAttachment(session comm.IUserSession, req *pb.Ma } } } - code = pb.ErrorCode_SystemError + + session.SendMsg(string(this.module.GetType()), "getusermailattachment", &pb.MailGetUserMailAttachmentResp{Mail: mail}) return } diff --git a/modules/mail/model_mail.go b/modules/mail/model_mail.go index d95d0503c..471207852 100644 --- a/modules/mail/model_mail.go +++ b/modules/mail/model_mail.go @@ -53,7 +53,7 @@ func (this *modelMail) Mail_InsertUserMail(mail *pb.DBMailData) (err error) { mail.Reward = false if len(mail.GetItems()) > 0 { - mail.Reward = true + mail.Reward = false } _, err = this.DB.InsertOne(DB_MailTable, mail) @@ -66,10 +66,10 @@ func (this *modelMail) Mail_ReadOneMail(objId string) (mail *pb.DBMailData, err DB_MailTable, bson.M{"_id": objId}, bson.M{"$set": bson.M{ - "check": false, + "check": true, }}, - options.FindOneAndUpdate().SetUpsert(false).SetReturnDocument(options.After), - ).Decode(mail) + options.FindOneAndUpdate().SetUpsert(true).SetReturnDocument(options.After), + ).Decode(&mail) return mail, err } @@ -86,13 +86,12 @@ func (this *modelMail) Mail_GetMailAttachment(objId string) (itmes []*pb.UserAss } // 查看领取附件状态 -func (this *modelMail) Mail_GetMailAttachmentState(objId string) bool { +func (this *modelMail) Mail_GetMailAttachmentState(objId string, uid string) (*pb.DBMailData, error) { var nd *pb.DBMailData - err := this.DB.FindOne(DB_MailTable, bson.M{"_id": objId}).Decode(nd) - if err != nil { - return false - } - return nd.Reward && len(nd.GetItems()) > 0 + err := this.DB.FindOne(DB_MailTable, bson.M{"_id": objId}).Decode(&nd) + + return nd, err + //return !nd.Reward && len(nd.GetItems()) > 0 && nd.Uid == uid } // 更新领取附件状态 @@ -112,7 +111,7 @@ func (this *modelMail) Mail_UpdateMailAttachmentState(objId string) bool { // 删除一封邮件 func (this *modelMail) Mail_DelUserMail(objId string) bool { var obj *pb.DBMailData - err := this.DB.FindOne(DB_MailTable, bson.M{"_id": objId}).Decode(obj) + err := this.DB.FindOne(DB_MailTable, bson.M{"_id": objId}).Decode(&obj) if err != nil { return false } diff --git a/modules/shop/api_buy.go b/modules/shop/api_buy.go index bdeaf0fa4..c0710c4c7 100644 --- a/modules/shop/api_buy.go +++ b/modules/shop/api_buy.go @@ -51,7 +51,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb need[i] = &cfg.Game_atn{ A: v.A, T: v.T, - N: int32(math.Ceil(float64(v.N) * float64(conf.Sale) / float64(100))), + N: int32(math.Ceil(float64(v.N) * float64(conf.Sale) / float64(1000))), } } diff --git a/modules/shop/api_getlist.go b/modules/shop/api_getlist.go index 50610f544..07b8ac4a8 100644 --- a/modules/shop/api_getlist.go +++ b/modules/shop/api_getlist.go @@ -31,11 +31,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) tdata time.Duration ltime time.Duration ) - defer func() { - if code == pb.ErrorCode_Success { - session.SendMsg(string(this.module.GetType()), "getlist", &pb.ShopGetListResp{Goods: goods}) - } - }() + if shopconf, err = this.module.configure.GetShopConfigure(int32(req.SType)); err != nil && err != mgo.MongodbNil { code = pb.ErrorCode_SystemError return @@ -138,7 +134,8 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) } } else { code = pb.ErrorCode_ReqParameterError + return } - + session.SendMsg(string(this.module.GetType()), "getlist", &pb.ShopGetListResp{Goods: goods}) return } diff --git a/modules/shop/core.go b/modules/shop/core.go index c11532cf4..15cab6075 100644 --- a/modules/shop/core.go +++ b/modules/shop/core.go @@ -4,6 +4,7 @@ import ( "crypto/rand" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" + "math" "math/big" ) @@ -56,7 +57,7 @@ func transGoods(goods []*cfg.Game_shopitemData, ushoputem map[int32]*pb.DBShopIt result[i].Consume[i1] = &pb.UserAssets{ A: v1.A, T: v1.T, - N: v1.N, + N: int32(math.Ceil(float64(v1.N) * float64(v.Sale) / float64(1000))), } } } diff --git a/modules/shop/model_shop.go b/modules/shop/model_shop.go index 1194f53a8..97eb4b8af 100644 --- a/modules/shop/model_shop.go +++ b/modules/shop/model_shop.go @@ -30,6 +30,8 @@ func (this *modelShopComp) Init(service core.IService, module core.IModule, comp //查询用户装备数据 func (this *modelShopComp) QueryUserShopData(uId string) (data *pb.DBShop, err error) { data = &pb.DBShop{} - err = this.Get(uId, data) + if err = this.Get(uId, data); err != nil { + this.module.Errorf("err:%v", err) + } return } diff --git a/modules/task/api_activelist.go b/modules/task/api_activelist.go index 417253257..322ef4fb2 100644 --- a/modules/task/api_activelist.go +++ b/modules/task/api_activelist.go @@ -3,7 +3,6 @@ package task import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -28,7 +27,7 @@ func (this *apiComp) ActiveList(session comm.IUserSession, req *pb.TaskActiveLis if err != nil { code = pb.ErrorCode_SystemError } - utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeActiveList, req, resp) + // utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeActiveList, req, resp) }() resp.Active = this.moduleTask.modelTask.countActive(session.GetUserId(), comm.TaskTag(req.TaskTag)) diff --git a/modules/task/api_activereceive.go b/modules/task/api_activereceive.go index c3c1c73d9..2efad197e 100644 --- a/modules/task/api_activereceive.go +++ b/modules/task/api_activereceive.go @@ -3,7 +3,6 @@ package task import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -29,7 +28,7 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive if err != nil { code = pb.ErrorCode_SystemError } - utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeActiveReceive, req, resp) + // utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeActiveReceive, req, resp) }() ua := this.moduleTask.modelTaskActive.getUserActive(session.GetUserId(), req.Id, comm.TaskTag(req.TaskTag)) diff --git a/modules/task/api_list.go b/modules/task/api_list.go index db81c1859..4d272f908 100644 --- a/modules/task/api_list.go +++ b/modules/task/api_list.go @@ -3,7 +3,6 @@ package task import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -26,7 +25,7 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.TaskListReq) (code if err != nil { code = pb.ErrorCode_SystemError } - utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeList, req, rsp) + // utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeList, req, rsp) }() rsp.List = this.moduleTask.modelTask.getTaskList(session.GetUserId(), comm.TaskTag(req.TaskTag)) diff --git a/modules/task/api_receive.go b/modules/task/api_receive.go index b39c6b01e..9a5047e13 100644 --- a/modules/task/api_receive.go +++ b/modules/task/api_receive.go @@ -4,7 +4,6 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" - "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -28,7 +27,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq) if err != nil { code = pb.ErrorCode_SystemError } - utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeReceive, req, resp) + // utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeReceive, req, resp) }() userTask := this.moduleTask.modelTask.getUserTask(session.GetUserId(), req.Id) if userTask != nil { diff --git a/modules/task/model_task.go b/modules/task/model_task.go index 30feb0545..682535ca6 100644 --- a/modules/task/model_task.go +++ b/modules/task/model_task.go @@ -121,18 +121,20 @@ func (this *ModelTask) modifyUserTask(uid string, taskId string, data map[string //任务处理 func (this *ModelTask) taskHandle(uid string, taskType comm.TaskType, taskParam *pb.TaskParam) (*pb.DBTask, error) { - //查询当前用户未完成的任务列表 data, err := this.moduleTask.configure.getTasks(int32(taskType)) if err != nil { log.Errorf("taskHandle err %v", err) return nil, err } - for _, conf := range data { - //不满足限定条件 - if taskParam.First != conf.RestrictiveCondition { - continue + for _, conf := range data { + if conf.RestrictiveCondition != 0 { + //不满足限定条件 + if taskParam.First < conf.RestrictiveCondition { + continue + } } + //检查进度,执行处理器 if v, ok := this.checkTaskProgress(uid, conf); ok { if tt, err := this.finishHandle(v, conf); err != nil { @@ -140,7 +142,6 @@ func (this *ModelTask) taskHandle(uid string, taskType comm.TaskType, taskParam } else { return tt, nil } - } } return nil, nil @@ -168,7 +169,7 @@ func (this *ModelTask) finishHandle(userTask *pb.DBTask, config *cfg.Game_taskRo userTask.Progress = progress userTask.Status = 1 - return nil, nil + return userTask, nil } //清空任务 diff --git a/modules/task/module.go b/modules/task/module.go index 79371d24d..1c62c9963 100644 --- a/modules/task/module.go +++ b/modules/task/module.go @@ -70,8 +70,10 @@ func (this *ModuleTask) SendToTask(session comm.IUserSession, taskType comm.Task if task, err := this.modelTask.taskHandle(session.GetUserId(), taskType, taskPram); err != nil { code = pb.ErrorCode_TaskHandle } else { - if err := session.SendMsg(string(comm.ModuleTask), TaskSubTypeFinishedPush, &pb.TaskFinishedPush{TaskId: task.TaskId}); err != nil { - this.modelTask.moduleTask.Errorf("SendToTask sendmsg err:%v", err) + if task != nil { + if err := session.SendMsg(string(comm.ModuleTask), TaskSubTypeFinishedPush, &pb.TaskFinishedPush{TaskId: task.TaskId}); err != nil { + this.modelTask.moduleTask.Errorf("SendToTask sendmsg err:%v", err) + } } } return diff --git a/modules/user/api.go b/modules/user/api.go index 84facd0b2..507517801 100644 --- a/modules/user/api.go +++ b/modules/user/api.go @@ -17,6 +17,7 @@ const ( UserSubTypeUpdatesetting = "updatesetting" //更新设置 UserSubTypeVeriCode = "vericode" //验证码 UserSubTypeInitData = "initdata" //初始化用户 + UserGetTujianResp = "gettujian" //获取图鉴信息 ) type apiComp struct { diff --git a/modules/user/api_create.go b/modules/user/api_create.go index 82c78c417..ce63016bf 100644 --- a/modules/user/api_create.go +++ b/modules/user/api_create.go @@ -4,7 +4,6 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "github.com/spf13/cast" "google.golang.org/protobuf/proto" ) @@ -54,13 +53,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (c "created": true, //创角标识 } - //设置初始金币 - if val := this.module.configure.GetGlobalConf("init_gold"); val != "" { - update["gold"] = cast.ToInt32(val) - } - - err := this.module.modelUser.Change(session.GetUserId(), update) - if err != nil { + if err := this.module.modelUser.Change(session.GetUserId(), update); err != nil { code = pb.ErrorCode_DBError return } diff --git a/modules/user/api_gettujian.go b/modules/user/api_gettujian.go new file mode 100644 index 000000000..9e48d3bc6 --- /dev/null +++ b/modules/user/api_gettujian.go @@ -0,0 +1,33 @@ +package user + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +func (this *apiComp) GetTujianCheck(session comm.IUserSession, req *pb.UserGetTujianReq) (code pb.ErrorCode) { + return +} + +func (this *apiComp) GetTujian(session comm.IUserSession, req *pb.UserGetTujianReq) (code pb.ErrorCode, data proto.Message) { + if code = this.GetTujianCheck(session, req); code != pb.ErrorCode_Success { + return + } + + rsp := &pb.UserGetTujianResp{} + if result, err := this.module.modelUser.GetUserExpand(session.GetUserId()); err != nil { + this.module.Errorf("err:%v", err) + return + } else { + for k := range result.Tujian { + rsp.Heroids = append(rsp.Heroids, k) + } + } + err := session.SendMsg(string(this.module.GetType()), UserGetTujianResp, rsp) + if err != nil { + code = pb.ErrorCode_SystemError + } + return +} diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index 12d0c8432..6f45dce17 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -54,6 +54,7 @@ const ( ErrorCode_VeriCodeExpired ErrorCode = 1008 //验证码过期 ErrorCode_UserResetData ErrorCode = 1009 //初始化用户失败 ErrorCode_ModifynameCount ErrorCode = 1010 //名称修改次数不足 + ErrorCode_MailErr ErrorCode = 1011 // 邮件不存在 // friend ErrorCode_FriendNotSelf ErrorCode = 1100 //不能是自己 ErrorCode_FriendSelfMax ErrorCode = 1101 //超出好友最大数量 @@ -150,6 +151,7 @@ var ( 1008: "VeriCodeExpired", 1009: "UserResetData", 1010: "ModifynameCount", + 1011: "MailErr", 1100: "FriendNotSelf", 1101: "FriendSelfMax", 1102: "FriendTargetMax", @@ -237,6 +239,7 @@ var ( "VeriCodeExpired": 1008, "UserResetData": 1009, "ModifynameCount": 1010, + "MailErr": 1011, "FriendNotSelf": 1100, "FriendSelfMax": 1101, "FriendTargetMax": 1102, @@ -326,7 +329,7 @@ var File_errorcode_proto protoreflect.FileDescriptor var file_errorcode_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2a, 0xff, 0x0d, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0x8d, 0x0e, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, @@ -363,83 +366,84 @@ var file_errorcode_proto_rawDesc = []byte{ 0x6f, 0x64, 0x65, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x10, 0xf0, 0x07, 0x12, 0x12, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, 0x10, 0xf1, 0x07, 0x12, 0x14, 0x0a, 0x0f, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x6e, 0x61, 0x6d, 0x65, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xf2, 0x07, 0x12, 0x12, 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, - 0x64, 0x4e, 0x6f, 0x74, 0x53, 0x65, 0x6c, 0x66, 0x10, 0xcc, 0x08, 0x12, 0x12, 0x0a, 0x0d, 0x46, - 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x66, 0x4d, 0x61, 0x78, 0x10, 0xcd, 0x08, 0x12, - 0x14, 0x0a, 0x0f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4d, - 0x61, 0x78, 0x10, 0xce, 0x08, 0x12, 0x15, 0x0a, 0x10, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, - 0x65, 0x6c, 0x66, 0x4e, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x10, 0xcf, 0x08, 0x12, 0x17, 0x0a, 0x12, - 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4e, 0x6f, 0x44, 0x61, - 0x74, 0x61, 0x10, 0xd0, 0x08, 0x12, 0x0e, 0x0a, 0x09, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x59, - 0x65, 0x74, 0x10, 0xd1, 0x08, 0x12, 0x13, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, - 0x70, 0x70, 0x6c, 0x79, 0x59, 0x65, 0x74, 0x10, 0xd2, 0x08, 0x12, 0x17, 0x0a, 0x12, 0x46, 0x72, - 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x66, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x59, 0x65, 0x74, - 0x10, 0xd3, 0x08, 0x12, 0x19, 0x0a, 0x14, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x59, 0x65, 0x74, 0x10, 0xd4, 0x08, 0x12, 0x15, - 0x0a, 0x10, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x10, 0xd5, 0x08, 0x12, 0x13, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, - 0x6c, 0x61, 0x63, 0x6b, 0x4d, 0x61, 0x78, 0x10, 0xd6, 0x08, 0x12, 0x1a, 0x0a, 0x15, 0x46, 0x72, - 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4e, 0x61, 0x6d, 0x65, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x10, 0xd7, 0x08, 0x12, 0x12, 0x0a, 0x0d, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x4e, - 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xb0, 0x09, 0x12, 0x15, 0x0a, 0x10, 0x49, 0x74, - 0x65, 0x6d, 0x73, 0x4e, 0x6f, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x69, 0x72, 0x64, 0x10, 0xb1, - 0x09, 0x12, 0x16, 0x0a, 0x11, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x47, 0x72, 0x69, 0x64, 0x4e, 0x75, - 0x6d, 0x55, 0x70, 0x70, 0x65, 0x72, 0x10, 0xb2, 0x09, 0x12, 0x19, 0x0a, 0x14, 0x49, 0x74, 0x65, - 0x6d, 0x73, 0x47, 0x69, 0x72, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x70, 0x65, - 0x72, 0x10, 0xb3, 0x09, 0x12, 0x10, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x78, - 0x69, 0x73, 0x74, 0x10, 0x94, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, - 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x95, 0x0a, 0x12, 0x0e, 0x0a, 0x09, 0x48, 0x65, 0x72, - 0x6f, 0x4d, 0x61, 0x78, 0x4c, 0x76, 0x10, 0x96, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, - 0x6f, 0x49, 0x6e, 0x69, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x10, 0x97, 0x0a, 0x12, 0x11, 0x0a, - 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x45, 0x72, 0x72, 0x10, 0x98, 0x0a, - 0x12, 0x13, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x55, 0x70, 0x45, - 0x72, 0x72, 0x10, 0x99, 0x0a, 0x12, 0x14, 0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, - 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x10, 0x9a, 0x0a, 0x12, 0x13, 0x0a, 0x0e, 0x48, - 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x10, 0x9b, 0x0a, - 0x12, 0x18, 0x0a, 0x13, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x74, 0x4e, 0x65, 0x65, 0x64, 0x52, - 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x10, 0x9c, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65, - 0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x10, 0x9d, 0x0a, 0x12, 0x0f, 0x0a, - 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x10, 0x9e, 0x0a, 0x12, 0x14, - 0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x10, 0x9f, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x41, - 0x77, 0x61, 0x6b, 0x65, 0x6e, 0x10, 0xa0, 0x0a, 0x12, 0x0f, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f, - 0x49, 0x73, 0x4c, 0x6f, 0x63, 0x6b, 0x10, 0xa1, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65, 0x72, - 0x6f, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xa2, 0x0a, 0x12, 0x14, 0x0a, 0x0f, - 0x48, 0x65, 0x72, 0x6f, 0x43, 0x6f, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x45, 0x72, 0x72, 0x10, - 0xa3, 0x0a, 0x12, 0x10, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x74, 0x61, 0x72, 0x45, 0x72, - 0x72, 0x10, 0xa4, 0x0a, 0x12, 0x10, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70, 0x65, - 0x45, 0x72, 0x72, 0x10, 0xa5, 0x0a, 0x12, 0x13, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x45, 0x78, - 0x70, 0x54, 0x79, 0x70, 0x65, 0x45, 0x72, 0x72, 0x10, 0xa6, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, - 0x65, 0x72, 0x6f, 0x41, 0x64, 0x64, 0x4d, 0x61, 0x78, 0x45, 0x78, 0x70, 0x10, 0xa7, 0x0a, 0x12, - 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x74, 0x61, 0x72, 0x4c, 0x76, 0x45, 0x72, 0x72, - 0x10, 0xa8, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x53, 0x74, - 0x61, 0x72, 0x4c, 0x76, 0x10, 0xa9, 0x0a, 0x12, 0x1e, 0x0a, 0x19, 0x45, 0x71, 0x75, 0x69, 0x70, - 0x6d, 0x65, 0x6e, 0x74, 0x4f, 0x6e, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x71, 0x75, 0x69, 0x70, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0xf8, 0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, - 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x76, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, - 0x65, 0x64, 0x10, 0xf9, 0x0a, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, - 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x10, - 0xdc, 0x0b, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x44, - 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xdd, 0x0b, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x61, 0x69, - 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xde, 0x0b, - 0x12, 0x18, 0x0a, 0x13, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x50, 0x72, 0x65, 0x4e, - 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xdf, 0x0b, 0x12, 0x19, 0x0a, 0x14, 0x4d, 0x61, - 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x52, 0x65, 0x77, 0x61, - 0x72, 0x64, 0x10, 0xe0, 0x0b, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, - 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, - 0xe1, 0x0b, 0x12, 0x0d, 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc0, - 0x0c, 0x12, 0x0e, 0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x65, 0x74, 0x10, 0xc1, - 0x0c, 0x12, 0x0f, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x10, - 0xc2, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, - 0x65, 0x64, 0x10, 0xc3, 0x0c, 0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, - 0x69, 0x76, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc4, 0x0c, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x61, - 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x10, - 0xc5, 0x0c, 0x12, 0x17, 0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, - 0x4e, 0x6f, 0x65, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xc6, 0x0c, 0x12, 0x13, 0x0a, 0x0e, 0x54, - 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xc7, 0x0c, - 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, - 0x10, 0xc8, 0x0c, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xf2, 0x07, 0x12, 0x0c, 0x0a, 0x07, 0x4d, 0x61, 0x69, 0x6c, 0x45, + 0x72, 0x72, 0x10, 0xf3, 0x07, 0x12, 0x12, 0x0a, 0x0d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4e, + 0x6f, 0x74, 0x53, 0x65, 0x6c, 0x66, 0x10, 0xcc, 0x08, 0x12, 0x12, 0x0a, 0x0d, 0x46, 0x72, 0x69, + 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x66, 0x4d, 0x61, 0x78, 0x10, 0xcd, 0x08, 0x12, 0x14, 0x0a, + 0x0f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4d, 0x61, 0x78, + 0x10, 0xce, 0x08, 0x12, 0x15, 0x0a, 0x10, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, + 0x66, 0x4e, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x10, 0xcf, 0x08, 0x12, 0x17, 0x0a, 0x12, 0x46, 0x72, + 0x69, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4e, 0x6f, 0x44, 0x61, 0x74, 0x61, + 0x10, 0xd0, 0x08, 0x12, 0x0e, 0x0a, 0x09, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x59, 0x65, 0x74, + 0x10, 0xd1, 0x08, 0x12, 0x13, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70, + 0x6c, 0x79, 0x59, 0x65, 0x74, 0x10, 0xd2, 0x08, 0x12, 0x17, 0x0a, 0x12, 0x46, 0x72, 0x69, 0x65, + 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x66, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x59, 0x65, 0x74, 0x10, 0xd3, + 0x08, 0x12, 0x19, 0x0a, 0x14, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x54, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x59, 0x65, 0x74, 0x10, 0xd4, 0x08, 0x12, 0x15, 0x0a, 0x10, + 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x10, 0xd5, 0x08, 0x12, 0x13, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x42, 0x6c, 0x61, + 0x63, 0x6b, 0x4d, 0x61, 0x78, 0x10, 0xd6, 0x08, 0x12, 0x1a, 0x0a, 0x15, 0x46, 0x72, 0x69, 0x65, + 0x6e, 0x64, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4e, 0x61, 0x6d, 0x65, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x10, 0xd7, 0x08, 0x12, 0x12, 0x0a, 0x0d, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x4e, 0x6f, 0x45, + 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xb0, 0x09, 0x12, 0x15, 0x0a, 0x10, 0x49, 0x74, 0x65, 0x6d, + 0x73, 0x4e, 0x6f, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x69, 0x72, 0x64, 0x10, 0xb1, 0x09, 0x12, + 0x16, 0x0a, 0x11, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x47, 0x72, 0x69, 0x64, 0x4e, 0x75, 0x6d, 0x55, + 0x70, 0x70, 0x65, 0x72, 0x10, 0xb2, 0x09, 0x12, 0x19, 0x0a, 0x14, 0x49, 0x74, 0x65, 0x6d, 0x73, + 0x47, 0x69, 0x72, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x70, 0x65, 0x72, 0x10, + 0xb3, 0x09, 0x12, 0x10, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x78, 0x69, 0x73, + 0x74, 0x10, 0x94, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x6e, + 0x6f, 0x75, 0x67, 0x68, 0x10, 0x95, 0x0a, 0x12, 0x0e, 0x0a, 0x09, 0x48, 0x65, 0x72, 0x6f, 0x4d, + 0x61, 0x78, 0x4c, 0x76, 0x10, 0x96, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x49, + 0x6e, 0x69, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x10, 0x97, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, + 0x65, 0x72, 0x6f, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x45, 0x72, 0x72, 0x10, 0x98, 0x0a, 0x12, 0x13, + 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x55, 0x70, 0x45, 0x72, 0x72, + 0x10, 0x99, 0x0a, 0x12, 0x14, 0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x52, 0x65, + 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x10, 0x9a, 0x0a, 0x12, 0x13, 0x0a, 0x0e, 0x48, 0x65, 0x72, + 0x6f, 0x4e, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x10, 0x9b, 0x0a, 0x12, 0x18, + 0x0a, 0x13, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x74, 0x4e, 0x65, 0x65, 0x64, 0x52, 0x65, 0x73, + 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x10, 0x9c, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, + 0x4e, 0x6f, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x10, 0x9d, 0x0a, 0x12, 0x0f, 0x0a, 0x0a, 0x48, + 0x65, 0x72, 0x6f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x10, 0x9e, 0x0a, 0x12, 0x14, 0x0a, 0x0f, + 0x48, 0x65, 0x72, 0x6f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x10, + 0x9f, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x41, 0x77, 0x61, + 0x6b, 0x65, 0x6e, 0x10, 0xa0, 0x0a, 0x12, 0x0f, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x73, + 0x4c, 0x6f, 0x63, 0x6b, 0x10, 0xa1, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x4d, + 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xa2, 0x0a, 0x12, 0x14, 0x0a, 0x0f, 0x48, 0x65, + 0x72, 0x6f, 0x43, 0x6f, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x45, 0x72, 0x72, 0x10, 0xa3, 0x0a, + 0x12, 0x10, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x74, 0x61, 0x72, 0x45, 0x72, 0x72, 0x10, + 0xa4, 0x0a, 0x12, 0x10, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x45, 0x72, + 0x72, 0x10, 0xa5, 0x0a, 0x12, 0x13, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x45, 0x78, 0x70, 0x54, + 0x79, 0x70, 0x65, 0x45, 0x72, 0x72, 0x10, 0xa6, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, + 0x6f, 0x41, 0x64, 0x64, 0x4d, 0x61, 0x78, 0x45, 0x78, 0x70, 0x10, 0xa7, 0x0a, 0x12, 0x12, 0x0a, + 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x74, 0x61, 0x72, 0x4c, 0x76, 0x45, 0x72, 0x72, 0x10, 0xa8, + 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x53, 0x74, 0x61, 0x72, + 0x4c, 0x76, 0x10, 0xa9, 0x0a, 0x12, 0x1e, 0x0a, 0x19, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, + 0x6e, 0x74, 0x4f, 0x6e, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0xf8, 0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, + 0x6e, 0x74, 0x4c, 0x76, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, + 0x10, 0xf9, 0x0a, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e, + 0x6f, 0x74, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x10, 0xdc, 0x0b, + 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x44, 0x46, 0x61, + 0x69, 0x6c, 0x65, 0x64, 0x10, 0xdd, 0x0b, 0x12, 0x15, 0x0a, 0x10, 0x4d, 0x61, 0x69, 0x6e, 0x6c, + 0x69, 0x6e, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xde, 0x0b, 0x12, 0x18, + 0x0a, 0x13, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x50, 0x72, 0x65, 0x4e, 0x6f, 0x74, + 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xdf, 0x0b, 0x12, 0x19, 0x0a, 0x14, 0x4d, 0x61, 0x69, 0x6e, + 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, + 0x10, 0xe0, 0x0b, 0x12, 0x1b, 0x0a, 0x16, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x43, + 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xe1, 0x0b, + 0x12, 0x0d, 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc0, 0x0c, 0x12, + 0x0e, 0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x65, 0x74, 0x10, 0xc1, 0x0c, 0x12, + 0x0f, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x10, 0xc2, 0x0c, + 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, + 0x10, 0xc3, 0x0c, 0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, + 0x65, 0x49, 0x6e, 0x69, 0x74, 0x10, 0xc4, 0x0c, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x61, 0x73, 0x6b, + 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xc5, 0x0c, + 0x12, 0x17, 0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, + 0x65, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xc6, 0x0c, 0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, + 0x6b, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xc7, 0x0c, 0x12, 0x11, + 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xc8, + 0x0c, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/pb/mail_msg.pb.go b/pb/mail_msg.pb.go index 6be82fa19..949428518 100644 --- a/pb/mail_msg.pb.go +++ b/pb/mail_msg.pb.go @@ -349,7 +349,7 @@ type MailDelMailResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Mail []*DBMailData `protobuf:"bytes,1,rep,name=Mail,proto3" json:"Mail"` + ObjID string `protobuf:"bytes,1,opt,name=ObjID,proto3" json:"ObjID"` // 返回删除邮件id } func (x *MailDelMailResp) Reset() { @@ -384,11 +384,11 @@ func (*MailDelMailResp) Descriptor() ([]byte, []int) { return file_mail_mail_msg_proto_rawDescGZIP(), []int{7} } -func (x *MailDelMailResp) GetMail() []*DBMailData { +func (x *MailDelMailResp) GetObjID() string { if x != nil { - return x.Mail + return x.ObjID } - return nil + return "" } // 推送邮件 @@ -465,14 +465,13 @@ var file_mail_mail_msg_proto_rawDesc = []byte{ 0x61, 0x52, 0x04, 0x4d, 0x61, 0x69, 0x6c, 0x22, 0x26, 0x0a, 0x0e, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x65, 0x6c, 0x4d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x22, - 0x32, 0x0a, 0x0f, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x65, 0x6c, 0x4d, 0x61, 0x69, 0x6c, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x04, 0x4d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x4d, - 0x61, 0x69, 0x6c, 0x22, 0x35, 0x0a, 0x12, 0x4d, 0x61, 0x69, 0x6c, 0x47, 0x65, 0x74, 0x4e, 0x65, - 0x77, 0x4d, 0x61, 0x69, 0x6c, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1f, 0x0a, 0x04, 0x4d, 0x61, 0x69, - 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6c, - 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x4d, 0x61, 0x69, 0x6c, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x27, 0x0a, 0x0f, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x65, 0x6c, 0x4d, 0x61, 0x69, 0x6c, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x22, 0x35, 0x0a, 0x12, 0x4d, 0x61, 0x69, 0x6c, + 0x47, 0x65, 0x74, 0x4e, 0x65, 0x77, 0x4d, 0x61, 0x69, 0x6c, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1f, + 0x0a, 0x04, 0x4d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, + 0x42, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x4d, 0x61, 0x69, 0x6c, 0x42, + 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -504,13 +503,12 @@ var file_mail_mail_msg_proto_depIdxs = []int32{ 9, // 0: MailGetListResp.Mails:type_name -> DBMailData 9, // 1: MailReadMailResp.Mail:type_name -> DBMailData 9, // 2: MailGetUserMailAttachmentResp.Mail:type_name -> DBMailData - 9, // 3: MailDelMailResp.Mail:type_name -> DBMailData - 9, // 4: MailGetNewMailPush.Mail:type_name -> DBMailData - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 9, // 3: MailGetNewMailPush.Mail:type_name -> DBMailData + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_mail_mail_msg_proto_init() } diff --git a/pb/proto/errorcode.proto b/pb/proto/errorcode.proto index 775710e1f..df6edf96f 100644 --- a/pb/proto/errorcode.proto +++ b/pb/proto/errorcode.proto @@ -34,6 +34,7 @@ enum ErrorCode { VeriCodeExpired = 1008; //验证码过期 UserResetData = 1009; //初始化用户失败 ModifynameCount = 1010; //名称修改次数不足 + MailErr = 1011; // 邮件不存在 // friend FriendNotSelf = 1100; //不能是自己 diff --git a/pb/proto/mail/mail_msg.proto b/pb/proto/mail/mail_msg.proto index dedeba2aa..98cc9473d 100644 --- a/pb/proto/mail/mail_msg.proto +++ b/pb/proto/mail/mail_msg.proto @@ -35,7 +35,7 @@ message MailDelMailReq { } message MailDelMailResp { - repeated DBMailData Mail = 1; + string ObjID = 1; // 返回删除邮件id } // 推送邮件 diff --git a/pb/proto/user/user_msg.proto b/pb/proto/user/user_msg.proto index caef23a01..fdcd3bfdb 100644 --- a/pb/proto/user/user_msg.proto +++ b/pb/proto/user/user_msg.proto @@ -89,4 +89,12 @@ message UserModifynameReq { message UserModifynameResp { string uid = 1; uint32 count = 2; //剩余修改次数 +} + +message UserGetTujianReq{ + +} + +message UserGetTujianResp{ + repeated int32 heroids = 1; } \ No newline at end of file diff --git a/pb/proto/userexpand.proto b/pb/proto/userexpand.proto index fe38ed0d7..d76675dc1 100644 --- a/pb/proto/userexpand.proto +++ b/pb/proto/userexpand.proto @@ -10,4 +10,5 @@ message DBUserExpand { uint32 initdataCount = 5; //今日初始累计次数 int32 chatchannel = 6; //跨服聊天频道 int32 modifynameCount = 7; //修改昵称次数 + map tujian = 8; // 图鉴 } diff --git a/pb/user_msg.pb.go b/pb/user_msg.pb.go index e5d9739c5..71371735c 100644 --- a/pb/user_msg.pb.go +++ b/pb/user_msg.pb.go @@ -1074,6 +1074,91 @@ func (x *UserModifynameResp) GetCount() uint32 { return 0 } +type UserGetTujianReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UserGetTujianReq) Reset() { + *x = UserGetTujianReq{} + if protoimpl.UnsafeEnabled { + mi := &file_user_user_msg_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserGetTujianReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserGetTujianReq) ProtoMessage() {} + +func (x *UserGetTujianReq) ProtoReflect() protoreflect.Message { + mi := &file_user_user_msg_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserGetTujianReq.ProtoReflect.Descriptor instead. +func (*UserGetTujianReq) Descriptor() ([]byte, []int) { + return file_user_user_msg_proto_rawDescGZIP(), []int{22} +} + +type UserGetTujianResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Heroids []int32 `protobuf:"varint,1,rep,packed,name=heroids,proto3" json:"heroids"` +} + +func (x *UserGetTujianResp) Reset() { + *x = UserGetTujianResp{} + if protoimpl.UnsafeEnabled { + mi := &file_user_user_msg_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserGetTujianResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserGetTujianResp) ProtoMessage() {} + +func (x *UserGetTujianResp) ProtoReflect() protoreflect.Message { + mi := &file_user_user_msg_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserGetTujianResp.ProtoReflect.Descriptor instead. +func (*UserGetTujianResp) Descriptor() ([]byte, []int) { + return file_user_user_msg_proto_rawDescGZIP(), []int{23} +} + +func (x *UserGetTujianResp) GetHeroids() []int32 { + if x != nil { + return x.Heroids + } + return nil +} + var File_user_user_msg_proto protoreflect.FileDescriptor var file_user_user_msg_proto_rawDesc = []byte{ @@ -1147,8 +1232,12 @@ var file_user_user_msg_proto_rawDesc = []byte{ 0x6f, 0x64, 0x69, 0x66, 0x79, 0x6e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x12, 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x47, 0x65, 0x74, + 0x54, 0x75, 0x6a, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x22, 0x2d, 0x0a, 0x11, 0x55, 0x73, 0x65, + 0x72, 0x47, 0x65, 0x74, 0x54, 0x75, 0x6a, 0x69, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, + 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, + 0x07, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1163,7 +1252,7 @@ func file_user_user_msg_proto_rawDescGZIP() []byte { return file_user_user_msg_proto_rawDescData } -var file_user_user_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 22) +var file_user_user_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 24) var file_user_user_msg_proto_goTypes = []interface{}{ (*UserLoginReq)(nil), // 0: UserLoginReq (*UserLoginResp)(nil), // 1: UserLoginResp @@ -1187,22 +1276,24 @@ var file_user_user_msg_proto_goTypes = []interface{}{ (*UserInitdataResp)(nil), // 19: UserInitdataResp (*UserModifynameReq)(nil), // 20: UserModifynameReq (*UserModifynameResp)(nil), // 21: UserModifynameResp - (*DBUser)(nil), // 22: DBUser - (*DBUserExpand)(nil), // 23: DBUserExpand - (ErrorCode)(0), // 24: ErrorCode - (*CacheUser)(nil), // 25: CacheUser - (*UserAssets)(nil), // 26: UserAssets - (*DBUserSetting)(nil), // 27: DBUserSetting + (*UserGetTujianReq)(nil), // 22: UserGetTujianReq + (*UserGetTujianResp)(nil), // 23: UserGetTujianResp + (*DBUser)(nil), // 24: DBUser + (*DBUserExpand)(nil), // 25: DBUserExpand + (ErrorCode)(0), // 26: ErrorCode + (*CacheUser)(nil), // 27: CacheUser + (*UserAssets)(nil), // 28: UserAssets + (*DBUserSetting)(nil), // 29: DBUserSetting } var file_user_user_msg_proto_depIdxs = []int32{ - 22, // 0: UserLoginResp.data:type_name -> DBUser - 23, // 1: UserLoginResp.ex:type_name -> DBUserExpand - 24, // 2: UserRegisterResp.Code:type_name -> ErrorCode - 25, // 3: UserLoadResp.data:type_name -> CacheUser - 26, // 4: UserAddResReq.res:type_name -> UserAssets - 26, // 5: UserAddResResp.res:type_name -> UserAssets - 27, // 6: UserGetSettingResp.setting:type_name -> DBUserSetting - 27, // 7: UserUpdateSettingReq.setting:type_name -> DBUserSetting + 24, // 0: UserLoginResp.data:type_name -> DBUser + 25, // 1: UserLoginResp.ex:type_name -> DBUserExpand + 26, // 2: UserRegisterResp.Code:type_name -> ErrorCode + 27, // 3: UserLoadResp.data:type_name -> CacheUser + 28, // 4: UserAddResReq.res:type_name -> UserAssets + 28, // 5: UserAddResResp.res:type_name -> UserAssets + 29, // 6: UserGetSettingResp.setting:type_name -> DBUserSetting + 29, // 7: UserUpdateSettingReq.setting:type_name -> DBUserSetting 8, // [8:8] is the sub-list for method output_type 8, // [8:8] is the sub-list for method input_type 8, // [8:8] is the sub-list for extension type_name @@ -1484,6 +1575,30 @@ func file_user_user_msg_proto_init() { return nil } } + file_user_user_msg_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserGetTujianReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_user_msg_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserGetTujianResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1491,7 +1606,7 @@ func file_user_user_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_user_user_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 22, + NumMessages: 24, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/userexpand.pb.go b/pb/userexpand.pb.go index 026506f28..2dd722859 100644 --- a/pb/userexpand.pb.go +++ b/pb/userexpand.pb.go @@ -26,13 +26,14 @@ type DBUserExpand struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` //主键id - Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` //用户id - Lastreadnotiftime int64 `protobuf:"varint,3,opt,name=lastreadnotiftime,proto3" json:"lastreadnotiftime"` //最后阅读公告时间 - LastInitdataTime int64 `protobuf:"varint,4,opt,name=lastInitdataTime,proto3" json:"lastInitdataTime"` //上次初始数据时间 - InitdataCount uint32 `protobuf:"varint,5,opt,name=initdataCount,proto3" json:"initdataCount"` //今日初始累计次数 - Chatchannel int32 `protobuf:"varint,6,opt,name=chatchannel,proto3" json:"chatchannel"` //跨服聊天频道 - ModifynameCount int32 `protobuf:"varint,7,opt,name=modifynameCount,proto3" json:"modifynameCount"` //修改昵称次数 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` //主键id + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` //用户id + Lastreadnotiftime int64 `protobuf:"varint,3,opt,name=lastreadnotiftime,proto3" json:"lastreadnotiftime"` //最后阅读公告时间 + LastInitdataTime int64 `protobuf:"varint,4,opt,name=lastInitdataTime,proto3" json:"lastInitdataTime"` //上次初始数据时间 + InitdataCount uint32 `protobuf:"varint,5,opt,name=initdataCount,proto3" json:"initdataCount"` //今日初始累计次数 + Chatchannel int32 `protobuf:"varint,6,opt,name=chatchannel,proto3" json:"chatchannel"` //跨服聊天频道 + ModifynameCount int32 `protobuf:"varint,7,opt,name=modifynameCount,proto3" json:"modifynameCount"` //修改昵称次数 + Tujian map[int32]bool `protobuf:"bytes,8,rep,name=tujian,proto3" json:"tujian" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 图鉴 } func (x *DBUserExpand) Reset() { @@ -116,11 +117,18 @@ func (x *DBUserExpand) GetModifynameCount() int32 { return 0 } +func (x *DBUserExpand) GetTujian() map[int32]bool { + if x != nil { + return x.Tujian + } + return nil +} + var File_userexpand_proto protoreflect.FileDescriptor var file_userexpand_proto_rawDesc = []byte{ 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xfc, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x45, 0x78, 0x70, + 0x74, 0x6f, 0x22, 0xea, 0x02, 0x0a, 0x0c, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x65, 0x61, @@ -136,8 +144,14 @@ var file_userexpand_proto_rawDesc = []byte{ 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x28, 0x0a, 0x0f, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x6e, 0x61, 0x6d, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x6e, 0x61, 0x6d, 0x65, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x74, 0x12, 0x31, 0x0a, 0x06, 0x74, 0x75, 0x6a, 0x69, 0x61, 0x6e, 0x18, 0x08, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, + 0x2e, 0x54, 0x75, 0x6a, 0x69, 0x61, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x74, 0x75, + 0x6a, 0x69, 0x61, 0x6e, 0x1a, 0x39, 0x0a, 0x0b, 0x54, 0x75, 0x6a, 0x69, 0x61, 0x6e, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, + 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -152,16 +166,18 @@ func file_userexpand_proto_rawDescGZIP() []byte { return file_userexpand_proto_rawDescData } -var file_userexpand_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_userexpand_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_userexpand_proto_goTypes = []interface{}{ (*DBUserExpand)(nil), // 0: DBUserExpand + nil, // 1: DBUserExpand.TujianEntry } var file_userexpand_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 1, // 0: DBUserExpand.tujian:type_name -> DBUserExpand.TujianEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_userexpand_proto_init() } @@ -189,7 +205,7 @@ func file_userexpand_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_userexpand_proto_rawDesc, NumEnums: 0, - NumMessages: 1, + NumMessages: 2, NumExtensions: 0, NumServices: 0, }, diff --git a/probuf转go.cmd b/probuf转go.cmd deleted file mode 100644 index 5848191d7..000000000 --- a/probuf转go.cmd +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -pb2go.exe -pause \ No newline at end of file diff --git a/services/comp_gateroute.go b/services/comp_gateroute.go index af6455cdc..013741c34 100644 --- a/services/comp_gateroute.go +++ b/services/comp_gateroute.go @@ -84,8 +84,8 @@ func (this *SCompGateRoute) Init(service core.IService, comp core.IServiceComp, //组件启动时注册rpc服务监听 func (this *SCompGateRoute) Start() (err error) { - this.service.RegisterFunctionName(string(comm.Rpc_GatewayRoute), this.ReceiveMsg) //注册网关路由接收接口 - this.service.RegisterFunctionName(string(comm.Rpc_NoticeUserClose), this.NoticeUserClose) //注册用户离线通知 + this.service.RegisterFunctionName(string(comm.Rpc_GatewayRoute), this.ReceiveMsg) //注册网关路由接收接口 + this.service.RegisterFunctionName(string(comm.Rpc_GatewayNoticeUserClose), this.NoticeUserClose) //注册用户离线通知 err = this.ServiceCompBase.Start() return } diff --git a/utils/trace.go b/utils/trace.go index 16b54858f..a1f5737fb 100644 --- a/utils/trace.go +++ b/utils/trace.go @@ -18,9 +18,9 @@ const ( ) //打印函数处理信息 -func TraceFunc(uid string, module string, funcName string, funcArgs interface{}, rsp interface{}) { - log.Debugf("traceFunc uid:%s module:%s funcName:%s funcArgs:%v", uid, module, funcName, funcArgs) -} +// func TraceFunc(uid string, module string, funcName string, funcArgs interface{}, rsp interface{}) { +// log.Debugf("traceFunc uid:%s module:%s funcName:%s funcArgs:%v", uid, module, funcName, funcArgs) +// } //打印函数处理时间 func TraceTimeCost(funcName string, invocation time.Time) {