mirror of
https://gitee.com/WuKongDev/WuKongIM.git
synced 2026-05-07 01:00:47 +08:00
feat: add agent channel
This commit is contained in:
@@ -58,7 +58,9 @@ func (h *Handler) hasPermissionForChannel(channelId string, channelType uint8) (
|
||||
return wkproto.ReasonSuccess, nil
|
||||
}
|
||||
// 客服频道,直接通过
|
||||
if channelType == wkproto.ChannelTypeCustomerService || channelType == wkproto.ChannelTypeVisitors {
|
||||
if channelType == wkproto.ChannelTypeCustomerService ||
|
||||
channelType == wkproto.ChannelTypeVisitors ||
|
||||
channelType == wkproto.ChannelTypeAgent {
|
||||
return wkproto.ReasonSuccess, nil
|
||||
}
|
||||
|
||||
@@ -116,6 +118,14 @@ func (h *Handler) hasPermissionForSender(channelId string, channelType uint8, e
|
||||
}
|
||||
}
|
||||
|
||||
// agent频道
|
||||
if channelType == wkproto.ChannelTypeAgent {
|
||||
uid, agentUID := options.GetUidAndAgentUIDWith(channelId)
|
||||
if fromUid == uid || fromUid == agentUID {
|
||||
return wkproto.ReasonSuccess, nil
|
||||
}
|
||||
}
|
||||
|
||||
// 系统发的消息直接通过
|
||||
if options.G.IsSystemDevice(e.Conn.DeviceId) {
|
||||
return wkproto.ReasonSuccess, nil
|
||||
|
||||
@@ -29,7 +29,7 @@ func GetAgentChannelIDWith(uid, agentUID string) string {
|
||||
}
|
||||
|
||||
// GetUidAndAgentUIDWith 获取用户ID和AgentID
|
||||
func GetUidAndAgentUIDWith(channelId string) (string, string) {
|
||||
func GetUidAndAgentUIDWith(channelId string) (uid string, agentUID string) {
|
||||
channelIDs := strings.Split(channelId, "@")
|
||||
if len(channelIDs) == 2 {
|
||||
return channelIDs[0], channelIDs[1]
|
||||
|
||||
Reference in New Issue
Block a user