Compare commits
8 Commits
427fca7ed1
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 332d812347 | |||
| c39cea8656 | |||
| 9439be8a60 | |||
| 558677bc3a | |||
| 0ca8a0ccbb | |||
| 5a0f4b71d4 | |||
| 44ebbe4449 | |||
| 5dc5391b07 |
@@ -173,7 +173,7 @@ user-service/
|
|||||||
# 增加服务器步骤
|
# 增加服务器步骤
|
||||||
|
|
||||||
代码
|
代码
|
||||||
1. go module 命名:`git.hlsq.asia/mmorpg/service-${服务名}`
|
1. go module 命名:`git.hlsq.asia/alex/service-${服务名}`
|
||||||
2. `deploy、config` 修改
|
2. `deploy、config` 修改
|
||||||
|
|
||||||
common
|
common
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package etcd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.hlsq.asia/mmorpg/service-common/config"
|
"git.hlsq.asia/alex/service-common/config"
|
||||||
"go.etcd.io/etcd/client/v3"
|
"go.etcd.io/etcd/client/v3"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -37,6 +37,10 @@ func GetClient() *Client {
|
|||||||
return instance
|
return instance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) Raw() *clientv3.Client {
|
||||||
|
return c.cli
|
||||||
|
}
|
||||||
|
|
||||||
// Get 获取数据
|
// Get 获取数据
|
||||||
func (c *Client) Get(key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error) {
|
func (c *Client) Get(key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package kafka
|
package kafka
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.hlsq.asia/mmorpg/service-common/config"
|
"git.hlsq.asia/alex/service-common/config"
|
||||||
"github.com/IBM/sarama"
|
"github.com/IBM/sarama"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"git.hlsq.asia/mmorpg/service-common/utils"
|
"git.hlsq.asia/alex/service-common/utils"
|
||||||
"github.com/IBM/sarama"
|
"github.com/IBM/sarama"
|
||||||
"go.opentelemetry.io/otel"
|
"go.opentelemetry.io/otel"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
|||||||
@@ -6,3 +6,43 @@ type Topic interface {
|
|||||||
Name() string
|
Name() string
|
||||||
OnMessage(context.Context) error
|
OnMessage(context.Context) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TopicQuestionAnswer struct {
|
||||||
|
MessageSn int64 `json:"messageSn"`
|
||||||
|
USN int64 `json:"usn"`
|
||||||
|
QuestionSn int64 `json:"questionSn"`
|
||||||
|
QuestionAnswer string `json:"questionAnswer"`
|
||||||
|
Answer string `json:"answer"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *TopicQuestionAnswer) Name() string {
|
||||||
|
return "qgdzs.question.answer"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *TopicQuestionAnswer) OnMessage(_ context.Context) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type TopicAddPoint struct {
|
||||||
|
MessageSn int64 `json:"messageSn"`
|
||||||
|
Source AddPointSource `json:"source"`
|
||||||
|
USN int64 `json:"usn"`
|
||||||
|
Point int64 `json:"point"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AddPointSource int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
AddPointSourceUnKnown AddPointSource = 0
|
||||||
|
AddPointSourceRandom AddPointSource = 1
|
||||||
|
AddPointSourceCategory AddPointSource = 2
|
||||||
|
AddPointSourceQuickly AddPointSource = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
func (t *TopicAddPoint) Name() string {
|
||||||
|
return "qgdzs.user.point"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *TopicAddPoint) OnMessage(_ context.Context) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package mongo
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.hlsq.asia/mmorpg/service-common/config"
|
"git.hlsq.asia/alex/service-common/config"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
"go.mongodb.org/mongo-driver/mongo/options"
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package mysql
|
package mysql
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.hlsq.asia/mmorpg/service-common/config"
|
"git.hlsq.asia/alex/service-common/config"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"gorm.io/driver/mysql"
|
"gorm.io/driver/mysql"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/logger"
|
"gorm.io/gorm/logger"
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package redis
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.hlsq.asia/mmorpg/service-common/config"
|
"git.hlsq.asia/alex/service-common/config"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"github.com/redis/go-redis/v9"
|
"github.com/redis/go-redis/v9"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ var (
|
|||||||
// ServiceProvider 服务提供者
|
// ServiceProvider 服务提供者
|
||||||
type ServiceProvider struct {
|
type ServiceProvider struct {
|
||||||
Target string
|
Target string
|
||||||
SID string
|
SID int64
|
||||||
Addr string
|
Addr string
|
||||||
}
|
}
|
||||||
|
|
||||||
// InstanceProvider 副本提供者
|
// InstanceProvider 副本提供者
|
||||||
type InstanceProvider struct {
|
type InstanceProvider struct {
|
||||||
InstanceID int // 副本ID
|
InstanceID int // 副本ID
|
||||||
UniqueNo string // 副本唯一编号
|
UniqueNo int64 // 副本唯一编号
|
||||||
SID string
|
SID int64
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.hlsq.asia/mmorpg/service-common/db/etcd"
|
"git.hlsq.asia/alex/service-common/db/etcd"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
clientv3 "go.etcd.io/etcd/client/v3"
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package discover
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.hlsq.asia/mmorpg/service-common/db/etcd"
|
"git.hlsq.asia/alex/service-common/db/etcd"
|
||||||
"git.hlsq.asia/mmorpg/service-common/discover/common"
|
"git.hlsq.asia/alex/service-common/discover/common"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
|
"git.hlsq.asia/alex/service-common/utils"
|
||||||
clientv3 "go.etcd.io/etcd/client/v3"
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
@@ -12,8 +13,8 @@ import (
|
|||||||
// 大量读少量写的情况下,读写锁比同步Map更高效
|
// 大量读少量写的情况下,读写锁比同步Map更高效
|
||||||
var (
|
var (
|
||||||
instanceMU = sync.RWMutex{}
|
instanceMU = sync.RWMutex{}
|
||||||
instanceM = make(map[string]string) // [uniqueNo]sid
|
instanceM = make(map[int64]int64) // [uniqueNo]sid
|
||||||
instanceLeaseM = make(map[string]clientv3.LeaseID) // [uniqueNo]
|
instanceLeaseM = make(map[int64]clientv3.LeaseID) // [uniqueNo]
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -22,7 +23,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FindInstanceByUniqueNo 根据唯一标识查询副本
|
// FindInstanceByUniqueNo 根据唯一标识查询副本
|
||||||
func FindInstanceByUniqueNo(uniqueNO string) (sid string) {
|
func FindInstanceByUniqueNo(uniqueNO int64) (sid int64) {
|
||||||
instanceMU.RLock()
|
instanceMU.RLock()
|
||||||
defer instanceMU.RUnlock()
|
defer instanceMU.RUnlock()
|
||||||
if c, ok := instanceM[uniqueNO]; ok {
|
if c, ok := instanceM[uniqueNO]; ok {
|
||||||
@@ -32,7 +33,7 @@ func FindInstanceByUniqueNo(uniqueNO string) (sid string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RegisterInstance 注册副本
|
// RegisterInstance 注册副本
|
||||||
func RegisterInstance(sid string, instanceID int32, uniqueNo string, ttl int64) error {
|
func RegisterInstance(sid int64, instanceID int32, uniqueNo int64, ttl int64) error {
|
||||||
serverMU.Lock()
|
serverMU.Lock()
|
||||||
defer serverMU.Unlock()
|
defer serverMU.Unlock()
|
||||||
leaseID, err := common.NewLeaseAndKeepAlive(ttl)
|
leaseID, err := common.NewLeaseAndKeepAlive(ttl)
|
||||||
@@ -40,7 +41,7 @@ func RegisterInstance(sid string, instanceID int32, uniqueNo string, ttl int64)
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
key := fmt.Sprintf("%v/%v/%v", common.KeyDiscoverInstance, instanceID, uniqueNo)
|
key := fmt.Sprintf("%v/%v/%v", common.KeyDiscoverInstance, instanceID, uniqueNo)
|
||||||
_, err = etcd.GetClient().Put(key, sid, clientv3.WithLease(leaseID))
|
_, err = etcd.GetClient().Put(key, utils.Int64ToString(sid), clientv3.WithLease(leaseID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -49,7 +50,7 @@ func RegisterInstance(sid string, instanceID int32, uniqueNo string, ttl int64)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UnRegisterInstance 解注册副本
|
// UnRegisterInstance 解注册副本
|
||||||
func UnRegisterInstance(uniqueNo string) {
|
func UnRegisterInstance(uniqueNo int64) {
|
||||||
serverMU.Lock()
|
serverMU.Lock()
|
||||||
defer serverMU.Unlock()
|
defer serverMU.Unlock()
|
||||||
if leaseID, ok := instanceLeaseM[uniqueNo]; ok {
|
if leaseID, ok := instanceLeaseM[uniqueNo]; ok {
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ package discover
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.hlsq.asia/mmorpg/service-common/db/etcd"
|
"git.hlsq.asia/alex/service-common/db/etcd"
|
||||||
"git.hlsq.asia/mmorpg/service-common/discover/common"
|
"git.hlsq.asia/alex/service-common/discover/common"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
|
"git.hlsq.asia/alex/service-common/utils"
|
||||||
"go.etcd.io/etcd/api/v3/mvccpb"
|
"go.etcd.io/etcd/api/v3/mvccpb"
|
||||||
clientv3 "go.etcd.io/etcd/client/v3"
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -89,13 +90,13 @@ func onServerChange(t mvccpb.Event_EventType, key, value string) {
|
|||||||
case clientv3.EventTypePut:
|
case clientv3.EventTypePut:
|
||||||
onCBByType(common.ListenerTypeNewServer, &common.ServiceProvider{
|
onCBByType(common.ListenerTypeNewServer, &common.ServiceProvider{
|
||||||
Target: common.KeyDiscoverService + "/" + split[2],
|
Target: common.KeyDiscoverService + "/" + split[2],
|
||||||
SID: split[3],
|
SID: utils.StringToInt64(split[3]),
|
||||||
Addr: value,
|
Addr: value,
|
||||||
})
|
})
|
||||||
case clientv3.EventTypeDelete:
|
case clientv3.EventTypeDelete:
|
||||||
onCBByType(common.ListenerTypeCloseServer, &common.ServiceProvider{
|
onCBByType(common.ListenerTypeCloseServer, &common.ServiceProvider{
|
||||||
Target: common.KeyDiscoverService + "/" + split[2],
|
Target: common.KeyDiscoverService + "/" + split[2],
|
||||||
SID: split[3],
|
SID: utils.StringToInt64(split[3]),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,14 +112,14 @@ func onInstanceChange(t mvccpb.Event_EventType, key, value string, preKv *mvccpb
|
|||||||
case clientv3.EventTypePut:
|
case clientv3.EventTypePut:
|
||||||
onCBByType(common.ListenerTypeNewInstance, &common.InstanceProvider{
|
onCBByType(common.ListenerTypeNewInstance, &common.InstanceProvider{
|
||||||
InstanceID: instanceID,
|
InstanceID: instanceID,
|
||||||
UniqueNo: split[3],
|
UniqueNo: utils.StringToInt64(split[3]),
|
||||||
SID: value,
|
SID: utils.StringToInt64(value),
|
||||||
})
|
})
|
||||||
case clientv3.EventTypeDelete:
|
case clientv3.EventTypeDelete:
|
||||||
onCBByType(common.ListenerTypeCloseInstance, &common.InstanceProvider{
|
onCBByType(common.ListenerTypeCloseInstance, &common.InstanceProvider{
|
||||||
InstanceID: instanceID,
|
InstanceID: instanceID,
|
||||||
UniqueNo: split[3],
|
UniqueNo: utils.StringToInt64(split[3]),
|
||||||
SID: string(preKv.Value),
|
SID: utils.StringToInt64(string(preKv.Value)),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package discover
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.hlsq.asia/mmorpg/service-common/db/etcd"
|
"git.hlsq.asia/alex/service-common/db/etcd"
|
||||||
"git.hlsq.asia/mmorpg/service-common/discover/common"
|
"git.hlsq.asia/alex/service-common/discover/common"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"git.hlsq.asia/mmorpg/service-common/net/grpc/grpc_conn"
|
"git.hlsq.asia/alex/service-common/net/grpc/grpcconn"
|
||||||
clientv3 "go.etcd.io/etcd/client/v3"
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -14,8 +14,8 @@ import (
|
|||||||
// 大量读少量写的情况下,读写锁比同步Map更高效
|
// 大量读少量写的情况下,读写锁比同步Map更高效
|
||||||
var (
|
var (
|
||||||
serverMU = sync.RWMutex{}
|
serverMU = sync.RWMutex{}
|
||||||
conn = make(map[string]*grpc_conn.GrpcConnectionMgr)
|
conn = make(map[string]*grpcconn.GrpcConnectionMgr)
|
||||||
serverLeaseM = make(map[string]clientv3.LeaseID)
|
serverLeaseM = make(map[int64]clientv3.LeaseID)
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -24,7 +24,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FindServer 根据SID或随机查找服务
|
// FindServer 根据SID或随机查找服务
|
||||||
func FindServer(target string, sid ...string) (*grpc.ClientConn, error) {
|
func FindServer(target string, sid ...int64) (*grpc.ClientConn, error) {
|
||||||
serverMU.RLock()
|
serverMU.RLock()
|
||||||
defer serverMU.RUnlock()
|
defer serverMU.RUnlock()
|
||||||
if v, ok := conn[target]; ok {
|
if v, ok := conn[target]; ok {
|
||||||
@@ -33,17 +33,17 @@ func FindServer(target string, sid ...string) (*grpc.ClientConn, error) {
|
|||||||
return nil, fmt.Errorf("cannot find server")
|
return nil, fmt.Errorf("cannot find server")
|
||||||
}
|
}
|
||||||
|
|
||||||
func FindServerAll(target string) map[string]*grpc.ClientConn {
|
func FindServerAll(target string) map[int64]*grpc.ClientConn {
|
||||||
serverMU.RLock()
|
serverMU.RLock()
|
||||||
defer serverMU.RUnlock()
|
defer serverMU.RUnlock()
|
||||||
if v, ok := conn[target]; ok {
|
if v, ok := conn[target]; ok {
|
||||||
return v.LoadAll()
|
return v.LoadAll()
|
||||||
}
|
}
|
||||||
return make(map[string]*grpc.ClientConn)
|
return make(map[int64]*grpc.ClientConn)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterGrpcServer 注册服务提供者
|
// RegisterGrpcServer 注册服务提供者
|
||||||
func RegisterGrpcServer(target string, sid string, addr string, ttl int64) error {
|
func RegisterGrpcServer(target string, sid int64, addr string, ttl int64) error {
|
||||||
serverMU.Lock()
|
serverMU.Lock()
|
||||||
defer serverMU.Unlock()
|
defer serverMU.Unlock()
|
||||||
leaseID, err := common.NewLeaseAndKeepAlive(ttl)
|
leaseID, err := common.NewLeaseAndKeepAlive(ttl)
|
||||||
@@ -59,7 +59,7 @@ func RegisterGrpcServer(target string, sid string, addr string, ttl int64) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UnRegisterGrpcServer 解注册服务提供者
|
// UnRegisterGrpcServer 解注册服务提供者
|
||||||
func UnRegisterGrpcServer(sid string) {
|
func UnRegisterGrpcServer(sid int64) {
|
||||||
serverMU.Lock()
|
serverMU.Lock()
|
||||||
defer serverMU.Unlock()
|
defer serverMU.Unlock()
|
||||||
if leaseID, ok := serverLeaseM[sid]; ok {
|
if leaseID, ok := serverLeaseM[sid]; ok {
|
||||||
@@ -79,7 +79,7 @@ func onServerStart(data any) {
|
|||||||
if v, ok := conn[provider.Target]; ok {
|
if v, ok := conn[provider.Target]; ok {
|
||||||
v.Store(provider.SID, provider.Addr)
|
v.Store(provider.SID, provider.Addr)
|
||||||
} else {
|
} else {
|
||||||
mgr := grpc_conn.NewGrpcConnectionMgr()
|
mgr := grpcconn.NewGrpcConnectionMgr()
|
||||||
mgr.Store(provider.SID, provider.Addr)
|
mgr.Store(provider.SID, provider.Addr)
|
||||||
conn[provider.Target] = mgr
|
conn[provider.Target] = mgr
|
||||||
}
|
}
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module git.hlsq.asia/mmorpg/service-common
|
module git.hlsq.asia/alex/service-common
|
||||||
|
|
||||||
go 1.24.0
|
go 1.24.0
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package log
|
package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"git.hlsq.asia/alex/service-common/config"
|
||||||
"github.com/natefinch/lumberjack"
|
"github.com/natefinch/lumberjack"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"go.uber.org/zap/zapcore"
|
"go.uber.org/zap/zapcore"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Init(debug bool, maxSize, maxBackups, maxAge int32, level string) {
|
func Init(cfg *config.LogConfig) {
|
||||||
// 格式配置
|
// 格式配置
|
||||||
jsonConfig := zapcore.EncoderConfig{
|
jsonConfig := zapcore.EncoderConfig{
|
||||||
MessageKey: "M",
|
MessageKey: "M",
|
||||||
@@ -30,19 +31,19 @@ func Init(debug bool, maxSize, maxBackups, maxAge int32, level string) {
|
|||||||
|
|
||||||
// 日志输出到控制台和文件
|
// 日志输出到控制台和文件
|
||||||
writeSyncer := []zapcore.WriteSyncer{zapcore.AddSync(os.Stdout)}
|
writeSyncer := []zapcore.WriteSyncer{zapcore.AddSync(os.Stdout)}
|
||||||
if !debug {
|
if !cfg.Debug {
|
||||||
writeSyncer = append(writeSyncer, zapcore.AddSync(&lumberjack.Logger{
|
writeSyncer = append(writeSyncer, zapcore.AddSync(&lumberjack.Logger{
|
||||||
Filename: "./logs/log.log", // 日志文件位置
|
Filename: "./logs/log.log", // 日志文件位置
|
||||||
MaxSize: int(maxSize), // 最大文件大小(MB)
|
MaxSize: int(cfg.MaxSize), // 最大文件大小(MB)
|
||||||
MaxBackups: int(maxBackups), // 保留旧文件的最大个数
|
MaxBackups: int(cfg.MaxBackups), // 保留旧文件的最大个数
|
||||||
MaxAge: int(maxAge), // 保留旧文件的最大天数
|
MaxAge: int(cfg.MaxAge), // 保留旧文件的最大天数
|
||||||
Compress: false, // 是否压缩/归档旧文件
|
Compress: false, // 是否压缩/归档旧文件
|
||||||
LocalTime: true,
|
LocalTime: true,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
var encoder zapcore.Encoder
|
var encoder zapcore.Encoder
|
||||||
if debug {
|
if cfg.Debug {
|
||||||
encoder = zapcore.NewConsoleEncoder(jsonConfig)
|
encoder = zapcore.NewConsoleEncoder(jsonConfig)
|
||||||
} else {
|
} else {
|
||||||
encoder = zapcore.NewJSONEncoder(jsonConfig)
|
encoder = zapcore.NewJSONEncoder(jsonConfig)
|
||||||
@@ -50,9 +51,9 @@ func Init(debug bool, maxSize, maxBackups, maxAge int32, level string) {
|
|||||||
logger := zap.New(zapcore.NewCore(
|
logger := zap.New(zapcore.NewCore(
|
||||||
encoder,
|
encoder,
|
||||||
zapcore.NewMultiWriteSyncer(writeSyncer...),
|
zapcore.NewMultiWriteSyncer(writeSyncer...),
|
||||||
zap.NewAtomicLevelAt(GetLogLevel(level)),
|
zap.NewAtomicLevelAt(GetLogLevel(cfg.Level)),
|
||||||
))
|
))
|
||||||
if debug {
|
if cfg.Debug {
|
||||||
logger = logger.WithOptions(
|
logger = logger.WithOptions(
|
||||||
zap.AddCaller(),
|
zap.AddCaller(),
|
||||||
zap.AddCallerSkip(1),
|
zap.AddCallerSkip(1),
|
||||||
|
|||||||
45
module/db.go
45
module/db.go
@@ -1,43 +1,43 @@
|
|||||||
package module
|
package module
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.hlsq.asia/mmorpg/service-common/config"
|
"git.hlsq.asia/alex/service-common/config"
|
||||||
"git.hlsq.asia/mmorpg/service-common/db/etcd"
|
"git.hlsq.asia/alex/service-common/db/etcd"
|
||||||
"git.hlsq.asia/mmorpg/service-common/db/kafka"
|
"git.hlsq.asia/alex/service-common/db/kafka"
|
||||||
"git.hlsq.asia/mmorpg/service-common/db/mysql"
|
"git.hlsq.asia/alex/service-common/db/mysql"
|
||||||
"git.hlsq.asia/mmorpg/service-common/db/redis"
|
"git.hlsq.asia/alex/service-common/db/redis"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DB 数据库模块
|
// DB 数据库模块
|
||||||
type DB struct {
|
type DB struct {
|
||||||
DefaultModule
|
DefaultModule
|
||||||
cfg *config.DBConfig
|
Cfg *config.DBConfig
|
||||||
appName string
|
AppName string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *DB) Init() error {
|
func (m *DB) Init() error {
|
||||||
// ETCD
|
// ETCD
|
||||||
if m.cfg.Etcd != nil {
|
if m.Cfg.Etcd != nil {
|
||||||
if err := etcd.Init(m.cfg.Etcd); err != nil {
|
if err := etcd.Init(m.Cfg.Etcd); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// MYSQL
|
// MYSQL
|
||||||
if m.cfg.MySQL != nil {
|
if m.Cfg.MySQL != nil {
|
||||||
if err := mysql.Init(m.cfg.MySQL); err != nil {
|
if err := mysql.Init(m.Cfg.MySQL); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// REDIS
|
// REDIS
|
||||||
if m.cfg.Redis != nil {
|
if m.Cfg.Redis != nil {
|
||||||
if err := redis.Init(m.cfg.Redis); err != nil {
|
if err := redis.Init(m.Cfg.Redis); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// KAFKA
|
// KAFKA
|
||||||
if m.cfg.Kafka != nil {
|
if m.Cfg.Kafka != nil {
|
||||||
if err := kafka.Init(m.cfg.Kafka, m.appName); err != nil {
|
if err := kafka.Init(m.Cfg.Kafka, m.AppName); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,16 +59,3 @@ func (m *DB) Stop() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *DB) Bind(data ...any) Module {
|
|
||||||
if data == nil || len(data) == 0 {
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
if cfg, ok := data[0].(*config.DBConfig); ok {
|
|
||||||
m.cfg = cfg
|
|
||||||
}
|
|
||||||
if appName, ok := data[1].(string); ok {
|
|
||||||
m.appName = appName
|
|
||||||
}
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package module
|
package module
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.hlsq.asia/mmorpg/service-common/discover"
|
"git.hlsq.asia/alex/service-common/discover"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +1,27 @@
|
|||||||
package module
|
package module
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.hlsq.asia/mmorpg/service-common/net/grpc/service"
|
"git.hlsq.asia/alex/service-common/net/grpc/service"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Grpc Grpc模块
|
// Grpc Grpc模块
|
||||||
type Grpc struct {
|
type Grpc struct {
|
||||||
DefaultModule
|
DefaultModule
|
||||||
server service.IService
|
Server service.IService
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Grpc) Start(ready *sync.WaitGroup) error {
|
func (m *Grpc) Start(ready *sync.WaitGroup) error {
|
||||||
m.server.Init(ready)
|
m.Server.Init(ready)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Grpc) AfterStart() error {
|
func (m *Grpc) AfterStart() error {
|
||||||
m.server.SetReady()
|
m.Server.SetReady()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Grpc) Stop() error {
|
func (m *Grpc) Stop() error {
|
||||||
m.server.Close()
|
m.Server.Close()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Grpc) Bind(data ...any) Module {
|
|
||||||
if data == nil || len(data) == 0 {
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
if ser, ok := data[0].(service.IService); ok {
|
|
||||||
m.server = ser
|
|
||||||
}
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
|
|||||||
17
module/log.go
Normal file
17
module/log.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package module
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.hlsq.asia/alex/service-common/config"
|
||||||
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Log 日志模块
|
||||||
|
type Log struct {
|
||||||
|
DefaultModule
|
||||||
|
Cfg *config.LogConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Log) Init() error {
|
||||||
|
log.Init(m.Cfg)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ type Module interface {
|
|||||||
Start(ready *sync.WaitGroup) error // 启动
|
Start(ready *sync.WaitGroup) error // 启动
|
||||||
AfterStart() error // 启动之后
|
AfterStart() error // 启动之后
|
||||||
Stop() error // 停止
|
Stop() error // 停止
|
||||||
Bind(data ...any) Module // 绑定数据
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type DefaultModule struct {
|
type DefaultModule struct {
|
||||||
@@ -31,7 +30,3 @@ func (m *DefaultModule) AfterStart() error {
|
|||||||
func (m *DefaultModule) Stop() error {
|
func (m *DefaultModule) Stop() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *DefaultModule) Bind(_ ...any) Module {
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.hlsq.asia/mmorpg/service-common/config"
|
"git.hlsq.asia/alex/service-common/config"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -14,9 +14,9 @@ import (
|
|||||||
// Prometheus 普罗米修斯模块
|
// Prometheus 普罗米修斯模块
|
||||||
type Prometheus struct {
|
type Prometheus struct {
|
||||||
DefaultModule
|
DefaultModule
|
||||||
wg *sync.WaitGroup
|
Cfg *config.MetricConfig
|
||||||
server *http.Server
|
wg *sync.WaitGroup
|
||||||
metricCfg *config.MetricConfig
|
server *http.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Prometheus) Init() error {
|
func (m *Prometheus) Init() error {
|
||||||
@@ -29,7 +29,7 @@ func (m *Prometheus) Start(ready *sync.WaitGroup) error {
|
|||||||
go func() {
|
go func() {
|
||||||
defer m.wg.Done()
|
defer m.wg.Done()
|
||||||
m.server = &http.Server{
|
m.server = &http.Server{
|
||||||
Addr: fmt.Sprintf("%v:%v", m.metricCfg.Prometheus.Address, m.metricCfg.Prometheus.Port),
|
Addr: fmt.Sprintf("%v:%v", m.Cfg.Prometheus.Address, m.Cfg.Prometheus.Port),
|
||||||
Handler: promhttp.Handler(),
|
Handler: promhttp.Handler(),
|
||||||
}
|
}
|
||||||
ready.Done()
|
ready.Done()
|
||||||
@@ -48,13 +48,3 @@ func (m *Prometheus) Stop() error {
|
|||||||
m.wg.Wait()
|
m.wg.Wait()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Prometheus) Bind(data ...any) Module {
|
|
||||||
if data == nil || len(data) == 0 {
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
if mc, ok := data[0].(*config.MetricConfig); ok {
|
|
||||||
m.metricCfg = mc
|
|
||||||
}
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
|
|||||||
66
module/snowflake.go
Normal file
66
module/snowflake.go
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
package module
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"git.hlsq.asia/alex/service-common/db/etcd"
|
||||||
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
|
"git.hlsq.asia/alex/service-common/utils"
|
||||||
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
|
"go.etcd.io/etcd/client/v3/concurrency"
|
||||||
|
"math/rand"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Snowflake 雪花模块
|
||||||
|
type Snowflake struct {
|
||||||
|
DefaultModule
|
||||||
|
snowflakeSession *concurrency.Session
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Snowflake) Init() error {
|
||||||
|
node, session, err := acquire(context.Background(), 1, 1000)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
m.snowflakeSession = session
|
||||||
|
utils.InitSnowflake(node)
|
||||||
|
log.Infof("snowflake node: %v", node)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Snowflake) Stop() error {
|
||||||
|
_ = m.snowflakeSession.Close()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func acquire(ctx context.Context, min, max int) (int64, *concurrency.Session, error) {
|
||||||
|
nums := rand.Perm(max - min + 1)
|
||||||
|
for i := range nums {
|
||||||
|
nums[i] += min
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, n := range nums {
|
||||||
|
key := fmt.Sprintf("node/num/%d", n)
|
||||||
|
|
||||||
|
session, err := concurrency.NewSession(
|
||||||
|
etcd.GetClient().Raw(),
|
||||||
|
concurrency.WithContext(ctx),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return 0, nil, utils.ErrorsWrap(fmt.Errorf("etcd NewSession error: %v", err))
|
||||||
|
}
|
||||||
|
|
||||||
|
txnResp, _ := etcd.GetClient().Raw().Txn(ctx).
|
||||||
|
If(clientv3.Compare(clientv3.CreateRevision(key), "=", 0)).
|
||||||
|
Then(clientv3.OpPut(key, "", clientv3.WithLease(session.Lease()))).
|
||||||
|
Commit()
|
||||||
|
|
||||||
|
if txnResp.Succeeded {
|
||||||
|
return int64(n), session, nil
|
||||||
|
} else {
|
||||||
|
_ = session.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0, nil, utils.ErrorsWrap(errors.New("etcd num empty"), "acquire error")
|
||||||
|
}
|
||||||
@@ -2,8 +2,8 @@ package module
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.hlsq.asia/mmorpg/service-common/config"
|
"git.hlsq.asia/alex/service-common/config"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"go.opentelemetry.io/otel"
|
"go.opentelemetry.io/otel"
|
||||||
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
|
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
|
||||||
"go.opentelemetry.io/otel/propagation"
|
"go.opentelemetry.io/otel/propagation"
|
||||||
@@ -15,16 +15,16 @@ import (
|
|||||||
// Tracer 链路追踪模块
|
// Tracer 链路追踪模块
|
||||||
type Tracer struct {
|
type Tracer struct {
|
||||||
DefaultModule
|
DefaultModule
|
||||||
|
Cfg *config.MetricConfig
|
||||||
|
ServiceName string
|
||||||
tp *sdktrace.TracerProvider
|
tp *sdktrace.TracerProvider
|
||||||
metricCfg *config.MetricConfig
|
|
||||||
serviceName string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Tracer) Init() error {
|
func (m *Tracer) Init() error {
|
||||||
exporter, err := otlptracegrpc.New(
|
exporter, err := otlptracegrpc.New(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
otlptracegrpc.WithInsecure(),
|
otlptracegrpc.WithInsecure(),
|
||||||
otlptracegrpc.WithEndpoint(m.metricCfg.Jaeger.Endpoint),
|
otlptracegrpc.WithEndpoint(m.Cfg.Jaeger.Endpoint),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -34,7 +34,7 @@ func (m *Tracer) Init() error {
|
|||||||
sdktrace.WithBatcher(exporter),
|
sdktrace.WithBatcher(exporter),
|
||||||
sdktrace.WithResource(resource.NewWithAttributes(
|
sdktrace.WithResource(resource.NewWithAttributes(
|
||||||
semconv.SchemaURL,
|
semconv.SchemaURL,
|
||||||
semconv.ServiceNameKey.String(m.serviceName),
|
semconv.ServiceNameKey.String(m.ServiceName),
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
otel.SetTracerProvider(m.tp)
|
otel.SetTracerProvider(m.tp)
|
||||||
@@ -51,16 +51,3 @@ func (m *Tracer) Stop() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Tracer) Bind(data ...any) Module {
|
|
||||||
if data == nil || len(data) == 0 {
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
if mc, ok := data[0].(*config.MetricConfig); ok {
|
|
||||||
m.metricCfg = mc
|
|
||||||
}
|
|
||||||
if name, ok := data[1].(string); ok {
|
|
||||||
m.serviceName = name
|
|
||||||
}
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
package grpc_client
|
|
||||||
|
|
||||||
import (
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/discover"
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/discover/common"
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb"
|
|
||||||
)
|
|
||||||
|
|
||||||
func GatewayNewClient(sid ...string) (grpc_pb.GatewayClient, error) {
|
|
||||||
c, err := discover.FindServer(common.KeyDiscoverGateway, sid...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return grpc_pb.NewGatewayClient(c), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GatewayNewBroadcastClient() map[string]grpc_pb.GatewayClient {
|
|
||||||
clientM := make(map[string]grpc_pb.GatewayClient)
|
|
||||||
connM := discover.FindServerAll(common.KeyDiscoverGateway)
|
|
||||||
for sid, conn := range connM {
|
|
||||||
clientM[sid] = grpc_pb.NewGatewayClient(conn)
|
|
||||||
}
|
|
||||||
return clientM
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package grpc_client
|
|
||||||
|
|
||||||
import (
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/discover"
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/discover/common"
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/net/grpc/resolver"
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb"
|
|
||||||
)
|
|
||||||
|
|
||||||
func QgdzsNewClient(sid ...string) (grpc_pb.QgdzsClient, error) {
|
|
||||||
c, err := discover.FindServer(common.KeyDiscoverQgdzs, sid...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return grpc_pb.NewQgdzsClient(c), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func QgdzsNewClientLB() (grpc_pb.QgdzsClient, error) {
|
|
||||||
c, err := resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameQgdzs)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return grpc_pb.NewQgdzsClient(c), nil
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package grpc_client
|
|
||||||
|
|
||||||
import (
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/discover"
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/discover/common"
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/net/grpc/resolver"
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb"
|
|
||||||
)
|
|
||||||
|
|
||||||
func SceneNewClient(sid ...string) (grpc_pb.SceneClient, error) {
|
|
||||||
c, err := discover.FindServer(common.KeyDiscoverScene, sid...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return grpc_pb.NewSceneClient(c), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func SceneNewClientLB() (grpc_pb.SceneClient, error) {
|
|
||||||
c, err := resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameScene)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return grpc_pb.NewSceneClient(c), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func SceneNewBroadcastClient() map[string]grpc_pb.SceneClient {
|
|
||||||
clientM := make(map[string]grpc_pb.SceneClient)
|
|
||||||
connM := discover.FindServerAll(common.KeyDiscoverScene)
|
|
||||||
for sid, conn := range connM {
|
|
||||||
clientM[sid] = grpc_pb.NewSceneClient(conn)
|
|
||||||
}
|
|
||||||
return clientM
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package grpc_client
|
|
||||||
|
|
||||||
import (
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/discover"
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/discover/common"
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/net/grpc/resolver"
|
|
||||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb"
|
|
||||||
)
|
|
||||||
|
|
||||||
func UserNewClient(sid ...string) (grpc_pb.UserClient, error) {
|
|
||||||
c, err := discover.FindServer(common.KeyDiscoverUser, sid...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return grpc_pb.NewUserClient(c), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func UserNewClientLB() (grpc_pb.UserClient, error) {
|
|
||||||
c, err := resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameUser)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return grpc_pb.NewUserClient(c), nil
|
|
||||||
}
|
|
||||||
24
net/grpc/grpcclient/client_gateway.go
Normal file
24
net/grpc/grpcclient/client_gateway.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package grpcclient
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.hlsq.asia/alex/service-common/discover"
|
||||||
|
"git.hlsq.asia/alex/service-common/discover/common"
|
||||||
|
"git.hlsq.asia/alex/service-common/proto/rs/rspb"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GatewayNewClient(sid ...int64) (rspb.GatewayClient, error) {
|
||||||
|
c, err := discover.FindServer(common.KeyDiscoverGateway, sid...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return rspb.NewGatewayClient(c), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GatewayNewBroadcastClient() map[int64]rspb.GatewayClient {
|
||||||
|
clientM := make(map[int64]rspb.GatewayClient)
|
||||||
|
connM := discover.FindServerAll(common.KeyDiscoverGateway)
|
||||||
|
for sid, conn := range connM {
|
||||||
|
clientM[sid] = rspb.NewGatewayClient(conn)
|
||||||
|
}
|
||||||
|
return clientM
|
||||||
|
}
|
||||||
24
net/grpc/grpcclient/client_qgdzs.go
Normal file
24
net/grpc/grpcclient/client_qgdzs.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package grpcclient
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.hlsq.asia/alex/service-common/discover"
|
||||||
|
"git.hlsq.asia/alex/service-common/discover/common"
|
||||||
|
"git.hlsq.asia/alex/service-common/net/grpc/resolver"
|
||||||
|
"git.hlsq.asia/alex/service-common/proto/rs/rspb"
|
||||||
|
)
|
||||||
|
|
||||||
|
func QgdzsNewClient(sid ...int64) (rspb.QgdzsClient, error) {
|
||||||
|
c, err := discover.FindServer(common.KeyDiscoverQgdzs, sid...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return rspb.NewQgdzsClient(c), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func QgdzsNewClientLB() (rspb.QgdzsClient, error) {
|
||||||
|
c, err := resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameQgdzs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return rspb.NewQgdzsClient(c), nil
|
||||||
|
}
|
||||||
33
net/grpc/grpcclient/client_scene.go
Normal file
33
net/grpc/grpcclient/client_scene.go
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package grpcclient
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.hlsq.asia/alex/service-common/discover"
|
||||||
|
"git.hlsq.asia/alex/service-common/discover/common"
|
||||||
|
"git.hlsq.asia/alex/service-common/net/grpc/resolver"
|
||||||
|
"git.hlsq.asia/alex/service-common/proto/rs/rspb"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SceneNewClient(sid ...int64) (rspb.SceneClient, error) {
|
||||||
|
c, err := discover.FindServer(common.KeyDiscoverScene, sid...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return rspb.NewSceneClient(c), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func SceneNewClientLB() (rspb.SceneClient, error) {
|
||||||
|
c, err := resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameScene)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return rspb.NewSceneClient(c), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func SceneNewBroadcastClient() map[int64]rspb.SceneClient {
|
||||||
|
clientM := make(map[int64]rspb.SceneClient)
|
||||||
|
connM := discover.FindServerAll(common.KeyDiscoverScene)
|
||||||
|
for sid, conn := range connM {
|
||||||
|
clientM[sid] = rspb.NewSceneClient(conn)
|
||||||
|
}
|
||||||
|
return clientM
|
||||||
|
}
|
||||||
24
net/grpc/grpcclient/client_user.go
Normal file
24
net/grpc/grpcclient/client_user.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package grpcclient
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.hlsq.asia/alex/service-common/discover"
|
||||||
|
"git.hlsq.asia/alex/service-common/discover/common"
|
||||||
|
"git.hlsq.asia/alex/service-common/net/grpc/resolver"
|
||||||
|
"git.hlsq.asia/alex/service-common/proto/rs/rspb"
|
||||||
|
)
|
||||||
|
|
||||||
|
func UserNewClient(sid ...int64) (rspb.UserClient, error) {
|
||||||
|
c, err := discover.FindServer(common.KeyDiscoverUser, sid...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return rspb.NewUserClient(c), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func UserNewClientLB() (rspb.UserClient, error) {
|
||||||
|
c, err := resolver.GetGrpcClientConn("etcd:///" + common.KeyDiscoverServiceNameUser)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return rspb.NewUserClient(c), nil
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package grpc_client
|
package grpcclient
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"fmt"
|
||||||
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
"strconv"
|
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ type gatewayStream struct {
|
|||||||
stream grpc.ClientStream
|
stream grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func findGatewayBySID(sid string, fun GatewayFun) (*gatewayStream, error) {
|
func findGatewayBySID(sid int64, fun GatewayFun) (*gatewayStream, error) {
|
||||||
key := gatewayKey(sid, fun)
|
key := gatewayKey(sid, fun)
|
||||||
|
|
||||||
if v, ok := gatewayServer.Load(key); ok {
|
if v, ok := gatewayServer.Load(key); ok {
|
||||||
@@ -53,7 +53,7 @@ func findGatewayBySID(sid string, fun GatewayFun) (*gatewayStream, error) {
|
|||||||
return ss, nil
|
return ss, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func SendMessageToGateway(sid string, fun GatewayFun, msg proto.Message, re ...bool) error {
|
func SendMessageToGateway(sid int64, fun GatewayFun, msg proto.Message, re ...bool) error {
|
||||||
ss, err := findGatewayBySID(sid, fun)
|
ss, err := findGatewayBySID(sid, fun)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -78,6 +78,6 @@ func SendMessageToGateway(sid string, fun GatewayFun, msg proto.Message, re ...b
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func gatewayKey(sid string, fun GatewayFun) string {
|
func gatewayKey(sid int64, fun GatewayFun) string {
|
||||||
return sid + "-" + strconv.Itoa(int(fun))
|
return fmt.Sprintf("%v-%v", sid, fun)
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package grpc_client
|
package grpcclient
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"fmt"
|
||||||
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
"strconv"
|
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ type sceneStream struct {
|
|||||||
stream grpc.ClientStream
|
stream grpc.ClientStream
|
||||||
}
|
}
|
||||||
|
|
||||||
func findSceneBySID(sid string, fun SceneFun) (*sceneStream, error) {
|
func findSceneBySID(sid int64, fun SceneFun) (*sceneStream, error) {
|
||||||
key := sceneKey(sid, fun)
|
key := sceneKey(sid, fun)
|
||||||
|
|
||||||
if v, ok := sceneServer.Load(key); ok {
|
if v, ok := sceneServer.Load(key); ok {
|
||||||
@@ -53,7 +53,7 @@ func findSceneBySID(sid string, fun SceneFun) (*sceneStream, error) {
|
|||||||
return ss, nil
|
return ss, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func SendMessageToScene(sid string, fun SceneFun, msg proto.Message, re ...bool) error {
|
func SendMessageToScene(sid int64, fun SceneFun, msg proto.Message, re ...bool) error {
|
||||||
ss, err := findSceneBySID(sid, fun)
|
ss, err := findSceneBySID(sid, fun)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -78,6 +78,6 @@ func SendMessageToScene(sid string, fun SceneFun, msg proto.Message, re ...bool)
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func sceneKey(sid string, fun SceneFun) string {
|
func sceneKey(sid int64, fun SceneFun) string {
|
||||||
return sid + "-" + strconv.Itoa(int(fun))
|
return fmt.Sprintf("%v-%v", sid, fun)
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package grpc_conn
|
package grpcconn
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials/insecure"
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
@@ -10,11 +10,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type GrpcConnection struct {
|
type GrpcConnection struct {
|
||||||
sid string
|
sid int64
|
||||||
conn *grpc.ClientConn
|
conn *grpc.ClientConn
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGrpcConnection(sid string, address string) (*GrpcConnection, error) {
|
func NewGrpcConnection(sid int64, address string) (*GrpcConnection, error) {
|
||||||
p := &GrpcConnection{
|
p := &GrpcConnection{
|
||||||
sid: sid,
|
sid: sid,
|
||||||
}
|
}
|
||||||
@@ -1,25 +1,25 @@
|
|||||||
package grpc_conn
|
package grpcconn
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GrpcConnectionMgr struct {
|
type GrpcConnectionMgr struct {
|
||||||
poolM map[string]*GrpcConnection
|
poolM map[int64]*GrpcConnection
|
||||||
poolS []*GrpcConnection
|
poolS []*GrpcConnection
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGrpcConnectionMgr() *GrpcConnectionMgr {
|
func NewGrpcConnectionMgr() *GrpcConnectionMgr {
|
||||||
return &GrpcConnectionMgr{
|
return &GrpcConnectionMgr{
|
||||||
poolM: make(map[string]*GrpcConnection),
|
poolM: make(map[int64]*GrpcConnection),
|
||||||
poolS: make([]*GrpcConnection, 0),
|
poolS: make([]*GrpcConnection, 0),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *GrpcConnectionMgr) Store(sid string, addr string) {
|
func (p *GrpcConnectionMgr) Store(sid int64, addr string) {
|
||||||
pool, err := NewGrpcConnection(sid, addr)
|
pool, err := NewGrpcConnection(sid, addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("create grpc err: %v, sid: %v, addr: %v", err, sid, addr)
|
log.Errorf("create grpc err: %v, sid: %v, addr: %v", err, sid, addr)
|
||||||
@@ -29,7 +29,7 @@ func (p *GrpcConnectionMgr) Store(sid string, addr string) {
|
|||||||
p.poolS = append(p.poolS, pool)
|
p.poolS = append(p.poolS, pool)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *GrpcConnectionMgr) Delete(sid string) int {
|
func (p *GrpcConnectionMgr) Delete(sid int64) int {
|
||||||
delete(p.poolM, sid)
|
delete(p.poolM, sid)
|
||||||
for i, pool := range p.poolS {
|
for i, pool := range p.poolS {
|
||||||
if pool.sid == sid {
|
if pool.sid == sid {
|
||||||
@@ -40,9 +40,9 @@ func (p *GrpcConnectionMgr) Delete(sid string) int {
|
|||||||
return len(p.poolS)
|
return len(p.poolS)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *GrpcConnectionMgr) Load(sid ...string) (*grpc.ClientConn, error) {
|
func (p *GrpcConnectionMgr) Load(sid ...int64) (*grpc.ClientConn, error) {
|
||||||
var pool *GrpcConnection
|
var pool *GrpcConnection
|
||||||
if len(sid) > 0 && sid[0] != "" {
|
if len(sid) > 0 && sid[0] != 0 {
|
||||||
pool = p.poolM[sid[0]]
|
pool = p.poolM[sid[0]]
|
||||||
} else {
|
} else {
|
||||||
pool = p.poolS[rand.Intn(len(p.poolS))]
|
pool = p.poolS[rand.Intn(len(p.poolS))]
|
||||||
@@ -53,8 +53,8 @@ func (p *GrpcConnectionMgr) Load(sid ...string) (*grpc.ClientConn, error) {
|
|||||||
return pool.GetConnection(), nil
|
return pool.GetConnection(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *GrpcConnectionMgr) LoadAll() map[string]*grpc.ClientConn {
|
func (p *GrpcConnectionMgr) LoadAll() map[int64]*grpc.ClientConn {
|
||||||
sidM := make(map[string]*grpc.ClientConn)
|
sidM := make(map[int64]*grpc.ClientConn)
|
||||||
for sid, pool := range p.poolM {
|
for sid, pool := range p.poolM {
|
||||||
sidM[sid] = pool.GetConnection()
|
sidM[sid] = pool.GetConnection()
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package resolver
|
package resolver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials/insecure"
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package resolver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.hlsq.asia/mmorpg/service-common/db/etcd"
|
"git.hlsq.asia/alex/service-common/db/etcd"
|
||||||
"git.hlsq.asia/mmorpg/service-common/discover/common"
|
"git.hlsq.asia/alex/service-common/discover/common"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"go.etcd.io/etcd/client/v3"
|
"go.etcd.io/etcd/client/v3"
|
||||||
"google.golang.org/grpc/resolver"
|
"google.golang.org/grpc/resolver"
|
||||||
"strings"
|
"strings"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package service
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"go.opentelemetry.io/otel"
|
"go.opentelemetry.io/otel"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
otelcodes "go.opentelemetry.io/otel/codes"
|
otelcodes "go.opentelemetry.io/otel/codes"
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.hlsq.asia/mmorpg/service-common/config"
|
"git.hlsq.asia/alex/service-common/config"
|
||||||
"git.hlsq.asia/mmorpg/service-common/discover"
|
"git.hlsq.asia/alex/service-common/discover"
|
||||||
"git.hlsq.asia/mmorpg/service-common/log"
|
"git.hlsq.asia/alex/service-common/log"
|
||||||
"git.hlsq.asia/mmorpg/service-common/utils"
|
"git.hlsq.asia/alex/service-common/utils"
|
||||||
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/health"
|
"google.golang.org/grpc/health"
|
||||||
@@ -25,7 +25,7 @@ type IService interface {
|
|||||||
type Base struct {
|
type Base struct {
|
||||||
Target string
|
Target string
|
||||||
ServiceName string
|
ServiceName string
|
||||||
SID string
|
SID int64
|
||||||
Serve *grpc.Server
|
Serve *grpc.Server
|
||||||
Cfg *config.GrpcConfig
|
Cfg *config.GrpcConfig
|
||||||
OnCustomGrpcServerOption func() []grpc.ServerOption
|
OnCustomGrpcServerOption func() []grpc.ServerOption
|
||||||
@@ -39,7 +39,7 @@ type Base struct {
|
|||||||
func (s *Base) Init(ready *sync.WaitGroup) {
|
func (s *Base) Init(ready *sync.WaitGroup) {
|
||||||
s.wg = &sync.WaitGroup{}
|
s.wg = &sync.WaitGroup{}
|
||||||
s.wg.Add(1)
|
s.wg.Add(1)
|
||||||
s.SID = utils.SnowflakeInstance().Generate().String()
|
s.SID = utils.SnowflakeInstance().Generate().Int64()
|
||||||
go func() {
|
go func() {
|
||||||
defer s.wg.Done()
|
defer s.wg.Done()
|
||||||
defer s.OnClose()
|
defer s.OnClose()
|
||||||
@@ -91,6 +91,7 @@ func (s *Base) SetReady() {
|
|||||||
if s.healthcheck != nil {
|
if s.healthcheck != nil {
|
||||||
s.healthcheck.SetServingStatus("", grpc_health_v1.HealthCheckResponse_SERVING)
|
s.healthcheck.SetServingStatus("", grpc_health_v1.HealthCheckResponse_SERVING)
|
||||||
}
|
}
|
||||||
|
log.Infof("%v server ready, port: %v", s.Target, s.Cfg.Port)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Base) Close() {
|
func (s *Base) Close() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package http_resp
|
package httpresp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/rs_common"
|
"git.hlsq.asia/alex/service-common/proto/rs/rscommon"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
)
|
)
|
||||||
@@ -41,7 +41,7 @@ func (c *Code) Error() string {
|
|||||||
|
|
||||||
func (c *Code) Wrap() error {
|
func (c *Code) Wrap() error {
|
||||||
st := status.New(codes.Unknown, c.Error())
|
st := status.New(codes.Unknown, c.Error())
|
||||||
st, _ = st.WithDetails(&rs_common.ErrorInfo{
|
st, _ = st.WithDetails(&rscommon.ErrorInfo{
|
||||||
Code: int32(c.Code()),
|
Code: int32(c.Code()),
|
||||||
Msg: c.Error(),
|
Msg: c.Error(),
|
||||||
})
|
})
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package http_resp
|
package httpresp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -3,7 +3,7 @@ package websocket
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"git.hlsq.asia/mmorpg/service-common/net/socket"
|
"git.hlsq.asia/alex/service-common/net/socket"
|
||||||
"github.com/panjf2000/gnet/v2"
|
"github.com/panjf2000/gnet/v2"
|
||||||
"github.com/panjf2000/gnet/v2/pkg/logging"
|
"github.com/panjf2000/gnet/v2/pkg/logging"
|
||||||
"sync"
|
"sync"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
// protoc v4.25.1
|
// protoc v4.25.1
|
||||||
// source: rs_common.proto
|
// source: rs_common.proto
|
||||||
|
|
||||||
package rs_common
|
package rscommon
|
||||||
|
|
||||||
import (
|
import (
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
@@ -82,11 +82,11 @@ var file_rs_common_proto_rawDesc = []byte{
|
|||||||
0x6f, 0x22, 0x31, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12,
|
0x6f, 0x22, 0x31, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12,
|
||||||
0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f,
|
0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f,
|
||||||
0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x03, 0x4d, 0x73, 0x67, 0x42, 0x38, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71,
|
0x03, 0x4d, 0x73, 0x67, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71,
|
||||||
0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72,
|
0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72,
|
||||||
0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x6f, 0x2f, 0x72, 0x73, 0x2f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06,
|
0x6f, 0x2f, 0x72, 0x73, 0x2f, 0x72, 0x73, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: ./proto/rs/grpc_pb/service_user_grpc.pb.go
|
// Source: ./proto/rs/rspb/service_user_grpc.pb.go
|
||||||
|
|
||||||
// Package mocks is a generated GoMock package.
|
// Package mocks is a generated GoMock package.
|
||||||
package mocks
|
package mocks
|
||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
context "context"
|
context "context"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
||||||
grpc_pb "git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb"
|
rspb "git.hlsq.asia/alex/service-common/proto/rs/rspb"
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
grpc "google.golang.org/grpc"
|
grpc "google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
@@ -37,14 +37,14 @@ func (m *MockUserClient) EXPECT() *MockUserClientMockRecorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetUserInfo mocks base method.
|
// GetUserInfo mocks base method.
|
||||||
func (m *MockUserClient) GetUserInfo(ctx context.Context, in *grpc_pb.GetUserInfoReq, opts ...grpc.CallOption) (*grpc_pb.GetUserInfoResp, error) {
|
func (m *MockUserClient) GetUserInfo(ctx context.Context, in *rspb.GetUserInfoReq, opts ...grpc.CallOption) (*rspb.GetUserInfoResp, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
varargs := []interface{}{ctx, in}
|
varargs := []interface{}{ctx, in}
|
||||||
for _, a := range opts {
|
for _, a := range opts {
|
||||||
varargs = append(varargs, a)
|
varargs = append(varargs, a)
|
||||||
}
|
}
|
||||||
ret := m.ctrl.Call(m, "GetUserInfo", varargs...)
|
ret := m.ctrl.Call(m, "GetUserInfo", varargs...)
|
||||||
ret0, _ := ret[0].(*grpc_pb.GetUserInfoResp)
|
ret0, _ := ret[0].(*rspb.GetUserInfoResp)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
@@ -57,14 +57,14 @@ func (mr *MockUserClientMockRecorder) GetUserInfo(ctx, in interface{}, opts ...i
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PhoneLogin mocks base method.
|
// PhoneLogin mocks base method.
|
||||||
func (m *MockUserClient) PhoneLogin(ctx context.Context, in *grpc_pb.PhoneLoginReq, opts ...grpc.CallOption) (*grpc_pb.PhoneLoginResp, error) {
|
func (m *MockUserClient) PhoneLogin(ctx context.Context, in *rspb.PhoneLoginReq, opts ...grpc.CallOption) (*rspb.PhoneLoginResp, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
varargs := []interface{}{ctx, in}
|
varargs := []interface{}{ctx, in}
|
||||||
for _, a := range opts {
|
for _, a := range opts {
|
||||||
varargs = append(varargs, a)
|
varargs = append(varargs, a)
|
||||||
}
|
}
|
||||||
ret := m.ctrl.Call(m, "PhoneLogin", varargs...)
|
ret := m.ctrl.Call(m, "PhoneLogin", varargs...)
|
||||||
ret0, _ := ret[0].(*grpc_pb.PhoneLoginResp)
|
ret0, _ := ret[0].(*rspb.PhoneLoginResp)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
@@ -77,14 +77,14 @@ func (mr *MockUserClientMockRecorder) PhoneLogin(ctx, in interface{}, opts ...in
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WxMiniLogin mocks base method.
|
// WxMiniLogin mocks base method.
|
||||||
func (m *MockUserClient) WxMiniLogin(ctx context.Context, in *grpc_pb.WxMiniLoginReq, opts ...grpc.CallOption) (*grpc_pb.WxMiniLoginResp, error) {
|
func (m *MockUserClient) WxMiniLogin(ctx context.Context, in *rspb.WxMiniLoginReq, opts ...grpc.CallOption) (*rspb.WxMiniLoginResp, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
varargs := []interface{}{ctx, in}
|
varargs := []interface{}{ctx, in}
|
||||||
for _, a := range opts {
|
for _, a := range opts {
|
||||||
varargs = append(varargs, a)
|
varargs = append(varargs, a)
|
||||||
}
|
}
|
||||||
ret := m.ctrl.Call(m, "WxMiniLogin", varargs...)
|
ret := m.ctrl.Call(m, "WxMiniLogin", varargs...)
|
||||||
ret0, _ := ret[0].(*grpc_pb.WxMiniLoginResp)
|
ret0, _ := ret[0].(*rspb.WxMiniLoginResp)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
@@ -120,10 +120,10 @@ func (m *MockUserServer) EXPECT() *MockUserServerMockRecorder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetUserInfo mocks base method.
|
// GetUserInfo mocks base method.
|
||||||
func (m *MockUserServer) GetUserInfo(arg0 context.Context, arg1 *grpc_pb.GetUserInfoReq) (*grpc_pb.GetUserInfoResp, error) {
|
func (m *MockUserServer) GetUserInfo(arg0 context.Context, arg1 *rspb.GetUserInfoReq) (*rspb.GetUserInfoResp, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "GetUserInfo", arg0, arg1)
|
ret := m.ctrl.Call(m, "GetUserInfo", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*grpc_pb.GetUserInfoResp)
|
ret0, _ := ret[0].(*rspb.GetUserInfoResp)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
@@ -135,10 +135,10 @@ func (mr *MockUserServerMockRecorder) GetUserInfo(arg0, arg1 interface{}) *gomoc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PhoneLogin mocks base method.
|
// PhoneLogin mocks base method.
|
||||||
func (m *MockUserServer) PhoneLogin(arg0 context.Context, arg1 *grpc_pb.PhoneLoginReq) (*grpc_pb.PhoneLoginResp, error) {
|
func (m *MockUserServer) PhoneLogin(arg0 context.Context, arg1 *rspb.PhoneLoginReq) (*rspb.PhoneLoginResp, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "PhoneLogin", arg0, arg1)
|
ret := m.ctrl.Call(m, "PhoneLogin", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*grpc_pb.PhoneLoginResp)
|
ret0, _ := ret[0].(*rspb.PhoneLoginResp)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
@@ -150,10 +150,10 @@ func (mr *MockUserServerMockRecorder) PhoneLogin(arg0, arg1 interface{}) *gomock
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WxMiniLogin mocks base method.
|
// WxMiniLogin mocks base method.
|
||||||
func (m *MockUserServer) WxMiniLogin(arg0 context.Context, arg1 *grpc_pb.WxMiniLoginReq) (*grpc_pb.WxMiniLoginResp, error) {
|
func (m *MockUserServer) WxMiniLogin(arg0 context.Context, arg1 *rspb.WxMiniLoginReq) (*rspb.WxMiniLoginResp, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "WxMiniLogin", arg0, arg1)
|
ret := m.ctrl.Call(m, "WxMiniLogin", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*grpc_pb.WxMiniLoginResp)
|
ret0, _ := ret[0].(*rspb.WxMiniLoginResp)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
@@ -4,10 +4,10 @@
|
|||||||
// protoc v4.25.1
|
// protoc v4.25.1
|
||||||
// source: service_gateway.proto
|
// source: service_gateway.proto
|
||||||
|
|
||||||
package grpc_pb
|
package rspb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "git.hlsq.asia/mmorpg/service-common/proto/rs/rs_common"
|
_ "git.hlsq.asia/alex/service-common/proto/rs/rscommon"
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
@@ -26,7 +26,7 @@ type ToClientReq struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"`
|
USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"`
|
||||||
MessageID int32 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"`
|
MessageID int32 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"`
|
||||||
Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"`
|
Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"`
|
||||||
}
|
}
|
||||||
@@ -63,11 +63,11 @@ func (*ToClientReq) Descriptor() ([]byte, []int) {
|
|||||||
return file_service_gateway_proto_rawDescGZIP(), []int{0}
|
return file_service_gateway_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ToClientReq) GetUSN() string {
|
func (x *ToClientReq) GetUSN() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.USN
|
return x.USN
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ToClientReq) GetMessageID() int32 {
|
func (x *ToClientReq) GetMessageID() int32 {
|
||||||
@@ -127,7 +127,7 @@ type KickUserReq struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"`
|
USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *KickUserReq) Reset() {
|
func (x *KickUserReq) Reset() {
|
||||||
@@ -162,11 +162,11 @@ func (*KickUserReq) Descriptor() ([]byte, []int) {
|
|||||||
return file_service_gateway_proto_rawDescGZIP(), []int{2}
|
return file_service_gateway_proto_rawDescGZIP(), []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *KickUserReq) GetUSN() string {
|
func (x *KickUserReq) GetUSN() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.USN
|
return x.USN
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
type KickUserResp struct {
|
type KickUserResp struct {
|
||||||
@@ -214,13 +214,13 @@ var file_service_gateway_proto_rawDesc = []byte{
|
|||||||
0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d,
|
0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d,
|
||||||
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x0b, 0x54, 0x6f, 0x43, 0x6c,
|
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x0b, 0x54, 0x6f, 0x43, 0x6c,
|
||||||
0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01,
|
0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73,
|
0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73,
|
||||||
0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x4d, 0x65,
|
0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x4d, 0x65,
|
||||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f,
|
0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f,
|
||||||
0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61,
|
0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61,
|
||||||
0x64, 0x22, 0x0e, 0x0a, 0x0c, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73,
|
0x64, 0x22, 0x0e, 0x0a, 0x0c, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73,
|
||||||
0x70, 0x22, 0x1f, 0x0a, 0x0b, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71,
|
0x70, 0x22, 0x1f, 0x0a, 0x0b, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71,
|
||||||
0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55,
|
0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55,
|
||||||
0x53, 0x4e, 0x22, 0x0e, 0x0a, 0x0c, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,
|
0x53, 0x4e, 0x22, 0x0e, 0x0a, 0x0c, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65,
|
||||||
0x73, 0x70, 0x32, 0x61, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2b, 0x0a,
|
0x73, 0x70, 0x32, 0x61, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2b, 0x0a,
|
||||||
0x08, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x0c, 0x2e, 0x54, 0x6f, 0x43, 0x6c,
|
0x08, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x0c, 0x2e, 0x54, 0x6f, 0x43, 0x6c,
|
||||||
@@ -228,11 +228,11 @@ var file_service_gateway_proto_rawDesc = []byte{
|
|||||||
0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x28, 0x01, 0x12, 0x29, 0x0a, 0x08, 0x4b, 0x69,
|
0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x28, 0x01, 0x12, 0x29, 0x0a, 0x08, 0x4b, 0x69,
|
||||||
0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0c, 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65,
|
0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0c, 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65,
|
||||||
0x72, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52,
|
0x72, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52,
|
||||||
0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73,
|
0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73,
|
||||||
0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65,
|
0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65,
|
||||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f,
|
0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f,
|
||||||
0x74, 0x6f, 0x2f, 0x72, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70,
|
0x74, 0x6f, 0x2f, 0x72, 0x73, 0x2f, 0x72, 0x73, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
// - protoc v4.25.1
|
// - protoc v4.25.1
|
||||||
// source: service_gateway.proto
|
// source: service_gateway.proto
|
||||||
|
|
||||||
package grpc_pb
|
package rspb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -2,11 +2,11 @@
|
|||||||
// source: service_qgdzs.proto
|
// source: service_qgdzs.proto
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Package grpc_pb is a reverse proxy.
|
Package rspb is a reverse proxy.
|
||||||
|
|
||||||
It translates gRPC into RESTful JSON APIs.
|
It translates gRPC into RESTful JSON APIs.
|
||||||
*/
|
*/
|
||||||
package grpc_pb
|
package rspb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -59,6 +59,30 @@ func local_request_Qgdzs_GenerateQuestion_0(ctx context.Context, marshaler runti
|
|||||||
return msg, metadata, err
|
return msg, metadata, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func request_Qgdzs_CustomAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq CustomAnswerQuestionReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
)
|
||||||
|
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
msg, err := client.CustomAnswerQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_Qgdzs_CustomAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq CustomAnswerQuestionReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
)
|
||||||
|
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
msg, err := server.CustomAnswerQuestion(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
func request_Qgdzs_RandomGetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
func request_Qgdzs_RandomGetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
var (
|
var (
|
||||||
protoReq RandomGetQuestionReq
|
protoReq RandomGetQuestionReq
|
||||||
@@ -275,6 +299,54 @@ func local_request_Qgdzs_GetQuestionInfo_0(ctx context.Context, marshaler runtim
|
|||||||
return msg, metadata, err
|
return msg, metadata, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func request_Qgdzs_GetPointRecord_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq GetPointRecordReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
)
|
||||||
|
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
msg, err := client.GetPointRecord(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_Qgdzs_GetPointRecord_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq GetPointRecordReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
)
|
||||||
|
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
msg, err := server.GetPointRecord(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func request_Qgdzs_GetPoint_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq GetPointReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
)
|
||||||
|
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
msg, err := client.GetPoint(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func local_request_Qgdzs_GetPoint_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||||
|
var (
|
||||||
|
protoReq GetPointReq
|
||||||
|
metadata runtime.ServerMetadata
|
||||||
|
)
|
||||||
|
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||||
|
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||||
|
}
|
||||||
|
msg, err := server.GetPoint(ctx, &protoReq)
|
||||||
|
return msg, metadata, err
|
||||||
|
}
|
||||||
|
|
||||||
// RegisterQgdzsHandlerServer registers the http handlers for service Qgdzs to "mux".
|
// RegisterQgdzsHandlerServer registers the http handlers for service Qgdzs to "mux".
|
||||||
// UnaryRPC :call QgdzsServer directly.
|
// UnaryRPC :call QgdzsServer directly.
|
||||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||||
@@ -301,6 +373,26 @@ func RegisterQgdzsHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||||||
}
|
}
|
||||||
forward_Qgdzs_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
forward_Qgdzs_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
})
|
})
|
||||||
|
mux.Handle(http.MethodPost, pattern_Qgdzs_CustomAnswerQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
var stream runtime.ServerTransportStream
|
||||||
|
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/CustomAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/auth/custom_answer"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_Qgdzs_CustomAnswerQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||||
|
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_Qgdzs_CustomAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
mux.Handle(http.MethodPost, pattern_Qgdzs_RandomGetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
mux.Handle(http.MethodPost, pattern_Qgdzs_RandomGetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@@ -481,6 +573,46 @@ func RegisterQgdzsHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
|
|||||||
}
|
}
|
||||||
forward_Qgdzs_GetQuestionInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
forward_Qgdzs_GetQuestionInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
})
|
})
|
||||||
|
mux.Handle(http.MethodPost, pattern_Qgdzs_GetPointRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
var stream runtime.ServerTransportStream
|
||||||
|
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/GetPointRecord", runtime.WithHTTPPathPattern("/qgdzs/auth/point/record"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_Qgdzs_GetPointRecord_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||||
|
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_Qgdzs_GetPointRecord_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
|
mux.Handle(http.MethodPost, pattern_Qgdzs_GetPoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
var stream runtime.ServerTransportStream
|
||||||
|
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/GetPoint", runtime.WithHTTPPathPattern("/qgdzs/auth/point/info"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := local_request_Qgdzs_GetPoint_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||||
|
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_Qgdzs_GetPoint_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -538,6 +670,23 @@ func RegisterQgdzsHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||||||
}
|
}
|
||||||
forward_Qgdzs_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
forward_Qgdzs_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
})
|
})
|
||||||
|
mux.Handle(http.MethodPost, pattern_Qgdzs_CustomAnswerQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/CustomAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/auth/custom_answer"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_Qgdzs_CustomAnswerQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_Qgdzs_CustomAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
mux.Handle(http.MethodPost, pattern_Qgdzs_RandomGetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
mux.Handle(http.MethodPost, pattern_Qgdzs_RandomGetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
ctx, cancel := context.WithCancel(req.Context())
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@@ -691,11 +840,46 @@ func RegisterQgdzsHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
|
|||||||
}
|
}
|
||||||
forward_Qgdzs_GetQuestionInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
forward_Qgdzs_GetQuestionInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
})
|
})
|
||||||
|
mux.Handle(http.MethodPost, pattern_Qgdzs_GetPointRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/GetPointRecord", runtime.WithHTTPPathPattern("/qgdzs/auth/point/record"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_Qgdzs_GetPointRecord_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_Qgdzs_GetPointRecord_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
|
mux.Handle(http.MethodPost, pattern_Qgdzs_GetPoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||||
|
ctx, cancel := context.WithCancel(req.Context())
|
||||||
|
defer cancel()
|
||||||
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
|
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/GetPoint", runtime.WithHTTPPathPattern("/qgdzs/auth/point/info"))
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, md, err := request_Qgdzs_GetPoint_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||||
|
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||||
|
if err != nil {
|
||||||
|
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
forward_Qgdzs_GetPoint_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||||
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
pattern_Qgdzs_GenerateQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "auth", "generate_question"}, ""))
|
pattern_Qgdzs_GenerateQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "auth", "generate_question"}, ""))
|
||||||
|
pattern_Qgdzs_CustomAnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "auth", "custom_answer"}, ""))
|
||||||
pattern_Qgdzs_RandomGetQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "random", "question"}, ""))
|
pattern_Qgdzs_RandomGetQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "random", "question"}, ""))
|
||||||
pattern_Qgdzs_RandomAnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "random", "answer"}, ""))
|
pattern_Qgdzs_RandomAnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "random", "answer"}, ""))
|
||||||
pattern_Qgdzs_GetAllCategory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "category", "get_category"}, ""))
|
pattern_Qgdzs_GetAllCategory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "category", "get_category"}, ""))
|
||||||
@@ -705,10 +889,13 @@ var (
|
|||||||
pattern_Qgdzs_QuicklyAnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "quickly", "answer"}, ""))
|
pattern_Qgdzs_QuicklyAnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "quickly", "answer"}, ""))
|
||||||
pattern_Qgdzs_GetRecord_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "auth", "get_record"}, ""))
|
pattern_Qgdzs_GetRecord_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "auth", "get_record"}, ""))
|
||||||
pattern_Qgdzs_GetQuestionInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "open", "get_question_info"}, ""))
|
pattern_Qgdzs_GetQuestionInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "open", "get_question_info"}, ""))
|
||||||
|
pattern_Qgdzs_GetPointRecord_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "auth", "point", "record"}, ""))
|
||||||
|
pattern_Qgdzs_GetPoint_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "auth", "point", "info"}, ""))
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
forward_Qgdzs_GenerateQuestion_0 = runtime.ForwardResponseMessage
|
forward_Qgdzs_GenerateQuestion_0 = runtime.ForwardResponseMessage
|
||||||
|
forward_Qgdzs_CustomAnswerQuestion_0 = runtime.ForwardResponseMessage
|
||||||
forward_Qgdzs_RandomGetQuestion_0 = runtime.ForwardResponseMessage
|
forward_Qgdzs_RandomGetQuestion_0 = runtime.ForwardResponseMessage
|
||||||
forward_Qgdzs_RandomAnswerQuestion_0 = runtime.ForwardResponseMessage
|
forward_Qgdzs_RandomAnswerQuestion_0 = runtime.ForwardResponseMessage
|
||||||
forward_Qgdzs_GetAllCategory_0 = runtime.ForwardResponseMessage
|
forward_Qgdzs_GetAllCategory_0 = runtime.ForwardResponseMessage
|
||||||
@@ -718,4 +905,6 @@ var (
|
|||||||
forward_Qgdzs_QuicklyAnswerQuestion_0 = runtime.ForwardResponseMessage
|
forward_Qgdzs_QuicklyAnswerQuestion_0 = runtime.ForwardResponseMessage
|
||||||
forward_Qgdzs_GetRecord_0 = runtime.ForwardResponseMessage
|
forward_Qgdzs_GetRecord_0 = runtime.ForwardResponseMessage
|
||||||
forward_Qgdzs_GetQuestionInfo_0 = runtime.ForwardResponseMessage
|
forward_Qgdzs_GetQuestionInfo_0 = runtime.ForwardResponseMessage
|
||||||
|
forward_Qgdzs_GetPointRecord_0 = runtime.ForwardResponseMessage
|
||||||
|
forward_Qgdzs_GetPoint_0 = runtime.ForwardResponseMessage
|
||||||
)
|
)
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
// - protoc v4.25.1
|
// - protoc v4.25.1
|
||||||
// source: service_qgdzs.proto
|
// source: service_qgdzs.proto
|
||||||
|
|
||||||
package grpc_pb
|
package rspb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
@@ -24,6 +24,8 @@ const _ = grpc.SupportPackageIsVersion7
|
|||||||
type QgdzsClient interface {
|
type QgdzsClient interface {
|
||||||
// 生成题目
|
// 生成题目
|
||||||
GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error)
|
GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error)
|
||||||
|
// 自定义问答
|
||||||
|
CustomAnswerQuestion(ctx context.Context, in *CustomAnswerQuestionReq, opts ...grpc.CallOption) (*CustomAnswerQuestionResp, error)
|
||||||
// ---------- 随机答题 ----------
|
// ---------- 随机答题 ----------
|
||||||
// 获取题目
|
// 获取题目
|
||||||
RandomGetQuestion(ctx context.Context, in *RandomGetQuestionReq, opts ...grpc.CallOption) (*RandomGetQuestionResp, error)
|
RandomGetQuestion(ctx context.Context, in *RandomGetQuestionReq, opts ...grpc.CallOption) (*RandomGetQuestionResp, error)
|
||||||
@@ -46,6 +48,11 @@ type QgdzsClient interface {
|
|||||||
GetRecord(ctx context.Context, in *GetRecordReq, opts ...grpc.CallOption) (*GetRecordResp, error)
|
GetRecord(ctx context.Context, in *GetRecordReq, opts ...grpc.CallOption) (*GetRecordResp, error)
|
||||||
// 获取具体的题目
|
// 获取具体的题目
|
||||||
GetQuestionInfo(ctx context.Context, in *GetQuestionInfoReq, opts ...grpc.CallOption) (*GetQuestionInfoResp, error)
|
GetQuestionInfo(ctx context.Context, in *GetQuestionInfoReq, opts ...grpc.CallOption) (*GetQuestionInfoResp, error)
|
||||||
|
// ---------- 学识分 ----------
|
||||||
|
// 获取学识分获取记录
|
||||||
|
GetPointRecord(ctx context.Context, in *GetPointRecordReq, opts ...grpc.CallOption) (*GetPointRecordResp, error)
|
||||||
|
// 获取学识分
|
||||||
|
GetPoint(ctx context.Context, in *GetPointReq, opts ...grpc.CallOption) (*GetPointResp, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type qgdzsClient struct {
|
type qgdzsClient struct {
|
||||||
@@ -65,6 +72,15 @@ func (c *qgdzsClient) GenerateQuestion(ctx context.Context, in *GenerateQuestion
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *qgdzsClient) CustomAnswerQuestion(ctx context.Context, in *CustomAnswerQuestionReq, opts ...grpc.CallOption) (*CustomAnswerQuestionResp, error) {
|
||||||
|
out := new(CustomAnswerQuestionResp)
|
||||||
|
err := c.cc.Invoke(ctx, "/Qgdzs/CustomAnswerQuestion", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *qgdzsClient) RandomGetQuestion(ctx context.Context, in *RandomGetQuestionReq, opts ...grpc.CallOption) (*RandomGetQuestionResp, error) {
|
func (c *qgdzsClient) RandomGetQuestion(ctx context.Context, in *RandomGetQuestionReq, opts ...grpc.CallOption) (*RandomGetQuestionResp, error) {
|
||||||
out := new(RandomGetQuestionResp)
|
out := new(RandomGetQuestionResp)
|
||||||
err := c.cc.Invoke(ctx, "/Qgdzs/RandomGetQuestion", in, out, opts...)
|
err := c.cc.Invoke(ctx, "/Qgdzs/RandomGetQuestion", in, out, opts...)
|
||||||
@@ -146,12 +162,32 @@ func (c *qgdzsClient) GetQuestionInfo(ctx context.Context, in *GetQuestionInfoRe
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *qgdzsClient) GetPointRecord(ctx context.Context, in *GetPointRecordReq, opts ...grpc.CallOption) (*GetPointRecordResp, error) {
|
||||||
|
out := new(GetPointRecordResp)
|
||||||
|
err := c.cc.Invoke(ctx, "/Qgdzs/GetPointRecord", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *qgdzsClient) GetPoint(ctx context.Context, in *GetPointReq, opts ...grpc.CallOption) (*GetPointResp, error) {
|
||||||
|
out := new(GetPointResp)
|
||||||
|
err := c.cc.Invoke(ctx, "/Qgdzs/GetPoint", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// QgdzsServer is the server API for Qgdzs service.
|
// QgdzsServer is the server API for Qgdzs service.
|
||||||
// All implementations must embed UnimplementedQgdzsServer
|
// All implementations must embed UnimplementedQgdzsServer
|
||||||
// for forward compatibility
|
// for forward compatibility
|
||||||
type QgdzsServer interface {
|
type QgdzsServer interface {
|
||||||
// 生成题目
|
// 生成题目
|
||||||
GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error)
|
GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error)
|
||||||
|
// 自定义问答
|
||||||
|
CustomAnswerQuestion(context.Context, *CustomAnswerQuestionReq) (*CustomAnswerQuestionResp, error)
|
||||||
// ---------- 随机答题 ----------
|
// ---------- 随机答题 ----------
|
||||||
// 获取题目
|
// 获取题目
|
||||||
RandomGetQuestion(context.Context, *RandomGetQuestionReq) (*RandomGetQuestionResp, error)
|
RandomGetQuestion(context.Context, *RandomGetQuestionReq) (*RandomGetQuestionResp, error)
|
||||||
@@ -174,6 +210,11 @@ type QgdzsServer interface {
|
|||||||
GetRecord(context.Context, *GetRecordReq) (*GetRecordResp, error)
|
GetRecord(context.Context, *GetRecordReq) (*GetRecordResp, error)
|
||||||
// 获取具体的题目
|
// 获取具体的题目
|
||||||
GetQuestionInfo(context.Context, *GetQuestionInfoReq) (*GetQuestionInfoResp, error)
|
GetQuestionInfo(context.Context, *GetQuestionInfoReq) (*GetQuestionInfoResp, error)
|
||||||
|
// ---------- 学识分 ----------
|
||||||
|
// 获取学识分获取记录
|
||||||
|
GetPointRecord(context.Context, *GetPointRecordReq) (*GetPointRecordResp, error)
|
||||||
|
// 获取学识分
|
||||||
|
GetPoint(context.Context, *GetPointReq) (*GetPointResp, error)
|
||||||
mustEmbedUnimplementedQgdzsServer()
|
mustEmbedUnimplementedQgdzsServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,6 +225,9 @@ type UnimplementedQgdzsServer struct {
|
|||||||
func (UnimplementedQgdzsServer) GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error) {
|
func (UnimplementedQgdzsServer) GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GenerateQuestion not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GenerateQuestion not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedQgdzsServer) CustomAnswerQuestion(context.Context, *CustomAnswerQuestionReq) (*CustomAnswerQuestionResp, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method CustomAnswerQuestion not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedQgdzsServer) RandomGetQuestion(context.Context, *RandomGetQuestionReq) (*RandomGetQuestionResp, error) {
|
func (UnimplementedQgdzsServer) RandomGetQuestion(context.Context, *RandomGetQuestionReq) (*RandomGetQuestionResp, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method RandomGetQuestion not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method RandomGetQuestion not implemented")
|
||||||
}
|
}
|
||||||
@@ -211,6 +255,12 @@ func (UnimplementedQgdzsServer) GetRecord(context.Context, *GetRecordReq) (*GetR
|
|||||||
func (UnimplementedQgdzsServer) GetQuestionInfo(context.Context, *GetQuestionInfoReq) (*GetQuestionInfoResp, error) {
|
func (UnimplementedQgdzsServer) GetQuestionInfo(context.Context, *GetQuestionInfoReq) (*GetQuestionInfoResp, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetQuestionInfo not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetQuestionInfo not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedQgdzsServer) GetPointRecord(context.Context, *GetPointRecordReq) (*GetPointRecordResp, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetPointRecord not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedQgdzsServer) GetPoint(context.Context, *GetPointReq) (*GetPointResp, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetPoint not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedQgdzsServer) mustEmbedUnimplementedQgdzsServer() {}
|
func (UnimplementedQgdzsServer) mustEmbedUnimplementedQgdzsServer() {}
|
||||||
|
|
||||||
// UnsafeQgdzsServer may be embedded to opt out of forward compatibility for this service.
|
// UnsafeQgdzsServer may be embedded to opt out of forward compatibility for this service.
|
||||||
@@ -242,6 +292,24 @@ func _Qgdzs_GenerateQuestion_Handler(srv interface{}, ctx context.Context, dec f
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Qgdzs_CustomAnswerQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(CustomAnswerQuestionReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(QgdzsServer).CustomAnswerQuestion(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/Qgdzs/CustomAnswerQuestion",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(QgdzsServer).CustomAnswerQuestion(ctx, req.(*CustomAnswerQuestionReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
func _Qgdzs_RandomGetQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _Qgdzs_RandomGetQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(RandomGetQuestionReq)
|
in := new(RandomGetQuestionReq)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@@ -404,6 +472,42 @@ func _Qgdzs_GetQuestionInfo_Handler(srv interface{}, ctx context.Context, dec fu
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Qgdzs_GetPointRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetPointRecordReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(QgdzsServer).GetPointRecord(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/Qgdzs/GetPointRecord",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(QgdzsServer).GetPointRecord(ctx, req.(*GetPointRecordReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Qgdzs_GetPoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetPointReq)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(QgdzsServer).GetPoint(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/Qgdzs/GetPoint",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(QgdzsServer).GetPoint(ctx, req.(*GetPointReq))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
// Qgdzs_ServiceDesc is the grpc.ServiceDesc for Qgdzs service.
|
// Qgdzs_ServiceDesc is the grpc.ServiceDesc for Qgdzs service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
@@ -415,6 +519,10 @@ var Qgdzs_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "GenerateQuestion",
|
MethodName: "GenerateQuestion",
|
||||||
Handler: _Qgdzs_GenerateQuestion_Handler,
|
Handler: _Qgdzs_GenerateQuestion_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "CustomAnswerQuestion",
|
||||||
|
Handler: _Qgdzs_CustomAnswerQuestion_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "RandomGetQuestion",
|
MethodName: "RandomGetQuestion",
|
||||||
Handler: _Qgdzs_RandomGetQuestion_Handler,
|
Handler: _Qgdzs_RandomGetQuestion_Handler,
|
||||||
@@ -451,6 +559,14 @@ var Qgdzs_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "GetQuestionInfo",
|
MethodName: "GetQuestionInfo",
|
||||||
Handler: _Qgdzs_GetQuestionInfo_Handler,
|
Handler: _Qgdzs_GetQuestionInfo_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetPointRecord",
|
||||||
|
Handler: _Qgdzs_GetPointRecord_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetPoint",
|
||||||
|
Handler: _Qgdzs_GetPoint_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "service_qgdzs.proto",
|
Metadata: "service_qgdzs.proto",
|
||||||
@@ -4,10 +4,10 @@
|
|||||||
// protoc v4.25.1
|
// protoc v4.25.1
|
||||||
// source: service_scene.proto
|
// source: service_scene.proto
|
||||||
|
|
||||||
package grpc_pb
|
package rspb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "git.hlsq.asia/mmorpg/service-common/proto/rs/rs_common"
|
_ "git.hlsq.asia/alex/service-common/proto/rs/rscommon"
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
@@ -26,9 +26,9 @@ type EnterReq struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID
|
USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID
|
||||||
GatewaySID string `protobuf:"bytes,2,opt,name=GatewaySID,proto3" json:"GatewaySID,omitempty"` // 网关服务ID
|
GatewaySID int64 `protobuf:"varint,2,opt,name=GatewaySID,proto3" json:"GatewaySID,omitempty"` // 网关服务ID
|
||||||
InstanceID int32 `protobuf:"varint,3,opt,name=InstanceID,proto3" json:"InstanceID,omitempty"` // 副本ID
|
InstanceID int32 `protobuf:"varint,3,opt,name=InstanceID,proto3" json:"InstanceID,omitempty"` // 副本ID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EnterReq) Reset() {
|
func (x *EnterReq) Reset() {
|
||||||
@@ -63,18 +63,18 @@ func (*EnterReq) Descriptor() ([]byte, []int) {
|
|||||||
return file_service_scene_proto_rawDescGZIP(), []int{0}
|
return file_service_scene_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EnterReq) GetUSN() string {
|
func (x *EnterReq) GetUSN() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.USN
|
return x.USN
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EnterReq) GetGatewaySID() string {
|
func (x *EnterReq) GetGatewaySID() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.GatewaySID
|
return x.GatewaySID
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EnterReq) GetInstanceID() int32 {
|
func (x *EnterReq) GetInstanceID() int32 {
|
||||||
@@ -89,8 +89,8 @@ type EnterResp struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
SceneSID string `protobuf:"bytes,1,opt,name=SceneSID,proto3" json:"SceneSID,omitempty"` // 场景服务ID
|
SceneSID int64 `protobuf:"varint,1,opt,name=SceneSID,proto3" json:"SceneSID,omitempty"` // 场景服务ID
|
||||||
UniqueNo string `protobuf:"bytes,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号
|
UniqueNo int64 `protobuf:"varint,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号
|
||||||
MessageID int32 `protobuf:"varint,3,opt,name=MessageID,proto3" json:"MessageID,omitempty"` // 发送给客户端的消息ID
|
MessageID int32 `protobuf:"varint,3,opt,name=MessageID,proto3" json:"MessageID,omitempty"` // 发送给客户端的消息ID
|
||||||
Payload []byte `protobuf:"bytes,4,opt,name=Payload,proto3" json:"Payload,omitempty"` // 消息负载
|
Payload []byte `protobuf:"bytes,4,opt,name=Payload,proto3" json:"Payload,omitempty"` // 消息负载
|
||||||
}
|
}
|
||||||
@@ -127,18 +127,18 @@ func (*EnterResp) Descriptor() ([]byte, []int) {
|
|||||||
return file_service_scene_proto_rawDescGZIP(), []int{1}
|
return file_service_scene_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EnterResp) GetSceneSID() string {
|
func (x *EnterResp) GetSceneSID() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.SceneSID
|
return x.SceneSID
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EnterResp) GetUniqueNo() string {
|
func (x *EnterResp) GetUniqueNo() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.UniqueNo
|
return x.UniqueNo
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EnterResp) GetMessageID() int32 {
|
func (x *EnterResp) GetMessageID() int32 {
|
||||||
@@ -160,8 +160,8 @@ type LeaveReq struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID
|
USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID
|
||||||
UniqueNo string `protobuf:"bytes,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号
|
UniqueNo int64 `protobuf:"varint,2,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *LeaveReq) Reset() {
|
func (x *LeaveReq) Reset() {
|
||||||
@@ -196,18 +196,18 @@ func (*LeaveReq) Descriptor() ([]byte, []int) {
|
|||||||
return file_service_scene_proto_rawDescGZIP(), []int{2}
|
return file_service_scene_proto_rawDescGZIP(), []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *LeaveReq) GetUSN() string {
|
func (x *LeaveReq) GetUSN() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.USN
|
return x.USN
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *LeaveReq) GetUniqueNo() string {
|
func (x *LeaveReq) GetUniqueNo() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.UniqueNo
|
return x.UniqueNo
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
type LeaveResp struct {
|
type LeaveResp struct {
|
||||||
@@ -253,12 +253,12 @@ type ActionReq struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
UniqueNo string `protobuf:"bytes,1,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号
|
UniqueNo int64 `protobuf:"varint,1,opt,name=UniqueNo,proto3" json:"UniqueNo,omitempty"` // 副本唯一编号
|
||||||
USN string `protobuf:"bytes,2,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID
|
USN int64 `protobuf:"varint,2,opt,name=USN,proto3" json:"USN,omitempty"` // 用户ID
|
||||||
Action int32 `protobuf:"varint,3,opt,name=Action,proto3" json:"Action,omitempty"` // 指令ID
|
Action int32 `protobuf:"varint,3,opt,name=Action,proto3" json:"Action,omitempty"` // 指令ID
|
||||||
DirX int32 `protobuf:"zigzag32,4,opt,name=DirX,proto3" json:"DirX,omitempty"` // 移动-X方向(×1000 缩放)
|
DirX int32 `protobuf:"zigzag32,4,opt,name=DirX,proto3" json:"DirX,omitempty"` // 移动-X方向(×1000 缩放)
|
||||||
DirY int32 `protobuf:"zigzag32,5,opt,name=DirY,proto3" json:"DirY,omitempty"` // 移动-Y方向(×1000 缩放)
|
DirY int32 `protobuf:"zigzag32,5,opt,name=DirY,proto3" json:"DirY,omitempty"` // 移动-Y方向(×1000 缩放)
|
||||||
SkillID int32 `protobuf:"varint,6,opt,name=SkillID,proto3" json:"SkillID,omitempty"` // 攻击-技能ID
|
SkillID int32 `protobuf:"varint,6,opt,name=SkillID,proto3" json:"SkillID,omitempty"` // 攻击-技能ID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ActionReq) Reset() {
|
func (x *ActionReq) Reset() {
|
||||||
@@ -293,18 +293,18 @@ func (*ActionReq) Descriptor() ([]byte, []int) {
|
|||||||
return file_service_scene_proto_rawDescGZIP(), []int{4}
|
return file_service_scene_proto_rawDescGZIP(), []int{4}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ActionReq) GetUniqueNo() string {
|
func (x *ActionReq) GetUniqueNo() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.UniqueNo
|
return x.UniqueNo
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ActionReq) GetUSN() string {
|
func (x *ActionReq) GetUSN() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.USN
|
return x.USN
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ActionReq) GetAction() int32 {
|
func (x *ActionReq) GetAction() int32 {
|
||||||
@@ -379,27 +379,27 @@ var file_service_scene_proto_rawDesc = []byte{
|
|||||||
0x0a, 0x13, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x2e,
|
0x0a, 0x13, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x2e,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5c, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52,
|
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5c, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52,
|
||||||
0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||||
0x03, 0x55, 0x53, 0x4e, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53,
|
0x03, 0x55, 0x53, 0x4e, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53,
|
||||||
0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61,
|
0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61,
|
||||||
0x79, 0x53, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,
|
0x79, 0x53, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,
|
||||||
0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e,
|
0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e,
|
||||||
0x63, 0x65, 0x49, 0x44, 0x22, 0x7b, 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73,
|
0x63, 0x65, 0x49, 0x44, 0x22, 0x7b, 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73,
|
||||||
0x70, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x18, 0x01, 0x20,
|
0x70, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x18, 0x01, 0x20,
|
||||||
0x01, 0x28, 0x09, 0x52, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x12, 0x1a, 0x0a,
|
0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x53, 0x49, 0x44, 0x12, 0x1a, 0x0a,
|
||||||
0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||||
0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73,
|
0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73,
|
||||||
0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x4d, 0x65,
|
0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x4d, 0x65,
|
||||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f,
|
0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f,
|
||||||
0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61,
|
0x61, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61,
|
||||||
0x64, 0x22, 0x38, 0x0a, 0x08, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a,
|
0x64, 0x22, 0x38, 0x0a, 0x08, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a,
|
||||||
0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12,
|
0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12,
|
||||||
0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28,
|
0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x09, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x22, 0x0b, 0x0a, 0x09, 0x4c,
|
0x03, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x6f, 0x22, 0x0b, 0x0a, 0x09, 0x4c,
|
||||||
0x65, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x93, 0x01, 0x0a, 0x09, 0x41, 0x63, 0x74,
|
0x65, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x93, 0x01, 0x0a, 0x09, 0x41, 0x63, 0x74,
|
||||||
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65,
|
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65,
|
||||||
0x4e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65,
|
0x4e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65,
|
||||||
0x4e, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x4e, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||||
0x03, 0x55, 0x53, 0x4e, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03,
|
0x03, 0x55, 0x53, 0x4e, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03,
|
||||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04,
|
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04,
|
||||||
0x44, 0x69, 0x72, 0x58, 0x18, 0x04, 0x20, 0x01, 0x28, 0x11, 0x52, 0x04, 0x44, 0x69, 0x72, 0x58,
|
0x44, 0x69, 0x72, 0x58, 0x18, 0x04, 0x20, 0x01, 0x28, 0x11, 0x52, 0x04, 0x44, 0x69, 0x72, 0x58,
|
||||||
@@ -414,10 +414,10 @@ var file_service_scene_proto_rawDesc = []byte{
|
|||||||
0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x25, 0x0a, 0x06, 0x41, 0x63, 0x74,
|
0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x25, 0x0a, 0x06, 0x41, 0x63, 0x74,
|
||||||
0x69, 0x6f, 0x6e, 0x12, 0x0a, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a,
|
0x69, 0x6f, 0x6e, 0x12, 0x0a, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a,
|
||||||
0x0b, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x28, 0x01,
|
0x0b, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x28, 0x01,
|
||||||
0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69,
|
0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69,
|
||||||
0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||||
0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x73,
|
0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x73,
|
||||||
0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x2f, 0x72, 0x73, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
// - protoc v4.25.1
|
// - protoc v4.25.1
|
||||||
// source: service_scene.proto
|
// source: service_scene.proto
|
||||||
|
|
||||||
package grpc_pb
|
package rspb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
@@ -4,10 +4,10 @@
|
|||||||
// protoc v4.25.1
|
// protoc v4.25.1
|
||||||
// source: service_user.proto
|
// source: service_user.proto
|
||||||
|
|
||||||
package grpc_pb
|
package rspb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "git.hlsq.asia/mmorpg/service-common/proto/rs/rs_common"
|
_ "git.hlsq.asia/alex/service-common/proto/rs/rscommon"
|
||||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
@@ -83,7 +83,7 @@ type PhoneLoginResp struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID
|
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID
|
||||||
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` // 用户名
|
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` // 用户名
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,11 +119,11 @@ func (*PhoneLoginResp) Descriptor() ([]byte, []int) {
|
|||||||
return file_service_user_proto_rawDescGZIP(), []int{1}
|
return file_service_user_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PhoneLoginResp) GetUSN() string {
|
func (x *PhoneLoginResp) GetUSN() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.USN
|
return x.USN
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PhoneLoginResp) GetName() string {
|
func (x *PhoneLoginResp) GetName() string {
|
||||||
@@ -186,7 +186,7 @@ type WxMiniLoginResp struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID
|
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID
|
||||||
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` // 用户名
|
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` // 用户名
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,11 +222,11 @@ func (*WxMiniLoginResp) Descriptor() ([]byte, []int) {
|
|||||||
return file_service_user_proto_rawDescGZIP(), []int{3}
|
return file_service_user_proto_rawDescGZIP(), []int{3}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *WxMiniLoginResp) GetUSN() string {
|
func (x *WxMiniLoginResp) GetUSN() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.USN
|
return x.USN
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *WxMiniLoginResp) GetName() string {
|
func (x *WxMiniLoginResp) GetName() string {
|
||||||
@@ -242,7 +242,7 @@ type GetUserInfoReq struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetUserInfoReq) Reset() {
|
func (x *GetUserInfoReq) Reset() {
|
||||||
@@ -277,11 +277,11 @@ func (*GetUserInfoReq) Descriptor() ([]byte, []int) {
|
|||||||
return file_service_user_proto_rawDescGZIP(), []int{4}
|
return file_service_user_proto_rawDescGZIP(), []int{4}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetUserInfoReq) GetUSN() string {
|
func (x *GetUserInfoReq) GetUSN() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.USN
|
return x.USN
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetUserInfoResp struct {
|
type GetUserInfoResp struct {
|
||||||
@@ -289,7 +289,7 @@ type GetUserInfoResp struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
USN string `protobuf:"bytes,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||||
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"`
|
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,11 +325,11 @@ func (*GetUserInfoResp) Descriptor() ([]byte, []int) {
|
|||||||
return file_service_user_proto_rawDescGZIP(), []int{5}
|
return file_service_user_proto_rawDescGZIP(), []int{5}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetUserInfoResp) GetUSN() string {
|
func (x *GetUserInfoResp) GetUSN() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.USN
|
return x.USN
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetUserInfoResp) GetName() string {
|
func (x *GetUserInfoResp) GetName() string {
|
||||||
@@ -351,19 +351,19 @@ var file_service_user_proto_rawDesc = []byte{
|
|||||||
0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f,
|
0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f,
|
||||||
0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x36,
|
0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x36,
|
||||||
0x0a, 0x0e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70,
|
0x0a, 0x0e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70,
|
||||||
0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75,
|
0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75,
|
||||||
0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x24, 0x0a, 0x0e, 0x57, 0x78, 0x4d, 0x69, 0x6e, 0x69,
|
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x24, 0x0a, 0x0e, 0x57, 0x78, 0x4d, 0x69, 0x6e, 0x69,
|
||||||
0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65,
|
0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x37, 0x0a, 0x0f,
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x37, 0x0a, 0x0f,
|
||||||
0x57, 0x78, 0x4d, 0x69, 0x6e, 0x69, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12,
|
0x57, 0x78, 0x4d, 0x69, 0x6e, 0x69, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12,
|
||||||
0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x73,
|
0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73,
|
||||||
0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x22, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72,
|
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x22, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72,
|
||||||
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01,
|
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x22, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74,
|
0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x22, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74,
|
||||||
0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03,
|
0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03,
|
||||||
0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12,
|
0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12,
|
||||||
0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
|
0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
|
||||||
0x6d, 0x65, 0x32, 0xb9, 0x01, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x0a, 0x50,
|
0x6d, 0x65, 0x32, 0xb9, 0x01, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x0a, 0x50,
|
||||||
0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0e, 0x2e, 0x50, 0x68, 0x6f, 0x6e,
|
0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0e, 0x2e, 0x50, 0x68, 0x6f, 0x6e,
|
||||||
@@ -376,11 +376,11 @@ var file_service_user_proto_rawDesc = []byte{
|
|||||||
0x0f, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71,
|
0x0f, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71,
|
||||||
0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65,
|
0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65,
|
||||||
0x73, 0x70, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f,
|
0x73, 0x70, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f,
|
||||||
0x75, 0x73, 0x65, 0x72, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x42, 0x36,
|
0x75, 0x73, 0x65, 0x72, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x42, 0x33,
|
||||||
0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f,
|
0x5a, 0x31, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f,
|
||||||
0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63,
|
0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63,
|
||||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x73, 0x2f, 0x67,
|
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x73, 0x2f, 0x72,
|
||||||
0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x73, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
// source: service_user.proto
|
// source: service_user.proto
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Package grpc_pb is a reverse proxy.
|
Package rspb is a reverse proxy.
|
||||||
|
|
||||||
It translates gRPC into RESTful JSON APIs.
|
It translates gRPC into RESTful JSON APIs.
|
||||||
*/
|
*/
|
||||||
package grpc_pb
|
package rspb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
// - protoc v4.25.1
|
// - protoc v4.25.1
|
||||||
// source: service_user.proto
|
// source: service_user.proto
|
||||||
|
|
||||||
package grpc_pb
|
package rspb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
context "context"
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
// protoc v4.25.1
|
// protoc v4.25.1
|
||||||
// source: ss_common.proto
|
// source: ss_common.proto
|
||||||
|
|
||||||
package ss_common
|
package sscommon
|
||||||
|
|
||||||
import (
|
import (
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
@@ -23,11 +23,11 @@ var File_ss_common_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
var file_ss_common_proto_rawDesc = []byte{
|
var file_ss_common_proto_rawDesc = []byte{
|
||||||
0x0a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
0x0a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x6f, 0x42, 0x38, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73,
|
0x6f, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73,
|
||||||
0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
|
0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
|
||||||
0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73,
|
0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73,
|
||||||
0x73, 0x2f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
0x73, 0x2f, 0x73, 0x73, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x74, 0x6f, 0x33,
|
0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_ss_common_proto_goTypes = []interface{}{}
|
var file_ss_common_proto_goTypes = []interface{}{}
|
||||||
@@ -4,10 +4,10 @@
|
|||||||
// protoc v4.25.1
|
// protoc v4.25.1
|
||||||
// source: action.proto
|
// source: action.proto
|
||||||
|
|
||||||
package ss_pb
|
package sspb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "git.hlsq.asia/mmorpg/service-common/proto/ss/ss_common"
|
_ "git.hlsq.asia/alex/service-common/proto/ss/sscommon"
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
@@ -259,9 +259,9 @@ type PositionInfo struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
USN string `protobuf:"bytes,1,opt,name=USN,proto3" json:"USN,omitempty"`
|
USN int64 `protobuf:"varint,1,opt,name=USN,proto3" json:"USN,omitempty"`
|
||||||
X int32 `protobuf:"zigzag32,2,opt,name=X,proto3" json:"X,omitempty"`
|
X int32 `protobuf:"zigzag32,2,opt,name=X,proto3" json:"X,omitempty"`
|
||||||
Y int32 `protobuf:"zigzag32,3,opt,name=Y,proto3" json:"Y,omitempty"`
|
Y int32 `protobuf:"zigzag32,3,opt,name=Y,proto3" json:"Y,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PositionInfo) Reset() {
|
func (x *PositionInfo) Reset() {
|
||||||
@@ -296,11 +296,11 @@ func (*PositionInfo) Descriptor() ([]byte, []int) {
|
|||||||
return file_action_proto_rawDescGZIP(), []int{3}
|
return file_action_proto_rawDescGZIP(), []int{3}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PositionInfo) GetUSN() string {
|
func (x *PositionInfo) GetUSN() int64 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.USN
|
return x.USN
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PositionInfo) GetX() int32 {
|
func (x *PositionInfo) GetX() int32 {
|
||||||
@@ -388,7 +388,7 @@ var file_action_proto_rawDesc = []byte{
|
|||||||
0x12, 0x18, 0x0a, 0x07, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28,
|
0x12, 0x18, 0x0a, 0x07, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28,
|
||||||
0x05, 0x52, 0x07, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x3c, 0x0a, 0x0c, 0x50, 0x6f,
|
0x05, 0x52, 0x07, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x3c, 0x0a, 0x0c, 0x50, 0x6f,
|
||||||
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53,
|
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53,
|
||||||
0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x0c, 0x0a, 0x01,
|
0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x0c, 0x0a, 0x01,
|
||||||
0x58, 0x18, 0x02, 0x20, 0x01, 0x28, 0x11, 0x52, 0x01, 0x58, 0x12, 0x0c, 0x0a, 0x01, 0x59, 0x18,
|
0x58, 0x18, 0x02, 0x20, 0x01, 0x28, 0x11, 0x52, 0x01, 0x58, 0x12, 0x0c, 0x0a, 0x01, 0x59, 0x18,
|
||||||
0x03, 0x20, 0x01, 0x28, 0x11, 0x52, 0x01, 0x59, 0x22, 0x31, 0x0a, 0x0c, 0x53, 0x32, 0x43, 0x5f,
|
0x03, 0x20, 0x01, 0x28, 0x11, 0x52, 0x01, 0x59, 0x22, 0x31, 0x0a, 0x0c, 0x53, 0x32, 0x43, 0x5f,
|
||||||
0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f,
|
0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f,
|
||||||
@@ -398,11 +398,11 @@ var file_action_proto_rawDesc = []byte{
|
|||||||
0x4e, 0x5f, 0x49, 0x44, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x12,
|
0x4e, 0x5f, 0x49, 0x44, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x12,
|
||||||
0x0a, 0x0e, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x5f, 0x4d, 0x4f, 0x56, 0x45,
|
0x0a, 0x0e, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x5f, 0x4d, 0x4f, 0x56, 0x45,
|
||||||
0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x5f,
|
0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x5f,
|
||||||
0x41, 0x54, 0x54, 0x41, 0x43, 0x4b, 0x10, 0x02, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x2e,
|
0x41, 0x54, 0x54, 0x41, 0x43, 0x4b, 0x10, 0x02, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x2e,
|
||||||
0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67,
|
0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67,
|
||||||
0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f,
|
0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x5f, 0x70, 0x62, 0x62, 0x06,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -4,10 +4,10 @@
|
|||||||
// protoc v4.25.1
|
// protoc v4.25.1
|
||||||
// source: define.proto
|
// source: define.proto
|
||||||
|
|
||||||
package ss_pb
|
package sspb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "git.hlsq.asia/mmorpg/service-common/proto/ss/ss_common"
|
_ "git.hlsq.asia/alex/service-common/proto/ss/sscommon"
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
@@ -158,11 +158,11 @@ var file_define_proto_rawDesc = []byte{
|
|||||||
0x4e, 0x43, 0x45, 0x10, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45,
|
0x4e, 0x43, 0x45, 0x10, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45,
|
||||||
0x5f, 0x49, 0x44, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x66, 0x12, 0x17, 0x0a, 0x13,
|
0x5f, 0x49, 0x44, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x66, 0x12, 0x17, 0x0a, 0x13,
|
||||||
0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x49, 0x44, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54,
|
0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x49, 0x44, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54,
|
||||||
0x49, 0x4f, 0x4e, 0x10, 0x67, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73,
|
0x49, 0x4f, 0x4e, 0x10, 0x67, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73,
|
||||||
0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65,
|
0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65,
|
||||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f,
|
0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f,
|
||||||
0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x74, 0x6f, 0x33,
|
0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -4,10 +4,10 @@
|
|||||||
// protoc v4.25.1
|
// protoc v4.25.1
|
||||||
// source: service.proto
|
// source: service.proto
|
||||||
|
|
||||||
package ss_pb
|
package sspb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "git.hlsq.asia/mmorpg/service-common/proto/ss/ss_common"
|
_ "git.hlsq.asia/alex/service-common/proto/ss/sscommon"
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
@@ -249,11 +249,10 @@ var file_service_proto_rawDesc = []byte{
|
|||||||
0x54, 0x5f, 0x49, 0x44, 0x5f, 0x51, 0x55, 0x45, 0x55, 0x45, 0x5f, 0x55, 0x50, 0x5f, 0x46, 0x55,
|
0x54, 0x5f, 0x49, 0x44, 0x5f, 0x51, 0x55, 0x45, 0x55, 0x45, 0x5f, 0x55, 0x50, 0x5f, 0x46, 0x55,
|
||||||
0x4c, 0x4c, 0x10, 0x04, 0x12, 0x1d, 0x0a, 0x19, 0x4b, 0x49, 0x43, 0x4b, 0x5f, 0x4f, 0x55, 0x54,
|
0x4c, 0x4c, 0x10, 0x04, 0x12, 0x1d, 0x0a, 0x19, 0x4b, 0x49, 0x43, 0x4b, 0x5f, 0x4f, 0x55, 0x54,
|
||||||
0x5f, 0x49, 0x44, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49,
|
0x5f, 0x49, 0x44, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49,
|
||||||
0x44, 0x10, 0x05, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e,
|
0x44, 0x10, 0x05, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e,
|
||||||
0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76,
|
0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76,
|
||||||
0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
0x33,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
17
utils/jwt.go
17
utils/jwt.go
@@ -1,19 +1,17 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
"google.golang.org/grpc/metadata"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Claims struct {
|
type Claims struct {
|
||||||
USN string `json:"usn"`
|
USN int64 `json:"usn"`
|
||||||
jwt.RegisteredClaims
|
jwt.RegisteredClaims
|
||||||
}
|
}
|
||||||
|
|
||||||
func GenToken(usn string, secret string, expires time.Duration) (string, error) {
|
func GenToken(usn int64, secret string, expires time.Duration) (string, error) {
|
||||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, Claims{
|
token := jwt.NewWithClaims(jwt.SigningMethodHS256, Claims{
|
||||||
USN: usn,
|
USN: usn,
|
||||||
RegisteredClaims: jwt.RegisteredClaims{
|
RegisteredClaims: jwt.RegisteredClaims{
|
||||||
@@ -39,14 +37,3 @@ func ParseToken(tokenString string, secret string) (*Claims, error) {
|
|||||||
}
|
}
|
||||||
return claims, nil
|
return claims, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ShouldBindUsn(ctx context.Context, usn *string) bool {
|
|
||||||
if md, ok := metadata.FromIncomingContext(ctx); ok {
|
|
||||||
usnArr := md.Get("X-Usn")
|
|
||||||
if len(usnArr) == 0 || usnArr[0] == "" {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
*usn = usnArr[0]
|
|
||||||
}
|
|
||||||
return *usn != ""
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -21,3 +21,8 @@ func StringToInt64(s string) int64 {
|
|||||||
}
|
}
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Int64ToString converts int64 to string
|
||||||
|
func Int64ToString(i int64) string {
|
||||||
|
return strconv.FormatInt(i, 10)
|
||||||
|
}
|
||||||
|
|||||||
29
utils/session.go
Normal file
29
utils/session.go
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"google.golang.org/grpc/metadata"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UserSession struct {
|
||||||
|
USN int64 `json:"usn" redis:"usn"`
|
||||||
|
IP string `json:"ip" redis:"ip"`
|
||||||
|
UserAgent string `json:"ua" redis:"ua"`
|
||||||
|
AccessToken string `json:"at" redis:"at"`
|
||||||
|
RefreshToken string `json:"rt" redis:"rt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (us *UserSession) GetUsnKey() string {
|
||||||
|
return "usn"
|
||||||
|
}
|
||||||
|
|
||||||
|
func ShouldBindUsn(ctx context.Context, usn *int64) bool {
|
||||||
|
if md, ok := metadata.FromIncomingContext(ctx); ok {
|
||||||
|
usnArr := md.Get("X-Usn")
|
||||||
|
if len(usnArr) == 0 || usnArr[0] == "" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
*usn = StringToInt64(usnArr[0])
|
||||||
|
}
|
||||||
|
return *usn != 0
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ package utils
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"git.hlsq.asia/mmorpg/service-common/net/http/http_resp"
|
"git.hlsq.asia/alex/service-common/net/http/httpresp"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
@@ -26,7 +26,7 @@ func CreateTestContext(method, path string, body interface{}) (*httptest.Respons
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AssertResponse 断言返回值
|
// AssertResponse 断言返回值
|
||||||
func AssertResponse(ts *suite.Suite, w *httptest.ResponseRecorder, httpCode int, code *http_resp.Code) {
|
func AssertResponse(ts *suite.Suite, w *httptest.ResponseRecorder, httpCode int, code *httpresp.Code) {
|
||||||
ts.Assert().Equal(httpCode, w.Code)
|
ts.Assert().Equal(httpCode, w.Code)
|
||||||
var response map[string]interface{}
|
var response map[string]interface{}
|
||||||
ts.Assert().NoError(json.Unmarshal(w.Body.Bytes(), &response))
|
ts.Assert().NoError(json.Unmarshal(w.Body.Bytes(), &response))
|
||||||
|
|||||||
Reference in New Issue
Block a user