Commit 23ab5719 by Li Feifei

解决冲突

parents 573d7fa4 f86d4ced
...@@ -2,11 +2,12 @@ package db ...@@ -2,11 +2,12 @@ package db
import ( import (
"fmt" "fmt"
"github.com/astaxie/beego/orm"
"github.com/go-redis/redis/v8"
"log" "log"
"sync" "sync"
"github.com/astaxie/beego/orm"
"github.com/go-redis/redis/v8"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
) )
...@@ -54,7 +55,9 @@ func newMysqlClient() { ...@@ -54,7 +55,9 @@ func newMysqlClient() {
log.Println("db connect error => ", err) log.Println("db connect error => ", err)
return return
} }
orm.RegisterModel(new(CompanyApp), new(ImBase), new(ImChatRoom), new(ImUserRelationship))
orm.RegisterModel(new(CompanyApp), new(ImBase), new(ImChatRoom), new(ImUserRelationship), new(ImUser))
MysqlClient = orm.NewOrm() MysqlClient = orm.NewOrm()
log.Println("MySQL connect success") log.Println("MySQL connect success")
} }
...@@ -26,16 +26,32 @@ type ImChatRoom struct { ...@@ -26,16 +26,32 @@ type ImChatRoom struct {
Updatetime string Updatetime string
} }
type ImUserRelationship struct { type ImUserRelationship struct {
Id int Id int
Accid string Accid string
Faccid string Faccid string
Type int Type int
Msg string Msg string
Blacklist int Blacklist int
Mute int Mute int
Serverex string Serverex string
Createtime string Createtime string
Updatetime string Updatetime string
} }
\ No newline at end of file
type ImUser struct {
Id int64
Accid string
Appkey string
Name string
Mob adile string
Disable int64
MuteEstoppel int64
MuteAudioVideo int64
Ext string
Createtime string
Updatetime string
LoginStatus int64
Platfrom string
Edition string
}
...@@ -5,6 +5,7 @@ import ( ...@@ -5,6 +5,7 @@ import (
"encoding/hex" "encoding/hex"
"errors" "errors"
"fmt" "fmt"
"im-microservice/sevice/im_user"
"log" "log"
"net" "net"
"regexp" "regexp"
...@@ -108,6 +109,7 @@ func main() { ...@@ -108,6 +109,7 @@ func main() {
s := grpc.NewServer() s := grpc.NewServer()
pb.RegisterConfigureSeviceServer(s, &ic.ConfigureSevice{}) pb.RegisterConfigureSeviceServer(s, &ic.ConfigureSevice{})
pb.RegisterChatRoomServiceServer(s, &im_chat_room.ImChatRoomService{}) pb.RegisterChatRoomServiceServer(s, &im_chat_room.ImChatRoomService{})
pb.RegisterImUserServer(s, &im_user.ImUserServer{})
if err := s.Serve(lis); err != nil { if err := s.Serve(lis); err != nil {
log.Fatalf("failed to serve: %v", err) log.Fatalf("failed to serve: %v", err)
} }
......
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.24.0 // protoc-gen-go v1.25.0
// protoc v3.12.3 // protoc v3.12.3
// source: u-proto/common.proto // source: u-proto/common.proto
package pb package pb
import ( import (
reflect "reflect"
sync "sync"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
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"
sync "sync"
) )
const ( const (
......
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.3
// source: u-proto/im_user.proto
package pb
import (
context "context"
reflect "reflect"
sync "sync"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
//注册登录
type ImUserRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *Common `protobuf:"bytes,1,opt,name=Common,proto3" json:"Common,omitempty"`
Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
Mobile string `protobuf:"bytes,3,opt,name=Mobile,proto3" json:"Mobile,omitempty"`
Code string `protobuf:"bytes,4,opt,name=Code,proto3" json:"Code,omitempty"`
Platfrom string `protobuf:"bytes,5,opt,name=Platfrom,proto3" json:"Platfrom,omitempty"`
}
func (x *ImUserRequest) Reset() {
*x = ImUserRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImUserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImUserRequest) ProtoMessage() {}
func (x *ImUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ImUserRequest.ProtoReflect.Descriptor instead.
func (*ImUserRequest) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_proto_rawDescGZIP(), []int{0}
}
func (x *ImUserRequest) GetCommon() *Common {
if x != nil {
return x.Common
}
return nil
}
func (x *ImUserRequest) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *ImUserRequest) GetMobile() string {
if x != nil {
return x.Mobile
}
return ""
}
func (x *ImUserRequest) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *ImUserRequest) GetPlatfrom() string {
if x != nil {
return x.Platfrom
}
return ""
}
type ImUserReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Appid string `protobuf:"bytes,2,opt,name=Appid,proto3" json:"Appid,omitempty"`
}
func (x *ImUserReply) Reset() {
*x = ImUserReply{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImUserReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImUserReply) ProtoMessage() {}
func (x *ImUserReply) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ImUserReply.ProtoReflect.Descriptor instead.
func (*ImUserReply) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_proto_rawDescGZIP(), []int{1}
}
func (x *ImUserReply) GetAppid() string {
if x != nil {
return x.Appid
}
return ""
}
//用户退出
type ImUserOutRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *Common `protobuf:"bytes,1,opt,name=Common,proto3" json:"Common,omitempty"`
Appid string `protobuf:"bytes,2,opt,name=Appid,proto3" json:"Appid,omitempty"`
}
func (x *ImUserOutRequest) Reset() {
*x = ImUserOutRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImUserOutRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImUserOutRequest) ProtoMessage() {}
func (x *ImUserOutRequest) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ImUserOutRequest.ProtoReflect.Descriptor instead.
func (*ImUserOutRequest) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_proto_rawDescGZIP(), []int{2}
}
func (x *ImUserOutRequest) GetCommon() *Common {
if x != nil {
return x.Common
}
return nil
}
func (x *ImUserOutRequest) GetAppid() string {
if x != nil {
return x.Appid
}
return ""
}
//用户设置禁言,禁音视频
type ImUserSetRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *Common `protobuf:"bytes,1,opt,name=Common,proto3" json:"Common,omitempty"`
Mute bool `protobuf:"varint,2,opt,name=Mute,proto3" json:"Mute,omitempty"`
Appid string `protobuf:"bytes,3,opt,name=Appid,proto3" json:"Appid,omitempty"`
}
func (x *ImUserSetRequest) Reset() {
*x = ImUserSetRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImUserSetRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImUserSetRequest) ProtoMessage() {}
func (x *ImUserSetRequest) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ImUserSetRequest.ProtoReflect.Descriptor instead.
func (*ImUserSetRequest) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_proto_rawDescGZIP(), []int{3}
}
func (x *ImUserSetRequest) GetCommon() *Common {
if x != nil {
return x.Common
}
return nil
}
func (x *ImUserSetRequest) GetMute() bool {
if x != nil {
return x.Mute
}
return false
}
func (x *ImUserSetRequest) GetAppid() string {
if x != nil {
return x.Appid
}
return ""
}
type ImUserSetReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ImUserSetReply) Reset() {
*x = ImUserSetReply{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImUserSetReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImUserSetReply) ProtoMessage() {}
func (x *ImUserSetReply) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ImUserSetReply.ProtoReflect.Descriptor instead.
func (*ImUserSetReply) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_proto_rawDescGZIP(), []int{4}
}
//获取单个用户信息
type ImUserOneRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *Common `protobuf:"bytes,1,opt,name=Common,proto3" json:"Common,omitempty"`
Appid string `protobuf:"bytes,2,opt,name=Appid,proto3" json:"Appid,omitempty"`
}
func (x *ImUserOneRequest) Reset() {
*x = ImUserOneRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImUserOneRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImUserOneRequest) ProtoMessage() {}
func (x *ImUserOneRequest) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ImUserOneRequest.ProtoReflect.Descriptor instead.
func (*ImUserOneRequest) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_proto_rawDescGZIP(), []int{5}
}
func (x *ImUserOneRequest) GetCommon() *Common {
if x != nil {
return x.Common
}
return nil
}
func (x *ImUserOneRequest) GetAppid() string {
if x != nil {
return x.Appid
}
return ""
}
type ImUserOneReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"`
Appid string `protobuf:"bytes,2,opt,name=Appid,proto3" json:"Appid,omitempty"`
Name string `protobuf:"bytes,3,opt,name=Name,proto3" json:"Name,omitempty"`
Mobile string `protobuf:"bytes,4,opt,name=Mobile,proto3" json:"Mobile,omitempty"`
Disable int64 `protobuf:"varint,5,opt,name=Disable,proto3" json:"Disable,omitempty"`
MuteEstoppel int64 `protobuf:"varint,6,opt,name=MuteEstoppel,proto3" json:"MuteEstoppel,omitempty"`
MuteAudioVideo int64 `protobuf:"varint,7,opt,name=MuteAudioVideo,proto3" json:"MuteAudioVideo,omitempty"`
Ext string `protobuf:"bytes,8,opt,name=Ext,proto3" json:"Ext,omitempty"`
Createtime string `protobuf:"bytes,9,opt,name=Createtime,proto3" json:"Createtime,omitempty"`
Updatetime string `protobuf:"bytes,10,opt,name=Updatetime,proto3" json:"Updatetime,omitempty"`
LoginStatus int64 `protobuf:"varint,11,opt,name=LoginStatus,proto3" json:"LoginStatus,omitempty"`
Platfrom string `protobuf:"bytes,12,opt,name=Platfrom,proto3" json:"Platfrom,omitempty"`
Edition string `protobuf:"bytes,13,opt,name=Edition,proto3" json:"Edition,omitempty"`
}
func (x *ImUserOneReply) Reset() {
*x = ImUserOneReply{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImUserOneReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImUserOneReply) ProtoMessage() {}
func (x *ImUserOneReply) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ImUserOneReply.ProtoReflect.Descriptor instead.
func (*ImUserOneReply) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_proto_rawDescGZIP(), []int{6}
}
func (x *ImUserOneReply) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *ImUserOneReply) GetAppid() string {
if x != nil {
return x.Appid
}
return ""
}
func (x *ImUserOneReply) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *ImUserOneReply) GetMobile() string {
if x != nil {
return x.Mobile
}
return ""
}
func (x *ImUserOneReply) GetDisable() int64 {
if x != nil {
return x.Disable
}
return 0
}
func (x *ImUserOneReply) GetMuteEstoppel() int64 {
if x != nil {
return x.MuteEstoppel
}
return 0
}
func (x *ImUserOneReply) GetMuteAudioVideo() int64 {
if x != nil {
return x.MuteAudioVideo
}
return 0
}
func (x *ImUserOneReply) GetExt() string {
if x != nil {
return x.Ext
}
return ""
}
func (x *ImUserOneReply) GetCreatetime() string {
if x != nil {
return x.Createtime
}
return ""
}
func (x *ImUserOneReply) GetUpdatetime() string {
if x != nil {
return x.Updatetime
}
return ""
}
func (x *ImUserOneReply) GetLoginStatus() int64 {
if x != nil {
return x.LoginStatus
}
return 0
}
func (x *ImUserOneReply) GetPlatfrom() string {
if x != nil {
return x.Platfrom
}
return ""
}
func (x *ImUserOneReply) GetEdition() string {
if x != nil {
return x.Edition
}
return ""
}
//获取用户列表
type ImUserListRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *Common `protobuf:"bytes,1,opt,name=Common,proto3" json:"Common,omitempty"`
Page int64 `protobuf:"varint,2,opt,name=Page,proto3" json:"Page,omitempty"`
Mobile string `protobuf:"bytes,3,opt,name=Mobile,proto3" json:"Mobile,omitempty"`
Name string `protobuf:"bytes,4,opt,name=Name,proto3" json:"Name,omitempty"`
Disable int64 `protobuf:"varint,5,opt,name=Disable,proto3" json:"Disable,omitempty"`
MuteEstoppel int64 `protobuf:"varint,6,opt,name=MuteEstoppel,proto3" json:"MuteEstoppel,omitempty"`
MuteAudioVideo int64 `protobuf:"varint,7,opt,name=MuteAudioVideo,proto3" json:"MuteAudioVideo,omitempty"`
Ext string `protobuf:"bytes,8,opt,name=Ext,proto3" json:"Ext,omitempty"`
Createtime string `protobuf:"bytes,9,opt,name=Createtime,proto3" json:"Createtime,omitempty"`
Updatetime string `protobuf:"bytes,10,opt,name=Updatetime,proto3" json:"Updatetime,omitempty"`
LoginStatus int64 `protobuf:"varint,11,opt,name=LoginStatus,proto3" json:"LoginStatus,omitempty"`
Platfrom string `protobuf:"bytes,12,opt,name=Platfrom,proto3" json:"Platfrom,omitempty"`
Edition string `protobuf:"bytes,13,opt,name=Edition,proto3" json:"Edition,omitempty"`
}
func (x *ImUserListRequest) Reset() {
*x = ImUserListRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImUserListRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImUserListRequest) ProtoMessage() {}
func (x *ImUserListRequest) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ImUserListRequest.ProtoReflect.Descriptor instead.
func (*ImUserListRequest) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_proto_rawDescGZIP(), []int{7}
}
func (x *ImUserListRequest) GetCommon() *Common {
if x != nil {
return x.Common
}
return nil
}
func (x *ImUserListRequest) GetPage() int64 {
if x != nil {
return x.Page
}
return 0
}
func (x *ImUserListRequest) GetMobile() string {
if x != nil {
return x.Mobile
}
return ""
}
func (x *ImUserListRequest) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *ImUserListRequest) GetDisable() int64 {
if x != nil {
return x.Disable
}
return 0
}
func (x *ImUserListRequest) GetMuteEstoppel() int64 {
if x != nil {
return x.MuteEstoppel
}
return 0
}
func (x *ImUserListRequest) GetMuteAudioVideo() int64 {
if x != nil {
return x.MuteAudioVideo
}
return 0
}
func (x *ImUserListRequest) GetExt() string {
if x != nil {
return x.Ext
}
return ""
}
func (x *ImUserListRequest) GetCreatetime() string {
if x != nil {
return x.Createtime
}
return ""
}
func (x *ImUserListRequest) GetUpdatetime() string {
if x != nil {
return x.Updatetime
}
return ""
}
func (x *ImUserListRequest) GetLoginStatus() int64 {
if x != nil {
return x.LoginStatus
}
return 0
}
func (x *ImUserListRequest) GetPlatfrom() string {
if x != nil {
return x.Platfrom
}
return ""
}
func (x *ImUserListRequest) GetEdition() string {
if x != nil {
return x.Edition
}
return ""
}
type ImUserListReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
List []*ImUserOneReply `protobuf:"bytes,1,rep,name=List,proto3" json:"List,omitempty"`
Paginate *Page `protobuf:"bytes,2,opt,name=Paginate,proto3" json:"Paginate,omitempty"`
}
func (x *ImUserListReply) Reset() {
*x = ImUserListReply{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImUserListReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImUserListReply) ProtoMessage() {}
func (x *ImUserListReply) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ImUserListReply.ProtoReflect.Descriptor instead.
func (*ImUserListReply) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_proto_rawDescGZIP(), []int{8}
}
func (x *ImUserListReply) GetList() []*ImUserOneReply {
if x != nil {
return x.List
}
return nil
}
func (x *ImUserListReply) GetPaginate() *Page {
if x != nil {
return x.Paginate
}
return nil
}
var File_u_proto_im_user_proto protoreflect.FileDescriptor
var file_u_proto_im_user_proto_rawDesc = []byte{
0x0a, 0x15, 0x75, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6d, 0x5f, 0x75, 0x73, 0x65,
0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x14, 0x75, 0x2d, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0x8f, 0x01, 0x0a, 0x0d, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52,
0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x4d,
0x6f, 0x62, 0x69, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4d, 0x6f, 0x62,
0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66,
0x72, 0x6f, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66,
0x72, 0x6f, 0x6d, 0x22, 0x23, 0x0a, 0x0b, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x70,
0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x22, 0x4c, 0x0a, 0x10, 0x49, 0x6d, 0x55, 0x73,
0x65, 0x72, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x06,
0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70,
0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x22, 0x60, 0x0a, 0x10, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72,
0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x06, 0x43, 0x6f,
0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e,
0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12,
0x0a, 0x04, 0x4d, 0x75, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x4d, 0x75,
0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x22, 0x10, 0x0a, 0x0e, 0x49, 0x6d, 0x55, 0x73,
0x65, 0x72, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x4c, 0x0a, 0x10, 0x49, 0x6d,
0x55, 0x73, 0x65, 0x72, 0x4f, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22,
0x0a, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a,
0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x06, 0x43, 0x6f, 0x6d, 0x6d,
0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x22, 0xf2, 0x02, 0x0a, 0x0e, 0x49, 0x6d, 0x55,
0x73, 0x65, 0x72, 0x4f, 0x6e, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x49,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41,
0x70, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x41, 0x70, 0x70, 0x69,
0x64, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x4d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4d, 0x6f, 0x62, 0x69, 0x6c, 0x65, 0x12, 0x18, 0x0a,
0x07, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07,
0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x4d, 0x75, 0x74, 0x65, 0x45,
0x73, 0x74, 0x6f, 0x70, 0x70, 0x65, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x4d,
0x75, 0x74, 0x65, 0x45, 0x73, 0x74, 0x6f, 0x70, 0x70, 0x65, 0x6c, 0x12, 0x26, 0x0a, 0x0e, 0x4d,
0x75, 0x74, 0x65, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x18, 0x07, 0x20,
0x01, 0x28, 0x03, 0x52, 0x0e, 0x4d, 0x75, 0x74, 0x65, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x56, 0x69,
0x64, 0x65, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x45, 0x78, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x45, 0x78, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x74,
0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74,
0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x74,
0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74,
0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x4c, 0x6f, 0x67, 0x69,
0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66,
0x72, 0x6f, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66,
0x72, 0x6f, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0d,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x87, 0x03,
0x0a, 0x11, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52,
0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x50, 0x61, 0x67, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x50, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x4d,
0x6f, 0x62, 0x69, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4d, 0x6f, 0x62,
0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x44, 0x69, 0x73, 0x61, 0x62,
0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c,
0x65, 0x12, 0x22, 0x0a, 0x0c, 0x4d, 0x75, 0x74, 0x65, 0x45, 0x73, 0x74, 0x6f, 0x70, 0x70, 0x65,
0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x4d, 0x75, 0x74, 0x65, 0x45, 0x73, 0x74,
0x6f, 0x70, 0x70, 0x65, 0x6c, 0x12, 0x26, 0x0a, 0x0e, 0x4d, 0x75, 0x74, 0x65, 0x41, 0x75, 0x64,
0x69, 0x6f, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x4d,
0x75, 0x74, 0x65, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x12, 0x10, 0x0a,
0x03, 0x45, 0x78, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x45, 0x78, 0x74, 0x12,
0x1e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12,
0x1e, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12,
0x20, 0x0a, 0x0b, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0b,
0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x72, 0x6f, 0x6d, 0x18, 0x0c, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x18, 0x0a,
0x07, 0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x45, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x5f, 0x0a, 0x0f, 0x49, 0x6d, 0x55, 0x73, 0x65,
0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x26, 0x0a, 0x04, 0x4c, 0x69,
0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d,
0x55, 0x73, 0x65, 0x72, 0x4f, 0x6e, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x52, 0x04, 0x4c, 0x69,
0x73, 0x74, 0x12, 0x24, 0x0a, 0x08, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x08,
0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x32, 0xad, 0x03, 0x0a, 0x06, 0x49, 0x6d, 0x55,
0x73, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x0e, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x67,
0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d, 0x55, 0x73, 0x65,
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d,
0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x0b, 0x49,
0x6d, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x11, 0x2e, 0x70, 0x62, 0x2e,
0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e,
0x70, 0x62, 0x2e, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00,
0x12, 0x3c, 0x0a, 0x0e, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x4f,
0x75, 0x74, 0x12, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x75,
0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d,
0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x42,
0x0a, 0x14, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x46, 0x6f, 0x72, 0x62, 0x69, 0x64, 0x64, 0x65,
0x6e, 0x57, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d, 0x55, 0x73,
0x65, 0x72, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x70,
0x62, 0x2e, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79,
0x22, 0x00, 0x12, 0x3f, 0x0a, 0x11, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x46, 0x6f, 0x72, 0x62,
0x69, 0x64, 0x64, 0x65, 0x6e, 0x41, 0x56, 0x12, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d, 0x55,
0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e,
0x70, 0x62, 0x2e, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c,
0x79, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x09, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x6e, 0x65,
0x12, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x6e, 0x65, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d, 0x55, 0x73,
0x65, 0x72, 0x4f, 0x6e, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0a,
0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e,
0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73,
0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_u_proto_im_user_proto_rawDescOnce sync.Once
file_u_proto_im_user_proto_rawDescData = file_u_proto_im_user_proto_rawDesc
)
func file_u_proto_im_user_proto_rawDescGZIP() []byte {
file_u_proto_im_user_proto_rawDescOnce.Do(func() {
file_u_proto_im_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_u_proto_im_user_proto_rawDescData)
})
return file_u_proto_im_user_proto_rawDescData
}
var file_u_proto_im_user_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_u_proto_im_user_proto_goTypes = []interface{}{
(*ImUserRequest)(nil), // 0: pb.ImUserRequest
(*ImUserReply)(nil), // 1: pb.ImUserReply
(*ImUserOutRequest)(nil), // 2: pb.ImUserOutRequest
(*ImUserSetRequest)(nil), // 3: pb.ImUserSetRequest
(*ImUserSetReply)(nil), // 4: pb.ImUserSetReply
(*ImUserOneRequest)(nil), // 5: pb.ImUserOneRequest
(*ImUserOneReply)(nil), // 6: pb.ImUserOneReply
(*ImUserListRequest)(nil), // 7: pb.ImUserListRequest
(*ImUserListReply)(nil), // 8: pb.ImUserListReply
(*Common)(nil), // 9: pb.Common
(*Page)(nil), // 10: pb.Page
}
var file_u_proto_im_user_proto_depIdxs = []int32{
9, // 0: pb.ImUserRequest.Common:type_name -> pb.Common
9, // 1: pb.ImUserOutRequest.Common:type_name -> pb.Common
9, // 2: pb.ImUserSetRequest.Common:type_name -> pb.Common
9, // 3: pb.ImUserOneRequest.Common:type_name -> pb.Common
9, // 4: pb.ImUserListRequest.Common:type_name -> pb.Common
6, // 5: pb.ImUserListReply.List:type_name -> pb.ImUserOneReply
10, // 6: pb.ImUserListReply.Paginate:type_name -> pb.Page
0, // 7: pb.ImUser.ImUserRegister:input_type -> pb.ImUserRequest
0, // 8: pb.ImUser.ImUserLogin:input_type -> pb.ImUserRequest
2, // 9: pb.ImUser.ImUserLoginOut:input_type -> pb.ImUserOutRequest
3, // 10: pb.ImUser.ImUserForbiddenWords:input_type -> pb.ImUserSetRequest
3, // 11: pb.ImUser.ImUserForbiddenAV:input_type -> pb.ImUserSetRequest
5, // 12: pb.ImUser.ImUserOne:input_type -> pb.ImUserOneRequest
7, // 13: pb.ImUser.ImUserList:input_type -> pb.ImUserListRequest
1, // 14: pb.ImUser.ImUserRegister:output_type -> pb.ImUserReply
1, // 15: pb.ImUser.ImUserLogin:output_type -> pb.ImUserReply
4, // 16: pb.ImUser.ImUserLoginOut:output_type -> pb.ImUserSetReply
4, // 17: pb.ImUser.ImUserForbiddenWords:output_type -> pb.ImUserSetReply
4, // 18: pb.ImUser.ImUserForbiddenAV:output_type -> pb.ImUserSetReply
6, // 19: pb.ImUser.ImUserOne:output_type -> pb.ImUserOneReply
8, // 20: pb.ImUser.ImUserList:output_type -> pb.ImUserListReply
14, // [14:21] is the sub-list for method output_type
7, // [7:14] is the sub-list for method input_type
7, // [7:7] is the sub-list for extension type_name
7, // [7:7] is the sub-list for extension extendee
0, // [0:7] is the sub-list for field type_name
}
func init() { file_u_proto_im_user_proto_init() }
func file_u_proto_im_user_proto_init() {
if File_u_proto_im_user_proto != nil {
return
}
file_u_proto_common_proto_init()
if !protoimpl.UnsafeEnabled {
file_u_proto_im_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImUserRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImUserReply); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImUserOutRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImUserSetRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImUserSetReply); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImUserOneRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImUserOneReply); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImUserListRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImUserListReply); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_u_proto_im_user_proto_rawDesc,
NumEnums: 0,
NumMessages: 9,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_u_proto_im_user_proto_goTypes,
DependencyIndexes: file_u_proto_im_user_proto_depIdxs,
MessageInfos: file_u_proto_im_user_proto_msgTypes,
}.Build()
File_u_proto_im_user_proto = out.File
file_u_proto_im_user_proto_rawDesc = nil
file_u_proto_im_user_proto_goTypes = nil
file_u_proto_im_user_proto_depIdxs = nil
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// ImUserClient is the client API for ImUser service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type ImUserClient interface {
ImUserRegister(ctx context.Context, in *ImUserRequest, opts ...grpc.CallOption) (*ImUserReply, error)
ImUserLogin(ctx context.Context, in *ImUserRequest, opts ...grpc.CallOption) (*ImUserReply, error)
ImUserLoginOut(ctx context.Context, in *ImUserOutRequest, opts ...grpc.CallOption) (*ImUserSetReply, error)
ImUserForbiddenWords(ctx context.Context, in *ImUserSetRequest, opts ...grpc.CallOption) (*ImUserSetReply, error)
ImUserForbiddenAV(ctx context.Context, in *ImUserSetRequest, opts ...grpc.CallOption) (*ImUserSetReply, error)
ImUserOne(ctx context.Context, in *ImUserOneRequest, opts ...grpc.CallOption) (*ImUserOneReply, error)
ImUserList(ctx context.Context, in *ImUserListRequest, opts ...grpc.CallOption) (*ImUserListReply, error)
}
type imUserClient struct {
cc grpc.ClientConnInterface
}
func NewImUserClient(cc grpc.ClientConnInterface) ImUserClient {
return &imUserClient{cc}
}
func (c *imUserClient) ImUserRegister(ctx context.Context, in *ImUserRequest, opts ...grpc.CallOption) (*ImUserReply, error) {
out := new(ImUserReply)
err := c.cc.Invoke(ctx, "/pb.ImUser/ImUserRegister", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *imUserClient) ImUserLogin(ctx context.Context, in *ImUserRequest, opts ...grpc.CallOption) (*ImUserReply, error) {
out := new(ImUserReply)
err := c.cc.Invoke(ctx, "/pb.ImUser/ImUserLogin", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *imUserClient) ImUserLoginOut(ctx context.Context, in *ImUserOutRequest, opts ...grpc.CallOption) (*ImUserSetReply, error) {
out := new(ImUserSetReply)
err := c.cc.Invoke(ctx, "/pb.ImUser/ImUserLoginOut", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *imUserClient) ImUserForbiddenWords(ctx context.Context, in *ImUserSetRequest, opts ...grpc.CallOption) (*ImUserSetReply, error) {
out := new(ImUserSetReply)
err := c.cc.Invoke(ctx, "/pb.ImUser/ImUserForbiddenWords", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *imUserClient) ImUserForbiddenAV(ctx context.Context, in *ImUserSetRequest, opts ...grpc.CallOption) (*ImUserSetReply, error) {
out := new(ImUserSetReply)
err := c.cc.Invoke(ctx, "/pb.ImUser/ImUserForbiddenAV", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *imUserClient) ImUserOne(ctx context.Context, in *ImUserOneRequest, opts ...grpc.CallOption) (*ImUserOneReply, error) {
out := new(ImUserOneReply)
err := c.cc.Invoke(ctx, "/pb.ImUser/ImUserOne", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *imUserClient) ImUserList(ctx context.Context, in *ImUserListRequest, opts ...grpc.CallOption) (*ImUserListReply, error) {
out := new(ImUserListReply)
err := c.cc.Invoke(ctx, "/pb.ImUser/ImUserList", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ImUserServer is the server API for ImUser service.
type ImUserServer interface {
ImUserRegister(context.Context, *ImUserRequest) (*ImUserReply, error)
ImUserLogin(context.Context, *ImUserRequest) (*ImUserReply, error)
ImUserLoginOut(context.Context, *ImUserOutRequest) (*ImUserSetReply, error)
ImUserForbiddenWords(context.Context, *ImUserSetRequest) (*ImUserSetReply, error)
ImUserForbiddenAV(context.Context, *ImUserSetRequest) (*ImUserSetReply, error)
ImUserOne(context.Context, *ImUserOneRequest) (*ImUserOneReply, error)
ImUserList(context.Context, *ImUserListRequest) (*ImUserListReply, error)
}
// UnimplementedImUserServer can be embedded to have forward compatible implementations.
type UnimplementedImUserServer struct {
}
func (*UnimplementedImUserServer) ImUserRegister(context.Context, *ImUserRequest) (*ImUserReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ImUserRegister not implemented")
}
func (*UnimplementedImUserServer) ImUserLogin(context.Context, *ImUserRequest) (*ImUserReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ImUserLogin not implemented")
}
func (*UnimplementedImUserServer) ImUserLoginOut(context.Context, *ImUserOutRequest) (*ImUserSetReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ImUserLoginOut not implemented")
}
func (*UnimplementedImUserServer) ImUserForbiddenWords(context.Context, *ImUserSetRequest) (*ImUserSetReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ImUserForbiddenWords not implemented")
}
func (*UnimplementedImUserServer) ImUserForbiddenAV(context.Context, *ImUserSetRequest) (*ImUserSetReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ImUserForbiddenAV not implemented")
}
func (*UnimplementedImUserServer) ImUserOne(context.Context, *ImUserOneRequest) (*ImUserOneReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ImUserOne not implemented")
}
func (*UnimplementedImUserServer) ImUserList(context.Context, *ImUserListRequest) (*ImUserListReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ImUserList not implemented")
}
func RegisterImUserServer(s *grpc.Server, srv ImUserServer) {
s.RegisterService(&_ImUser_serviceDesc, srv)
}
func _ImUser_ImUserRegister_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ImUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ImUserServer).ImUserRegister(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.ImUser/ImUserRegister",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ImUserServer).ImUserRegister(ctx, req.(*ImUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ImUser_ImUserLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ImUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ImUserServer).ImUserLogin(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.ImUser/ImUserLogin",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ImUserServer).ImUserLogin(ctx, req.(*ImUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ImUser_ImUserLoginOut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ImUserOutRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ImUserServer).ImUserLoginOut(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.ImUser/ImUserLoginOut",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ImUserServer).ImUserLoginOut(ctx, req.(*ImUserOutRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ImUser_ImUserForbiddenWords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ImUserSetRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ImUserServer).ImUserForbiddenWords(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.ImUser/ImUserForbiddenWords",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ImUserServer).ImUserForbiddenWords(ctx, req.(*ImUserSetRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ImUser_ImUserForbiddenAV_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ImUserSetRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ImUserServer).ImUserForbiddenAV(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.ImUser/ImUserForbiddenAV",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ImUserServer).ImUserForbiddenAV(ctx, req.(*ImUserSetRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ImUser_ImUserOne_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ImUserOneRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ImUserServer).ImUserOne(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.ImUser/ImUserOne",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ImUserServer).ImUserOne(ctx, req.(*ImUserOneRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ImUser_ImUserList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ImUserListRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ImUserServer).ImUserList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.ImUser/ImUserList",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ImUserServer).ImUserList(ctx, req.(*ImUserListRequest))
}
return interceptor(ctx, in, info, handler)
}
var _ImUser_serviceDesc = grpc.ServiceDesc{
ServiceName: "pb.ImUser",
HandlerType: (*ImUserServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ImUserRegister",
Handler: _ImUser_ImUserRegister_Handler,
},
{
MethodName: "ImUserLogin",
Handler: _ImUser_ImUserLogin_Handler,
},
{
MethodName: "ImUserLoginOut",
Handler: _ImUser_ImUserLoginOut_Handler,
},
{
MethodName: "ImUserForbiddenWords",
Handler: _ImUser_ImUserForbiddenWords_Handler,
},
{
MethodName: "ImUserForbiddenAV",
Handler: _ImUser_ImUserForbiddenAV_Handler,
},
{
MethodName: "ImUserOne",
Handler: _ImUser_ImUserOne_Handler,
},
{
MethodName: "ImUserList",
Handler: _ImUser_ImUserList_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "u-proto/im_user.proto",
}
package im_user
import (
"context"
"errors"
"im-microservice/db"
"im-microservice/helper"
"im-microservice/pb"
)
type ImUserServer struct {
pb.UnimplementedImUserServer
}
type ImUser struct {
Name string `validate:"required"`
Mobile string `validate:"required,numeric,len=11"`
Code string `validate:"required"`
Platfrom string `validate:"required"`
}
type ImUserSet struct {
Appid string `validate:"required"`
Mute bool `validate:"required"`
}
type ImUserQ struct {
Appid string `validate:"required"`
}
//注册
func (u *ImUserServer) ImUserRegister(ctx context.Context, in *pb.ImUserRequest) (reply *pb.ImUserReply, err error) {
imUser := &ImUser{
Name: in.GetName(),
Mobile: in.GetMobile(),
Code: in.GetCode(),
}
// 参数验证是否合法
if err = helper.Valiator(imUser); err != nil {
return
}
// 从redis获取短信验证码
cache_code, err := helper.GetCode(imUser.Mobile)
if err != nil {
return
}
//对比验证码
if cache_code != imUser.Code {
err = errors.New("验证码不匹配")
return
}
reply = &pb.ImUserReply{}
// 是否已经注册过, 如果已经注册返回用户信息
if c_user, _ := GetImUserByMobile(imUser.Mobile); c_user.Appid != "" {
reply.Appid = c_user.Appid
return
}
// 企业用户注册失败
c_user, err := helper.CreateImUser(imUser.Name, imUser.Mobile)
if err != nil {
return
}
reply.Appid = c_user.Appid
return
}
//用户登录
func (u *ImUserServer) ImUserLogin(ctx context.Context, in *pb.ImUserRequest) (reply *pb.ImUserReply, err error) {
imUser := &ImUser{
Name: in.GetName(),
Mobile: in.GetMobile(),
Code: in.GetCode(),
Platfrom: in.GetPlatfrom(),
}
// 参数验证是否合法
if err = helper.Valiator(imUser); err != nil {
return
}
// 从redis获取短信验证码
cache_code, err := helper.GetCode(imUser.Mobile)
if err != nil {
return
}
//对比验证码
if cache_code != imUser.Code {
err = errors.New("验证码不匹配")
return
}
reply = &pb.ImUserReply{}
c_user, _ := GetImUserByMobile(imUser.Mobile)
if c_user.Appid == "" {
err = errors.New("用户不存在")
return
}
//更新用户登录时间
if res, _ := SaveUpdatetime(imUser.Mobile, imUser.Platfrom); res != 1 {
err = errors.New("用户登录时间更新失败")
return
}
reply.Appid = c_user.Appid
return
}
//用户退出
func (u *ImUserServer) ImUserLoginOut(ctx context.Context, in *pb.ImUserOutRequest) (reply *pb.ImUserSetReply, err error) {
imUserOut := &ImUserQ{
Appid: in.GetAppid(),
}
if res, _ := SaveLoginOut(imUserOut.Appid); res != 1 {
err = errors.New("用户更改登录状态信息失败")
return
}
reply = &pb.ImUserSetReply{}
return
}
//用户禁言
func (u *ImUserServer) ImUserForbiddenWords(ctx context.Context, in *pb.ImUserSetRequest) (reply *pb.ImUserSetReply, err error) {
imUserSet := &ImUserSet{
Appid: in.GetAppid(),
Mute: in.GetMute(),
}
if res, _ := SetImUserMute(imUserSet.Appid, "mute_estoppel", imUserSet.Mute); res != 1 {
err = errors.New("用户禁言失败")
return
}
reply = &pb.ImUserSetReply{}
return
}
//用户禁音视频
func (u *ImUserServer) ImUserForbiddenAV(ctx context.Context, in *pb.ImUserSetRequest) (reply *pb.ImUserSetReply, err error) {
imUserSet := &ImUserSet{
Appid: in.GetAppid(),
Mute: in.GetMute(),
}
if res, _ := SetImUserMute(imUserSet.Appid, "mute_audio_video", imUserSet.Mute); res != 1 {
err = errors.New("用户禁言失败")
return
}
reply = &pb.ImUserSetReply{}
return
}
//获取用户信息
func (u *ImUserServer) ImUserOne(ctx context.Context, in *pb.ImUserOneRequest) (reply *pb.ImUserOneReply, err error) {
imUserId := &ImUserQ{
Appid: in.GetAppid(),
}
// 参数验证是否合法
if err = helper.Valiator(imUserId); err != nil {
return
}
reply = &pb.ImUserOneReply{}
c_user, err := GetImUserByAppid(imUserId.Appid)
if err != nil {
return
}
reply = getImUser(c_user)
return
}
func getImUser(imuser db.ImUser) *pb.ImUserOneReply {
return &pb.ImUserOneReply{
Id: int64(imuser.Id),
Appid: imuser.Appid,
Name: imuser.Name,
Mobile: imuser.Mobile,
Disable: int64(imuser.Disable),
MuteEstoppel: int64(imuser.MuteEstoppel),
MuteAudioVideo: int64(imuser.MuteAudioVideo),
Ext: imuser.Ext,
Createtime: imuser.Createtime,
Updatetime: imuser.Updatetime,
LoginStatus: int64(imuser.LoginStatus),
Platfrom: imuser.Platfrom,
Edition: imuser.Edition,
}
}
//获取用户列表
func (u *ImUserServer) ImUserList(ctx context.Context, in *pb.ImUserListRequest) (reply *pb.ImUserListReply, err error) {
results, err := GetImUserList(in)
if err != nil {
return
}
reply = &pb.ImUserListReply{Paginate: &pb.Page{}}
im_user_list := results["list"].([]db.ImUser)
for _, v := range im_user_list {
reply.List = append(reply.List, getImUser(v))
}
reply.Paginate.PageSize = int64(results["page_size"].(int))
reply.Paginate.PagetNo = results["page"].(int64)
reply.Paginate.TotalCount = results["total_count"].(int64)
reply.Paginate.TotalPage = results["total_page"].(int64)
return
}
package im_user
import (
"crypto/md5"
"encoding/hex"
"errors"
"fmt"
"im-microservice/db"
"im-microservice/helper"
"im-microservice/pb"
"github.com/astaxie/beego/orm"
"github.com/segmentio/ksuid"
)
const (
u_table_name = "im_user"
)
func createAppid() string {
id := ksuid.New()
h := md5.New()
h.Write([]byte(id.String()))
return hex.EncodeToString(h.Sum(nil))
}
//通过手机号获取用户数据
func GetImUserByMobile(mobile string) (db.ImUser, error) {
var c_user db.ImUser
fmt.Println(db.MysqlClient)
err := db.MysqlClient.QueryTable(u_table_name).Filter("mobile", mobile).One(&c_user)
if err != nil {
return c_user, err
}
return c_user, nil
}
//im用户注册
func CreateImUser(name string, mobile string) (db.ImUser, error) {
appid := createAppid()
var c_user db.ImUser
c_user.Appid = appid
c_user.Name = name
c_user.Mobile = mobile
c_user.Createtime = helper.GetNowTime()
_, err := db.MysqlClient.Insert(&c_user)
if err != nil {
return c_user, err
}
return c_user, nil
}
//用户登录更新登录信息
func SaveUpdatetime(mobile string, platfrom string) (int64, error) {
updatetime := helper.GetNowTime()
orm_params := make(orm.Params)
orm_params["login_status"] = 1
orm_params["updatetime"] = updatetime
orm_params["platfrom"] = platfrom
res, err := db.MysqlClient.QueryTable(u_table_name).Filter("mobile", mobile).Update(orm_params)
if err != nil {
return 0, err
}
return res, nil
}
//用户退出
func SaveLoginOut(appid string) (int64, error) {
orm_params := make(orm.Params)
orm_params["login_status"] = 0
res, err := db.MysqlClient.QueryTable(u_table_name).Filter("appid", appid).Update(orm_params)
if err != nil {
return 0, err
}
return res, nil
}
//用户设置
func SetImUserMute(appid string, field string, mute bool) (int64, error) {
orm_params := make(orm.Params)
if mute == true {
orm_params[field] = 1
} else {
orm_params[field] = 0
}
res, err := db.MysqlClient.QueryTable(u_table_name).Filter("appid", appid).Update(orm_params)
if err != nil {
return 0, err
}
return res, nil
}
//获取用户信息
func GetImUserByAppid(appid string) (db.ImUser, error) {
var c_user db.ImUser
fmt.Println(db.MysqlClient)
err := db.MysqlClient.QueryTable(u_table_name).Filter("appid", appid).One(&c_user)
if err != nil {
return c_user, err
}
return c_user, nil
}
//获取用户列表
func GetImUserList(request *pb.ImUserListRequest) (results map[string]interface{}, err error) {
var (
mobile = request.GetMobile()
name = request.GetName()
disable = request.GetDisable()
mute_estoppel = request.GetMuteEstoppel()
mute_audio_video = request.GetMuteAudioVideo()
ext = request.GetExt()
login_status = request.GetLoginStatus()
platfrom = request.GetPlatfrom()
page = request.GetPage()
edition = request.GetEdition()
)
if page == 0 {
page = 1
}
count_db := db.MysqlClient.QueryTable(u_table_name)
if name != "" {
count_db = count_db.Filter("name__icontains", name)
}
if mobile != "" {
count_db = count_db.Filter("mobile", mobile)
}
if disable != 0 {
count_db = count_db.Filter("disable", disable)
}
if mute_estoppel != 0 {
count_db = count_db.Filter("mute_estoppel", mute_estoppel)
}
if mute_audio_video != 0 {
count_db = count_db.Filter("mute_audio_video", mute_audio_video)
}
if ext != "" {
count_db = count_db.Filter("ext__icontains", ext)
}
if login_status != 0 {
count_db = count_db.Filter("login_status", login_status)
}
if platfrom != "" {
count_db = count_db.Filter("platfrom", platfrom)
}
if edition != "" {
count_db = count_db.Filter("edition", edition)
}
ctn, err := count_db.Count()
if err != nil {
return
}
if ctn == 0 {
err = errors.New("没有查询到任何数据")
return
}
//获取
offset, total_page := helper.Paginate(ctn, 20, page)
// 查询数据
var im_user []db.ImUser
if _, err = count_db.Limit(20, offset).All(&im_user); err != nil {
return
}
results = make(map[string]interface{})
results["list"] = im_user
results["total_page"] = total_page
results["total_count"] = ctn
results["page"] = page
results["page_size"] = 20
return
}
syntax = "proto3";
package pb;
import "u-proto/common.proto";
//注册登录
message ImUserRequest {
Common Common = 1;
string Name = 2;
string Mobile = 3;
string Code = 4;
string Platfrom = 5;
}
message ImUserReply{
string Appid = 2;
}
//用户退出
message ImUserOutRequest {
Common Common = 1;
string Appid = 2;
}
//用户设置禁言,禁音视频
message ImUserSetRequest {
Common Common = 1;
bool Mute = 2;
string Appid = 3;
}
message ImUserSetReply {}
//获取单个用户信息
message ImUserOneRequest {
Common Common = 1;
string Appid = 2;
}
message ImUserOneReply {
int64 Id = 1;
string Appid = 2;
string Name = 3;
string Mobile = 4;
int64 Disable = 5;
int64 MuteEstoppel = 6;
int64 MuteAudioVideo = 7;
string Ext = 8;
string Createtime = 9;
string Updatetime = 10;
int64 LoginStatus = 11;
string Platfrom = 12;
string Edition = 13;
}
//获取用户列表
message ImUserListRequest {
Common Common = 1;
int64 Page = 2;
string Mobile = 3;
string Name = 4;
int64 Disable = 5;
int64 MuteEstoppel = 6;
int64 MuteAudioVideo = 7;
string Ext = 8;
string Createtime = 9;
string Updatetime = 10;
int64 LoginStatus = 11;
string Platfrom = 12;
string Edition = 13;
}
message ImUserListReply{
repeated ImUserOneReply List = 1;
Page Paginate = 2;
}
service ImUser {
rpc ImUserRegister (ImUserRequest) returns(ImUserReply) {}
rpc ImUserLogin (ImUserRequest) returns(ImUserReply) {}
rpc ImUserLoginOut (ImUserOutRequest) returns(ImUserSetReply) {}
rpc ImUserForbiddenWords (ImUserSetRequest) returns(ImUserSetReply) {}
rpc ImUserForbiddenAV (ImUserSetRequest) returns(ImUserSetReply) {}
rpc ImUserOne (ImUserOneRequest) returns(ImUserOneReply) {}
rpc ImUserList(ImUserListRequest) returns(ImUserListReply){}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment