Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
813568cb63
@ -14,7 +14,7 @@ var user_builders = []*TestCase{
|
|||||||
mainType: string(comm.ModuleUser),
|
mainType: string(comm.ModuleUser),
|
||||||
subType: user.UserSubTypeCreate,
|
subType: user.UserSubTypeCreate,
|
||||||
req: &pb.UserCreateReq{ //设置请求参数
|
req: &pb.UserCreateReq{ //设置请求参数
|
||||||
NickName: "乐谷7411",
|
NickName: "乐谷7422",
|
||||||
},
|
},
|
||||||
rsp: &pb.UserCreateResp{},
|
rsp: &pb.UserCreateResp{},
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
@ -18,11 +18,11 @@ func (this *ModelSession) Init(service core.IService, module core.IModule, comp
|
|||||||
}
|
}
|
||||||
|
|
||||||
//获取用户
|
//获取用户
|
||||||
func (this *ModelSession) getUserSession(uid string) *pb.CacheUser {
|
func (this *ModelSession) getUserSession(uid string) (cuser *pb.CacheUser) {
|
||||||
cacheUser := &pb.CacheUser{}
|
cuser = &pb.CacheUser{}
|
||||||
if err := this.Get(uid, cacheUser); err != nil {
|
if err := this.Get(uid, cuser); err != nil {
|
||||||
log.Errorf("GetUserSession err:%v", err)
|
log.Errorf("GetUserSession err:%v", err)
|
||||||
return nil
|
return
|
||||||
}
|
}
|
||||||
return cacheUser
|
return
|
||||||
}
|
}
|
||||||
|
@ -61,13 +61,13 @@ func (this *ModelUser) User_Create(user *pb.DBUser) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//获取用户
|
//获取用户
|
||||||
func (this *ModelUser) GetUser(uid string) *pb.DBUser {
|
func (this *ModelUser) GetUser(uid string) (user *pb.DBUser) {
|
||||||
dbUser := &pb.DBUser{}
|
user = &pb.DBUser{}
|
||||||
if err := this.Get(uid, dbUser); err != nil {
|
if err := this.Get(uid, user); err != nil {
|
||||||
log.Errorf("getUser err:%v", err)
|
log.Errorf("getUser err:%v", err)
|
||||||
return nil
|
return
|
||||||
}
|
}
|
||||||
return dbUser
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置属性
|
//设置属性
|
||||||
|
@ -41,12 +41,20 @@ func (this *User) OnInstallComp() {
|
|||||||
|
|
||||||
//获取用户数据
|
//获取用户数据
|
||||||
func (this *User) GetUser(uid string) *pb.DBUser {
|
func (this *User) GetUser(uid string) *pb.DBUser {
|
||||||
return this.modelUser.GetUser(uid)
|
user := this.modelUser.GetUser(uid)
|
||||||
|
if user.Id == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return user
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取用户会话
|
//获取用户会话
|
||||||
func (this *User) GetUserSession(uid string) *pb.CacheUser {
|
func (this *User) GetUserSession(uid string) *pb.CacheUser {
|
||||||
return this.modelSession.getUserSession(uid)
|
cuser := this.modelSession.getUserSession(uid)
|
||||||
|
if cuser.Uid == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return cuser
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询用户属性值 例如 金币 经验
|
//查询用户属性值 例如 金币 经验
|
||||||
|
@ -5,6 +5,7 @@ message CacheUser {
|
|||||||
string uid = 1;
|
string uid = 1;
|
||||||
string SessionId = 2;
|
string SessionId = 2;
|
||||||
string GatewayServiceId = 3;
|
string GatewayServiceId = 3;
|
||||||
|
string ip = 4;
|
||||||
// DB_UserData UserData = 4; //@go_tags(`json:",inline"`)
|
// DB_UserData UserData = 4; //@go_tags(`json:",inline"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@ type CacheUser struct {
|
|||||||
|
|
||||||
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"`
|
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"`
|
||||||
SessionId string `protobuf:"bytes,2,opt,name=SessionId,proto3" json:"SessionId"`
|
SessionId string `protobuf:"bytes,2,opt,name=SessionId,proto3" json:"SessionId"`
|
||||||
GatewayServiceId string `protobuf:"bytes,3,opt,name=GatewayServiceId,proto3" json:",inline"` // DB_UserData UserData = 4; //
|
GatewayServiceId string `protobuf:"bytes,3,opt,name=GatewayServiceId,proto3" json:"GatewayServiceId"`
|
||||||
|
Ip string `protobuf:"bytes,4,opt,name=ip,proto3" json:",inline"` // DB_UserData UserData = 4; //
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CacheUser) Reset() {
|
func (x *CacheUser) Reset() {
|
||||||
@ -83,6 +84,13 @@ func (x *CacheUser) GetGatewayServiceId() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *CacheUser) GetIp() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Ip
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type DBUser struct {
|
type DBUser struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@ -262,13 +270,14 @@ var File_user_user_db_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
var file_user_user_db_proto_rawDesc = []byte{
|
var file_user_user_db_proto_rawDesc = []byte{
|
||||||
0x0a, 0x12, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x62, 0x2e, 0x70,
|
0x0a, 0x12, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x62, 0x2e, 0x70,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x67, 0x0a, 0x09, 0x43, 0x61, 0x63, 0x68, 0x65, 0x55, 0x73, 0x65,
|
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x77, 0x0a, 0x09, 0x43, 0x61, 0x63, 0x68, 0x65, 0x55, 0x73, 0x65,
|
||||||
0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
||||||
0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64,
|
0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64,
|
||||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49,
|
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49,
|
||||||
0x64, 0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76,
|
0x64, 0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76,
|
||||||
0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x47, 0x61, 0x74,
|
0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x47, 0x61, 0x74,
|
||||||
0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x22, 0x8c, 0x03,
|
0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x0e, 0x0a,
|
||||||
|
0x02, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, 0x8c, 0x03,
|
||||||
0x0a, 0x06, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
|
0x0a, 0x06, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
|
||||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75,
|
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75,
|
||||||
|
Loading…
Reference in New Issue
Block a user