management system add api

This commit is contained in:
Gordon 2021-09-26 14:26:45 +08:00
parent 98ed0234fc
commit b27fc2ba35
18 changed files with 275 additions and 174 deletions

View File

@ -116,8 +116,10 @@ push:
android: android:
accessID: 111 accessID: 111
secretKey: 111 secretKey: 111
manager:
appManagerUid: ["openIM123456","openIM654321"]
secrets: ["openIM1","openIM2"]
appmanageruid: "openIM123456"
secret: tuoyun secret: tuoyun
multiloginpolicy: multiloginpolicy:

View File

@ -66,10 +66,6 @@ func UserSendMsg(c *gin.Context) {
} }
token := c.Request.Header.Get("token") token := c.Request.Header.Get("token")
if !utils.VerifyToken(token, params.SendID) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
return
}
log.InfoByKv("Ws call success to sendMsgReq", params.OperationID, "Parameters", params) log.InfoByKv("Ws call success to sendMsgReq", params.OperationID, "Parameters", params)

View File

@ -12,9 +12,9 @@ import (
) )
type paramsImportFriendReq struct { type paramsImportFriendReq struct {
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
UID string `json:"uid" binding:"required"` UIDList []string `json:"uidList" binding:"required"`
OwnerUid string `json:"ownerUid"` OwnerUid string `json:"ownerUid" binding:"required"`
} }
type paramsAddFriend struct { type paramsAddFriend struct {
@ -36,20 +36,19 @@ func ImportFriend(c *gin.Context) {
return return
} }
req := &pbFriend.ImportFriendReq{ req := &pbFriend.ImportFriendReq{
Uid: params.UID, UidList: params.UIDList,
OperationID: params.OperationID, OperationID: params.OperationID,
OwnerUid: params.OwnerUid, OwnerUid: params.OwnerUid,
Token: c.Request.Header.Get("token"), Token: c.Request.Header.Get("token"),
} }
log.Info(req.Token, req.OperationID, "api add friend is server")
RpcResp, err := client.ImportFriend(context.Background(), req) RpcResp, err := client.ImportFriend(context.Background(), req)
if err != nil { if err != nil {
log.Error(req.Token, req.OperationID, "err=%s,ImportFriend failed", err) log.Error(req.Token, req.OperationID, "err=%s,ImportFriend failed", err)
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "cImportFriend failed"}) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "cImportFriend failed" + err.Error()})
return return
} }
log.InfoByArgs("ImportFriend success,args=%s", RpcResp.String()) log.InfoByArgs("ImportFriend success,args=%s", RpcResp.String())
resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg} resp := gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": RpcResp.FailedUidList}
c.JSON(http.StatusOK, resp) c.JSON(http.StatusOK, resp)
log.InfoByArgs("ImportFriend success return,get args=%s,return args=%s", req.String(), RpcResp.String()) log.InfoByArgs("ImportFriend success return,get args=%s,return args=%s", req.String(), RpcResp.String())
} }

View File

@ -13,7 +13,7 @@ import (
) )
type InviteUserToGroupReq struct { type InviteUserToGroupReq struct {
GroupID string `json:"groupID"` GroupID string `json:"groupID" binding:"required"`
UidList []string `json:"uidList" binding:"required"` UidList []string `json:"uidList" binding:"required"`
Reason string `json:"reason"` Reason string `json:"reason"`
OperationID string `json:"operationID" binding:"required"` OperationID string `json:"operationID" binding:"required"`
@ -46,6 +46,7 @@ func KickGroupMember(c *gin.Context) {
OperationID: params.OperationID, OperationID: params.OperationID,
GroupID: params.GroupID, GroupID: params.GroupID,
Token: c.Request.Header.Get("token"), Token: c.Request.Header.Get("token"),
UidListInfo: params.UidListInfo, UidListInfo: params.UidListInfo,
} }
log.Info(req.Token, req.OperationID, "recv req: ", req.String()) log.Info(req.Token, req.OperationID, "recv req: ", req.String())

View File

@ -103,9 +103,10 @@ func ManagementSendMsg(c *gin.Context) {
} }
token := c.Request.Header.Get("token") token := c.Request.Header.Get("token")
if !utils.VerifyToken(token, config.Config.AppManagerUid) { if !utils.IsContain(params.SendID, config.Config.Manager.AppManagerUid) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err,not authorized", "sendTime": 0, "MsgID": ""}) c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "not appManager", "sendTime": 0, "MsgID": ""})
return return
} }
log.InfoByKv("Ws call success to ManagementSendMsgReq", params.OperationID, "Parameters", params) log.InfoByKv("Ws call success to ManagementSendMsgReq", params.OperationID, "Parameters", params)

View File

@ -86,6 +86,7 @@ func main() {
chatGroup.POST("/pull_msg", apiChat.UserPullMsg) chatGroup.POST("/pull_msg", apiChat.UserPullMsg)
chatGroup.POST("/send_msg", apiChat.UserSendMsg) chatGroup.POST("/send_msg", apiChat.UserSendMsg)
} }
//Manager
managementGroup := r.Group("/manager") managementGroup := r.Group("/manager")
{ {
managementGroup.POST("/delete_user", manage.DeleteUser) managementGroup.POST("/delete_user", manage.DeleteUser)

View File

@ -108,7 +108,10 @@ type config struct {
} }
} }
} }
Manager struct {
AppManagerUid []string `yaml:"appManagerUid"`
Secrets []string `yaml:"secrets"`
}
Kafka struct { Kafka struct {
Ws2mschat struct { Ws2mschat struct {
Addr []string `yaml:"addr"` Addr []string `yaml:"addr"`
@ -124,9 +127,7 @@ type config struct {
MsgToPush string `yaml:"msgToPush"` MsgToPush string `yaml:"msgToPush"`
} }
} }
AppManagerUid string Secret string `yaml:"secret"`
Secret string
MultiLoginPolicy struct { MultiLoginPolicy struct {
OnlyOneTerminalAccess bool `yaml:"onlyOneTerminalAccess"` OnlyOneTerminalAccess bool `yaml:"onlyOneTerminalAccess"`
MobileAndPCTerminalAccessButOtherTerminalKickEachOther bool `yaml:"mobileAndPCTerminalAccessButOtherTerminalKickEachOther"` MobileAndPCTerminalAccessButOtherTerminalKickEachOther bool `yaml:"mobileAndPCTerminalAccessButOtherTerminalKickEachOther"`

View File

@ -69,3 +69,5 @@ var ContentType2PushContent = map[int64]string{
Video: "[video]", Video: "[video]",
File: "[file]", File: "[file]",
} }
const FriendAcceptTip = "You have successfully become friends, so start chatting"

View File

@ -1,12 +1,28 @@
package im_mysql_model package im_mysql_model
import ( import (
"Open_IM/src/common/config"
"Open_IM/src/common/db" "Open_IM/src/common/db"
pbAuth "Open_IM/src/proto/auth" pbAuth "Open_IM/src/proto/auth"
"Open_IM/src/utils"
_ "github.com/jinzhu/gorm/dialects/mysql" _ "github.com/jinzhu/gorm/dialects/mysql"
"time" "time"
) )
func init() {
//init managers
var pb pbAuth.UserRegisterReq
for k, v := range config.Config.Manager.AppManagerUid {
if !IsExistUser(v) {
pb.UID = v
pb.Name = "AppManager" + utils.IntToString(k+1)
err := UserRegister(&pb)
if err != nil {
panic(err)
}
}
}
}
func UserRegister(pb *pbAuth.UserRegisterReq) error { func UserRegister(pb *pbAuth.UserRegisterReq) error {
dbConn, err := db.DB.MysqlDB.DefaultGormDB() dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil { if err != nil {
@ -113,3 +129,19 @@ func SelectAllUID() ([]string, error) {
} }
return uid, nil return uid, nil
} }
func IsExistUser(uid string) bool {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return false
}
var number int32
err = dbConn.Raw("select count(*) from `user` where uid = ?", uid).Count(&number).Error
if err != nil {
return false
}
if number != 1 {
return false
}
return true
}

View File

@ -35,7 +35,7 @@ func (m *CommonResp) Reset() { *m = CommonResp{} }
func (m *CommonResp) String() string { return proto.CompactTextString(m) } func (m *CommonResp) String() string { return proto.CompactTextString(m) }
func (*CommonResp) ProtoMessage() {} func (*CommonResp) ProtoMessage() {}
func (*CommonResp) Descriptor() ([]byte, []int) { func (*CommonResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{0} return fileDescriptor_friend_05873114bd399886, []int{0}
} }
func (m *CommonResp) XXX_Unmarshal(b []byte) error { func (m *CommonResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CommonResp.Unmarshal(m, b) return xxx_messageInfo_CommonResp.Unmarshal(m, b)
@ -82,7 +82,7 @@ func (m *GetFriendsInfoReq) Reset() { *m = GetFriendsInfoReq{} }
func (m *GetFriendsInfoReq) String() string { return proto.CompactTextString(m) } func (m *GetFriendsInfoReq) String() string { return proto.CompactTextString(m) }
func (*GetFriendsInfoReq) ProtoMessage() {} func (*GetFriendsInfoReq) ProtoMessage() {}
func (*GetFriendsInfoReq) Descriptor() ([]byte, []int) { func (*GetFriendsInfoReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{1} return fileDescriptor_friend_05873114bd399886, []int{1}
} }
func (m *GetFriendsInfoReq) XXX_Unmarshal(b []byte) error { func (m *GetFriendsInfoReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetFriendsInfoReq.Unmarshal(m, b) return xxx_messageInfo_GetFriendsInfoReq.Unmarshal(m, b)
@ -136,7 +136,7 @@ func (m *GetFriendInfoResp) Reset() { *m = GetFriendInfoResp{} }
func (m *GetFriendInfoResp) String() string { return proto.CompactTextString(m) } func (m *GetFriendInfoResp) String() string { return proto.CompactTextString(m) }
func (*GetFriendInfoResp) ProtoMessage() {} func (*GetFriendInfoResp) ProtoMessage() {}
func (*GetFriendInfoResp) Descriptor() ([]byte, []int) { func (*GetFriendInfoResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{2} return fileDescriptor_friend_05873114bd399886, []int{2}
} }
func (m *GetFriendInfoResp) XXX_Unmarshal(b []byte) error { func (m *GetFriendInfoResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetFriendInfoResp.Unmarshal(m, b) return xxx_messageInfo_GetFriendInfoResp.Unmarshal(m, b)
@ -198,7 +198,7 @@ func (m *GetFriendData) Reset() { *m = GetFriendData{} }
func (m *GetFriendData) String() string { return proto.CompactTextString(m) } func (m *GetFriendData) String() string { return proto.CompactTextString(m) }
func (*GetFriendData) ProtoMessage() {} func (*GetFriendData) ProtoMessage() {}
func (*GetFriendData) Descriptor() ([]byte, []int) { func (*GetFriendData) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{3} return fileDescriptor_friend_05873114bd399886, []int{3}
} }
func (m *GetFriendData) XXX_Unmarshal(b []byte) error { func (m *GetFriendData) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetFriendData.Unmarshal(m, b) return xxx_messageInfo_GetFriendData.Unmarshal(m, b)
@ -309,7 +309,7 @@ func (m *AddFriendReq) Reset() { *m = AddFriendReq{} }
func (m *AddFriendReq) String() string { return proto.CompactTextString(m) } func (m *AddFriendReq) String() string { return proto.CompactTextString(m) }
func (*AddFriendReq) ProtoMessage() {} func (*AddFriendReq) ProtoMessage() {}
func (*AddFriendReq) Descriptor() ([]byte, []int) { func (*AddFriendReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{4} return fileDescriptor_friend_05873114bd399886, []int{4}
} }
func (m *AddFriendReq) XXX_Unmarshal(b []byte) error { func (m *AddFriendReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AddFriendReq.Unmarshal(m, b) return xxx_messageInfo_AddFriendReq.Unmarshal(m, b)
@ -358,7 +358,7 @@ func (m *AddFriendReq) GetReqMessage() string {
} }
type ImportFriendReq struct { type ImportFriendReq struct {
Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` UidList []string `protobuf:"bytes,1,rep,name=uidList" json:"uidList,omitempty"`
OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"`
Token string `protobuf:"bytes,3,opt,name=Token" json:"Token,omitempty"` Token string `protobuf:"bytes,3,opt,name=Token" json:"Token,omitempty"`
OwnerUid string `protobuf:"bytes,4,opt,name=OwnerUid" json:"OwnerUid,omitempty"` OwnerUid string `protobuf:"bytes,4,opt,name=OwnerUid" json:"OwnerUid,omitempty"`
@ -371,7 +371,7 @@ func (m *ImportFriendReq) Reset() { *m = ImportFriendReq{} }
func (m *ImportFriendReq) String() string { return proto.CompactTextString(m) } func (m *ImportFriendReq) String() string { return proto.CompactTextString(m) }
func (*ImportFriendReq) ProtoMessage() {} func (*ImportFriendReq) ProtoMessage() {}
func (*ImportFriendReq) Descriptor() ([]byte, []int) { func (*ImportFriendReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{5} return fileDescriptor_friend_05873114bd399886, []int{5}
} }
func (m *ImportFriendReq) XXX_Unmarshal(b []byte) error { func (m *ImportFriendReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ImportFriendReq.Unmarshal(m, b) return xxx_messageInfo_ImportFriendReq.Unmarshal(m, b)
@ -391,11 +391,11 @@ func (m *ImportFriendReq) XXX_DiscardUnknown() {
var xxx_messageInfo_ImportFriendReq proto.InternalMessageInfo var xxx_messageInfo_ImportFriendReq proto.InternalMessageInfo
func (m *ImportFriendReq) GetUid() string { func (m *ImportFriendReq) GetUidList() []string {
if m != nil { if m != nil {
return m.Uid return m.UidList
} }
return "" return nil
} }
func (m *ImportFriendReq) GetOperationID() string { func (m *ImportFriendReq) GetOperationID() string {
@ -419,6 +419,52 @@ func (m *ImportFriendReq) GetOwnerUid() string {
return "" return ""
} }
type ImportFriendResp struct {
CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"`
FailedUidList []string `protobuf:"bytes,2,rep,name=failedUidList" json:"failedUidList,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ImportFriendResp) Reset() { *m = ImportFriendResp{} }
func (m *ImportFriendResp) String() string { return proto.CompactTextString(m) }
func (*ImportFriendResp) ProtoMessage() {}
func (*ImportFriendResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_05873114bd399886, []int{6}
}
func (m *ImportFriendResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ImportFriendResp.Unmarshal(m, b)
}
func (m *ImportFriendResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ImportFriendResp.Marshal(b, m, deterministic)
}
func (dst *ImportFriendResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_ImportFriendResp.Merge(dst, src)
}
func (m *ImportFriendResp) XXX_Size() int {
return xxx_messageInfo_ImportFriendResp.Size(m)
}
func (m *ImportFriendResp) XXX_DiscardUnknown() {
xxx_messageInfo_ImportFriendResp.DiscardUnknown(m)
}
var xxx_messageInfo_ImportFriendResp proto.InternalMessageInfo
func (m *ImportFriendResp) GetCommonResp() *CommonResp {
if m != nil {
return m.CommonResp
}
return nil
}
func (m *ImportFriendResp) GetFailedUidList() []string {
if m != nil {
return m.FailedUidList
}
return nil
}
type GetFriendApplyReq struct { type GetFriendApplyReq struct {
OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"`
Token string `protobuf:"bytes,2,opt,name=Token" json:"Token,omitempty"` Token string `protobuf:"bytes,2,opt,name=Token" json:"Token,omitempty"`
@ -431,7 +477,7 @@ func (m *GetFriendApplyReq) Reset() { *m = GetFriendApplyReq{} }
func (m *GetFriendApplyReq) String() string { return proto.CompactTextString(m) } func (m *GetFriendApplyReq) String() string { return proto.CompactTextString(m) }
func (*GetFriendApplyReq) ProtoMessage() {} func (*GetFriendApplyReq) ProtoMessage() {}
func (*GetFriendApplyReq) Descriptor() ([]byte, []int) { func (*GetFriendApplyReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{6} return fileDescriptor_friend_05873114bd399886, []int{7}
} }
func (m *GetFriendApplyReq) XXX_Unmarshal(b []byte) error { func (m *GetFriendApplyReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetFriendApplyReq.Unmarshal(m, b) return xxx_messageInfo_GetFriendApplyReq.Unmarshal(m, b)
@ -478,7 +524,7 @@ func (m *GetFriendApplyResp) Reset() { *m = GetFriendApplyResp{} }
func (m *GetFriendApplyResp) String() string { return proto.CompactTextString(m) } func (m *GetFriendApplyResp) String() string { return proto.CompactTextString(m) }
func (*GetFriendApplyResp) ProtoMessage() {} func (*GetFriendApplyResp) ProtoMessage() {}
func (*GetFriendApplyResp) Descriptor() ([]byte, []int) { func (*GetFriendApplyResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{7} return fileDescriptor_friend_05873114bd399886, []int{8}
} }
func (m *GetFriendApplyResp) XXX_Unmarshal(b []byte) error { func (m *GetFriendApplyResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetFriendApplyResp.Unmarshal(m, b) return xxx_messageInfo_GetFriendApplyResp.Unmarshal(m, b)
@ -540,7 +586,7 @@ func (m *ApplyUserInfo) Reset() { *m = ApplyUserInfo{} }
func (m *ApplyUserInfo) String() string { return proto.CompactTextString(m) } func (m *ApplyUserInfo) String() string { return proto.CompactTextString(m) }
func (*ApplyUserInfo) ProtoMessage() {} func (*ApplyUserInfo) ProtoMessage() {}
func (*ApplyUserInfo) Descriptor() ([]byte, []int) { func (*ApplyUserInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{8} return fileDescriptor_friend_05873114bd399886, []int{9}
} }
func (m *ApplyUserInfo) XXX_Unmarshal(b []byte) error { func (m *ApplyUserInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ApplyUserInfo.Unmarshal(m, b) return xxx_messageInfo_ApplyUserInfo.Unmarshal(m, b)
@ -649,7 +695,7 @@ func (m *GetFriendListReq) Reset() { *m = GetFriendListReq{} }
func (m *GetFriendListReq) String() string { return proto.CompactTextString(m) } func (m *GetFriendListReq) String() string { return proto.CompactTextString(m) }
func (*GetFriendListReq) ProtoMessage() {} func (*GetFriendListReq) ProtoMessage() {}
func (*GetFriendListReq) Descriptor() ([]byte, []int) { func (*GetFriendListReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{9} return fileDescriptor_friend_05873114bd399886, []int{10}
} }
func (m *GetFriendListReq) XXX_Unmarshal(b []byte) error { func (m *GetFriendListReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetFriendListReq.Unmarshal(m, b) return xxx_messageInfo_GetFriendListReq.Unmarshal(m, b)
@ -696,7 +742,7 @@ func (m *GetFriendListResp) Reset() { *m = GetFriendListResp{} }
func (m *GetFriendListResp) String() string { return proto.CompactTextString(m) } func (m *GetFriendListResp) String() string { return proto.CompactTextString(m) }
func (*GetFriendListResp) ProtoMessage() {} func (*GetFriendListResp) ProtoMessage() {}
func (*GetFriendListResp) Descriptor() ([]byte, []int) { func (*GetFriendListResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{10} return fileDescriptor_friend_05873114bd399886, []int{11}
} }
func (m *GetFriendListResp) XXX_Unmarshal(b []byte) error { func (m *GetFriendListResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetFriendListResp.Unmarshal(m, b) return xxx_messageInfo_GetFriendListResp.Unmarshal(m, b)
@ -757,7 +803,7 @@ func (m *UserInfo) Reset() { *m = UserInfo{} }
func (m *UserInfo) String() string { return proto.CompactTextString(m) } func (m *UserInfo) String() string { return proto.CompactTextString(m) }
func (*UserInfo) ProtoMessage() {} func (*UserInfo) ProtoMessage() {}
func (*UserInfo) Descriptor() ([]byte, []int) { func (*UserInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{11} return fileDescriptor_friend_05873114bd399886, []int{12}
} }
func (m *UserInfo) XXX_Unmarshal(b []byte) error { func (m *UserInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UserInfo.Unmarshal(m, b) return xxx_messageInfo_UserInfo.Unmarshal(m, b)
@ -861,7 +907,7 @@ func (m *AddBlacklistReq) Reset() { *m = AddBlacklistReq{} }
func (m *AddBlacklistReq) String() string { return proto.CompactTextString(m) } func (m *AddBlacklistReq) String() string { return proto.CompactTextString(m) }
func (*AddBlacklistReq) ProtoMessage() {} func (*AddBlacklistReq) ProtoMessage() {}
func (*AddBlacklistReq) Descriptor() ([]byte, []int) { func (*AddBlacklistReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{12} return fileDescriptor_friend_05873114bd399886, []int{13}
} }
func (m *AddBlacklistReq) XXX_Unmarshal(b []byte) error { func (m *AddBlacklistReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AddBlacklistReq.Unmarshal(m, b) return xxx_messageInfo_AddBlacklistReq.Unmarshal(m, b)
@ -922,7 +968,7 @@ func (m *RemoveBlacklistReq) Reset() { *m = RemoveBlacklistReq{} }
func (m *RemoveBlacklistReq) String() string { return proto.CompactTextString(m) } func (m *RemoveBlacklistReq) String() string { return proto.CompactTextString(m) }
func (*RemoveBlacklistReq) ProtoMessage() {} func (*RemoveBlacklistReq) ProtoMessage() {}
func (*RemoveBlacklistReq) Descriptor() ([]byte, []int) { func (*RemoveBlacklistReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{13} return fileDescriptor_friend_05873114bd399886, []int{14}
} }
func (m *RemoveBlacklistReq) XXX_Unmarshal(b []byte) error { func (m *RemoveBlacklistReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RemoveBlacklistReq.Unmarshal(m, b) return xxx_messageInfo_RemoveBlacklistReq.Unmarshal(m, b)
@ -975,7 +1021,7 @@ func (m *GetBlacklistReq) Reset() { *m = GetBlacklistReq{} }
func (m *GetBlacklistReq) String() string { return proto.CompactTextString(m) } func (m *GetBlacklistReq) String() string { return proto.CompactTextString(m) }
func (*GetBlacklistReq) ProtoMessage() {} func (*GetBlacklistReq) ProtoMessage() {}
func (*GetBlacklistReq) Descriptor() ([]byte, []int) { func (*GetBlacklistReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{14} return fileDescriptor_friend_05873114bd399886, []int{15}
} }
func (m *GetBlacklistReq) XXX_Unmarshal(b []byte) error { func (m *GetBlacklistReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetBlacklistReq.Unmarshal(m, b) return xxx_messageInfo_GetBlacklistReq.Unmarshal(m, b)
@ -1022,7 +1068,7 @@ func (m *GetBlacklistResp) Reset() { *m = GetBlacklistResp{} }
func (m *GetBlacklistResp) String() string { return proto.CompactTextString(m) } func (m *GetBlacklistResp) String() string { return proto.CompactTextString(m) }
func (*GetBlacklistResp) ProtoMessage() {} func (*GetBlacklistResp) ProtoMessage() {}
func (*GetBlacklistResp) Descriptor() ([]byte, []int) { func (*GetBlacklistResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{15} return fileDescriptor_friend_05873114bd399886, []int{16}
} }
func (m *GetBlacklistResp) XXX_Unmarshal(b []byte) error { func (m *GetBlacklistResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetBlacklistResp.Unmarshal(m, b) return xxx_messageInfo_GetBlacklistResp.Unmarshal(m, b)
@ -1076,7 +1122,7 @@ func (m *IsFriendReq) Reset() { *m = IsFriendReq{} }
func (m *IsFriendReq) String() string { return proto.CompactTextString(m) } func (m *IsFriendReq) String() string { return proto.CompactTextString(m) }
func (*IsFriendReq) ProtoMessage() {} func (*IsFriendReq) ProtoMessage() {}
func (*IsFriendReq) Descriptor() ([]byte, []int) { func (*IsFriendReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{16} return fileDescriptor_friend_05873114bd399886, []int{17}
} }
func (m *IsFriendReq) XXX_Unmarshal(b []byte) error { func (m *IsFriendReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_IsFriendReq.Unmarshal(m, b) return xxx_messageInfo_IsFriendReq.Unmarshal(m, b)
@ -1130,7 +1176,7 @@ func (m *IsFriendResp) Reset() { *m = IsFriendResp{} }
func (m *IsFriendResp) String() string { return proto.CompactTextString(m) } func (m *IsFriendResp) String() string { return proto.CompactTextString(m) }
func (*IsFriendResp) ProtoMessage() {} func (*IsFriendResp) ProtoMessage() {}
func (*IsFriendResp) Descriptor() ([]byte, []int) { func (*IsFriendResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{17} return fileDescriptor_friend_05873114bd399886, []int{18}
} }
func (m *IsFriendResp) XXX_Unmarshal(b []byte) error { func (m *IsFriendResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_IsFriendResp.Unmarshal(m, b) return xxx_messageInfo_IsFriendResp.Unmarshal(m, b)
@ -1184,7 +1230,7 @@ func (m *IsInBlackListReq) Reset() { *m = IsInBlackListReq{} }
func (m *IsInBlackListReq) String() string { return proto.CompactTextString(m) } func (m *IsInBlackListReq) String() string { return proto.CompactTextString(m) }
func (*IsInBlackListReq) ProtoMessage() {} func (*IsInBlackListReq) ProtoMessage() {}
func (*IsInBlackListReq) Descriptor() ([]byte, []int) { func (*IsInBlackListReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{18} return fileDescriptor_friend_05873114bd399886, []int{19}
} }
func (m *IsInBlackListReq) XXX_Unmarshal(b []byte) error { func (m *IsInBlackListReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_IsInBlackListReq.Unmarshal(m, b) return xxx_messageInfo_IsInBlackListReq.Unmarshal(m, b)
@ -1238,7 +1284,7 @@ func (m *IsInBlackListResp) Reset() { *m = IsInBlackListResp{} }
func (m *IsInBlackListResp) String() string { return proto.CompactTextString(m) } func (m *IsInBlackListResp) String() string { return proto.CompactTextString(m) }
func (*IsInBlackListResp) ProtoMessage() {} func (*IsInBlackListResp) ProtoMessage() {}
func (*IsInBlackListResp) Descriptor() ([]byte, []int) { func (*IsInBlackListResp) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{19} return fileDescriptor_friend_05873114bd399886, []int{20}
} }
func (m *IsInBlackListResp) XXX_Unmarshal(b []byte) error { func (m *IsInBlackListResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_IsInBlackListResp.Unmarshal(m, b) return xxx_messageInfo_IsInBlackListResp.Unmarshal(m, b)
@ -1292,7 +1338,7 @@ func (m *DeleteFriendReq) Reset() { *m = DeleteFriendReq{} }
func (m *DeleteFriendReq) String() string { return proto.CompactTextString(m) } func (m *DeleteFriendReq) String() string { return proto.CompactTextString(m) }
func (*DeleteFriendReq) ProtoMessage() {} func (*DeleteFriendReq) ProtoMessage() {}
func (*DeleteFriendReq) Descriptor() ([]byte, []int) { func (*DeleteFriendReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{20} return fileDescriptor_friend_05873114bd399886, []int{21}
} }
func (m *DeleteFriendReq) XXX_Unmarshal(b []byte) error { func (m *DeleteFriendReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteFriendReq.Unmarshal(m, b) return xxx_messageInfo_DeleteFriendReq.Unmarshal(m, b)
@ -1347,7 +1393,7 @@ func (m *AddFriendResponseReq) Reset() { *m = AddFriendResponseReq{} }
func (m *AddFriendResponseReq) String() string { return proto.CompactTextString(m) } func (m *AddFriendResponseReq) String() string { return proto.CompactTextString(m) }
func (*AddFriendResponseReq) ProtoMessage() {} func (*AddFriendResponseReq) ProtoMessage() {}
func (*AddFriendResponseReq) Descriptor() ([]byte, []int) { func (*AddFriendResponseReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{21} return fileDescriptor_friend_05873114bd399886, []int{22}
} }
func (m *AddFriendResponseReq) XXX_Unmarshal(b []byte) error { func (m *AddFriendResponseReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AddFriendResponseReq.Unmarshal(m, b) return xxx_messageInfo_AddFriendResponseReq.Unmarshal(m, b)
@ -1409,7 +1455,7 @@ func (m *SetFriendCommentReq) Reset() { *m = SetFriendCommentReq{} }
func (m *SetFriendCommentReq) String() string { return proto.CompactTextString(m) } func (m *SetFriendCommentReq) String() string { return proto.CompactTextString(m) }
func (*SetFriendCommentReq) ProtoMessage() {} func (*SetFriendCommentReq) ProtoMessage() {}
func (*SetFriendCommentReq) Descriptor() ([]byte, []int) { func (*SetFriendCommentReq) Descriptor() ([]byte, []int) {
return fileDescriptor_friend_17d6a40c7694c30a, []int{22} return fileDescriptor_friend_05873114bd399886, []int{23}
} }
func (m *SetFriendCommentReq) XXX_Unmarshal(b []byte) error { func (m *SetFriendCommentReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SetFriendCommentReq.Unmarshal(m, b) return xxx_messageInfo_SetFriendCommentReq.Unmarshal(m, b)
@ -1464,6 +1510,7 @@ func init() {
proto.RegisterType((*GetFriendData)(nil), "friend.GetFriendData") proto.RegisterType((*GetFriendData)(nil), "friend.GetFriendData")
proto.RegisterType((*AddFriendReq)(nil), "friend.AddFriendReq") proto.RegisterType((*AddFriendReq)(nil), "friend.AddFriendReq")
proto.RegisterType((*ImportFriendReq)(nil), "friend.ImportFriendReq") proto.RegisterType((*ImportFriendReq)(nil), "friend.ImportFriendReq")
proto.RegisterType((*ImportFriendResp)(nil), "friend.ImportFriendResp")
proto.RegisterType((*GetFriendApplyReq)(nil), "friend.GetFriendApplyReq") proto.RegisterType((*GetFriendApplyReq)(nil), "friend.GetFriendApplyReq")
proto.RegisterType((*GetFriendApplyResp)(nil), "friend.GetFriendApplyResp") proto.RegisterType((*GetFriendApplyResp)(nil), "friend.GetFriendApplyResp")
proto.RegisterType((*ApplyUserInfo)(nil), "friend.ApplyUserInfo") proto.RegisterType((*ApplyUserInfo)(nil), "friend.ApplyUserInfo")
@ -1507,7 +1554,7 @@ type FriendClient interface {
DeleteFriend(ctx context.Context, in *DeleteFriendReq, opts ...grpc.CallOption) (*CommonResp, error) DeleteFriend(ctx context.Context, in *DeleteFriendReq, opts ...grpc.CallOption) (*CommonResp, error)
AddFriendResponse(ctx context.Context, in *AddFriendResponseReq, opts ...grpc.CallOption) (*CommonResp, error) AddFriendResponse(ctx context.Context, in *AddFriendResponseReq, opts ...grpc.CallOption) (*CommonResp, error)
SetFriendComment(ctx context.Context, in *SetFriendCommentReq, opts ...grpc.CallOption) (*CommonResp, error) SetFriendComment(ctx context.Context, in *SetFriendCommentReq, opts ...grpc.CallOption) (*CommonResp, error)
ImportFriend(ctx context.Context, in *ImportFriendReq, opts ...grpc.CallOption) (*CommonResp, error) ImportFriend(ctx context.Context, in *ImportFriendReq, opts ...grpc.CallOption) (*ImportFriendResp, error)
} }
type friendClient struct { type friendClient struct {
@ -1635,8 +1682,8 @@ func (c *friendClient) SetFriendComment(ctx context.Context, in *SetFriendCommen
return out, nil return out, nil
} }
func (c *friendClient) ImportFriend(ctx context.Context, in *ImportFriendReq, opts ...grpc.CallOption) (*CommonResp, error) { func (c *friendClient) ImportFriend(ctx context.Context, in *ImportFriendReq, opts ...grpc.CallOption) (*ImportFriendResp, error) {
out := new(CommonResp) out := new(ImportFriendResp)
err := grpc.Invoke(ctx, "/friend.friend/ImportFriend", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/friend.friend/ImportFriend", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -1660,7 +1707,7 @@ type FriendServer interface {
DeleteFriend(context.Context, *DeleteFriendReq) (*CommonResp, error) DeleteFriend(context.Context, *DeleteFriendReq) (*CommonResp, error)
AddFriendResponse(context.Context, *AddFriendResponseReq) (*CommonResp, error) AddFriendResponse(context.Context, *AddFriendResponseReq) (*CommonResp, error)
SetFriendComment(context.Context, *SetFriendCommentReq) (*CommonResp, error) SetFriendComment(context.Context, *SetFriendCommentReq) (*CommonResp, error)
ImportFriend(context.Context, *ImportFriendReq) (*CommonResp, error) ImportFriend(context.Context, *ImportFriendReq) (*ImportFriendResp, error)
} }
func RegisterFriendServer(s *grpc.Server, srv FriendServer) { func RegisterFriendServer(s *grpc.Server, srv FriendServer) {
@ -1984,68 +2031,72 @@ var _Friend_serviceDesc = grpc.ServiceDesc{
Metadata: "friend/friend.proto", Metadata: "friend/friend.proto",
} }
func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_17d6a40c7694c30a) } func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_05873114bd399886) }
var fileDescriptor_friend_17d6a40c7694c30a = []byte{ var fileDescriptor_friend_05873114bd399886 = []byte{
// 956 bytes of a gzipped FileDescriptorProto // 1011 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcd, 0x6e, 0xdb, 0x46, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcd, 0x6e, 0xdb, 0x46,
0x10, 0x86, 0x48, 0xc9, 0x96, 0x46, 0x52, 0x24, 0xaf, 0xdd, 0x96, 0x65, 0x83, 0xc2, 0x20, 0x72, 0x10, 0x86, 0x48, 0xc9, 0x96, 0x46, 0x52, 0x24, 0xaf, 0xdd, 0x96, 0x65, 0x83, 0x42, 0x20, 0x72,
0x48, 0x2f, 0x29, 0x90, 0x22, 0x27, 0x9f, 0x14, 0xbb, 0x0e, 0xd8, 0x34, 0x08, 0xc0, 0xd8, 0x97, 0x48, 0x2f, 0x29, 0xe0, 0x22, 0xa7, 0x9c, 0x14, 0xbb, 0x0e, 0xd4, 0x34, 0x08, 0xc0, 0xd8, 0x97,
0x16, 0x2d, 0x40, 0x8b, 0x23, 0x86, 0x08, 0xc9, 0x65, 0xb8, 0x6c, 0x2c, 0x3f, 0x41, 0xcf, 0x7d, 0x16, 0x2d, 0x40, 0x8b, 0x23, 0x85, 0x08, 0xff, 0xc2, 0x65, 0x12, 0xfb, 0xd4, 0x63, 0xcf, 0x7d,
0x8e, 0xbe, 0x5c, 0x1f, 0xa1, 0xd8, 0x5d, 0x2e, 0xb9, 0xfc, 0x71, 0x1b, 0x40, 0xb1, 0x73, 0xd2, 0x94, 0xbe, 0x59, 0x1f, 0xa1, 0xd8, 0x59, 0x92, 0xbb, 0xfc, 0x71, 0x1a, 0x54, 0x4e, 0x72, 0x32,
0xce, 0xec, 0x6a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0xb3, 0xbd,
0x81, 0x7b, 0x8d, 0x9c, 0xc0, 0x4c, 0x9f, 0xfe, 0xeb, 0x40, 0x5a, 0xdf, 0x04, 0x7d, 0x7f, 0x7e, 0x28, 0xf0, 0xed, 0x46, 0xb0, 0x84, 0xc9, 0x56, 0x6b, 0xe7, 0x0a, 0x7c, 0x63, 0x5e, 0xd8, 0x56,
0xbe, 0xf8, 0x65, 0x2e, 0x95, 0x27, 0xf2, 0xe7, 0x6a, 0x4f, 0x7c, 0x09, 0xff, 0xf0, 0x6f, 0x00, 0xf7, 0x81, 0x8c, 0x9f, 0xaf, 0xb1, 0x5e, 0x99, 0x68, 0xf4, 0x82, 0x4e, 0xf0, 0x3f, 0xc2, 0x81,
0x00, 0x00, 0xff, 0xff, 0x03, 0x5f, 0x15, 0x72, 0x20, 0x0f, 0x00, 0x00, 0xd7, 0x64, 0x35, 0xbb, 0xdb, 0x51, 0x99, 0x15, 0xe1, 0x3b, 0xcd, 0x9c, 0xc0, 0x9c, 0x37, 0x68,
0xca, 0xbe, 0x29, 0xef, 0x75, 0x10, 0xf8, 0x86, 0x5c, 0x4e, 0xf4, 0x95, 0x5f, 0x01, 0x69, 0xfc,
0x12, 0x51, 0xb1, 0x68, 0xfe, 0x42, 0x78, 0x3c, 0xfb, 0x65, 0x2a, 0x8f, 0x1e, 0xc9, 0x3f, 0x97,
0x7b, 0xf4, 0x2b, 0xfc, 0x87, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x85, 0x59, 0x8f, 0x67, 0x9c,
0x0f, 0x00, 0x00,
} }

View File

@ -41,14 +41,15 @@ message AddFriendReq{
message ImportFriendReq{ message ImportFriendReq{
string uid = 1; repeated string uidList = 1;
string OperationID = 2; string OperationID = 2;
string Token = 3; string Token = 3;
string OwnerUid = 4; string OwnerUid = 4;
} }
message ImportFriendResp{
CommonResp commonResp = 1;
repeated string failedUidList = 2;
}
message GetFriendApplyReq{ message GetFriendApplyReq{
string OperationID = 1; string OperationID = 1;
@ -178,5 +179,5 @@ service friend{
rpc deleteFriend(DeleteFriendReq) returns(CommonResp); rpc deleteFriend(DeleteFriendReq) returns(CommonResp);
rpc addFriendResponse(AddFriendResponseReq) returns(CommonResp); rpc addFriendResponse(AddFriendResponseReq) returns(CommonResp);
rpc setFriendComment(SetFriendCommentReq) returns(CommonResp); rpc setFriendComment(SetFriendCommentReq) returns(CommonResp);
rpc ImportFriend(ImportFriendReq) returns(CommonResp); rpc ImportFriend(ImportFriendReq) returns(ImportFriendResp);
} }

View File

@ -41,7 +41,11 @@ type MsgCallBackResp struct {
} }
func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (*pbChat.UserSendMsgResp, error) { func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (*pbChat.UserSendMsgResp, error) {
replay := pbChat.UserSendMsgResp{}
log.InfoByKv("sendMsg", pb.OperationID, "args", pb.String()) log.InfoByKv("sendMsg", pb.OperationID, "args", pb.String())
if !utils.VerifyToken(pb.Token, pb.SendID) {
return returnMsg(&replay, pb, http.StatusUnauthorized, "token validate err,not authorized", "", 0)
}
serverMsgID := GetMsgID(pb.SendID) serverMsgID := GetMsgID(pb.SendID)
pbData := pbChat.WSToMsgSvrChatMsg{} pbData := pbChat.WSToMsgSvrChatMsg{}
pbData.MsgFrom = pb.MsgFrom pbData.MsgFrom = pb.MsgFrom
@ -61,7 +65,6 @@ func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (*
pbData.OperationID = pb.OperationID pbData.OperationID = pb.OperationID
pbData.Token = pb.Token pbData.Token = pb.Token
pbData.SendTime = utils.GetCurrentTimestampByNano() pbData.SendTime = utils.GetCurrentTimestampByNano()
replay := pbChat.UserSendMsgResp{}
m := MsgCallBackResp{} m := MsgCallBackResp{}
if config.Config.MessageCallBack.CallbackSwitch { if config.Config.MessageCallBack.CallbackSwitch {
bMsg, err := http2.Post(config.Config.MessageCallBack.CallbackUrl, MsgCallBackReq{ bMsg, err := http2.Post(config.Config.MessageCallBack.CallbackUrl, MsgCallBackReq{

View File

@ -20,9 +20,11 @@ func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlackl
isMagagerFlag := 0 isMagagerFlag := 0
tokenUid := claims.UID tokenUid := claims.UID
if tokenUid == config.Config.AppManagerUid {
if utils.IsContain(tokenUid, config.Config.Manager.AppManagerUid) {
isMagagerFlag = 1 isMagagerFlag = 1
} }
if isMagagerFlag == 0 { if isMagagerFlag == 0 {
err = im_mysql_model.InsertInToUserBlackList(claims.UID, req.Uid) err = im_mysql_model.InsertInToUserBlackList(claims.UID, req.Uid)
if err != nil { if err != nil {

View File

@ -52,65 +52,69 @@ func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq
return &pbFriend.CommonResp{}, nil return &pbFriend.CommonResp{}, nil
} }
func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFriendReq) (*pbFriend.CommonResp, error) { func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFriendReq) (*pbFriend.ImportFriendResp, error) {
log.Info(req.Token, req.OperationID, "ImportFriendis server,userid=%s", req.OwnerUid) log.Info(req.Token, req.OperationID, "ImportFriend come here,args=%s", req.String())
var resp pbFriend.ImportFriendResp
//Parse token, to find current user information //Parse token, to find current user information
claims, err := utils.ParseToken(req.Token) claims, err := utils.ParseToken(req.Token)
if err != nil { if err != nil {
log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error())
return &pbFriend.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil return &pbFriend.ImportFriendResp{CommonResp: &pbFriend.CommonResp{ErrorCode: config.ErrAddFriend.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, FailedUidList: req.UidList}, nil
}
if claims.UID != config.Config.AppManagerUid {
log.Error(req.Token, req.OperationID, "not magager uid", claims.UID, config.Config.AppManagerUid)
return &pbFriend.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
} }
if _, err = im_mysql_model.FindUserByUID(req.Uid); err != nil { if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
log.Error(req.Token, req.OperationID, "this user not exists,cant not add friend", req.Uid) log.Error(req.Token, req.OperationID, "not magager uid", claims.UID)
return &pbFriend.CommonResp{ErrorCode: config.ErrAddFriend.ErrCode, ErrorMsg: config.ErrSearchUserInfo.ErrMsg}, nil return &pbFriend.ImportFriendResp{CommonResp: &pbFriend.CommonResp{ErrorCode: config.ErrAddFriend.ErrCode, ErrorMsg: "not authorized"}, FailedUidList: req.UidList}, nil
} }
if _, err = im_mysql_model.FindUserByUID(req.OwnerUid); err != nil { if _, err = im_mysql_model.FindUserByUID(req.OwnerUid); err != nil {
log.Error(req.Token, req.OperationID, "this user not exists,cant not add friend", req.OwnerUid) log.Error(req.Token, req.OperationID, "this user not exists,cant not add friend", req.OwnerUid)
return &pbFriend.CommonResp{ErrorCode: config.ErrAddFriend.ErrCode, ErrorMsg: config.ErrSearchUserInfo.ErrMsg}, nil return &pbFriend.ImportFriendResp{CommonResp: &pbFriend.CommonResp{ErrorCode: config.ErrAddFriend.ErrCode, ErrorMsg: "this user not exists,cant not add friend"}, FailedUidList: req.UidList}, nil
} }
for _, v := range req.UidList {
if _, err = im_mysql_model.FindUserByUID(v); err != nil {
resp.CommonResp.ErrorMsg = "some uid establish failed"
resp.CommonResp.ErrorCode = 408
resp.FailedUidList = append(resp.FailedUidList, v)
} else {
if _, err = im_mysql_model.FindFriendRelationshipFromFriend(req.OwnerUid, v); err != nil {
//Establish two single friendship
err1 := im_mysql_model.InsertToFriend(req.OwnerUid, v, 1)
if err1 != nil {
resp.FailedUidList = append(resp.FailedUidList, v)
log.Error(req.Token, req.OperationID, "err=%s,create friendship failed", err.Error())
}
err2 := im_mysql_model.InsertToFriend(v, req.OwnerUid, 1)
if err2 != nil {
log.Error(req.Token, req.OperationID, "err=%s,create friendship failed", err.Error())
}
if err1 == nil && err2 == nil {
var name, faceUrl string
n := content_struct.NotificationContent{1, constant.FriendAcceptTip, ""}
r, err := im_mysql_model.FindUserByUID(v)
if err != nil {
log.ErrorByKv("get info failed", req.OperationID, "err", err.Error(), "req", req.String())
}
if r != nil {
name, faceUrl = r.Name, r.Icon
}
_, err = im_mysql_model.FindFriendRelationshipFromFriend(req.OwnerUid, req.Uid) logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
SendID: v,
RecvID: req.OwnerUid,
SenderFaceURL: faceUrl,
SenderNickName: name,
Content: n.ContentToString(),
SendTime: utils.GetCurrentTimestampByNano(),
MsgFrom: constant.UserMsgType, //Notification message identification
ContentType: constant.AcceptFriendApplicationTip, //Add friend flag
SessionType: constant.SingleChatType,
OperationID: req.OperationID,
})
}
}
}
if err != nil {
log.Error("", req.OperationID, err.Error())
}
//Establish two single friendship
err = im_mysql_model.InsertToFriend(req.OwnerUid, req.Uid, 1)
if err != nil {
log.Error(req.Token, req.OperationID, "err=%s,create friendship failed", err.Error())
}
err = im_mysql_model.InsertToFriend(req.Uid, req.OwnerUid, 1)
if err != nil {
log.Error(req.Token, req.OperationID, "err=%s,create friendship failed", err.Error())
} }
return &resp, nil
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
SendID: req.OwnerUid,
RecvID: req.Uid,
Content: content_struct.NewContentStructString(0, "", " add you as a friend."),
SendTime: utils.GetCurrentTimestampBySecond(),
MsgFrom: constant.UserMsgType, //Notification message identification
ContentType: constant.AcceptFriendApplicationTip, //Add friend flag
SessionType: constant.SingleChatType,
OperationID: req.OperationID,
})
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
SendID: req.Uid,
RecvID: req.OwnerUid,
Content: content_struct.NewContentStructString(0, "", " add you as a friend."),
SendTime: utils.GetCurrentTimestampBySecond(),
MsgFrom: constant.UserMsgType, //Notification message identification
ContentType: constant.AcceptFriendApplicationTip, //Add friend flag
SessionType: constant.SingleChatType,
OperationID: req.OperationID,
})
return &pbFriend.CommonResp{}, nil
} }

View File

@ -87,7 +87,8 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
isMagagerFlag := 0 isMagagerFlag := 0
tokenUid := claims.UID tokenUid := claims.UID
if tokenUid == config.Config.AppManagerUid {
if utils.IsContain(tokenUid, config.Config.Manager.AppManagerUid) {
isMagagerFlag = 1 isMagagerFlag = 1
} }

View File

@ -63,8 +63,9 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
return &pbGroup.InviteUserToGroupResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil return &pbGroup.InviteUserToGroupResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil
} }
log.Info(claims.UID, req.OperationID, "recv req: ", req.String()) log.Info(claims.UID, req.OperationID, "recv req: ", req.String())
// if !imdb.IsExistGroupMember(req.GroupID, claims.UID) && claims.UID != config.Config.AppManagerUid
if !imdb.IsExistGroupMember(req.GroupID, claims.UID) && claims.UID != config.Config.AppManagerUid { if !imdb.IsExistGroupMember(req.GroupID, claims.UID) && !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
log.Error(req.Token, req.OperationID, "err= invite user not in group") log.Error(req.Token, req.OperationID, "err= invite user not in group")
return &pbGroup.InviteUserToGroupResp{ErrorCode: config.ErrAccess.ErrCode, ErrorMsg: config.ErrAccess.ErrMsg}, nil return &pbGroup.InviteUserToGroupResp{ErrorCode: config.ErrAccess.ErrCode, ErrorMsg: config.ErrAccess.ErrMsg}, nil
} }
@ -118,7 +119,8 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite
resp.ErrorCode = 0 resp.ErrorCode = 0
resp.ErrorMsg = "ok" resp.ErrorMsg = "ok"
if claims.UID == config.Config.AppManagerUid { //if claims.UID == config.Config.AppManagerUid
if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
var iu inviteUserToGroupReq var iu inviteUserToGroupReq
iu.GroupID = req.GroupID iu.GroupID = req.GroupID
iu.OperationID = req.OperationID iu.OperationID = req.OperationID
@ -268,7 +270,8 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
} }
} }
if flag != 1 { if flag != 1 {
if claims.UID == config.Config.AppManagerUid { // if claims.UID == config.Config.AppManagerUid {
if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
flag = 1 flag = 1
} }
} }
@ -320,7 +323,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
n := content_struct.NotificationContent{1, req.GroupID, kq.ContentToString()} n := content_struct.NotificationContent{1, req.GroupID, kq.ContentToString()}
if claims.UID == config.Config.AppManagerUid { if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
log.Info("", req.OperationID, claims.UID, req.GroupID) log.Info("", req.OperationID, claims.UID, req.GroupID)
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
SendID: claims.UID, SendID: claims.UID,

View File

@ -23,7 +23,7 @@ func (s *userServer) DeleteUsers(_ context.Context, req *pbUser.DeleteUsersReq)
log.ErrorByKv("parse token failed", req.OperationID, "err", err.Error()) log.ErrorByKv("parse token failed", req.OperationID, "err", err.Error())
return &pbUser.DeleteUsersResp{CommonResp: &pbUser.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: err.Error()}, FailedUidList: req.DeleteUidList}, nil return &pbUser.DeleteUsersResp{CommonResp: &pbUser.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: err.Error()}, FailedUidList: req.DeleteUidList}, nil
} }
if c.UID != config.Config.AppManagerUid { if !utils.IsContain(c.UID, config.Config.Manager.AppManagerUid) {
log.ErrorByKv(" Authentication failed", req.OperationID, "args", c) log.ErrorByKv(" Authentication failed", req.OperationID, "args", c)
return &pbUser.DeleteUsersResp{CommonResp: &pbUser.CommonResp{ErrorCode: 401, ErrorMsg: "not authorized"}, FailedUidList: req.DeleteUidList}, nil return &pbUser.DeleteUsersResp{CommonResp: &pbUser.CommonResp{ErrorCode: 401, ErrorMsg: "not authorized"}, FailedUidList: req.DeleteUidList}, nil
} }
@ -46,7 +46,7 @@ func (s *userServer) GetAllUsersUid(_ context.Context, req *pbUser.GetAllUsersUi
log.InfoByKv("parse token failed", req.OperationID, "err", err.Error()) log.InfoByKv("parse token failed", req.OperationID, "err", err.Error())
return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: err.Error()}}, nil return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: err.Error()}}, nil
} }
if c.UID != config.Config.AppManagerUid { if !utils.IsContain(c.UID, config.Config.Manager.AppManagerUid) {
log.ErrorByKv(" Authentication failed", req.OperationID, "args", c) log.ErrorByKv(" Authentication failed", req.OperationID, "args", c)
return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: 401, ErrorMsg: "not authorized"}}, nil return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: 401, ErrorMsg: "not authorized"}}, nil
} }

View File

@ -24,7 +24,8 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI
} }
ownerUid := "" ownerUid := ""
if claims.UID == config.Config.AppManagerUid { //if claims.UID == config.Config.AppManagerUid {
if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) {
ownerUid = req.Uid ownerUid = req.Uid
} else { } else {
ownerUid = claims.UID ownerUid = claims.UID