Commit fb9b837d by Li Feifei

develop

parent 21ffb012
...@@ -57,7 +57,7 @@ func newMysqlClient() { ...@@ -57,7 +57,7 @@ func newMysqlClient() {
} }
orm.RegisterModel(new(CompanyApp), new(ImBase), new(ImChatRoom), new(ImUserRelationship), new(ImUser)) orm.RegisterModel(new(CompanyApp), new(ImBase), new(ImChatRoom), new(ImUserRelationship), new(ImUser))
orm.Debug = true
MysqlClient = orm.NewOrm() MysqlClient = orm.NewOrm()
log.Println("MySQL connect success") log.Println("MySQL connect success")
} }
...@@ -8,10 +8,11 @@ require ( ...@@ -8,10 +8,11 @@ require (
github.com/go-redis/redis/v8 v8.0.0-beta.5 github.com/go-redis/redis/v8 v8.0.0-beta.5
github.com/go-sql-driver/mysql v1.5.0 github.com/go-sql-driver/mysql v1.5.0
github.com/golang/protobuf v1.4.1 github.com/golang/protobuf v1.4.1
github.com/grpc-ecosystem/grpc-health-probe v0.3.2 // indirect
github.com/leodido/go-urn v1.2.0 // indirect github.com/leodido/go-urn v1.2.0 // indirect
github.com/rs/xid v1.2.1 github.com/rs/xid v1.2.1
github.com/segmentio/ksuid v1.0.2 github.com/segmentio/ksuid v1.0.2
golang.org/x/net v0.0.0-20190923162816-aa69164e4478 golang.org/x/net v0.0.0-20191021144547-ec77196f6094
google.golang.org/grpc v1.30.0 google.golang.org/grpc v1.30.0
google.golang.org/protobuf v1.24.0 google.golang.org/protobuf v1.24.0
gopkg.in/go-playground/validator.v9 v9.31.0 gopkg.in/go-playground/validator.v9 v9.31.0
......
...@@ -64,7 +64,10 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw ...@@ -64,7 +64,10 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/grpc-ecosystem/grpc-health-probe v0.3.2 h1:daShAySXI1DnGc8U9B1E4Qm6o7qzmFR4aRIJ4vY/TUo=
github.com/grpc-ecosystem/grpc-health-probe v0.3.2/go.mod h1:izVOQ4RWbjUR6lm4nn+VLJyQ+FyaiGmprEYgI04Gs7U=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
...@@ -112,6 +115,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn ...@@ -112,6 +115,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191021144547-ec77196f6094 h1:5O4U9trLjNpuhpynaDsqwCk+Tw6seqJz1EbqbnzHrc8=
golang.org/x/net v0.0.0-20191021144547-ec77196f6094/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
...@@ -121,6 +126,7 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h ...@@ -121,6 +126,7 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191020212454-3e7259c5e7c2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
...@@ -143,6 +149,7 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaR ...@@ -143,6 +149,7 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaR
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
......
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"encoding/hex" "encoding/hex"
"errors" "errors"
"fmt" "fmt"
"im-microservice/sevice/im_user"
"log" "log"
"net" "net"
"regexp" "regexp"
...@@ -15,12 +15,15 @@ import ( ...@@ -15,12 +15,15 @@ import (
"im-microservice/helper" "im-microservice/helper"
"im-microservice/pb" "im-microservice/pb"
"im-microservice/sevice/im_chat_room" "im-microservice/sevice/im_chat_room"
"im-microservice/sevice/im_user"
iur "im-microservice/sevice/im_user_relationship"
ic "im-microservice/sevice/im_configure" ic "im-microservice/sevice/im_configure"
"golang.org/x/net/context" "golang.org/x/net/context"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata" "google.golang.org/grpc/metadata"
) )
const ( const (
...@@ -103,13 +106,14 @@ func main() { ...@@ -103,13 +106,14 @@ func main() {
log.Fatalf("failed to listen: %v", err) log.Fatalf("failed to listen: %v", err)
} }
//var opts []grpc.ServerOption var opts []grpc.ServerOption
//opts = append(opts, grpc.UnaryInterceptor(auth)) opts = append(opts, grpc.UnaryInterceptor(auth))
//s := grpc.NewServer(opts...) s := grpc.NewServer(opts...)
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{}) pb.RegisterImUserServer(s, &im_user.ImUserServer{})
pb.RegisterUserRelationshipServiceServer(s, &iur.UserRelationshipService{})
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.
// versions:
// protoc-gen-go v1.24.0
// protoc v3.12.3
// source: u-proto/im_user_relationship.proto
package pb
import (
context "context"
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"
reflect "reflect"
sync "sync"
)
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 UserRelationshipAddRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *Common `protobuf:"bytes,1,opt,name=Common,proto3" json:"Common,omitempty"`
Accid string `protobuf:"bytes,2,opt,name=Accid,proto3" json:"Accid,omitempty"`
Faccid string `protobuf:"bytes,3,opt,name=Faccid,proto3" json:"Faccid,omitempty"`
Type int64 `protobuf:"varint,4,opt,name=Type,proto3" json:"Type,omitempty"`
Msg string `protobuf:"bytes,5,opt,name=Msg,proto3" json:"Msg,omitempty"`
}
func (x *UserRelationshipAddRequest) Reset() {
*x = UserRelationshipAddRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_relationship_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserRelationshipAddRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserRelationshipAddRequest) ProtoMessage() {}
func (x *UserRelationshipAddRequest) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_relationship_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 UserRelationshipAddRequest.ProtoReflect.Descriptor instead.
func (*UserRelationshipAddRequest) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_relationship_proto_rawDescGZIP(), []int{0}
}
func (x *UserRelationshipAddRequest) GetCommon() *Common {
if x != nil {
return x.Common
}
return nil
}
func (x *UserRelationshipAddRequest) GetAccid() string {
if x != nil {
return x.Accid
}
return ""
}
func (x *UserRelationshipAddRequest) GetFaccid() string {
if x != nil {
return x.Faccid
}
return ""
}
func (x *UserRelationshipAddRequest) GetType() int64 {
if x != nil {
return x.Type
}
return 0
}
func (x *UserRelationshipAddRequest) GetMsg() string {
if x != nil {
return x.Msg
}
return ""
}
type UserRelationshipAddReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *UserRelationshipAddReply) Reset() {
*x = UserRelationshipAddReply{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_relationship_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserRelationshipAddReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserRelationshipAddReply) ProtoMessage() {}
func (x *UserRelationshipAddReply) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_relationship_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 UserRelationshipAddReply.ProtoReflect.Descriptor instead.
func (*UserRelationshipAddReply) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_relationship_proto_rawDescGZIP(), []int{1}
}
//删除好友
type UserRelationshipDelRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *Common `protobuf:"bytes,1,opt,name=Common,proto3" json:"Common,omitempty"`
Accid string `protobuf:"bytes,2,opt,name=Accid,proto3" json:"Accid,omitempty"`
Faccid string `protobuf:"bytes,3,opt,name=Faccid,proto3" json:"Faccid,omitempty"`
}
func (x *UserRelationshipDelRequest) Reset() {
*x = UserRelationshipDelRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_relationship_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserRelationshipDelRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserRelationshipDelRequest) ProtoMessage() {}
func (x *UserRelationshipDelRequest) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_relationship_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 UserRelationshipDelRequest.ProtoReflect.Descriptor instead.
func (*UserRelationshipDelRequest) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_relationship_proto_rawDescGZIP(), []int{2}
}
func (x *UserRelationshipDelRequest) GetCommon() *Common {
if x != nil {
return x.Common
}
return nil
}
func (x *UserRelationshipDelRequest) GetAccid() string {
if x != nil {
return x.Accid
}
return ""
}
func (x *UserRelationshipDelRequest) GetFaccid() string {
if x != nil {
return x.Faccid
}
return ""
}
// 获取好友关系
type UserRelationshipListRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *Common `protobuf:"bytes,1,opt,name=Common,proto3" json:"Common,omitempty"`
Accid string `protobuf:"bytes,2,opt,name=Accid,proto3" json:"Accid,omitempty"`
Updatetime string `protobuf:"bytes,3,opt,name=Updatetime,proto3" json:"Updatetime,omitempty"`
}
func (x *UserRelationshipListRequest) Reset() {
*x = UserRelationshipListRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_relationship_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserRelationshipListRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserRelationshipListRequest) ProtoMessage() {}
func (x *UserRelationshipListRequest) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_relationship_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 UserRelationshipListRequest.ProtoReflect.Descriptor instead.
func (*UserRelationshipListRequest) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_relationship_proto_rawDescGZIP(), []int{3}
}
func (x *UserRelationshipListRequest) GetCommon() *Common {
if x != nil {
return x.Common
}
return nil
}
func (x *UserRelationshipListRequest) GetAccid() string {
if x != nil {
return x.Accid
}
return ""
}
func (x *UserRelationshipListRequest) GetUpdatetime() string {
if x != nil {
return x.Updatetime
}
return ""
}
type UserRelationshipInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Faccid string `protobuf:"bytes,1,opt,name=Faccid,proto3" json:"Faccid,omitempty"`
Updatetime string `protobuf:"bytes,2,opt,name=Updatetime,proto3" json:"Updatetime,omitempty"`
}
func (x *UserRelationshipInfo) Reset() {
*x = UserRelationshipInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_relationship_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserRelationshipInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserRelationshipInfo) ProtoMessage() {}
func (x *UserRelationshipInfo) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_relationship_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 UserRelationshipInfo.ProtoReflect.Descriptor instead.
func (*UserRelationshipInfo) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_relationship_proto_rawDescGZIP(), []int{4}
}
func (x *UserRelationshipInfo) GetFaccid() string {
if x != nil {
return x.Faccid
}
return ""
}
func (x *UserRelationshipInfo) GetUpdatetime() string {
if x != nil {
return x.Updatetime
}
return ""
}
type UserRelationshipListReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
List []*UserRelationshipInfo `protobuf:"bytes,1,rep,name=List,proto3" json:"List,omitempty"`
}
func (x *UserRelationshipListReply) Reset() {
*x = UserRelationshipListReply{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_relationship_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserRelationshipListReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserRelationshipListReply) ProtoMessage() {}
func (x *UserRelationshipListReply) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_relationship_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 UserRelationshipListReply.ProtoReflect.Descriptor instead.
func (*UserRelationshipListReply) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_relationship_proto_rawDescGZIP(), []int{5}
}
func (x *UserRelationshipListReply) GetList() []*UserRelationshipInfo {
if x != nil {
return x.List
}
return nil
}
//设置黑名单/静音
type SetSpecialRelationReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *Common `protobuf:"bytes,1,opt,name=Common,proto3" json:"Common,omitempty"`
Accid string `protobuf:"bytes,2,opt,name=Accid,proto3" json:"Accid,omitempty"`
TargetAcc string `protobuf:"bytes,3,opt,name=TargetAcc,proto3" json:"TargetAcc,omitempty"`
RelationType int64 `protobuf:"varint,4,opt,name=RelationType,proto3" json:"RelationType,omitempty"`
Value int64 `protobuf:"varint,5,opt,name=Value,proto3" json:"Value,omitempty"`
}
func (x *SetSpecialRelationReq) Reset() {
*x = SetSpecialRelationReq{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_relationship_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SetSpecialRelationReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SetSpecialRelationReq) ProtoMessage() {}
func (x *SetSpecialRelationReq) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_relationship_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 SetSpecialRelationReq.ProtoReflect.Descriptor instead.
func (*SetSpecialRelationReq) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_relationship_proto_rawDescGZIP(), []int{6}
}
func (x *SetSpecialRelationReq) GetCommon() *Common {
if x != nil {
return x.Common
}
return nil
}
func (x *SetSpecialRelationReq) GetAccid() string {
if x != nil {
return x.Accid
}
return ""
}
func (x *SetSpecialRelationReq) GetTargetAcc() string {
if x != nil {
return x.TargetAcc
}
return ""
}
func (x *SetSpecialRelationReq) GetRelationType() int64 {
if x != nil {
return x.RelationType
}
return 0
}
func (x *SetSpecialRelationReq) GetValue() int64 {
if x != nil {
return x.Value
}
return 0
}
type ListBlackAndMuteListReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *Common `protobuf:"bytes,1,opt,name=Common,proto3" json:"Common,omitempty"`
Accid string `protobuf:"bytes,2,opt,name=Accid,proto3" json:"Accid,omitempty"`
}
func (x *ListBlackAndMuteListReq) Reset() {
*x = ListBlackAndMuteListReq{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_relationship_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListBlackAndMuteListReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListBlackAndMuteListReq) ProtoMessage() {}
func (x *ListBlackAndMuteListReq) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_relationship_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 ListBlackAndMuteListReq.ProtoReflect.Descriptor instead.
func (*ListBlackAndMuteListReq) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_relationship_proto_rawDescGZIP(), []int{7}
}
func (x *ListBlackAndMuteListReq) GetCommon() *Common {
if x != nil {
return x.Common
}
return nil
}
func (x *ListBlackAndMuteListReq) GetAccid() string {
if x != nil {
return x.Accid
}
return ""
}
type ListBlackAndMuteListReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Mutelist []*UserRelationshipInfo `protobuf:"bytes,1,rep,name=Mutelist,proto3" json:"Mutelist,omitempty"`
Blacklist []*UserRelationshipInfo `protobuf:"bytes,2,rep,name=Blacklist,proto3" json:"Blacklist,omitempty"`
}
func (x *ListBlackAndMuteListReply) Reset() {
*x = ListBlackAndMuteListReply{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_user_relationship_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListBlackAndMuteListReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListBlackAndMuteListReply) ProtoMessage() {}
func (x *ListBlackAndMuteListReply) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_user_relationship_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 ListBlackAndMuteListReply.ProtoReflect.Descriptor instead.
func (*ListBlackAndMuteListReply) Descriptor() ([]byte, []int) {
return file_u_proto_im_user_relationship_proto_rawDescGZIP(), []int{8}
}
func (x *ListBlackAndMuteListReply) GetMutelist() []*UserRelationshipInfo {
if x != nil {
return x.Mutelist
}
return nil
}
func (x *ListBlackAndMuteListReply) GetBlacklist() []*UserRelationshipInfo {
if x != nil {
return x.Blacklist
}
return nil
}
var File_u_proto_im_user_relationship_proto protoreflect.FileDescriptor
var file_u_proto_im_user_relationship_proto_rawDesc = []byte{
0x0a, 0x22, 0x75, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6d, 0x5f, 0x75, 0x73, 0x65,
0x72, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 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, 0x94,
0x01, 0x0a, 0x1a, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x68, 0x69, 0x70, 0x41, 0x64, 0x64, 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, 0x63, 0x63, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x05, 0x41, 0x63, 0x63, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x46, 0x61, 0x63, 0x63, 0x69,
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x46, 0x61, 0x63, 0x63, 0x69, 0x64, 0x12,
0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x54,
0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x4d, 0x73, 0x67, 0x22, 0x1a, 0x0a, 0x18, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x41, 0x64, 0x64, 0x52, 0x65, 0x70, 0x6c,
0x79, 0x22, 0x6e, 0x0a, 0x1a, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x68, 0x69, 0x70, 0x44, 0x65, 0x6c, 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, 0x63, 0x63, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x41, 0x63, 0x63, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x46, 0x61, 0x63,
0x63, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x46, 0x61, 0x63, 0x63, 0x69,
0x64, 0x22, 0x77, 0x0a, 0x1b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x68, 0x69, 0x70, 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, 0x14, 0x0a, 0x05, 0x41, 0x63, 0x63, 0x69, 0x64, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x05, 0x41, 0x63, 0x63, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x4e, 0x0a, 0x14, 0x55, 0x73,
0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x49, 0x6e,
0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x46, 0x61, 0x63, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x46, 0x61, 0x63, 0x63, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x49, 0x0a, 0x19, 0x55, 0x73,
0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x4c, 0x69,
0x73, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x2c, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52,
0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x04, 0x4c, 0x69, 0x73, 0x74, 0x22, 0xa9, 0x01, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x53, 0x70, 0x65,
0x63, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 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, 0x63, 0x63, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x41, 0x63, 0x63, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x61, 0x72,
0x67, 0x65, 0x74, 0x41, 0x63, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x54, 0x61,
0x72, 0x67, 0x65, 0x74, 0x41, 0x63, 0x63, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x52,
0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x56,
0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x56, 0x61, 0x6c, 0x75,
0x65, 0x22, 0x53, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x41, 0x6e,
0x64, 0x4d, 0x75, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 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, 0x63, 0x63, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x05, 0x41, 0x63, 0x63, 0x69, 0x64, 0x22, 0x89, 0x01, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x42,
0x6c, 0x61, 0x63, 0x6b, 0x41, 0x6e, 0x64, 0x4d, 0x75, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52,
0x65, 0x70, 0x6c, 0x79, 0x12, 0x34, 0x0a, 0x08, 0x4d, 0x75, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74,
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72,
0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x08, 0x4d, 0x75, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x09, 0x42, 0x6c,
0x61, 0x63, 0x6b, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e,
0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x68, 0x69, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x6c, 0x69,
0x73, 0x74, 0x32, 0x9a, 0x03, 0x0a, 0x17, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x45,
0x0a, 0x03, 0x41, 0x64, 0x64, 0x12, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52,
0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x41, 0x64, 0x64, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52,
0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x41, 0x64, 0x64, 0x52, 0x65,
0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12,
0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x68, 0x69, 0x70, 0x44, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x68, 0x69, 0x70, 0x41, 0x64, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12,
0x47, 0x0a, 0x03, 0x41, 0x6c, 0x6c, 0x12, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72,
0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x4c, 0x69, 0x73, 0x74,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65,
0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x4c, 0x69, 0x73,
0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x12, 0x53, 0x65, 0x74, 0x53,
0x70, 0x65, 0x63, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19,
0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x74, 0x53, 0x70, 0x65, 0x63, 0x69, 0x61, 0x6c, 0x52, 0x65,
0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x55,
0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x68, 0x69, 0x70, 0x41,
0x64, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x54, 0x0a, 0x14, 0x4c, 0x69, 0x73,
0x74, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x41, 0x6e, 0x64, 0x4d, 0x75, 0x74, 0x65, 0x4c, 0x69, 0x73,
0x74, 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x6c, 0x61, 0x63, 0x6b,
0x41, 0x6e, 0x64, 0x4d, 0x75, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x1d,
0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x6c, 0x61, 0x63, 0x6b, 0x41, 0x6e, 0x64,
0x4d, 0x75, 0x74, 0x65, 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_relationship_proto_rawDescOnce sync.Once
file_u_proto_im_user_relationship_proto_rawDescData = file_u_proto_im_user_relationship_proto_rawDesc
)
func file_u_proto_im_user_relationship_proto_rawDescGZIP() []byte {
file_u_proto_im_user_relationship_proto_rawDescOnce.Do(func() {
file_u_proto_im_user_relationship_proto_rawDescData = protoimpl.X.CompressGZIP(file_u_proto_im_user_relationship_proto_rawDescData)
})
return file_u_proto_im_user_relationship_proto_rawDescData
}
var file_u_proto_im_user_relationship_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_u_proto_im_user_relationship_proto_goTypes = []interface{}{
(*UserRelationshipAddRequest)(nil), // 0: pb.UserRelationshipAddRequest
(*UserRelationshipAddReply)(nil), // 1: pb.UserRelationshipAddReply
(*UserRelationshipDelRequest)(nil), // 2: pb.UserRelationshipDelRequest
(*UserRelationshipListRequest)(nil), // 3: pb.UserRelationshipListRequest
(*UserRelationshipInfo)(nil), // 4: pb.UserRelationshipInfo
(*UserRelationshipListReply)(nil), // 5: pb.UserRelationshipListReply
(*SetSpecialRelationReq)(nil), // 6: pb.SetSpecialRelationReq
(*ListBlackAndMuteListReq)(nil), // 7: pb.ListBlackAndMuteListReq
(*ListBlackAndMuteListReply)(nil), // 8: pb.ListBlackAndMuteListReply
(*Common)(nil), // 9: pb.Common
}
var file_u_proto_im_user_relationship_proto_depIdxs = []int32{
9, // 0: pb.UserRelationshipAddRequest.Common:type_name -> pb.Common
9, // 1: pb.UserRelationshipDelRequest.Common:type_name -> pb.Common
9, // 2: pb.UserRelationshipListRequest.Common:type_name -> pb.Common
4, // 3: pb.UserRelationshipListReply.List:type_name -> pb.UserRelationshipInfo
9, // 4: pb.SetSpecialRelationReq.Common:type_name -> pb.Common
9, // 5: pb.ListBlackAndMuteListReq.Common:type_name -> pb.Common
4, // 6: pb.ListBlackAndMuteListReply.Mutelist:type_name -> pb.UserRelationshipInfo
4, // 7: pb.ListBlackAndMuteListReply.Blacklist:type_name -> pb.UserRelationshipInfo
0, // 8: pb.UserRelationshipService.Add:input_type -> pb.UserRelationshipAddRequest
2, // 9: pb.UserRelationshipService.Delete:input_type -> pb.UserRelationshipDelRequest
3, // 10: pb.UserRelationshipService.All:input_type -> pb.UserRelationshipListRequest
6, // 11: pb.UserRelationshipService.SetSpecialRelation:input_type -> pb.SetSpecialRelationReq
7, // 12: pb.UserRelationshipService.ListBlackAndMuteList:input_type -> pb.ListBlackAndMuteListReq
1, // 13: pb.UserRelationshipService.Add:output_type -> pb.UserRelationshipAddReply
1, // 14: pb.UserRelationshipService.Delete:output_type -> pb.UserRelationshipAddReply
5, // 15: pb.UserRelationshipService.All:output_type -> pb.UserRelationshipListReply
1, // 16: pb.UserRelationshipService.SetSpecialRelation:output_type -> pb.UserRelationshipAddReply
8, // 17: pb.UserRelationshipService.ListBlackAndMuteList:output_type -> pb.ListBlackAndMuteListReply
13, // [13:18] is the sub-list for method output_type
8, // [8:13] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
}
func init() { file_u_proto_im_user_relationship_proto_init() }
func file_u_proto_im_user_relationship_proto_init() {
if File_u_proto_im_user_relationship_proto != nil {
return
}
file_u_proto_common_proto_init()
if !protoimpl.UnsafeEnabled {
file_u_proto_im_user_relationship_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserRelationshipAddRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_relationship_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserRelationshipAddReply); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_relationship_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserRelationshipDelRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_relationship_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserRelationshipListRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_relationship_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserRelationshipInfo); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_relationship_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserRelationshipListReply); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_relationship_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SetSpecialRelationReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_relationship_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListBlackAndMuteListReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_user_relationship_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListBlackAndMuteListReply); 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_relationship_proto_rawDesc,
NumEnums: 0,
NumMessages: 9,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_u_proto_im_user_relationship_proto_goTypes,
DependencyIndexes: file_u_proto_im_user_relationship_proto_depIdxs,
MessageInfos: file_u_proto_im_user_relationship_proto_msgTypes,
}.Build()
File_u_proto_im_user_relationship_proto = out.File
file_u_proto_im_user_relationship_proto_rawDesc = nil
file_u_proto_im_user_relationship_proto_goTypes = nil
file_u_proto_im_user_relationship_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
// UserRelationshipServiceClient is the client API for UserRelationshipService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type UserRelationshipServiceClient interface {
Add(ctx context.Context, in *UserRelationshipAddRequest, opts ...grpc.CallOption) (*UserRelationshipAddReply, error)
Delete(ctx context.Context, in *UserRelationshipDelRequest, opts ...grpc.CallOption) (*UserRelationshipAddReply, error)
All(ctx context.Context, in *UserRelationshipListRequest, opts ...grpc.CallOption) (*UserRelationshipListReply, error)
SetSpecialRelation(ctx context.Context, in *SetSpecialRelationReq, opts ...grpc.CallOption) (*UserRelationshipAddReply, error)
ListBlackAndMuteList(ctx context.Context, in *ListBlackAndMuteListReq, opts ...grpc.CallOption) (*ListBlackAndMuteListReply, error)
}
type userRelationshipServiceClient struct {
cc grpc.ClientConnInterface
}
func NewUserRelationshipServiceClient(cc grpc.ClientConnInterface) UserRelationshipServiceClient {
return &userRelationshipServiceClient{cc}
}
func (c *userRelationshipServiceClient) Add(ctx context.Context, in *UserRelationshipAddRequest, opts ...grpc.CallOption) (*UserRelationshipAddReply, error) {
out := new(UserRelationshipAddReply)
err := c.cc.Invoke(ctx, "/pb.UserRelationshipService/Add", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userRelationshipServiceClient) Delete(ctx context.Context, in *UserRelationshipDelRequest, opts ...grpc.CallOption) (*UserRelationshipAddReply, error) {
out := new(UserRelationshipAddReply)
err := c.cc.Invoke(ctx, "/pb.UserRelationshipService/Delete", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userRelationshipServiceClient) All(ctx context.Context, in *UserRelationshipListRequest, opts ...grpc.CallOption) (*UserRelationshipListReply, error) {
out := new(UserRelationshipListReply)
err := c.cc.Invoke(ctx, "/pb.UserRelationshipService/All", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userRelationshipServiceClient) SetSpecialRelation(ctx context.Context, in *SetSpecialRelationReq, opts ...grpc.CallOption) (*UserRelationshipAddReply, error) {
out := new(UserRelationshipAddReply)
err := c.cc.Invoke(ctx, "/pb.UserRelationshipService/SetSpecialRelation", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userRelationshipServiceClient) ListBlackAndMuteList(ctx context.Context, in *ListBlackAndMuteListReq, opts ...grpc.CallOption) (*ListBlackAndMuteListReply, error) {
out := new(ListBlackAndMuteListReply)
err := c.cc.Invoke(ctx, "/pb.UserRelationshipService/ListBlackAndMuteList", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// UserRelationshipServiceServer is the server API for UserRelationshipService service.
type UserRelationshipServiceServer interface {
Add(context.Context, *UserRelationshipAddRequest) (*UserRelationshipAddReply, error)
Delete(context.Context, *UserRelationshipDelRequest) (*UserRelationshipAddReply, error)
All(context.Context, *UserRelationshipListRequest) (*UserRelationshipListReply, error)
SetSpecialRelation(context.Context, *SetSpecialRelationReq) (*UserRelationshipAddReply, error)
ListBlackAndMuteList(context.Context, *ListBlackAndMuteListReq) (*ListBlackAndMuteListReply, error)
}
// UnimplementedUserRelationshipServiceServer can be embedded to have forward compatible implementations.
type UnimplementedUserRelationshipServiceServer struct {
}
func (*UnimplementedUserRelationshipServiceServer) Add(context.Context, *UserRelationshipAddRequest) (*UserRelationshipAddReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Add not implemented")
}
func (*UnimplementedUserRelationshipServiceServer) Delete(context.Context, *UserRelationshipDelRequest) (*UserRelationshipAddReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func (*UnimplementedUserRelationshipServiceServer) All(context.Context, *UserRelationshipListRequest) (*UserRelationshipListReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method All not implemented")
}
func (*UnimplementedUserRelationshipServiceServer) SetSpecialRelation(context.Context, *SetSpecialRelationReq) (*UserRelationshipAddReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetSpecialRelation not implemented")
}
func (*UnimplementedUserRelationshipServiceServer) ListBlackAndMuteList(context.Context, *ListBlackAndMuteListReq) (*ListBlackAndMuteListReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListBlackAndMuteList not implemented")
}
func RegisterUserRelationshipServiceServer(s *grpc.Server, srv UserRelationshipServiceServer) {
s.RegisterService(&_UserRelationshipService_serviceDesc, srv)
}
func _UserRelationshipService_Add_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserRelationshipAddRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserRelationshipServiceServer).Add(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.UserRelationshipService/Add",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserRelationshipServiceServer).Add(ctx, req.(*UserRelationshipAddRequest))
}
return interceptor(ctx, in, info, handler)
}
func _UserRelationshipService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserRelationshipDelRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserRelationshipServiceServer).Delete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.UserRelationshipService/Delete",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserRelationshipServiceServer).Delete(ctx, req.(*UserRelationshipDelRequest))
}
return interceptor(ctx, in, info, handler)
}
func _UserRelationshipService_All_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserRelationshipListRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserRelationshipServiceServer).All(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.UserRelationshipService/All",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserRelationshipServiceServer).All(ctx, req.(*UserRelationshipListRequest))
}
return interceptor(ctx, in, info, handler)
}
func _UserRelationshipService_SetSpecialRelation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetSpecialRelationReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserRelationshipServiceServer).SetSpecialRelation(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.UserRelationshipService/SetSpecialRelation",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserRelationshipServiceServer).SetSpecialRelation(ctx, req.(*SetSpecialRelationReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserRelationshipService_ListBlackAndMuteList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListBlackAndMuteListReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserRelationshipServiceServer).ListBlackAndMuteList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.UserRelationshipService/ListBlackAndMuteList",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserRelationshipServiceServer).ListBlackAndMuteList(ctx, req.(*ListBlackAndMuteListReq))
}
return interceptor(ctx, in, info, handler)
}
var _UserRelationshipService_serviceDesc = grpc.ServiceDesc{
ServiceName: "pb.UserRelationshipService",
HandlerType: (*UserRelationshipServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Add",
Handler: _UserRelationshipService_Add_Handler,
},
{
MethodName: "Delete",
Handler: _UserRelationshipService_Delete_Handler,
},
{
MethodName: "All",
Handler: _UserRelationshipService_All_Handler,
},
{
MethodName: "SetSpecialRelation",
Handler: _UserRelationshipService_SetSpecialRelation_Handler,
},
{
MethodName: "ListBlackAndMuteList",
Handler: _UserRelationshipService_ListBlackAndMuteList_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "u-proto/im_user_relationship.proto",
}
...@@ -2,9 +2,9 @@ package im_chat_room ...@@ -2,9 +2,9 @@ package im_chat_room
import ( import (
"errors" "errors"
"im-microservice/helper"
"im-microservice/db" "im-microservice/db"
"im-microservice/helper"
"im-microservice/pb" "im-microservice/pb"
"im-microservice/validator_struct" "im-microservice/validator_struct"
...@@ -12,29 +12,29 @@ import ( ...@@ -12,29 +12,29 @@ import (
) )
const ( const (
chat_table_name = "im_chat_room" chat_table_name = "im_chat_room"
chat_room_id = "id" chat_room_id = "id"
chat_creator = "creator" chat_creator = "creator"
chat_room = "name" chat_room = "name"
chat_announcement = "announcement" chat_announcement = "announcement"
chat_status = "status" chat_status = "status"
chat_create_time = "createtime" chat_create_time = "createtime"
) )
func AddChatRoom (addStruct *validator_struct.ChatRoomAddStruct) (int64, error) { func AddChatRoom(addStruct *validator_struct.ChatRoomAddStruct) (int64, error) {
var chat db.ImChatRoom var chat db.ImChatRoom
now := helper.GetNowTime() now := helper.GetNowTime()
chat.Name = addStruct.Name chat.Name = addStruct.Name
chat.Announcement = addStruct.Announcement chat.Announcement = addStruct.Announcement
chat.Creator = addStruct.Creator chat.Creator = addStruct.Creator
chat.Status = 1; chat.Status = 1
chat.Createtime = now chat.Createtime = now
chat.Updatetime = now chat.Updatetime = now
room_id, err := db.MysqlClient.Insert(&chat) room_id, err := db.MysqlClient.Insert(&chat)
return room_id, err return room_id, err
} }
func UpdateChatRoom( update *validator_struct.ChatRoomUpdate) error { func UpdateChatRoom(update *validator_struct.ChatRoomUpdate) error {
orm_params := make(orm.Params) orm_params := make(orm.Params)
if update.Status != 0 { if update.Status != 0 {
orm_params[chat_status] = update.Status orm_params[chat_status] = update.Status
...@@ -47,16 +47,18 @@ func UpdateChatRoom( update *validator_struct.ChatRoomUpdate) error { ...@@ -47,16 +47,18 @@ func UpdateChatRoom( update *validator_struct.ChatRoomUpdate) error {
} }
if len(orm_params) == 0 { if len(orm_params) == 0 {
return errors.New("修改房间的参数为空") return errors.New("修改房间的参数为空")
} }
orm_params["updatetime"] = helper.GetNowTime() orm_params["updatetime"] = helper.GetNowTime()
_, err := db.MysqlClient.QueryTable(chat_table_name).Filter(chat_room_id, update.RoomId).Update(orm_params) _, err := db.MysqlClient.QueryTable(chat_table_name).
Filter(chat_room_id, update.RoomId).Update(orm_params)
return err return err
} }
func DeleteChatRoom(room_id int64) error { func DeleteChatRoom(room_id int64) error {
_, err := db.MysqlClient.QueryTable(chat_table_name).Filter(chat_room_id, room_id).Delete() _, err := db.MysqlClient.QueryTable(chat_table_name).
Filter(chat_room_id, room_id).Delete()
return err return err
} }
...@@ -68,21 +70,21 @@ func ChatRoomInfo(info *validator_struct.ChatRoomInfo) (res db.ImChatRoom, err e ...@@ -68,21 +70,21 @@ func ChatRoomInfo(info *validator_struct.ChatRoomInfo) (res db.ImChatRoom, err e
func GetChatRooms(request *pb.ChatRoomAllRequest) (results map[string]interface{}, err error) { func GetChatRooms(request *pb.ChatRoomAllRequest) (results map[string]interface{}, err error) {
var ( var (
announcement = request.GetAnnouncement() announcement = request.GetAnnouncement()
name = request.GetName() name = request.GetName()
status = request.GetStatus() status = request.GetStatus()
creator = request.GetCreator() creator = request.GetCreator()
createtime = request.GetCreatetime() createtime = request.GetCreatetime()
page = request.GetPage() page = request.GetPage()
) )
if page == 0 { if page == 0 {
page = 1; page = 1
} }
count_db := db.MysqlClient.QueryTable(chat_table_name) count_db := db.MysqlClient.QueryTable(chat_table_name)
if announcement != "" { if announcement != "" {
count_db = count_db.Filter(chat_announcement + "__icontains", announcement) count_db = count_db.Filter(chat_announcement+"__icontains", announcement)
} }
if name != "" { if name != "" {
count_db = count_db.Filter(chat_room + "__icontains", name) count_db = count_db.Filter(chat_room+"__icontains", name)
} }
if status != 0 { if status != 0 {
count_db = count_db.Filter(chat_status, status) count_db = count_db.Filter(chat_status, status)
...@@ -91,14 +93,13 @@ func GetChatRooms(request *pb.ChatRoomAllRequest) (results map[string]interface{ ...@@ -91,14 +93,13 @@ func GetChatRooms(request *pb.ChatRoomAllRequest) (results map[string]interface{
count_db = count_db.Filter(chat_creator, creator) count_db = count_db.Filter(chat_creator, creator)
} }
if createtime != "" { if createtime != "" {
count_db = count_db.Filter(chat_create_time + "__age__gte", createtime) count_db = count_db.Filter(chat_create_time+"__gte", createtime)
} }
ctn, err := count_db.Count() ctn, err := count_db.Count()
if err != nil { if err != nil {
return return
} }
if ctn == 0 { if ctn == 0 {
err = errors.New("没有查询到任何数据")
return return
} }
// 获取查询条件聊天室的总数 // 获取查询条件聊天室的总数
...@@ -116,4 +117,4 @@ func GetChatRooms(request *pb.ChatRoomAllRequest) (results map[string]interface{ ...@@ -116,4 +117,4 @@ func GetChatRooms(request *pb.ChatRoomAllRequest) (results map[string]interface{
results["page"] = page results["page"] = page
results["page_size"] = 20 results["page_size"] = 20
return return
} }
\ No newline at end of file
...@@ -13,13 +13,14 @@ type ImChatRoomService struct { ...@@ -13,13 +13,14 @@ type ImChatRoomService struct {
pb.UnimplementedChatRoomServiceServer pb.UnimplementedChatRoomServiceServer
} }
func (cr *ImChatRoomService) Add(ctx context.Context, in *pb.ChatRoomAddRequest) (reply *pb.ChatRoomAddReply, err error) { func (cr *ImChatRoomService) Add(ctx context.Context,
in *pb.ChatRoomAddRequest) (reply *pb.ChatRoomAddReply, err error) {
chat_room_struct := vs.NewAddChatRoom(in) chat_room_struct := vs.NewAddChatRoom(in)
if err = helper.Valiator(chat_room_struct); err != nil { if err = helper.Valiator(chat_room_struct); err != nil {
return return
} }
room_id, err := helper.AddChatRoom(chat_room_struct) room_id, err := AddChatRoom(chat_room_struct)
if err != nil { if err != nil {
return return
} }
...@@ -28,41 +29,43 @@ func (cr *ImChatRoomService) Add(ctx context.Context, in *pb.ChatRoomAddRequest) ...@@ -28,41 +29,43 @@ func (cr *ImChatRoomService) Add(ctx context.Context, in *pb.ChatRoomAddRequest)
return return
} }
func (cr *ImChatRoomService) Update(ctx context.Context, in *pb.ChatRoomUpdateRequest) (reply *pb.ChatRoomUpdateReply, err error) { func (cr *ImChatRoomService) Update(ctx context.Context,
in *pb.ChatRoomUpdateRequest) (reply *pb.ChatRoomUpdateReply, err error) {
chat_room_struct := vs.NewChatRoomUpdate(in) chat_room_struct := vs.NewChatRoomUpdate(in)
if err = helper.Valiator(chat_room_struct); err != nil { if err = helper.Valiator(chat_room_struct); err != nil {
return return
} }
if err = UpdateChatRoom(chat_room_struct); err != nil {
if err = helper.UpdateChatRoom(chat_room_struct); err != nil {
return return
} }
reply = &pb.ChatRoomUpdateReply{} reply = &pb.ChatRoomUpdateReply{}
return return
} }
func (cr *ImChatRoomService) Delete(ctx context.Context, in *pb.ChatRoomDelRequest) (reply *pb.ChatRoomDelReply, err error) { func (cr *ImChatRoomService) Delete(ctx context.Context,
in *pb.ChatRoomDelRequest) (reply *pb.ChatRoomDelReply, err error) {
chat_room_struct := vs.NewChatRoomDel(in) chat_room_struct := vs.NewChatRoomDel(in)
if err = helper.Valiator(chat_room_struct); err != nil { if err = helper.Valiator(chat_room_struct); err != nil {
return return
} }
if err = helper.DeleteChatRoom(chat_room_struct.RoomId); err != nil { if err = DeleteChatRoom(chat_room_struct.RoomId); err != nil {
return return
} }
reply = &pb.ChatRoomDelReply{} reply = &pb.ChatRoomDelReply{}
return return
} }
func (cr *ImChatRoomService) Info(ctx context.Context, in *pb.ChatRoomInfoRequest) (reply *pb.ChatRoomInfoReply, err error) { func (cr *ImChatRoomService) Info(ctx context.Context,
in *pb.ChatRoomInfoRequest) (reply *pb.ChatRoomInfoReply, err error) {
chat_room_struct := vs.NewChatRoomInfo(in) chat_room_struct := vs.NewChatRoomInfo(in)
if err = helper.Valiator(chat_room_struct); err != nil { if err = helper.Valiator(chat_room_struct); err != nil {
return return
} }
db_chat_room, err := helper.ChatRoomInfo(chat_room_struct) db_chat_room, err := ChatRoomInfo(chat_room_struct)
if err != nil { if err != nil {
return return
} }
...@@ -82,13 +85,16 @@ func getchatroom(room db.ImChatRoom) *pb.ChatRoomInfoReply { ...@@ -82,13 +85,16 @@ func getchatroom(room db.ImChatRoom) *pb.ChatRoomInfoReply {
} }
} }
func (cr *ImChatRoomService) All(ctx context.Context, in *pb.ChatRoomAllRequest) (reply *pb.GetChatRoomsReply, err error) { func (cr *ImChatRoomService) All(ctx context.Context,
results, err := helper.GetChatRooms(in) in *pb.ChatRoomAllRequest) (reply *pb.GetChatRoomsReply, err error) {
results, err := GetChatRooms(in)
if err != nil { if err != nil {
return return
} }
reply = &pb.GetChatRoomsReply{Paginate: &pb.Page{}} reply = &pb.GetChatRoomsReply{Paginate: &pb.Page{}}
if len(results) == 0 {
return
}
db_rooms := results["list"].([]db.ImChatRoom) db_rooms := results["list"].([]db.ImChatRoom)
for _, v := range db_rooms { for _, v := range db_rooms {
reply.List = append(reply.List, getchatroom(v)) reply.List = append(reply.List, getchatroom(v))
......
...@@ -16,7 +16,8 @@ const ( ...@@ -16,7 +16,8 @@ const (
func GetImBaseByUserId(user_id int64) (db.ImBase, error) { func GetImBaseByUserId(user_id int64) (db.ImBase, error) {
var im_base db.ImBase var im_base db.ImBase
err := db.MysqlClient.QueryTable(b_table_name).Filter(b_user_id, user_id).One(&im_base) err := db.MysqlClient.QueryTable(b_table_name).
Filter(b_user_id, user_id).One(&im_base)
return im_base, err return im_base, err
} }
...@@ -25,21 +26,24 @@ func AddImBase(im *validator_struct.ConfigureAddStruct) error { ...@@ -25,21 +26,24 @@ func AddImBase(im *validator_struct.ConfigureAddStruct) error {
configure.CompanyUserId = im.CompanyUserId configure.CompanyUserId = im.CompanyUserId
configure.MsgHookUrl = im.MsgHookUrl configure.MsgHookUrl = im.MsgHookUrl
configure.MultideviceType = im.MultideviceType configure.MultideviceType = im.MultideviceType
_, err := db.MysqlClient.Insert(configure); _, err := db.MysqlClient.Insert(configure)
return err return err
} }
func DelConfigure(user_id int64) error { func DelConfigure(user_id int64) error {
configure := new(db.ImBase) configure := new(db.ImBase)
configure.CompanyUserId = user_id configure.CompanyUserId = user_id
_, err := db.MysqlClient.Delete(configure); _, err := db.MysqlClient.Delete(configure)
return err return err
} }
func GetConfigureAll() []*db.ImBase { func GetConfigureAll() ([]*db.ImBase, error) {
var configurs []*db.ImBase var configurs []*db.ImBase
_, _ = db.MysqlClient.QueryTable(b_table_name).All(&configurs) num, err := db.MysqlClient.QueryTable(b_table_name).All(&configurs)
return configurs if num == 0 {
return configurs, nil
}
return configurs, err
} }
func UpdateConfiguer(im *validator_struct.ConfigureUpdateStruct) error { func UpdateConfiguer(im *validator_struct.ConfigureUpdateStruct) error {
...@@ -53,6 +57,7 @@ func UpdateConfiguer(im *validator_struct.ConfigureUpdateStruct) error { ...@@ -53,6 +57,7 @@ func UpdateConfiguer(im *validator_struct.ConfigureUpdateStruct) error {
if len(orm_params) == 0 { if len(orm_params) == 0 {
return errors.New("没有数据更改") return errors.New("没有数据更改")
} }
_, err := db.MysqlClient.QueryTable(b_table_name).Filter(b_user_id, im.CompanyUserId).Update(orm_params) _, err := db.MysqlClient.QueryTable(b_table_name).
Filter(b_user_id, im.CompanyUserId).Update(orm_params)
return err return err
} }
...@@ -13,69 +13,77 @@ type ConfigureSevice struct { ...@@ -13,69 +13,77 @@ type ConfigureSevice struct {
pb.UnimplementedConfigureSeviceServer pb.UnimplementedConfigureSeviceServer
} }
func (cs *ConfigureSevice) Add(ctx context.Context, in *pb.ConfigureRequest) (reply *pb.ConfigureReply, err error) { func (cs *ConfigureSevice) Add(ctx context.Context,
in *pb.ConfigureRequest) (reply *pb.ConfigureReply, err error) {
configure_add_struct := vs.NewConfigureAddStruct(in) configure_add_struct := vs.NewConfigureAddStruct(in)
if err = helper.Valiator(configure_add_struct); err != nil { if err = helper.Valiator(configure_add_struct); err != nil {
return return
} }
// 已经添加过配置无需在添加 // 已经添加过配置无需在添加
if _, err = helper.GetImBaseByUserId(configure_add_struct.CompanyUserId); err == nil { if _, err = GetImBaseByUserId(configure_add_struct.CompanyUserId); err == nil {
err = errors.New("已经添加过配置,无需再添加") err = errors.New("已经添加过配置,无需再添加")
return return
} }
// 添加配置 // 添加配置
if err = helper.AddImBase(configure_add_struct); err != nil { if err = AddImBase(configure_add_struct); err != nil {
return return
} }
reply = &pb.ConfigureReply{} reply = &pb.ConfigureReply{}
return return
} }
func (cs *ConfigureSevice) Delete(ctx context.Context, in *pb.ConfigureDelRequest) (reply *pb.ConfigureReply, err error) { func (cs *ConfigureSevice) Delete(ctx context.Context,
in *pb.ConfigureDelRequest) (reply *pb.ConfigureReply, err error) {
cds := vs.NewConfigureDelStruct(in) cds := vs.NewConfigureDelStruct(in)
if err = helper.Valiator(cds); err != nil { if err = helper.Valiator(cds); err != nil {
return return
} }
// 执行删除操作 // 执行删除操作
if err = helper.DelConfigure(cds.CompanyUserId); err != nil { if err = DelConfigure(cds.CompanyUserId); err != nil {
return return
} }
reply = &pb.ConfigureReply{} reply = &pb.ConfigureReply{}
return return
} }
func (cs *ConfigureSevice) Select(ctx context.Context, in *pb.GetAllRequest) (reply *pb.GetAllReply, err error) { func (cs *ConfigureSevice) Select(ctx context.Context,
in *pb.GetAllRequest) (reply *pb.GetAllReply, err error) {
reply = &pb.GetAllReply{} reply = &pb.GetAllReply{}
configs := helper.GetConfigureAll() configs, err := GetConfigureAll()
if err != nil {
if len(configs) > 0 { return
for _, v := range configs { }
if len(configs) == 0 {
return
}
for _, v := range configs {
reply.GetAll = append(reply.GetAll, &pb.GetAllOneReply{ reply.GetAll = append(reply.GetAll, &pb.GetAllOneReply{
Reply: &pb.Public{ Reply: &pb.Public{
CompanyUserId: v.CompanyUserId, CompanyUserId: v.CompanyUserId,
MultideviceType: v.MultideviceType, MultideviceType: v.MultideviceType,
MsgHookUrl: v.MsgHookUrl, MsgHookUrl: v.MsgHookUrl,
}, },
}) })
}
} }
return return
} }
func (cs *ConfigureSevice) Update(ctx context.Context, in *pb.UpdateRequest) (reply *pb.ConfigureReply, err error) { func (cs *ConfigureSevice) Update(ctx context.Context,
in *pb.UpdateRequest) (reply *pb.ConfigureReply, err error) {
configure_add_struct := vs.NewConfigureUpdateStruct(in) configure_add_struct := vs.NewConfigureUpdateStruct(in)
if err = helper.Valiator(configure_add_struct); err != nil { if err = helper.Valiator(configure_add_struct); err != nil {
return return
} }
// 更新数据 // 更新数据
if err = helper.UpdateConfiguer(configure_add_struct); err != nil { if err = UpdateConfiguer(configure_add_struct); err != nil {
return return
} }
reply = &pb.ConfigureReply{} reply = &pb.ConfigureReply{}
return return
} }
\ No newline at end of file
package im_user_relationship package im_user_relationship
import (
"errors"
"github.com/astaxie/beego/orm"
"im-microservice/db"
"im-microservice/helper"
"im-microservice/validator_struct"
)
var (
db_tabel = "im_user_relationship"
db_field_accid = "accid"
db_field_faccid = "faccid"
db_field_type = "type"
db_field_msg = "msg"
db_field_blacklist = "blacklist"
db_field_mute = "mute"
db_field_serverex = "serverex"
db_field_updatetime = "updatetime"
db_field_createtime = "createtime"
open = 2
close = 1
)
// 是否是好友
func IsUserRelationship(accid, faccid string) bool {
return db.MysqlClient.QueryTable(db_tabel).Filter(db_field_accid, accid).
Filter(db_field_faccid, faccid).Exist()
}
func AddUserRelationship(in *validator_struct.UserRelationshipAdd) error {
var us db.ImUserRelationship
now := helper.GetNowTime()
us.Accid = in.Accid
us.Faccid = in.Faccid
us.Msg = in.Msg
us.Type = int(in.Type)
us.Updatetime = now
us.Blacklist = open
us.Mute = open
us.Createtime = now
_, err := db.MysqlClient.Insert(&us)
return err
}
func DBDelete(in *validator_struct.UserRelationshipDel) error {
_, err := db.MysqlClient.QueryTable(db_tabel).Filter(db_field_accid, in.Accid).
Filter(db_field_faccid, in.Faccid).Delete()
return err
}
func DBAll(in *validator_struct.UserRelationshipAll) ([]db.ImUserRelationship, error) {
var friends []db.ImUserRelationship
num, err := db.MysqlClient.QueryTable(db_tabel).Filter(db_field_accid, in.Accid).
Filter(db_field_blacklist, open).Filter(db_field_updatetime+"__gte", in.Updatetime).
All(&friends, db_field_faccid, db_field_updatetime)
if err != nil {
return nil, err
}
if num == 0 {
return nil, errors.New("好友列表为空")
}
return friends, nil
}
func SetSpecialRelationDb(in *validator_struct.SetSpecialRelation) error {
if ok := IsUserRelationship(in.Accid, in.TargetAcc); !ok {
return errors.New("被操作用户不是该用户好友")
}
orm_params := make(orm.Params)
// 加入黑名单
if in.RelationType == 1 {
if in.Value == 1 {
//黑名单
orm_params["blacklist"] = close
} else {
orm_params["blacklist"] = open
}
} else {
if in.Value == 1 {
//禁音
orm_params["mute"] = close
} else {
orm_params["mute"] = open
}
}
if len(orm_params) == 0 {
return nil
}
_, err := db.MysqlClient.QueryTable(db_tabel).Filter(db_field_accid, in.Accid).
Filter(db_field_faccid, in.TargetAcc).Update(orm_params)
return err
}
func ListBlackAndMuteListDB(in *validator_struct.ListBlackAndMuteList) (blacklist []db.ImUserRelationship,
mutelist []db.ImUserRelationship, err error) {
query_db := db.MysqlClient.QueryTable(db_tabel).Filter(db_field_accid, in.Accid)
_, err = query_db.Filter(db_field_blacklist, close).All(&blacklist)
if err != nil {
return
}
_, err = query_db.Filter(db_field_mute, close).All(&mutelist)
return
}
package im_user_relationship package im_user_relationship
import (
"context"
"errors"
"im-microservice/sevice/im_user"
"im-microservice/helper"
"im-microservice/pb"
vs "im-microservice/validator_struct"
)
type UserRelationshipService struct {
pb.UnimplementedUserRelationshipServiceServer
}
func (us *UserRelationshipService) Add(ctx context.Context,
in *pb.UserRelationshipAddRequest) (reply *pb.UserRelationshipAddReply, err error) {
m := map[string]interface{}{
"accid": in.GetAccid(),
"faccid": in.GetFaccid(),
"type": in.GetType(),
"msg": in.GetMsg(),
}
request := vs.NewUserRelationshipAdd(m)
if err = helper.Valiator(request); err != nil {
return
}
if ok := IsUserRelationship(request.Accid, request.Faccid); ok {
err = errors.New("已经添加过该好友")
return
}
//添加好友
if err = AddUserRelationship(request); err != nil {
return
}
// 更改用户版本信息
u_map := make(map[string]interface{})
u_map["edition"] = helper.GetNowTime()
_, _ = im_user.UpdateImUser(request.Accid, u_map)
reply = &pb.UserRelationshipAddReply{}
return
}
func (us *UserRelationshipService) Delete(ctx context.Context,
in *pb.UserRelationshipDelRequest) (reply *pb.UserRelationshipAddReply, err error) {
m := map[string]interface{}{
"accid": in.GetAccid(),
"faccid": in.GetFaccid(),
}
request := vs.NewUserRelationshipDel(m)
if err = helper.Valiator(request); err != nil {
return
}
// 删除好友
if err = DBDelete(request); err != nil {
return
}
// 更改用户版本信息
u_map := make(map[string]interface{})
u_map["edition"] = helper.GetNowTime()
_, _ = im_user.UpdateImUser(request.Accid, u_map)
reply = &pb.UserRelationshipAddReply{}
return
}
func (us *UserRelationshipService) All(ctx context.Context,
in *pb.UserRelationshipListRequest) (reply *pb.UserRelationshipListReply, err error) {
m := map[string]interface{}{
"accid": in.GetAccid(),
"updatetime": in.GetUpdatetime(),
}
request := vs.NewUserRelationshipAll(m)
if err = helper.Valiator(request); err != nil {
return
}
results, err := DBAll(request)
if err != nil {
return
}
reply = &pb.UserRelationshipListReply{}
for _, v := range results {
reply.List = append(reply.List, &pb.UserRelationshipInfo{
Faccid: v.Faccid,
Updatetime: v.Updatetime,
})
}
return
}
func (us *UserRelationshipService) SetSpecialRelation(ctx context.Context,
in *pb.SetSpecialRelationReq) (reply *pb.UserRelationshipAddReply, err error) {
m := map[string]interface{}{
"accid": in.GetAccid(),
"faccid": in.GetTargetAcc(),
"relation_type": in.GetRelationType(),
"value": in.GetValue(),
}
request := vs.NewSetSpecialRelation(m)
if err = helper.Valiator(request); err != nil {
return
}
if err = SetSpecialRelationDb(request); err != nil {
return
}
reply = &pb.UserRelationshipAddReply{}
return
}
func (us *UserRelationshipService) ListBlackAndMuteList(ctx context.Context,
in *pb.ListBlackAndMuteListReq) (reply *pb.ListBlackAndMuteListReply, err error) {
m := map[string]interface{}{
"accid": in.GetAccid(),
}
request := vs.NewListBlackAndMuteList(m)
if err = helper.Valiator(request); err != nil {
return
}
blacklist, mutelist, err := ListBlackAndMuteListDB(request)
if err != nil {
return
}
reply = &pb.ListBlackAndMuteListReply{}
if len(blacklist) > 0 {
for _, v := range blacklist {
reply.Blacklist = append(reply.Blacklist,
&pb.UserRelationshipInfo{Updatetime: v.Updatetime, Faccid: v.Faccid})
}
}
if len(mutelist) > 0 {
for _, v := range mutelist {
reply.Mutelist = append(reply.Mutelist,
&pb.UserRelationshipInfo{Updatetime: v.Updatetime, Faccid: v.Faccid})
}
}
return
}
syntax = "proto3";
package pb;
import "u-proto/common.proto";
//添加好友
message UserRelationshipAddRequest {
Common Common = 1;
string Accid = 2;
string Faccid = 3;
int64 Type = 4;
string Msg = 5;
}
message UserRelationshipAddReply {}
//删除好友
message UserRelationshipDelRequest {
Common Common = 1;
string Accid = 2;
string Faccid = 3;
}
// 获取好友关系
message UserRelationshipListRequest {
Common Common = 1;
string Accid = 2;
string Updatetime = 3;
}
message UserRelationshipInfo {
string Faccid = 1;
string Updatetime = 2;
}
message UserRelationshipListReply {
repeated UserRelationshipInfo List = 1;
}
//设置黑名单/静音
message SetSpecialRelationReq {
Common Common = 1;
string Accid = 2;
string TargetAcc = 3;
int64 RelationType = 4;
int64 Value = 5;
}
//查看指定用户的黑名单和静音列表
message ListBlackAndMuteListReq {
Common Common = 1;
string Accid = 2;
}
message ListBlackAndMuteListReply {
repeated UserRelationshipInfo Mutelist = 1;
repeated UserRelationshipInfo Blacklist = 2;
}
service UserRelationshipService {
rpc Add(UserRelationshipAddRequest) returns (UserRelationshipAddReply) {}
rpc Delete(UserRelationshipDelRequest) returns (UserRelationshipAddReply) {}
rpc All(UserRelationshipListRequest) returns (UserRelationshipListReply) {}
rpc SetSpecialRelation(SetSpecialRelationReq) returns (UserRelationshipAddReply) {}
rpc ListBlackAndMuteList(ListBlackAndMuteListReq) returns(ListBlackAndMuteListReply) {}
}
\ No newline at end of file
...@@ -9,12 +9,27 @@ type ConfigureAddStruct struct { ...@@ -9,12 +9,27 @@ type ConfigureAddStruct struct {
MsgHookUrl string `validate:"required"` MsgHookUrl string `validate:"required"`
} }
func NewConfigureAddStruct(in *pb.ConfigureRequest) *ConfigureAddStruct { func NewConfigureAddStruct(inter interface{}) *ConfigureAddStruct {
return &ConfigureAddStruct{ config := &ConfigureAddStruct{}
CompanyUserId: in.Public.GetCompanyUserId(), switch inter.(type) {
MultideviceType: in.Public.GetMultideviceType(), case *pb.ConfigureRequest:
MsgHookUrl: in.Public.GetMsgHookUrl(), var c = inter.(*pb.ConfigureRequest)
config.CompanyUserId = c.Public.GetCompanyUserId()
config.MultideviceType = c.Public.GetMultideviceType()
config.MsgHookUrl = c.Public.GetMsgHookUrl()
case map[string]interface{}:
var c = inter.(map[string]interface{})
if cui, ok := c["company_user_id"].(int64); ok {
config.CompanyUserId = cui
}
if mt, ok := c["multidevice_type"].(int64); ok {
config.MultideviceType = mt
}
if mhu, ok := c["msg_hook_url"].(string); ok {
config.MsgHookUrl = mhu
}
} }
return config
} }
// 修改配置 // 修改配置
...@@ -24,12 +39,27 @@ type ConfigureUpdateStruct struct { ...@@ -24,12 +39,27 @@ type ConfigureUpdateStruct struct {
MsgHookUrl string MsgHookUrl string
} }
func NewConfigureUpdateStruct(in *pb.UpdateRequest) *ConfigureUpdateStruct { func NewConfigureUpdateStruct(in interface{}) *ConfigureUpdateStruct {
return &ConfigureUpdateStruct{ var config_update = &ConfigureUpdateStruct{}
CompanyUserId: in.Public.GetCompanyUserId(), switch in.(type) {
MultideviceType: in.Public.GetMultideviceType(), case *pb.UpdateRequest:
MsgHookUrl: in.Public.GetMsgHookUrl(), var v = in.(*pb.ConfigureRequest)
config_update.CompanyUserId = v.Public.GetCompanyUserId()
config_update.MultideviceType = v.Public.GetMultideviceType()
config_update.MsgHookUrl = v.Public.GetMsgHookUrl()
case map[string]interface{}:
var c = in.(map[string]interface{})
if cui, ok := c["company_user_id"].(int64); ok {
config_update.CompanyUserId = cui
}
if mt, ok := c["multidevice_type"].(int64); ok {
config_update.MultideviceType = mt
}
if mhu, ok := c["msg_hook_url"].(string); ok {
config_update.MsgHookUrl = mhu
}
} }
return config_update
} }
// 删除配置 // 删除配置
...@@ -37,8 +67,20 @@ type ConfigureDelStruct struct { ...@@ -37,8 +67,20 @@ type ConfigureDelStruct struct {
CompanyUserId int64 `validate:"required,numeric"` CompanyUserId int64 `validate:"required,numeric"`
} }
func NewConfigureDelStruct(in *pb.ConfigureDelRequest) *ConfigureDelStruct { func NewConfigureDelStruct(inter interface{}) *ConfigureDelStruct {
return &ConfigureDelStruct{CompanyUserId: in.GetCompanyUserId()} room := &ConfigureDelStruct{}
switch inter.(type) {
case *pb.ConfigureDelRequest:
var c = inter.(*pb.ConfigureDelRequest)
room.CompanyUserId = c.GetCompanyUserId()
case map[string]interface{}:
var c = inter.(map[string]interface{})
if v, ok := c["company_user_id"].(int64); ok {
room.CompanyUserId = v
}
}
return room
} }
// 创建聊天室 // 创建聊天室
...@@ -97,7 +139,88 @@ type ChatRoomInfo struct { ...@@ -97,7 +139,88 @@ type ChatRoomInfo struct {
Updatetime string Updatetime string
} }
func NewChatRoomInfo(in *pb.ChatRoomInfoRequest) *ChatRoomInfo { func NewChatRoomInfo(inter interface{}) *ChatRoomInfo {
return &ChatRoomInfo{RoomId: in.GetRoomId()} room := &ChatRoomInfo{}
switch inter.(type) {
case *pb.ChatRoomInfoRequest:
var c = inter.(*pb.ChatRoomInfoRequest)
room.RoomId = c.RoomId
case map[string]interface{}:
var c = inter.(map[string]interface{})
if v, ok := c["room_id"].(int64); ok {
room.RoomId = v
}
}
return room
}
//添加好友
type UserRelationshipAdd struct {
Accid string `validate:"required"`
Faccid string `validate:"required"`
Type int64 `validate:"required"`
Msg string
}
func NewUserRelationshipAdd(in map[string]interface{}) *UserRelationshipAdd {
return &UserRelationshipAdd{
Accid: in["accid"].(string),
Faccid: in["faccid"].(string),
Type: in["type"].(int64),
Msg: in["msg"].(string),
}
}
// 删除好友
type UserRelationshipDel struct {
Accid string `validate:"required"`
Faccid string `validate:"required"`
}
func NewUserRelationshipDel(in map[string]interface{}) *UserRelationshipDel {
return &UserRelationshipDel{
Accid: in["accid"].(string),
Faccid: in["faccid"].(string),
}
}
// 获取好友列表
type UserRelationshipAll struct {
Accid string `validate:"required"`
Updatetime string `validate:"required"`
}
func NewUserRelationshipAll(in map[string]interface{}) *UserRelationshipAll {
return &UserRelationshipAll{
Accid: in["accid"].(string),
Updatetime: in["updatetime"].(string),
}
}
// 设置用户黑名单/禁音
type SetSpecialRelation struct {
Accid string `validate:"required"`
TargetAcc string `validate:"required"`
RelationType int64 `validate:"required,numeric,min=1"`
Value int64 `validate:"required,numeric,min=1"`
}
func NewSetSpecialRelation(in map[string]interface{}) *SetSpecialRelation{
return &SetSpecialRelation{
Accid: in["accid"].(string),
TargetAcc: in["faccid"].(string),
RelationType: in["relation_type"].(int64),
Value: in["value"].(int64),
}
}
// 获取用户列表
type ListBlackAndMuteList struct {
Accid string `validate:"required"`
} }
func NewListBlackAndMuteList(in map[string]interface{}) *ListBlackAndMuteList {
return &ListBlackAndMuteList{Accid:in["accid"].(string)}
}
\ 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