Commit f212f5bc by Li Feifei

add friend_request service

parent 1dae6eea
No preview for this file type
......@@ -56,7 +56,8 @@ func newMysqlClient() {
beeLogger.Log.Fatalf("db connect error => %v", err)
return
}
orm.RegisterModel(new(CompanyApp), new(ImBase), new(ImChatRoom), new(ImUserRelationship), new(ImUser))
orm.RegisterModel(new(CompanyApp), new(ImBase), new(ImChatRoom),
new(ImUserRelationship), new(ImUser), new(ImFriendRequest))
orm.Debug = true
MysqlClient = orm.NewOrm()
beeLogger.Log.Success("MySQL connect success")
......
......@@ -55,3 +55,12 @@ type ImUser struct {
Platform string
Edition string
}
type ImFriendRequest struct {
Id int
Accid string
Faccid string
Status int64
Createtime string
Updatetime string
}
......@@ -7,6 +7,7 @@ import (
"im-microservice/pb"
"im-microservice/sevice/health"
"im-microservice/sevice/im_chat_room"
"im-microservice/sevice/im_friend_request"
ic "im-microservice/sevice/im_configure"
"im-microservice/sevice/im_user"
iur "im-microservice/sevice/im_user_relationship"
......@@ -42,7 +43,7 @@ func init() {
grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(
grpc_validator.UnaryServerInterceptor(),
middleware.Interceptor,
middleware.Auth,
//middleware.Auth,
grpc_recovery.UnaryServerInterceptor(middleware.RecoveryInterceptor()),
grpc_zap.UnaryServerInterceptor(middleware.ZapInterceptor()),
)))
......@@ -52,6 +53,7 @@ func init() {
pb.RegisterChatRoomServiceServer(rpc_server, &im_chat_room.ImChatRoomService{})
pb.RegisterImUserServer(rpc_server, &im_user.ImUserServer{})
pb.RegisterUserRelationshipServiceServer(rpc_server, &iur.UserRelationshipService{})
pb.RegisterImFriendServiceServer(rpc_server, &im_friend_request.ImFriendService{})
reflection.Register(rpc_server)
RpcServer = rpc_server
}
......@@ -22,3 +22,18 @@
{"level":"error","ts":"2020-07-06T11:28:57.628+0800","caller":"grpclog/grpclog.go:51","msg":"grpc: server failed to encode response: rpc error: code = Internal desc = grpc: error while marshaling: proto: Marshal called with nil","system":"grpc","grpc_log":true}
{"level":"info","ts":"2020-07-06T13:42:58.519+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code OK","grpc.start_time":"2020-07-06T13:42:58+08:00","grpc.request.deadline":"2020-07-06T13:43:01+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.UserRelationshipService","grpc.method":"ListBlackAndMuteList","grpc.code":"OK","grpc.time_ms":33.638999938964844}
{"level":"info","ts":"2020-07-06T13:43:16.098+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code OK","grpc.start_time":"2020-07-06T13:43:16+08:00","grpc.request.deadline":"2020-07-06T13:43:19+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.UserRelationshipService","grpc.method":"ListBlackAndMuteList","grpc.code":"OK","grpc.time_ms":17.27400016784668}
{"level":"info","ts":"2020-07-06T15:31:36.222+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code AlreadyExists","grpc.start_time":"2020-07-06T15:31:35+08:00","grpc.request.deadline":"2020-07-06T15:31:38+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"Add","error":"rpc error: code = AlreadyExists desc = 已经添加过该好友","grpc.code":"AlreadyExists","grpc.time_ms":522.9140014648438}
{"level":"info","ts":"2020-07-06T15:35:26.910+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code NotFound","grpc.start_time":"2020-07-06T15:35:26+08:00","grpc.request.deadline":"2020-07-06T15:35:29+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"Add","error":"rpc error: code = NotFound desc = 用户不存在","grpc.code":"NotFound","grpc.time_ms":125.20099639892578}
{"level":"info","ts":"2020-07-06T15:36:07.905+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code OK","grpc.start_time":"2020-07-06T15:36:07+08:00","grpc.request.deadline":"2020-07-06T15:36:10+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"Add","grpc.code":"OK","grpc.time_ms":458.4519958496094}
{"level":"info","ts":"2020-07-06T15:37:06.868+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code OK","grpc.start_time":"2020-07-06T15:37:06+08:00","grpc.request.deadline":"2020-07-06T15:37:09+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"Add","grpc.code":"OK","grpc.time_ms":649.9130249023438}
{"level":"info","ts":"2020-07-06T15:37:40.312+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code OK","grpc.start_time":"2020-07-06T15:37:39+08:00","grpc.request.deadline":"2020-07-06T15:37:42+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"Add","grpc.code":"OK","grpc.time_ms":657.301025390625}
{"level":"info","ts":"2020-07-06T15:38:05.741+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code OK","grpc.start_time":"2020-07-06T15:38:04+08:00","grpc.request.deadline":"2020-07-06T15:38:07+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"Add","grpc.code":"OK","grpc.time_ms":779.1309814453125}
{"level":"info","ts":"2020-07-06T15:38:10.250+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code OK","grpc.start_time":"2020-07-06T15:38:09+08:00","grpc.request.deadline":"2020-07-06T15:38:12+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"Add","grpc.code":"OK","grpc.time_ms":726.1229858398438}
{"level":"info","ts":"2020-07-06T15:38:46.219+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code OK","grpc.start_time":"2020-07-06T15:38:43+08:00","grpc.request.deadline":"2020-07-06T15:38:46+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"Add","grpc.code":"OK","grpc.time_ms":2541.693115234375}
{"level":"info","ts":"2020-07-06T15:38:51.246+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code AlreadyExists","grpc.start_time":"2020-07-06T15:38:50+08:00","grpc.request.deadline":"2020-07-06T15:38:53+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"Add","error":"rpc error: code = AlreadyExists desc = 已经提交过申请","grpc.code":"AlreadyExists","grpc.time_ms":297.6159973144531}
{"level":"info","ts":"2020-07-06T15:40:50.063+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code OK","grpc.start_time":"2020-07-06T15:40:49+08:00","grpc.request.deadline":"2020-07-06T15:40:52+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"Update","grpc.code":"OK","grpc.time_ms":110.69400024414062}
{"level":"info","ts":"2020-07-06T15:41:04.915+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code OK","grpc.start_time":"2020-07-06T15:41:04+08:00","grpc.request.deadline":"2020-07-06T15:41:07+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"Update","grpc.code":"OK","grpc.time_ms":77.06600189208984}
{"level":"info","ts":"2020-07-06T16:00:29.941+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code OK","grpc.start_time":"2020-07-06T16:00:29+08:00","grpc.request.deadline":"2020-07-06T16:00:32+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"All","grpc.code":"OK","grpc.time_ms":229.0019989013672}
{"level":"info","ts":"2020-07-06T16:00:42.666+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code OK","grpc.start_time":"2020-07-06T16:00:42+08:00","grpc.request.deadline":"2020-07-06T16:00:45+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"All","grpc.code":"OK","grpc.time_ms":254.00100708007812}
{"level":"info","ts":"2020-07-06T16:01:07.713+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code OK","grpc.start_time":"2020-07-06T16:01:07+08:00","grpc.request.deadline":"2020-07-06T16:01:10+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"All","grpc.code":"OK","grpc.time_ms":147.58200073242188}
{"level":"info","ts":"2020-07-06T16:01:21.752+0800","caller":"go-grpc-middleware@v1.2.0/chain.go:25","msg":"finished unary call with code OK","grpc.start_time":"2020-07-06T16:01:21+08:00","grpc.request.deadline":"2020-07-06T16:01:24+08:00","system":"grpc","span.kind":"server","grpc.service":"pb.ImFriendService","grpc.method":"All","grpc.code":"OK","grpc.time_ms":215.05599975585938}
......@@ -68,18 +68,7 @@ func Auth(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
curtime := c_r.FindAllStringSubmatch(s, -1)
check_sum := cs_r.FindAllStringSubmatch(s, -1)
//if len(appkey) < 1 {
// return nil, permissionError("缺少appkey")
//}
//if len(nonce) < 1 {
// return nil, permissionError("缺少nonce")
//}
//if len(curtime) < 1 {
// return nil, permissionError("缺少curtime")
//}
//if len(check_sum) < 1 {
// return nil, permissionError("缺少checksum")
//}
request_map["Appkey"] = appkey[0][1]
request_map["Nonce"] = nonce[0][1]
request_map["Curtime"] = curtime[0][1]
......
No preview for this file type
......@@ -464,7 +464,7 @@ var file_u_proto_im_base_proto_rawDesc = []byte{
0x79, 0x22, 0x67, 0x0a, 0x13, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x44, 0x65,
0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x70,
0x61, 0x6e, 0x79, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42,
0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x58, 0x01, 0x52, 0x0d, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79,
0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x10, 0x00, 0x52, 0x0d, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79,
0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x6d,
0x6f, 0x6e, 0x52, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x22, 0x33, 0x0a, 0x0d, 0x47, 0x65,
......
......@@ -5,10 +5,10 @@ package pb
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
_ "github.com/mwitkow/go-proto-validators"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
......@@ -36,6 +36,9 @@ func (this *ConfigureReply) Validate() error {
return nil
}
func (this *ConfigureDelRequest) Validate() error {
if !(this.CompanyUserId > 0) {
return github_com_mwitkow_go_proto_validators.FieldError("CompanyUserId", fmt.Errorf(`value '%v' must be greater than '0'`, this.CompanyUserId))
}
if this.Common != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Common); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Common", err)
......
......@@ -705,7 +705,7 @@ var file_u_proto_im_chat_room_proto_rawDesc = []byte{
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, 0x1e, 0x0a, 0x06, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x58, 0x01, 0x52, 0x06, 0x52,
0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x10, 0x00, 0x52, 0x06, 0x52,
0x6f, 0x6f, 0x6d, 0x49, 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, 0x53, 0x74, 0x61,
0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75,
......@@ -717,14 +717,14 @@ var file_u_proto_im_chat_room_proto_rawDesc = []byte{
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, 0x1e, 0x0a, 0x06, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x58, 0x01, 0x52, 0x06,
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x10, 0x00, 0x52, 0x06,
0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x22, 0x12, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x74, 0x52, 0x6f,
0x6f, 0x6d, 0x44, 0x65, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x59, 0x0a, 0x13, 0x43, 0x68,
0x61, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 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, 0x1e, 0x0a, 0x06, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x58, 0x01, 0x52, 0x06, 0x52,
0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x10, 0x00, 0x52, 0x06, 0x52,
0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x22, 0xe8, 0x01, 0x0a, 0x11, 0x43, 0x68, 0x61, 0x74, 0x52, 0x6f,
0x6f, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x52,
0x6f, 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x52, 0x6f,
......
......@@ -5,10 +5,10 @@ package pb
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
_ "github.com/mwitkow/go-proto-validators"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
......@@ -42,6 +42,9 @@ func (this *ChatRoomUpdateRequest) Validate() error {
return github_com_mwitkow_go_proto_validators.FieldError("Common", err)
}
}
if !(this.RoomId > 0) {
return github_com_mwitkow_go_proto_validators.FieldError("RoomId", fmt.Errorf(`value '%v' must be greater than '0'`, this.RoomId))
}
return nil
}
func (this *ChatRoomUpdateReply) Validate() error {
......@@ -53,6 +56,9 @@ func (this *ChatRoomDelRequest) Validate() error {
return github_com_mwitkow_go_proto_validators.FieldError("Common", err)
}
}
if !(this.RoomId > 0) {
return github_com_mwitkow_go_proto_validators.FieldError("RoomId", fmt.Errorf(`value '%v' must be greater than '0'`, this.RoomId))
}
return nil
}
func (this *ChatRoomDelReply) Validate() error {
......@@ -64,6 +70,9 @@ func (this *ChatRoomInfoRequest) Validate() error {
return github_com_mwitkow_go_proto_validators.FieldError("Common", err)
}
}
if !(this.RoomId > 0) {
return github_com_mwitkow_go_proto_validators.FieldError("RoomId", fmt.Errorf(`value '%v' must be greater than '0'`, this.RoomId))
}
return nil
}
func (this *ChatRoomInfoReply) Validate() error {
......
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.3
// source: u-proto/im_friend_req.proto
package pb
import (
context "context"
proto "github.com/golang/protobuf/proto"
_ "github.com/mwitkow/go-proto-validators"
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 ImFriendAddReq 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 *ImFriendAddReq) Reset() {
*x = ImFriendAddReq{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_friend_req_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImFriendAddReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImFriendAddReq) ProtoMessage() {}
func (x *ImFriendAddReq) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_friend_req_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 ImFriendAddReq.ProtoReflect.Descriptor instead.
func (*ImFriendAddReq) Descriptor() ([]byte, []int) {
return file_u_proto_im_friend_req_proto_rawDescGZIP(), []int{0}
}
func (x *ImFriendAddReq) GetCommon() *Common {
if x != nil {
return x.Common
}
return nil
}
func (x *ImFriendAddReq) GetAccid() string {
if x != nil {
return x.Accid
}
return ""
}
func (x *ImFriendAddReq) GetFaccid() string {
if x != nil {
return x.Faccid
}
return ""
}
type ImFriendEmptyReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ImFriendEmptyReply) Reset() {
*x = ImFriendEmptyReply{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_friend_req_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImFriendEmptyReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImFriendEmptyReply) ProtoMessage() {}
func (x *ImFriendEmptyReply) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_friend_req_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 ImFriendEmptyReply.ProtoReflect.Descriptor instead.
func (*ImFriendEmptyReply) Descriptor() ([]byte, []int) {
return file_u_proto_im_friend_req_proto_rawDescGZIP(), []int{1}
}
// 更改添加好友状态
type ImFriendUpdateReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Common *Common `protobuf:"bytes,1,opt,name=Common,proto3" json:"Common,omitempty"`
Id int64 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"`
Status int64 `protobuf:"varint,3,opt,name=Status,proto3" json:"Status,omitempty"`
}
func (x *ImFriendUpdateReq) Reset() {
*x = ImFriendUpdateReq{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_friend_req_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImFriendUpdateReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImFriendUpdateReq) ProtoMessage() {}
func (x *ImFriendUpdateReq) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_friend_req_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 ImFriendUpdateReq.ProtoReflect.Descriptor instead.
func (*ImFriendUpdateReq) Descriptor() ([]byte, []int) {
return file_u_proto_im_friend_req_proto_rawDescGZIP(), []int{2}
}
func (x *ImFriendUpdateReq) GetCommon() *Common {
if x != nil {
return x.Common
}
return nil
}
func (x *ImFriendUpdateReq) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *ImFriendUpdateReq) GetStatus() int64 {
if x != nil {
return x.Status
}
return 0
}
// 获取申请好友列表
type ImFriendListReq 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 *ImFriendListReq) Reset() {
*x = ImFriendListReq{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_friend_req_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImFriendListReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImFriendListReq) ProtoMessage() {}
func (x *ImFriendListReq) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_friend_req_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 ImFriendListReq.ProtoReflect.Descriptor instead.
func (*ImFriendListReq) Descriptor() ([]byte, []int) {
return file_u_proto_im_friend_req_proto_rawDescGZIP(), []int{3}
}
func (x *ImFriendListReq) GetCommon() *Common {
if x != nil {
return x.Common
}
return nil
}
func (x *ImFriendListReq) GetAccid() string {
if x != nil {
return x.Accid
}
return ""
}
type ImFriendListOne struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,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"`
Createtime string `protobuf:"bytes,4,opt,name=Createtime,proto3" json:"Createtime,omitempty"`
}
func (x *ImFriendListOne) Reset() {
*x = ImFriendListOne{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_friend_req_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImFriendListOne) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImFriendListOne) ProtoMessage() {}
func (x *ImFriendListOne) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_friend_req_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 ImFriendListOne.ProtoReflect.Descriptor instead.
func (*ImFriendListOne) Descriptor() ([]byte, []int) {
return file_u_proto_im_friend_req_proto_rawDescGZIP(), []int{4}
}
func (x *ImFriendListOne) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *ImFriendListOne) GetAccid() string {
if x != nil {
return x.Accid
}
return ""
}
func (x *ImFriendListOne) GetFaccid() string {
if x != nil {
return x.Faccid
}
return ""
}
func (x *ImFriendListOne) GetCreatetime() string {
if x != nil {
return x.Createtime
}
return ""
}
type ImFriendListReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
List []*ImFriendListOne `protobuf:"bytes,1,rep,name=List,proto3" json:"List,omitempty"`
}
func (x *ImFriendListReply) Reset() {
*x = ImFriendListReply{}
if protoimpl.UnsafeEnabled {
mi := &file_u_proto_im_friend_req_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ImFriendListReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ImFriendListReply) ProtoMessage() {}
func (x *ImFriendListReply) ProtoReflect() protoreflect.Message {
mi := &file_u_proto_im_friend_req_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 ImFriendListReply.ProtoReflect.Descriptor instead.
func (*ImFriendListReply) Descriptor() ([]byte, []int) {
return file_u_proto_im_friend_req_proto_rawDescGZIP(), []int{5}
}
func (x *ImFriendListReply) GetList() []*ImFriendListOne {
if x != nil {
return x.List
}
return nil
}
var File_u_proto_im_friend_req_proto protoreflect.FileDescriptor
var file_u_proto_im_friend_req_proto_rawDesc = []byte{
0x0a, 0x1b, 0x75, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6d, 0x5f, 0x66, 0x72, 0x69,
0x65, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x71, 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, 0x1a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x77, 0x69, 0x74, 0x6b, 0x6f, 0x77, 0x2f, 0x67, 0x6f, 0x2d, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x2f,
0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x72, 0x0a, 0x0e, 0x49, 0x6d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x64, 0x64, 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, 0x1c, 0x0a, 0x05, 0x41, 0x63, 0x63, 0x69, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x58, 0x01, 0x52, 0x05, 0x41, 0x63,
0x63, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x06, 0x46, 0x61, 0x63, 0x63, 0x69, 0x64, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x58, 0x01, 0x52, 0x06, 0x46, 0x61, 0x63,
0x63, 0x69, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x49, 0x6d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x45,
0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x71, 0x0a, 0x11, 0x49, 0x6d, 0x46,
0x72, 0x69, 0x65, 0x6e, 0x64, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 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, 0x16, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06,
0xe2, 0xdf, 0x1f, 0x02, 0x58, 0x01, 0x52, 0x02, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x06, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, 0x08, 0xe2, 0xdf, 0x1f, 0x04,
0x10, 0x00, 0x18, 0x03, 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x53, 0x0a, 0x0f,
0x49, 0x6d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 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, 0x1c, 0x0a, 0x05, 0x41, 0x63, 0x63, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x58, 0x01, 0x52, 0x05, 0x41, 0x63, 0x63, 0x69,
0x64, 0x22, 0x6f, 0x0a, 0x0f, 0x49, 0x6d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x73,
0x74, 0x4f, 0x6e, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
0x52, 0x02, 0x49, 0x64, 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, 0x1e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65,
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x74, 0x69,
0x6d, 0x65, 0x22, 0x3c, 0x0a, 0x11, 0x49, 0x6d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69,
0x73, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x27, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d, 0x46, 0x72, 0x69,
0x65, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x6e, 0x65, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74,
0x32, 0xb6, 0x01, 0x0a, 0x0f, 0x49, 0x6d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x03, 0x41, 0x6c, 0x6c, 0x12, 0x13, 0x2e, 0x70, 0x62,
0x2e, 0x49, 0x6d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71,
0x1a, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69,
0x73, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x03, 0x41, 0x64, 0x64,
0x12, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x64,
0x64, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d, 0x46, 0x72, 0x69, 0x65,
0x6e, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x39,
0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d,
0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a,
0x16, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x6d, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x45, 0x6d, 0x70,
0x74, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
file_u_proto_im_friend_req_proto_rawDescOnce sync.Once
file_u_proto_im_friend_req_proto_rawDescData = file_u_proto_im_friend_req_proto_rawDesc
)
func file_u_proto_im_friend_req_proto_rawDescGZIP() []byte {
file_u_proto_im_friend_req_proto_rawDescOnce.Do(func() {
file_u_proto_im_friend_req_proto_rawDescData = protoimpl.X.CompressGZIP(file_u_proto_im_friend_req_proto_rawDescData)
})
return file_u_proto_im_friend_req_proto_rawDescData
}
var file_u_proto_im_friend_req_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_u_proto_im_friend_req_proto_goTypes = []interface{}{
(*ImFriendAddReq)(nil), // 0: pb.ImFriendAddReq
(*ImFriendEmptyReply)(nil), // 1: pb.ImFriendEmptyReply
(*ImFriendUpdateReq)(nil), // 2: pb.ImFriendUpdateReq
(*ImFriendListReq)(nil), // 3: pb.ImFriendListReq
(*ImFriendListOne)(nil), // 4: pb.ImFriendListOne
(*ImFriendListReply)(nil), // 5: pb.ImFriendListReply
(*Common)(nil), // 6: pb.Common
}
var file_u_proto_im_friend_req_proto_depIdxs = []int32{
6, // 0: pb.ImFriendAddReq.Common:type_name -> pb.Common
6, // 1: pb.ImFriendUpdateReq.Common:type_name -> pb.Common
6, // 2: pb.ImFriendListReq.Common:type_name -> pb.Common
4, // 3: pb.ImFriendListReply.List:type_name -> pb.ImFriendListOne
3, // 4: pb.ImFriendService.All:input_type -> pb.ImFriendListReq
0, // 5: pb.ImFriendService.Add:input_type -> pb.ImFriendAddReq
2, // 6: pb.ImFriendService.Update:input_type -> pb.ImFriendUpdateReq
5, // 7: pb.ImFriendService.All:output_type -> pb.ImFriendListReply
1, // 8: pb.ImFriendService.Add:output_type -> pb.ImFriendEmptyReply
1, // 9: pb.ImFriendService.Update:output_type -> pb.ImFriendEmptyReply
7, // [7:10] is the sub-list for method output_type
4, // [4:7] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_u_proto_im_friend_req_proto_init() }
func file_u_proto_im_friend_req_proto_init() {
if File_u_proto_im_friend_req_proto != nil {
return
}
file_u_proto_common_proto_init()
if !protoimpl.UnsafeEnabled {
file_u_proto_im_friend_req_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImFriendAddReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_friend_req_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImFriendEmptyReply); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_friend_req_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImFriendUpdateReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_friend_req_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImFriendListReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_friend_req_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImFriendListOne); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_u_proto_im_friend_req_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ImFriendListReply); 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_friend_req_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_u_proto_im_friend_req_proto_goTypes,
DependencyIndexes: file_u_proto_im_friend_req_proto_depIdxs,
MessageInfos: file_u_proto_im_friend_req_proto_msgTypes,
}.Build()
File_u_proto_im_friend_req_proto = out.File
file_u_proto_im_friend_req_proto_rawDesc = nil
file_u_proto_im_friend_req_proto_goTypes = nil
file_u_proto_im_friend_req_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
// ImFriendServiceClient is the client API for ImFriendService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type ImFriendServiceClient interface {
All(ctx context.Context, in *ImFriendListReq, opts ...grpc.CallOption) (*ImFriendListReply, error)
Add(ctx context.Context, in *ImFriendAddReq, opts ...grpc.CallOption) (*ImFriendEmptyReply, error)
Update(ctx context.Context, in *ImFriendUpdateReq, opts ...grpc.CallOption) (*ImFriendEmptyReply, error)
}
type imFriendServiceClient struct {
cc grpc.ClientConnInterface
}
func NewImFriendServiceClient(cc grpc.ClientConnInterface) ImFriendServiceClient {
return &imFriendServiceClient{cc}
}
func (c *imFriendServiceClient) All(ctx context.Context, in *ImFriendListReq, opts ...grpc.CallOption) (*ImFriendListReply, error) {
out := new(ImFriendListReply)
err := c.cc.Invoke(ctx, "/pb.ImFriendService/All", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *imFriendServiceClient) Add(ctx context.Context, in *ImFriendAddReq, opts ...grpc.CallOption) (*ImFriendEmptyReply, error) {
out := new(ImFriendEmptyReply)
err := c.cc.Invoke(ctx, "/pb.ImFriendService/Add", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *imFriendServiceClient) Update(ctx context.Context, in *ImFriendUpdateReq, opts ...grpc.CallOption) (*ImFriendEmptyReply, error) {
out := new(ImFriendEmptyReply)
err := c.cc.Invoke(ctx, "/pb.ImFriendService/Update", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ImFriendServiceServer is the server API for ImFriendService service.
type ImFriendServiceServer interface {
All(context.Context, *ImFriendListReq) (*ImFriendListReply, error)
Add(context.Context, *ImFriendAddReq) (*ImFriendEmptyReply, error)
Update(context.Context, *ImFriendUpdateReq) (*ImFriendEmptyReply, error)
}
// UnimplementedImFriendServiceServer can be embedded to have forward compatible implementations.
type UnimplementedImFriendServiceServer struct {
}
func (*UnimplementedImFriendServiceServer) All(context.Context, *ImFriendListReq) (*ImFriendListReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method All not implemented")
}
func (*UnimplementedImFriendServiceServer) Add(context.Context, *ImFriendAddReq) (*ImFriendEmptyReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Add not implemented")
}
func (*UnimplementedImFriendServiceServer) Update(context.Context, *ImFriendUpdateReq) (*ImFriendEmptyReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Update not implemented")
}
func RegisterImFriendServiceServer(s *grpc.Server, srv ImFriendServiceServer) {
s.RegisterService(&_ImFriendService_serviceDesc, srv)
}
func _ImFriendService_All_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ImFriendListReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ImFriendServiceServer).All(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.ImFriendService/All",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ImFriendServiceServer).All(ctx, req.(*ImFriendListReq))
}
return interceptor(ctx, in, info, handler)
}
func _ImFriendService_Add_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ImFriendAddReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ImFriendServiceServer).Add(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.ImFriendService/Add",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ImFriendServiceServer).Add(ctx, req.(*ImFriendAddReq))
}
return interceptor(ctx, in, info, handler)
}
func _ImFriendService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ImFriendUpdateReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ImFriendServiceServer).Update(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.ImFriendService/Update",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ImFriendServiceServer).Update(ctx, req.(*ImFriendUpdateReq))
}
return interceptor(ctx, in, info, handler)
}
var _ImFriendService_serviceDesc = grpc.ServiceDesc{
ServiceName: "pb.ImFriendService",
HandlerType: (*ImFriendServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "All",
Handler: _ImFriendService_All_Handler,
},
{
MethodName: "Add",
Handler: _ImFriendService_Add_Handler,
},
{
MethodName: "Update",
Handler: _ImFriendService_Update_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "u-proto/im_friend_req.proto",
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: u-proto/im_friend_req.proto
package pb
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
_ "github.com/mwitkow/go-proto-validators"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
func (this *ImFriendAddReq) Validate() error {
if this.Common != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Common); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Common", err)
}
}
if this.Accid == "" {
return github_com_mwitkow_go_proto_validators.FieldError("Accid", fmt.Errorf(`value '%v' must not be an empty string`, this.Accid))
}
if this.Faccid == "" {
return github_com_mwitkow_go_proto_validators.FieldError("Faccid", fmt.Errorf(`value '%v' must not be an empty string`, this.Faccid))
}
return nil
}
func (this *ImFriendEmptyReply) Validate() error {
return nil
}
func (this *ImFriendUpdateReq) Validate() error {
if this.Common != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Common); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Common", err)
}
}
if !(this.Status > 0) {
return github_com_mwitkow_go_proto_validators.FieldError("Status", fmt.Errorf(`value '%v' must be greater than '0'`, this.Status))
}
if !(this.Status < 3) {
return github_com_mwitkow_go_proto_validators.FieldError("Status", fmt.Errorf(`value '%v' must be less than '3'`, this.Status))
}
return nil
}
func (this *ImFriendListReq) Validate() error {
if this.Common != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Common); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("Common", err)
}
}
if this.Accid == "" {
return github_com_mwitkow_go_proto_validators.FieldError("Accid", fmt.Errorf(`value '%v' must not be an empty string`, this.Accid))
}
return nil
}
func (this *ImFriendListOne) Validate() error {
return nil
}
func (this *ImFriendListReply) Validate() error {
for _, item := range this.List {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("List", err)
}
}
}
return nil
}
......@@ -587,7 +587,7 @@ var file_u_proto_im_user_relationship_proto_rawDesc = []byte{
0x52, 0x05, 0x41, 0x63, 0x63, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x06, 0x46, 0x61, 0x63, 0x63, 0x69,
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x58, 0x01, 0x52,
0x06, 0x46, 0x61, 0x63, 0x63, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18,
0x04, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x58, 0x01, 0x52, 0x04, 0x54,
0x04, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x10, 0x00, 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,
......@@ -627,9 +627,9 @@ var file_u_proto_im_user_relationship_proto_rawDesc = []byte{
0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x58, 0x01, 0x52, 0x09, 0x54,
0x61, 0x72, 0x67, 0x65, 0x74, 0x41, 0x63, 0x63, 0x12, 0x2a, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06,
0xe2, 0xdf, 0x1f, 0x02, 0x58, 0x01, 0x52, 0x0c, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0xe2, 0xdf, 0x1f, 0x02, 0x10, 0x00, 0x52, 0x0c, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20,
0x01, 0x28, 0x03, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x58, 0x01, 0x52, 0x05, 0x56, 0x61, 0x6c,
0x01, 0x28, 0x03, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x10, 0x00, 0x52, 0x05, 0x56, 0x61, 0x6c,
0x75, 0x65, 0x22, 0x5b, 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,
......
......@@ -5,10 +5,10 @@ package pb
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
_ "github.com/mwitkow/go-proto-validators"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
......@@ -28,6 +28,9 @@ func (this *UserRelationshipAddRequest) Validate() error {
if this.Faccid == "" {
return github_com_mwitkow_go_proto_validators.FieldError("Faccid", fmt.Errorf(`value '%v' must not be an empty string`, this.Faccid))
}
if !(this.Type > 0) {
return github_com_mwitkow_go_proto_validators.FieldError("Type", fmt.Errorf(`value '%v' must be greater than '0'`, this.Type))
}
return nil
}
func (this *UserRelationshipAddReply) Validate() error {
......@@ -86,6 +89,12 @@ func (this *SetSpecialRelationReq) Validate() error {
if this.TargetAcc == "" {
return github_com_mwitkow_go_proto_validators.FieldError("TargetAcc", fmt.Errorf(`value '%v' must not be an empty string`, this.TargetAcc))
}
if !(this.RelationType > 0) {
return github_com_mwitkow_go_proto_validators.FieldError("RelationType", fmt.Errorf(`value '%v' must be greater than '0'`, this.RelationType))
}
if !(this.Value > 0) {
return github_com_mwitkow_go_proto_validators.FieldError("Value", fmt.Errorf(`value '%v' must be greater than '0'`, this.Value))
}
return nil
}
func (this *ListBlackAndMuteListReq) Validate() error {
......
package im_friend_request
import (
"github.com/astaxie/beego/orm"
"im-microservice/db"
"im-microservice/helper"
"im-microservice/pb"
)
var (
table_name = "im_friend_request"
field_id = "id"
field_accid = "accid"
field_faccid = "faccid"
field_status = "status"
field_updatetime = "updatetime"
)
const(
field_status_wait = iota
field_status_agree
field_status_refuse
)
func All(accid string) ([]db.ImFriendRequest, error){
var list []db.ImFriendRequest
_, err := db.MysqlClient.QueryTable(table_name).Filter(field_accid, accid).
Filter(field_status, field_status_wait).All(&list)
return list, err
}
func FindExits(accid, faccid string) bool {
return db.MysqlClient.QueryTable(table_name).
Filter(field_accid, accid).
Filter(field_faccid, faccid).
Filter(field_status,field_status_wait).Exist()
}
func AddRecord(in *pb.ImFriendAddReq) error {
var (
db_friend db.ImFriendRequest
)
now := helper.GetNowTime()
db_friend.Faccid = in.Faccid
db_friend.Accid = in.Accid
db_friend.Status = field_status_wait
db_friend.Createtime = now
db_friend.Updatetime = now
_, err := db.MysqlClient.Insert(&db_friend)
return err
}
func Update(in *pb.ImFriendUpdateReq) error {
orm_params := make(orm.Params)
orm_params[field_status] = in.Status
orm_params[field_updatetime] = helper.GetNowTime()
_, err := db.MysqlClient.QueryTable(table_name).Filter(field_id, in.Id).Filter(field_status, field_status_wait).Update(orm_params)
return err
}
package im_friend_request
import (
"context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"im-microservice/pb"
"im-microservice/sevice/im_user"
"im-microservice/sevice/im_user_relationship"
)
type ImFriendService struct {
pb.UnimplementedImFriendServiceServer
}
func (fs *ImFriendService) All (ctx context.Context, in *pb.ImFriendListReq) (reply *pb.ImFriendListReply, err error) {
// 添加用户是否存在
if _,err = im_user.GetImUserByAccid(in.Accid); err != nil {
err = status.Error(codes.NotFound, "用户不存在")
return
}
results, err := All(in.Accid)
if err != nil {
return
}
reply = &pb.ImFriendListReply{}
if len(results) > 0 {
for _, v := range results {
reply.List = append(reply.List, &pb.ImFriendListOne{
Id: int64(v.Id),
Accid: v.Accid,
Faccid: v.Faccid,
Createtime: v.Createtime,
})
}
}
return
}
func (fs *ImFriendService) Add (ctx context.Context,in *pb.ImFriendAddReq) (reply *pb.ImFriendEmptyReply, err error) {
// 添加用户是否存在
if _,err = im_user.GetImUserByAccid(in.Accid); err != nil {
err = status.Error(codes.NotFound, "用户不存在")
return
}
// 被添加用户存在
if _, err = im_user.GetImUserByAccid(in.Faccid); err != nil {
err = status.Error(codes.NotFound, "被添加用户不存在")
return
}
//是否已经添加过好友
if ok := im_user_relationship.IsUserRelationship(in.Accid, in.Faccid); ok {
err = status.Error(codes.AlreadyExists, "已经添加过该好友")
return
}
//对方用户黑名单不能添加
if ok :=im_user_relationship.IsBlack(in.Accid, in.Faccid); ok {
err = status.Error(codes.AlreadyExists, "已经添加过该好友")
return
}
// 已经提过添加好友申请
if ok := FindExits(in.Accid, in.Faccid); ok {
err = status.Error(codes.AlreadyExists, "已经提交过申请")
return
}
if err = AddRecord(in); err != nil {
return
}
reply = &pb.ImFriendEmptyReply{}
return
}
func (fs *ImFriendService) Update(ctx context.Context, in *pb.ImFriendUpdateReq) (reply *pb.ImFriendEmptyReply, err error) {
if err = Update(in); err != nil {
err = status.Error(codes.Internal, err.Error())
return
}
reply = &pb.ImFriendEmptyReply{}
return
}
......@@ -32,8 +32,20 @@ func IsUserRelationship(accid, faccid string) bool {
Filter(db_field_faccid, faccid).Exist()
}
//是否是对方黑名单
func IsBlack(accid, faccid string) bool {
return db.MysqlClient.QueryTable(db_tabel).Filter(db_field_accid, faccid).
Filter(db_field_faccid, accid).Filter(db_field_blacklist, close).Exist()
}
func AddUserRelationship(in *pb.UserRelationshipAddRequest) error {
var us db.ImUserRelationship
var (
us db.ImUserRelationship
ts db.ImUserRelationship
)
// 发起者
now := helper.GetNowTime()
us.Accid = in.Accid
us.Faccid = in.Faccid
......@@ -44,6 +56,24 @@ func AddUserRelationship(in *pb.UserRelationshipAddRequest) error {
us.Mute = open
us.Createtime = now
_, err := db.MysqlClient.Insert(&us)
if ok := IsUserRelationship(in.Faccid, in.Accid); !ok {
// 被添加者
ts.Accid = in.Faccid
ts.Faccid = in.Accid
ts.Msg = in.Msg
ts.Type = int(in.Type)
ts.Updatetime = now
ts.Blacklist = open
ts.Mute = open
ts.Createtime = now
_, err1 := db.MysqlClient.Insert(&ts)
if err1 != nil {
return status.Error(codes.Internal, err.Error())
}
}
if err != nil {
err = status.Error(codes.Internal, err.Error())
}
......
......@@ -5,8 +5,8 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"im-microservice/sevice/im_user"
"im-microservice/sevice/im_user"
"im-microservice/helper"
"im-microservice/pb"
)
......@@ -18,10 +18,6 @@ type UserRelationshipService struct {
func (us *UserRelationshipService) Add(ctx context.Context,
in *pb.UserRelationshipAddRequest) (reply *pb.UserRelationshipAddReply, err error) {
if ok := IsUserRelationship(in.Accid, in.Faccid); ok {
err = status.Error(codes.AlreadyExists, "已经添加过该好友")
return
}
//添加好友
if err = AddUserRelationship(in); err != nil {
return
......@@ -31,6 +27,9 @@ func (us *UserRelationshipService) Add(ctx context.Context,
u_map["edition"] = helper.GetNowTime()
_, _ = im_user.UpdateImUser(in.Accid, u_map)
// 更改请求用户版本信息
_,_ = im_user.UpdateImUser(in.Faccid, u_map)
reply = &pb.UserRelationshipAddReply{}
return
}
......@@ -47,6 +46,9 @@ func (us *UserRelationshipService) Delete(ctx context.Context,
u_map["edition"] = helper.GetNowTime()
_, _ = im_user.UpdateImUser(in.Accid, u_map)
// 更改被添加用户版本信息
_,_ = im_user.UpdateImUser(in.Faccid, u_map)
reply = &pb.UserRelationshipAddReply{}
return
}
......
......@@ -19,7 +19,7 @@ message ConfigureRequest {
message ConfigureReply {}
message ConfigureDelRequest {
int64 CompanyUserId = 1 [(validator.field) = {string_not_empty: true}];
int64 CompanyUserId = 1 [(validator.field) = {int_gt: 0}];
Common Common = 2;
}
......
......@@ -20,7 +20,7 @@ message ChatRoomAddReply{
// 更新聊天室
message ChatRoomUpdateRequest {
Common Common = 1;
int64 RoomId = 2 [(validator.field) = {string_not_empty: true}];
int64 RoomId = 2 [(validator.field) = {int_gt: 0}];
string Name = 3;
int64 Status = 4;
string Announcement = 5;
......@@ -31,7 +31,7 @@ message ChatRoomUpdateReply {}
// 删除聊天室
message ChatRoomDelRequest {
Common Common = 1;
int64 RoomId = 2 [(validator.field) = {string_not_empty: true}];
int64 RoomId = 2 [(validator.field) = {int_gt: 0}];
}
message ChatRoomDelReply {}
......@@ -39,7 +39,7 @@ message ChatRoomDelReply {}
// 获取单个聊天室信息
message ChatRoomInfoRequest {
Common Common = 1;
int64 RoomId = 2 [(validator.field) = {string_not_empty: true}];
int64 RoomId = 2 [(validator.field) = {int_gt: 0}];
}
message ChatRoomInfoReply {
......
syntax = "proto3";
package pb;
import "u-proto/common.proto";
import "github.com/mwitkow/go-proto-validators/validator.proto";
// 发起添加好友申请
message ImFriendAddReq {
Common Common = 1;
string Accid = 2 [(validator.field) = {string_not_empty: true}];
string Faccid = 3 [(validator.field) = {string_not_empty: true}];
}
message ImFriendEmptyReply {}
// 更改添加好友状态
message ImFriendUpdateReq {
Common Common = 1;
int64 Id = 2 [(validator.field) = {string_not_empty: true}];
int64 Status = 3 [(validator.field) = {int_gt: 0, int_lt:3}];
}
// 获取申请好友列表
message ImFriendListReq {
Common Common = 1;
string Accid = 2 [(validator.field) = {string_not_empty: true}];
}
message ImFriendListOne {
int64 Id = 1;
string Accid = 2;
string Faccid = 3;
string Createtime = 4;
}
message ImFriendListReply {
repeated ImFriendListOne List = 1;
}
service ImFriendService {
rpc All(ImFriendListReq) returns(ImFriendListReply) {}
rpc Add(ImFriendAddReq) returns(ImFriendEmptyReply) {}
rpc Update(ImFriendUpdateReq) returns(ImFriendEmptyReply) {}
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ message UserRelationshipAddRequest {
Common Common = 1;
string Accid = 2 [(validator.field) = {string_not_empty: true}];
string Faccid = 3 [(validator.field) = {string_not_empty: true}];
int64 Type = 4 [(validator.field) = {string_not_empty: true}];
int64 Type = 4 [(validator.field) = {int_gt: 0}];
string Msg = 5;
}
......@@ -45,8 +45,8 @@ message SetSpecialRelationReq {
Common Common = 1;
string Accid = 2 [(validator.field) = {string_not_empty: true}];
string TargetAcc = 3 [(validator.field) = {string_not_empty: true}];
int64 RelationType = 4 [(validator.field) = {string_not_empty: true}];
int64 Value = 5 [(validator.field) = {string_not_empty: true}];
int64 RelationType = 4 [(validator.field) = {int_gt: 0}];
int64 Value = 5 [(validator.field) = {int_gt: 0}];
}
//查看指定用户的黑名单和静音列表
......
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