WH01243 2 년 전
부모
커밋
e7683b88b5

+ 167 - 137
.idea/workspace.xml

@@ -5,11 +5,33 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="f5220264-ecf0-4305-ada3-6105184077a7" name="Changes" comment="提交">
+      <change afterPath="$PROJECT_DIR$/rpc/messagecenter/internal/logic/groupnameupdatelogic.go" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/logs/access.log" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/logs/access.log" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/logs/error.log" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/logs/error.log" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/logs/slow.log" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/logs/slow.log" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/logs/stat.log" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/logs/stat.log" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/api/messagecenter/internal/logic/findmessagelogic.go" beforeDir="false" afterPath="$PROJECT_DIR$/api/messagecenter/internal/logic/findmessagelogic.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/api/messagecenter/internal/logic/messageaddlogic.go" beforeDir="false" afterPath="$PROJECT_DIR$/api/messagecenter/internal/logic/messageaddlogic.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/api/messagecenter/internal/logic/userlistlogic.go" beforeDir="false" afterPath="$PROJECT_DIR$/api/messagecenter/internal/logic/userlistlogic.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/api/messagecenter/internal/logic/withdrawmessagelogic.go" beforeDir="false" afterPath="$PROJECT_DIR$/api/messagecenter/internal/logic/withdrawmessagelogic.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/api/messagecenter/internal/types/types.go" beforeDir="false" afterPath="$PROJECT_DIR$/api/messagecenter/internal/types/types.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/api/messagecenter/messagecenter.api" beforeDir="false" afterPath="$PROJECT_DIR$/api/messagecenter/messagecenter.api" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/entity/util.go" beforeDir="false" afterPath="$PROJECT_DIR$/entity/util.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/internal/logic/entpersonslistlogic.go" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/internal/logic/groupchatlogic.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/internal/server/messagecenterserver.go" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/internal/server/messagecenterserver.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/logs/access.log" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/logs/error.log" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/logs/severe.log" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/logs/slow.log" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/logs/stat.log" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/messagecenter.proto" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/messagecenter.proto" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/messagecenter/messagecenter.go" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/messagecenter/messagecenter.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/messagecenter/messagecenter.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/messagecenter/messagecenter.pb.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/messagecenter/messagecenter_grpc.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/messagecenter/messagecenter_grpc.pb.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/service/chat_group.go" beforeDir="false" afterPath="$PROJECT_DIR$/service/chat_group.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/service/ent_address_book.go" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/service/ent_address_book_test.go" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/service/message_mail_box.go" beforeDir="false" afterPath="$PROJECT_DIR$/service/message_mail_box.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/service/message_mail_box_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/service/message_mail_box_test.go" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -26,20 +48,93 @@
       </list>
     </option>
   </component>
-  <component name="GOROOT" url="file://H:/go/go1.16" />
+  <component name="GOROOT" url="file://H:/go/go1.18" />
   <component name="Git.Settings">
+    <favorite-branches>
+      <branch-storage>
+        <map>
+          <entry type="LOCAL">
+            <value>
+              <list>
+                <branch-info repo="$PROJECT_DIR$" source="dev_v1.2.6_wh" />
+              </list>
+            </value>
+          </entry>
+          <entry type="REMOTE">
+            <value>
+              <list>
+                <branch-info repo="$PROJECT_DIR$" source="origin/feature/v1.2.6" />
+              </list>
+            </value>
+          </entry>
+        </map>
+      </branch-storage>
+    </favorite-branches>
+    <option name="PUSH_TAGS">
+      <GitPushTagMode>
+        <option name="argument" value="--tags" />
+        <option name="title" value="All" />
+      </GitPushTagMode>
+    </option>
+    <option name="RECENT_BRANCH_BY_REPOSITORY">
+      <map>
+        <entry key="$PROJECT_DIR$" value="feature/v1.2.6_wh" />
+      </map>
+    </option>
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
   </component>
+  <component name="GitSEFilterConfiguration">
+    <file-type-list>
+      <filtered-out-file-type name="LOCAL_BRANCH" />
+      <filtered-out-file-type name="REMOTE_BRANCH" />
+      <filtered-out-file-type name="TAG" />
+      <filtered-out-file-type name="COMMIT_BY_MESSAGE" />
+    </file-type-list>
+  </component>
+  <component name="GitToolBoxStore">
+    <option name="projectConfigVersion" value="5" />
+    <option name="recentBranches">
+      <RecentBranches>
+        <option name="branchesForRepo">
+          <list>
+            <RecentBranchesForRepo>
+              <option name="branches">
+                <list>
+                  <RecentBranch>
+                    <option name="branchName" value="dev/v1.2.6_wh" />
+                    <option name="lastUsedInstant" value="1682236043" />
+                  </RecentBranch>
+                  <RecentBranch>
+                    <option name="branchName" value="feature/v1.2.6_wh" />
+                    <option name="lastUsedInstant" value="1682235983" />
+                  </RecentBranch>
+                  <RecentBranch>
+                    <option name="branchName" value="feature/v1.2.6" />
+                    <option name="lastUsedInstant" value="1682235768" />
+                  </RecentBranch>
+                  <RecentBranch>
+                    <option name="branchName" value="master" />
+                    <option name="lastUsedInstant" value="1681434817" />
+                  </RecentBranch>
+                </list>
+              </option>
+              <option name="repositoryRootUrl" value="file://$PROJECT_DIR$" />
+            </RecentBranchesForRepo>
+          </list>
+        </option>
+      </RecentBranches>
+    </option>
+  </component>
   <component name="GoLibraries">
     <option name="indexEntireGoPath" value="true" />
   </component>
   <component name="HighlightingSettingsPerFile">
-    <setting file="file://H:/go/go1.16/pkg/mod/app.yhyue.com/moapp/jybase@v0.0.0-20220617085837-48c1bf245c2f/common/common.go" root0="SKIP_INSPECTION" />
-    <setting file="file://H:/go/go1.16/pkg/mod/github.com/zeromicro/go-zero@v1.3.4/zrpc/internal/serverinterceptors/timeoutinterceptor.go" root0="SKIP_INSPECTION" />
-    <setting file="file://$PROJECT_DIR$/service/message_mail_box.go" root0="FORCE_HIGHLIGHTING" />
     <setting file="file://H:/go/go1.16/pkg/mod/app.yhyue.com/moapp/jybase@v0.0.0-20220617085837-48c1bf245c2f/mysql/mysql.go" root0="SKIP_INSPECTION" />
     <setting file="file://H:/go/go1.17.2/src/runtime/asm_amd64.s" root0="SKIP_INSPECTION" />
     <setting file="file://$PROJECT_DIR$/go.mod" root0="FORCE_HIGHLIGHTING" />
+    <setting file="file://H:/go/go1.16/pkg/mod/github.com/zeromicro/go-zero@v1.3.4/zrpc/internal/serverinterceptors/timeoutinterceptor.go" root0="SKIP_INSPECTION" />
+    <setting file="file://H:/go/go1.16/pkg/mod/app.yhyue.com/moapp/jybase@v0.0.0-20220617085837-48c1bf245c2f/common/common.go" root0="SKIP_INSPECTION" />
+    <setting file="file://$PROJECT_DIR$/service/message_mail_box.go" root0="FORCE_HIGHLIGHTING" />
   </component>
   <component name="MarkdownSettingsMigration">
     <option name="stateVersion" value="1" />
@@ -51,28 +146,50 @@
     <option name="showLibraryContents" value="true" />
   </component>
   <component name="PropertiesComponent">
+    <property name="DefaultGoTemplateProperty" value="Go File" />
+    <property name="Git.Branch.Popup.ShowAllRemotes" value="true" />
     <property name="WebServerToolWindowFactoryState" value="false" />
     <property name="configurable..is.expanded" value="false" />
     <property name="configurable.GoLibrariesConfigurable.is.expanded" value="true" />
     <property name="go.import.settings.migrated" value="true" />
-    <property name="last_opened_file_path" value="$USER_HOME$" />
-    <property name="settings.editor.selected.configurable" value="com.goide.configuration.GoLibrariesConfigurableProvider" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/rpc/messagecenter/messagecenter" />
+    <property name="settings.editor.selected.configurable" value="go.vgo" />
   </component>
   <component name="RecentsManager">
     <key name="CopyFile.RECENT_KEYS">
+      <recent name="D:\top_git_projects\SocialPlatform1\messageCenter\rpc\messagecenter\messagecenter" />
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\rpc\messagecenterclient" />
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\api\etc" />
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\rpc\etc" />
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\rpc" />
     </key>
     <key name="MoveFile.RECENT_KEYS">
+      <recent name="D:\top_git_projects\SocialPlatform1\messageCenter\rpc\messagecenter\messagecenter" />
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\rpc\messagecenterclient" />
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter" />
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\rpc" />
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\api" />
     </key>
   </component>
-  <component name="RunManager" selected="Go Test.TestMessaggeService_FindMessage/客服获取历史信息查询 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service">
+  <component name="RunManager" selected="Go 构建.go build  rpc">
+    <configuration name="go build  rpc" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true">
+      <module name="messageCenter" />
+      <working_directory value="$PROJECT_DIR$/rpc/messagecenter" />
+      <kind value="PACKAGE" />
+      <package value="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter" />
+      <directory value="$PROJECT_DIR$" />
+      <filePath value="$PROJECT_DIR$/rpc/messagecenter/messagecenter.go" />
+      <method v="2" />
+    </configuration>
+    <configuration name="go build api" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true">
+      <module name="messageCenter" />
+      <working_directory value="$PROJECT_DIR$/api/messagecenter" />
+      <kind value="PACKAGE" />
+      <package value="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter" />
+      <directory value="$PROJECT_DIR$/api/messagecenter" />
+      <filePath value="$PROJECT_DIR$/api/messagecenter/messagecenter.go" />
+      <method v="2" />
+    </configuration>
     <configuration name="messageApi" type="GoApplicationRunConfiguration" factoryName="Go Application">
       <module name="messageCenter" />
       <working_directory value="$PROJECT_DIR$/api/messagecenter" />
@@ -105,31 +222,7 @@
       <option name="run" value="false" />
       <method v="2" />
     </configuration>
-    <configuration name="TestMessaggeService_FindMessage/客服获取历史信息查询 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
-      <module name="messageCenter" />
-      <working_directory value="$PROJECT_DIR$/service" />
-      <root_directory value="$PROJECT_DIR$" />
-      <kind value="PACKAGE" />
-      <package value="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
-      <directory value="$PROJECT_DIR$" />
-      <filePath value="$PROJECT_DIR$" />
-      <framework value="gotest" />
-      <pattern value="^\QTestMessaggeService_FindMessage\E$/^\Q客服获取历史信息查询\E$" />
-      <method v="2" />
-    </configuration>
-    <configuration name="TestMessaggeService_SaveAutoReplyMsg/会话保存以及消息保存#01 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
-      <module name="messageCenter" />
-      <working_directory value="$PROJECT_DIR$/service" />
-      <root_directory value="$PROJECT_DIR$" />
-      <kind value="PACKAGE" />
-      <package value="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
-      <directory value="$PROJECT_DIR$" />
-      <filePath value="$PROJECT_DIR$" />
-      <framework value="gotest" />
-      <pattern value="^\QTestMessaggeService_SaveAutoReplyMsg\E$/^\Q会话保存以及消息保存#01\E$" />
-      <method v="2" />
-    </configuration>
-    <configuration name="TestMessaggeService_SaveMessage/7、机器人给用户发送信息 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
+    <configuration name="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_GroupNoticeGet/公告获取" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
       <module name="messageCenter" />
       <working_directory value="$PROJECT_DIR$/service" />
       <root_directory value="$PROJECT_DIR$" />
@@ -138,10 +231,10 @@
       <directory value="$PROJECT_DIR$" />
       <filePath value="$PROJECT_DIR$" />
       <framework value="gotest" />
-      <pattern value="^\QTestMessaggeService_SaveMessage\E$/^\Q7、机器人给用户发送信息\E$" />
+      <pattern value="^\QTestChatGroupService_GroupNoticeGet\E$/^\Q公告获取\E$" />
       <method v="2" />
     </configuration>
-    <configuration name="TestMessaggeService_UpdateReadById in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
+    <configuration name="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_GroupNoticeUpdate/公告修改" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
       <module name="messageCenter" />
       <working_directory value="$PROJECT_DIR$/service" />
       <root_directory value="$PROJECT_DIR$" />
@@ -150,37 +243,31 @@
       <directory value="$PROJECT_DIR$" />
       <filePath value="$PROJECT_DIR$" />
       <framework value="gotest" />
-      <pattern value="^\QTestMessaggeService_UpdateReadById\E$" />
+      <pattern value="^\QTestChatGroupService_GroupNoticeUpdate\E$/^\Q公告修改\E$" />
       <method v="2" />
     </configuration>
-    <configuration name="Test_test1 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test (1)" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
-      <module name="messageCenter" />
-      <working_directory value="$PROJECT_DIR$/rpc/messagecenter/test" />
-      <root_directory value="$PROJECT_DIR$" />
-      <kind value="PACKAGE" />
-      <package value="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test" />
-      <directory value="$PROJECT_DIR$" />
-      <filePath value="$PROJECT_DIR$" />
-      <framework value="gotest" />
-      <pattern value="^\QTest_test1\E$" />
+    <configuration name="genRpc" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile" temporary="true">
+      <makefile filename="$PROJECT_DIR$/Makefile" target="genRpc" workingDirectory="" arguments="">
+        <envs />
+      </makefile>
       <method v="2" />
     </configuration>
     <list>
-      <item itemvalue="Go Build.messageApi" />
-      <item itemvalue="Go Build.messageRpc" />
-      <item itemvalue="Go Test.Test_test1 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test (1)" />
-      <item itemvalue="Go Test.TestMessaggeService_SaveAutoReplyMsg/会话保存以及消息保存#01 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
-      <item itemvalue="Go Test.TestMessaggeService_UpdateReadById in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
-      <item itemvalue="Go Test.TestMessaggeService_SaveMessage/7、机器人给用户发送信息 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
-      <item itemvalue="Go Test.TestMessaggeService_FindMessage/客服获取历史信息查询 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
+      <item itemvalue="Go 构建.go build  rpc" />
+      <item itemvalue="Go 构建.go build api" />
+      <item itemvalue="Go 构建.messageApi" />
+      <item itemvalue="Go 构建.messageRpc" />
+      <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_GroupNoticeGet/公告获取" />
+      <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_GroupNoticeUpdate/公告修改" />
+      <item itemvalue="Makefile 目标.genRpc" />
     </list>
     <recent_temporary>
       <list>
-        <item itemvalue="Go Test.TestMessaggeService_FindMessage/客服获取历史信息查询 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
-        <item itemvalue="Go Test.TestMessaggeService_SaveMessage/7、机器人给用户发送信息 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
-        <item itemvalue="Go Test.TestMessaggeService_UpdateReadById in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
-        <item itemvalue="Go Test.Test_test1 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test (1)" />
-        <item itemvalue="Go Test.TestMessaggeService_SaveAutoReplyMsg/会话保存以及消息保存#01 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
+        <item itemvalue="Go 构建.go build  rpc" />
+        <item itemvalue="Go 构建.go build api" />
+        <item itemvalue="Makefile 目标.genRpc" />
+        <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_GroupNoticeUpdate/公告修改" />
+        <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_GroupNoticeGet/公告获取" />
       </list>
     </recent_temporary>
   </component>
@@ -201,7 +288,6 @@
     <option name="oldMeFiltersMigrated" value="true" />
   </component>
   <component name="VcsManagerConfiguration">
-    <MESSAGE value="封装方法" />
     <MESSAGE value="代码整合" />
     <MESSAGE value="用户列表修改" />
     <MESSAGE value="域名添加" />
@@ -217,95 +303,39 @@
     <MESSAGE value="聊天提交" />
     <MESSAGE value="提交" />
     <MESSAGE value="已读状态修改" />
-    <option name="LAST_COMMIT_MESSAGE" value="已读状态修改" />
+    <MESSAGE value="分支创建" />
+    <MESSAGE value="协议文件提交" />
+    <MESSAGE value="协议文件修改" />
+    <MESSAGE value="rpc更新提交" />
+    <MESSAGE value="协议文件出错修改" />
+    <MESSAGE value="api编码" />
+    <MESSAGE value="注释增加" />
+    <MESSAGE value="注释新增" />
+    <MESSAGE value="自测出现问题处理" />
+    <MESSAGE value="接口删除" />
+    <option name="LAST_COMMIT_MESSAGE" value="接口删除" />
   </component>
   <component name="VgoProject">
     <integration-enabled>true</integration-enabled>
     <environment>
       <map>
-        <entry key="GOPRIVATE" value="https://app.yhyue.com" />
-        <entry key="GOPROXY" value="https://goproxy.io,direct" />
-        <entry key="GOSUMDB" value="off" />
+        <entry key="GOPRIVATE" value="bp.jydev.jianyu360.cn,app.yhyue.com" />
+        <entry key="GOPROXY" value="https://goproxy.cn,https://goproxy.io,https://mirrors.aliyun.com/goproxy/,direct" />
       </map>
     </environment>
   </component>
   <component name="XDebuggerManager">
     <breakpoint-manager>
       <breakpoints>
-        <line-breakpoint type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/api/messagecenter/internal/logic/findmessagelogic.go</url>
-          <line>42</line>
-          <option name="timeStamp" value="2" />
-        </line-breakpoint>
-        <line-breakpoint type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/api/messagecenter/internal/logic/findmessagelogic.go</url>
-          <line>39</line>
-          <option name="timeStamp" value="3" />
-        </line-breakpoint>
-        <line-breakpoint type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/service/message_mail_box.go</url>
-          <line>152</line>
-          <option name="timeStamp" value="5" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/service/message_mail_box_test.go</url>
-          <line>44</line>
-          <option name="timeStamp" value="8" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/service/message_mail_box_test.go</url>
-          <line>242</line>
-          <option name="timeStamp" value="9" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/service/message_mail_box.go</url>
-          <line>310</line>
-          <option name="timeStamp" value="10" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/service/message_mail_box.go</url>
-          <line>388</line>
-          <option name="timeStamp" value="18" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/service/message_mail_box.go</url>
-          <line>386</line>
-          <option name="timeStamp" value="19" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/service/message_mail_box.go</url>
-          <line>393</line>
-          <option name="timeStamp" value="20" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/service/message_mail_box.go</url>
-          <line>410</line>
-          <option name="timeStamp" value="21" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/service/message_mail_box.go</url>
-          <line>164</line>
-          <option name="timeStamp" value="22" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/service/message_mail_box.go</url>
-          <line>114</line>
-          <option name="timeStamp" value="23" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/service/message_mail_box.go</url>
-          <line>302</line>
-          <option name="timeStamp" value="24" />
-        </line-breakpoint>
         <line-breakpoint enabled="true" type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/service/message_mail_box.go</url>
-          <line>316</line>
-          <option name="timeStamp" value="25" />
+          <url>file://$PROJECT_DIR$/service/chat_group.go</url>
+          <line>8</line>
+          <option name="timeStamp" value="59" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="DlvLineBreakpoint">
-          <url>file://$PROJECT_DIR$/service/message_mail_box.go</url>
-          <line>318</line>
-          <option name="timeStamp" value="26" />
+          <url>file://$PROJECT_DIR$/service/chat_group.go</url>
+          <line>7</line>
+          <option name="timeStamp" value="60" />
         </line-breakpoint>
       </breakpoints>
       <default-breakpoints>

+ 4 - 0
README.md

@@ -16,3 +16,7 @@ goctl 1.1.6
 ### 其他
 - 代理可使用 `GOPROXY=https://goproxy.io`
 - 目前使用的go 版本 1.16   (由于go-zero 对go版本有要求 ,go 1.15.1以下的版本,启动会报错)
+
+#
+
+#

+ 10 - 9
api/messagecenter/internal/logic/findmessagelogic.go

@@ -28,15 +28,16 @@ func NewFindMessageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FindM
 func (l *FindMessageLogic) FindMessage(req *types.MessageReq) (*types.CommonRes, error) {
 	// todo: add your logic here and delete this line
 	resp, err := l.svcCtx.Message.FindMessage(l.ctx, &messagecenter.MessageReq{
-		UserType:  req.UserType,
-		MsgType:   req.MsgType,
-		SendId:    quitl.Int64All(encrypt.SE.Decode4Hex(req.SendId)),
-		LastId:    quitl.Int64All(encrypt.SE.Decode4Hex(req.LastId)),
-		EntId:     req.EntId,
-		PageSize:  req.PageSize,
-		EntUserId: req.EntUserId,
-		NewUserId: req.NewUserId,
-		Sort:      req.Sort,
+		UserType:    req.UserType,
+		MsgType:     req.MsgType,
+		SendId:      quitl.Int64All(encrypt.SE.Decode4Hex(req.SendId)),
+		LastId:      quitl.Int64All(encrypt.SE.Decode4Hex(req.LastId)),
+		EntId:       req.EntId,
+		PageSize:    req.PageSize,
+		EntUserId:   req.EntUserId,
+		NewUserId:   req.NewUserId,
+		Sort:        req.Sort,
+		ChatGroupId: req.ChatGroupId,
 	})
 	if err != nil {
 		return nil, err

+ 16 - 13
api/messagecenter/internal/logic/messageaddlogic.go

@@ -1,13 +1,14 @@
 package logic
 
 import (
+	"context"
+
 	quitl "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/fsw"
 	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/svc"
 	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/api/messagecenter/internal/types"
 	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
-	"context"
 	"github.com/microcosm-cc/bluemonday"
 
 	"github.com/zeromicro/go-zero/core/logx"
@@ -41,18 +42,20 @@ func init() {
 func (l *MessageAddLogic) MessageAdd(req *types.MessageEntity) (*types.CommonRes, error) {
 
 	resp, err := l.svcCtx.Message.SaveMessage(l.ctx, &messagecenter.MessageEntity{
-		OwnType:   req.OwnType,
-		Title:     req.Title,
-		SendId:    quitl.Int64All(encrypt.SE.Decode4Hex(req.SendId)),
-		Content:   quitl.ObjToString(quitl.If(req.Type == 3 || req.Type == 4, fsw.Repl(req.Content), htmlFilter.Sanitize(fsw.Repl(req.Content)))),
-		Item:      req.Item,
-		Type:      req.Type,
-		Link:      req.Link,
-		Appid:     req.Appid,
-		ItemType:  req.ItemType,
-		ReceiveId: quitl.Int64All(encrypt.SE.Decode4Hex(req.ReceiveId)),
-		NewUserId: req.NewUserId,
-		EntUserId: req.EntUserId,
+		OwnType:     req.OwnType,
+		Title:       req.Title,
+		SendId:      quitl.Int64All(encrypt.SE.Decode4Hex(req.SendId)),
+		Content:     quitl.ObjToString(quitl.If(req.Type == 3 || req.Type == 4, fsw.Repl(req.Content), htmlFilter.Sanitize(fsw.Repl(req.Content)))),
+		Item:        req.Item,
+		Type:        req.Type,
+		Link:        req.Link,
+		Appid:       req.Appid,
+		ItemType:    req.ItemType,
+		ReceiveId:   quitl.Int64All(encrypt.SE.Decode4Hex(req.ReceiveId)),
+		NewUserId:   req.NewUserId,
+		EntUserId:   req.EntUserId,
+		ReceiverIds: req.ReceiverIds,
+		GroupIds:    req.GroupIds,
 	})
 	if err != nil {
 		return nil, err

+ 3 - 0
api/messagecenter/internal/logic/userlistlogic.go

@@ -38,6 +38,9 @@ func (l *UserListLogic) UserList(req *types.UserReq) (*types.CommonRes, error) {
 		IsArtificial: req.IsArtificial,
 		FiltrationId: req.FiltrationId,
 		EntId:        req.EntId,
+		QueryType:    req.QueryType,
+		NameSearch:   req.NameSearch,
+		PositionId:   req.PositionId,
 	})
 	if err != nil {
 		return nil, err

+ 8 - 5
api/messagecenter/internal/logic/withdrawmessagelogic.go

@@ -26,11 +26,14 @@ func NewWithdrawMessageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *W
 func (l *WithdrawMessageLogic) WithdrawMessage(req *types.ReadWithdrawReq) (resp *types.CommonRes, err error) {
 	// todo: add your logic here and delete this line
 	r, err := l.svcCtx.Message.WithdrawMessage(l.ctx, &messagecenter.ReadWithdrawReq{
-		MessageId: req.MessageId,
-		Appid:     req.Appid,
-		NewUserId: req.NewUserId,
-		UserType:  req.UserType,
-		EntUserId: req.EntUserId,
+		MessageId:        req.MessageId,
+		Appid:            req.Appid,
+		UserType:         req.UserType,
+		EntId:            req.EntId,
+		SenderId:         req.SenderId,
+		RecipientId:      req.RecipientId,
+		ChatGroupId:      req.ChatGroupId,
+		ConversationType: req.ConversationType,
 	})
 	if err != nil {
 		return nil, err

+ 35 - 26
api/messagecenter/internal/types/types.go

@@ -19,39 +19,45 @@ type UserReq struct {
 	StartTime    string `json:"startTime,optional"`
 	EndTime      string `json:"endTime,optional"`
 	NewUserId    int64  `header:"newUserId"`
+	PositionId   int64  `header:"positionId,optional"`
 	EntId        int64  `header:"entId,optional"`
 	EntUserId    int64  `header:"entUserId,optional"`
 	Page         int64  `json:"page,optional"`
 	Size         int64  `json:"size,optional"`
 	IsArtificial int64  `json:"isArtificial,optional"`
 	FiltrationId string `json:"filtrationId,optional"`
+	QueryType    int64  `json:"queryType,optional"`
+	NameSearch   string `json:"nameSearch,optional"`
 }
 
 type MessageEntity struct {
-	OwnType   int64  `json:"ownType"`
-	Title     string `json:"title"`
-	Content   string `json:"content"`
-	Item      int64  `json:"item"`
-	Type      int64  `json:"type"`
-	Link      string `json:"link"`
-	Appid     string `header:"appId"`
-	ItemType  int64  `json:"itemType"`
-	SendId    string `json:"sendId,optional"`
-	EntUserId int64  `header:"entUserId,optional"`
-	NewUserId int64  `header:"newUserId"`
-	ReceiveId string `json:"receiveId,optional"`
+	OwnType     int64   `json:"ownType"`
+	Title       string  `json:"title"`
+	Content     string  `json:"content"`
+	Item        int64   `json:"item"`
+	Type        int64   `json:"type"`
+	Link        string  `json:"link"`
+	Appid       string  `header:"appId"`
+	ItemType    int64   `json:"itemType"`
+	SendId      string  `json:"sendId,optional"`
+	EntUserId   int64   `header:"entUserId,optional"`
+	NewUserId   int64   `header:"newUserId"`
+	ReceiveId   string  `json:"receiveId,optional"`
+	ReceiverIds []int64 `json:"receiverIds,optional"` //个人[可多个]
+	GroupIds    []int64 `json:"groupIds,optional"`    //群聊[可多个]
 }
 
 type MessageReq struct {
-	MsgType   int64  `json:"msgType"`
-	UserType  int64  `json:"userType"`
-	SendId    string `json:"sendId,optional"`
-	LastId    string `json:"lastId,optional"`
-	PageSize  int64  `json:"pageSize"`
-	NewUserId int64  `header:"newUserId"`
-	EntUserId int64  `header:"entUserId,optional"`
-	EntId     int64  `header:"entId,optional"`
-	Sort      string `json:"sort,optional"`
+	MsgType     int64  `json:"msgType"`
+	UserType    int64  `json:"userType"`
+	SendId      string `json:"sendId,optional"`
+	LastId      string `json:"lastId,optional"`
+	PageSize    int64  `json:"pageSize"`
+	NewUserId   int64  `header:"newUserId"`
+	EntUserId   int64  `header:"entUserId,optional"`
+	EntId       int64  `header:"entId,optional"`
+	Sort        string `json:"sort,optional"`
+	ChatGroupId int64  `json:"chatGroupId,optional"`
 }
 
 type CommonRes struct {
@@ -89,11 +95,14 @@ type ReadStateReq struct {
 }
 
 type ReadWithdrawReq struct {
-	MessageId string `json:"messageId"`
-	Appid     string `header:"appid"`
-	NewUserId int64  `header:"newUserId,optional"`
-	EntUserId int64  `header:"entUserId,optional"`
-	UserType  int64  `json:"userType"`
+	MessageId        string `json:"messageId"`
+	Appid            string `header:"appid"`
+	UserType         int64  `json:"userType"` //用户与客服聊天 发送人类型区分 用户类型:2用户1客服
+	EntId            int64  `header:"entId,optional"`
+	SenderId         int64  `json:"senderId,optional"`         //发送人id
+	RecipientId      int64  `json:"recipientId,optional"`      //接收人id
+	ConversationType int64  `json:"conversationType,optional"` //会话类型 1:一对一用户聊天 2 用户与客服 3 一对群
+	ChatGroupId      int64  `json:"chatGroupId,optional"`      //群id
 }
 
 type AppraiseMessageReq struct {

+ 35 - 26
api/messagecenter/messagecenter.api

@@ -16,37 +16,43 @@ type UserReq {
 	StartTime    string `json:"startTime,optional"`
 	EndTime      string `json:"endTime,optional"`
 	NewUserId    int64  `header:"newUserId"`
+	PositionId   int64  `header:"positionId,optional"`
 	EntId        int64  `header:"entId,optional"`
 	EntUserId    int64  `header:"entUserId,optional"`
 	Page         int64  `json:"page,optional"`
 	Size         int64  `json:"size,optional"`
 	IsArtificial int64  `json:"isArtificial,optional"`
 	FiltrationId string `json:"filtrationId,optional"`
+	QueryType    int64  `json:"queryType,optional"`
+	NameSearch   string `json:"nameSearch,optional"`
 }
 type MessageEntity {
-	OwnType   int64  `json:"ownType"`
-	Title     string `json:"title"`
-	Content   string `json:"content"`
-	Item      int64  `json:"item"`
-	Type      int64  `json:"type"`
-	Link      string `json:"link"`
-	Appid     string `header:"appId"`
-	ItemType  int64  `json:"itemType"`
-	SendId    string `json:"sendId,optional"`
-	EntUserId int64  `header:"entUserId,optional"`
-	NewUserId int64  `header:"newUserId"`
-	ReceiveId string `json:"receiveId,optional"`
+	OwnType     int64   `json:"ownType"`
+	Title       string  `json:"title"`
+	Content     string  `json:"content"`
+	Item        int64   `json:"item"`
+	Type        int64   `json:"type"`
+	Link        string  `json:"link"`
+	Appid       string  `header:"appId"`
+	ItemType    int64   `json:"itemType"`
+	SendId      string  `json:"sendId,optional"`
+	EntUserId   int64   `header:"entUserId,optional"`
+	NewUserId   int64   `header:"newUserId"`
+	ReceiveId   string  `json:"receiveId,optional"`
+	ReceiverIds []int64 `json:"receiverIds,optional"` //个人[可多个]
+	GroupIds    []int64 `json:"groupIds,optional"`    //群聊[可多个]
 }
 type MessageReq {
-	MsgType   int64  `json:"msgType"`
-	UserType  int64  `json:"userType"`
-	SendId    string `json:"sendId,optional"`
-	LastId    string `json:"lastId,optional"`
-	PageSize  int64  `json:"pageSize"`
-	NewUserId int64  `header:"newUserId"`
-	EntUserId int64  `header:"entUserId,optional"`
-	EntId     int64  `header:"entId,optional"`
-	Sort      string `json:"sort,optional"`
+	MsgType     int64  `json:"msgType"`
+	UserType    int64  `json:"userType"`
+	SendId      string `json:"sendId,optional"`
+	LastId      string `json:"lastId,optional"`
+	PageSize    int64  `json:"pageSize"`
+	NewUserId   int64  `header:"newUserId"`
+	EntUserId   int64  `header:"entUserId,optional"`
+	EntId       int64  `header:"entId,optional"`
+	Sort        string `json:"sort,optional"`
+	ChatGroupId int64  `json:"chatGroupId,optional"`
 }
 
 type CommonRes {
@@ -79,11 +85,14 @@ type ReadStateReq {
 	NewUserId int64  `header:"newUserId"`
 }
 type ReadWithdrawReq {
-	MessageId string `json:"messageId"`
-	Appid     string `header:"appid"`
-	NewUserId int64  `header:"newUserId,optional"`
-	EntUserId int64  `header:"entUserId,optional"`
-	UserType  int64  `json:"userType"`
+	MessageId        string `json:"messageId"`
+	Appid            string `header:"appid"`
+	UserType         int64  `json:"userType"` //用户与客服聊天 发送人类型区分 用户类型:2用户1客服
+	EntId            int64  `header:"entId,optional"`
+	SenderId         int64  `json:"senderId,optional"`         //发送人id
+	RecipientId      int64  `json:"recipientId,optional"`      //接收人id
+	ConversationType int64  `json:"conversationType,optional"` //会话类型 1:一对一用户聊天 2 用户与客服 3 一对群
+	ChatGroupId      int64  `json:"chatGroupId,optional"`      //群id
 }
 
 type AppraiseMessageReq {

+ 6 - 2
entity/util.go

@@ -21,12 +21,16 @@ const (
 	SOCIALIZE_CHAT_GROUP        = "socialize_chat_group"
 	SOCIALIZE_CHAT_GROUP_NOTICE = "socialize_chat_group_notice"
 	SOCIALIZE_CHAT_GROUP_PERSON = "socialize_chat_group_person"
+	BASE_POSITION               = "base_position"
 	User_message_list           = "user_message_list"
 	//mainMysql
 	ENTNICHE_USER = "entniche_user"
 	//mongo
-	ENTNICHE_DELETE    = "entniche_delete"
-	SOCIALIZE_APPRAISE = "socialize_message_appraise"
+	ENTNICHE_DELETE                 = "entniche_delete"
+	SOCIALIZE_APPRAISE              = "socialize_message_appraise"
+	SOCIALIZE_SUMMARY               = "socialize_summary"
+	Socialize_summary               = "socialize_summary"
+	Socialize_customer_service_user = "socialize_customer_service_user"
 )
 const (
 	SUCCESS_CODE = int64(0)

+ 1 - 0
go.mod

@@ -7,6 +7,7 @@ require (
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
 	github.com/go-sql-driver/mysql v1.7.0
 	github.com/gomodule/redigo v2.0.0+incompatible // indirect
+	github.com/gogf/gf/v2 v2.0.6
 	github.com/microcosm-cc/bluemonday v1.0.23
 	github.com/zeromicro/go-zero v1.4.4
 	go.opentelemetry.io/otel/exporters/jaeger v1.11.0 // indirect

+ 4 - 5
rpc/messagecenter/internal/logic/entpersonslistlogic.go → rpc/messagecenter/internal/logic/groupchatlogic.go

@@ -10,14 +10,14 @@ import (
 	"github.com/zeromicro/go-zero/core/logx"
 )
 
-type EntPersonsListLogic struct {
+type GroupChatLogic struct {
 	ctx    context.Context
 	svcCtx *svc.ServiceContext
 	logx.Logger
 }
 
-func NewEntPersonsListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EntPersonsListLogic {
-	return &EntPersonsListLogic{
+func NewGroupChatLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GroupChatLogic {
+	return &GroupChatLogic{
 		ctx:    ctx,
 		svcCtx: svcCtx,
 		Logger: logx.WithContext(ctx),
@@ -28,7 +28,6 @@ var ChatGroup service.ChatGroupService
 
 // 通讯录 -企业人员列表
 func (l *EntPersonsListLogic) EntPersonsList(in *messagecenter.EntPersonsListReq) (*messagecenter.EntPersonListResp, error) {
-	// todo: add your logic here and delete this line
 	ChatGroup.EntPersonsList(in)
-	return &messagecenter.EntPersonListResp{}, nil
+	return &messagecenter.CommonReq{}, nil
 }

+ 34 - 0
rpc/messagecenter/internal/logic/groupnameupdatelogic.go

@@ -0,0 +1,34 @@
+package logic
+
+import (
+	"context"
+
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/internal/svc"
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GroupNameUpdateLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGroupNameUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GroupNameUpdateLogic {
+	return &GroupNameUpdateLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 群组名称修改
+func (l *GroupNameUpdateLogic) GroupNameUpdate(in *messagecenter.GroupNameUpdateReq) (*messagecenter.CommonReq, error) {
+	// todo: add your logic here and delete this line
+	status := ChatGroup.GroupNameUpdate(in.ChatGroupId, in.GroupName, in.AppId)
+	return &messagecenter.CommonReq{
+		ErrorCode: 0,
+		Status:    status,
+	}, nil
+}

+ 61 - 13
rpc/messagecenter/internal/server/messagecenterserver.go

@@ -1,4 +1,4 @@
-// Code generated by goctl. DO NOT EDIT.
+// Code generated by goctl. DO NOT EDIT!
 // Source: messagecenter.proto
 
 package server
@@ -22,37 +22,37 @@ func NewMessageCenterServer(svcCtx *svc.ServiceContext) *MessageCenterServer {
 	}
 }
 
-// 查询数量
+//  查询数量
 func (s *MessageCenterServer) Count(ctx context.Context, in *messagecenter.CountReq) (*messagecenter.CountResp, error) {
 	l := logic.NewCountLogic(ctx, s.svcCtx)
 	return l.Count(in)
 }
 
-// 用户列表查询
+//  用户列表查询
 func (s *MessageCenterServer) UserList(ctx context.Context, in *messagecenter.UserReq) (*messagecenter.UserResp, error) {
 	l := logic.NewUserListLogic(ctx, s.svcCtx)
 	return l.UserList(in)
 }
 
-// 聊天内容查询
+//  聊天内容查询
 func (s *MessageCenterServer) FindMessage(ctx context.Context, in *messagecenter.MessageReq) (*messagecenter.MessageResp, error) {
 	l := logic.NewFindMessageLogic(ctx, s.svcCtx)
 	return l.FindMessage(in)
 }
 
-// 聊天保存
+//  聊天保存
 func (s *MessageCenterServer) SaveMessage(ctx context.Context, in *messagecenter.MessageEntity) (*messagecenter.SaveMessageResp, error) {
 	l := logic.NewSaveMessageLogic(ctx, s.svcCtx)
 	return l.SaveMessage(in)
 }
 
-// 会话创建
+//  会话创建
 func (s *MessageCenterServer) CreateChatSession(ctx context.Context, in *messagecenter.ChatSessionReq) (*messagecenter.ChatSessionResp, error) {
 	l := logic.NewCreateChatSessionLogic(ctx, s.svcCtx)
 	return l.CreateChatSession(in)
 }
 
-// 会话关闭
+//  会话关闭
 func (s *MessageCenterServer) CloseChatSession(ctx context.Context, in *messagecenter.CloseSessionReq) (*messagecenter.ChatSessionResp, error) {
 	l := logic.NewCloseChatSessionLogic(ctx, s.svcCtx)
 	return l.CloseChatSession(in)
@@ -70,10 +70,52 @@ func (s *MessageCenterServer) UpdateReadById(ctx context.Context, in *messagecen
 	return l.UpdateReadById(in)
 }
 
-// 通讯录 -企业人员列表
-func (s *MessageCenterServer) EntPersonsList(ctx context.Context, in *messagecenter.EntPersonsListReq) (*messagecenter.EntPersonListResp, error) {
-	l := logic.NewEntPersonsListLogic(ctx, s.svcCtx)
-	return l.EntPersonsList(in)
+// 群组列表查询
+func (s *MessageCenterServer) ChatGroupList(ctx context.Context, in *messagecenter.ChatGroupListReq) (*messagecenter.ChatGroupListResp, error) {
+	l := logic.NewChatGroupListLogic(ctx, s.svcCtx)
+	return l.ChatGroupList(in)
+}
+
+// 群组新增
+func (s *MessageCenterServer) ChatGroupAdd(ctx context.Context, in *messagecenter.ChatGroupAddReq) (*messagecenter.CommonReq, error) {
+	l := logic.NewChatGroupAddLogic(ctx, s.svcCtx)
+	return l.ChatGroupAdd(in)
+}
+
+// 群组成员查询
+func (s *MessageCenterServer) ChatGroupPerson(ctx context.Context, in *messagecenter.ChatGroupPersonReq) (*messagecenter.ChatGroupPersonResp, error) {
+	l := logic.NewChatGroupPersonLogic(ctx, s.svcCtx)
+	return l.ChatGroupPerson(in)
+}
+
+// 加入群组
+func (s *MessageCenterServer) ChatGroupJoin(ctx context.Context, in *messagecenter.ChatGroupJoinReq) (*messagecenter.CommonReq, error) {
+	l := logic.NewChatGroupJoinLogic(ctx, s.svcCtx)
+	return l.ChatGroupJoin(in)
+}
+
+// 群组名称修改
+func (s *MessageCenterServer) GroupNameUpdate(ctx context.Context, in *messagecenter.GroupNameUpdateReq) (*messagecenter.CommonReq, error) {
+	l := logic.NewGroupNameUpdateLogic(ctx, s.svcCtx)
+	return l.GroupNameUpdate(in)
+}
+
+// 群任务新增
+func (s *MessageCenterServer) GroupNoticeAdd(ctx context.Context, in *messagecenter.GroupNoticeAddReq) (*messagecenter.CommonReq, error) {
+	l := logic.NewGroupNoticeAddLogic(ctx, s.svcCtx)
+	return l.GroupNoticeAdd(in)
+}
+
+// 群任务编辑
+func (s *MessageCenterServer) GroupNoticeUpdate(ctx context.Context, in *messagecenter.GroupNoticeUpdateReq) (*messagecenter.CommonReq, error) {
+	l := logic.NewGroupNoticeUpdateLogic(ctx, s.svcCtx)
+	return l.GroupNoticeUpdate(in)
+}
+
+// 群任务详情
+func (s *MessageCenterServer) GroupNoticeGet(ctx context.Context, in *messagecenter.ChatGroupPersonReq) (*messagecenter.GroupNoticeGetResp, error) {
+	l := logic.NewGroupNoticeGetLogic(ctx, s.svcCtx)
+	return l.GroupNoticeGet(in)
 }
 
 // 用户撤回消息
@@ -82,14 +124,20 @@ func (s *MessageCenterServer) WithdrawMessage(ctx context.Context, in *messagece
 	return l.WithdrawMessage(in)
 }
 
-// 用户评价回复
+//  用户评价回复
 func (s *MessageCenterServer) AppraiseMessage(ctx context.Context, in *messagecenter.AppraiseReq) (*messagecenter.CurrencyResp, error) {
 	l := logic.NewAppraiseMessageLogic(ctx, s.svcCtx)
 	return l.AppraiseMessage(in)
 }
 
-// 客服列表查询
+//  客服列表查询
 func (s *MessageCenterServer) ConversationList(ctx context.Context, in *messagecenter.ConversationReq) (*messagecenter.UserResp, error) {
 	l := logic.NewConversationListLogic(ctx, s.svcCtx)
 	return l.ConversationList(in)
 }
+
+//  群聊
+func (s *MessageCenterServer) GroupChat(ctx context.Context, in *messagecenter.MessageSaveReq) (*messagecenter.CommonReq, error) {
+	l := logic.NewGroupChatLogic(ctx, s.svcCtx)
+	return l.GroupChat(in)
+}

+ 99 - 3
rpc/messagecenter/messagecenter.proto

@@ -18,14 +18,17 @@ message UserReq {
   string    phone = 1;
   string    startTime = 2;
   string    endTime = 3;
-  int64     newUserId = 4;  //用户标识
+  int64     newUserId = 4;  //用户base_user_id
   int64     userType = 5;  //用户类型:2用户1客服
-  int64     entUserId = 6;  //企业标识
+  int64     entUserId = 6;  //客服id
   int64     page = 7;  //页
   int64     size =8; //数
   int64     isArtificial =9; //是否人工介入 1:人工介入 2:非让人工介入
   string    filtrationId = 10; //客服列表过滤会话中派对中用户
   int64  entId = 11;
+  int64  queryType = 12;
+  string  nameSearch =13;
+  int64     positionId = 14;  //用户职位id
 }
 message UserResp {
    repeated UserEntity data=1;
@@ -58,6 +61,8 @@ message MessageReq {
   int64         entId = 8;
   int64         customerEntId = 9;
   string        sort = 10;
+  int64         chatGroupId = 11;
+  int64         userId = 12; //base_user  表id
 }
 message MessageResp {
   int64         count = 1;
@@ -93,6 +98,8 @@ message MessageEntity {
   string        ownImg=18;
   string        messageId=19;
   int64         appraise=20;
+  repeated int64        groupIds =21;//群聊id [群组id]
+  repeated int64        receiverIds =22;//群聊接收人id [接收人为职位id]
 }
 
 message ChatSessionReq {
@@ -144,13 +151,86 @@ message CurrencyResp {
   int64 error_code = 2; //响应代码
   string error_msg = 1; //响应消息
 }
-
+message ChatGroupListReq{
+  int64 entId = 1;
+  string userName = 2;
+  string groupName = 3;
+  int64 positionId = 4;
+  string appId = 5;
+}
+message ChatGroupListResp {
+  repeated      ChatGroupList data = 1;
+  int64         error_code = 2; //响应代码
+  string        error_msg = 3; //响应消息
+}
+message ChatGroupList {
+  string  groupName = 1;
+  int64   personCount = 2;
+  string  chatGroupId = 3;
+  string  appId = 4;
+}
+message ChatGroupAddReq {
+  int64  entId = 1;
+  int64   positionId = 2;
+  repeated int64 userIdArr = 3;
+  string  appId = 4;
+}
 message CommonReq {
   bool          status = 1;
   int64         error_code = 2; //响应代码
   string        error_msg = 3; //响应消息
 }
+message ChatGroupPersonReq{
+  int64 chatGroupId = 1;
+  int64 ent_id = 2;
+  string  appId = 3;
+}
+message ChatGroupPersonResp{
+  map<string, ChatGroupPersonList> data = 1;//地区
+  int64         error_code = 2; //响应代码
+  string        error_msg = 3; //响应消息
+}
 
+message ChatGroupPersonList{
+  repeated      ChatGroupPerson data = 1;
+}
+message ChatGroupPerson{
+  string   personName = 1;
+  bool     isSystem = 2;
+  string   appId = 3;
+  string   positionId = 4;
+}
+message ChatGroupJoinReq{
+  int64 chatGroupId = 1;
+  int64 positionId = 2;
+  repeated int64 userIdArr = 3;
+  string  appId = 4;
+}
+message GroupNameUpdateReq{
+  int64  chatGroupId = 1;
+  int64  positionId = 2;
+  string groupName = 3;
+  string  appId = 4;
+}
+message GroupNoticeAddReq{
+  int64 chatGroupId = 1;
+  string content = 2;
+  string  appId = 3;
+}
+message GroupNoticeUpdateReq{
+  int64 groupNoticeId = 1;
+  string content = 2;
+  string appId = 3;
+}
+message GroupNoticeGetResp{
+  GroupNotice        data = 1;
+  int64         error_code = 2; //响应代码
+  string        error_msg = 3; //响应消息
+}
+message  GroupNotice{
+  string content = 1;
+  string  groupNoticeId = 2;
+}
 //企业人员列表、拉人进群列表
 message EntPersonsListReq{
   string name =1;
@@ -199,6 +279,22 @@ service messageCenter {
   rpc SaveAutoReplyMsg(SaveAutoReplyReq)returns(MessageResp);
   //根据消息修改已读状态
   rpc UpdateReadById(ReadStateReq)returns(CurrencyResp);
+  //群组列表查询
+  rpc ChatGroupList(ChatGroupListReq)returns(ChatGroupListResp);
+  //群组新增
+  rpc ChatGroupAdd(ChatGroupAddReq)returns(CommonReq);
+  //群组成员查询
+  rpc ChatGroupPerson(ChatGroupPersonReq)returns(ChatGroupPersonResp);
+  //加入群组
+  rpc ChatGroupJoin(ChatGroupJoinReq)returns(CommonReq);
+  //群组名称修改
+  rpc GroupNameUpdate(GroupNameUpdateReq)returns(CommonReq);
+  //群任务新增
+  rpc GroupNoticeAdd(GroupNoticeAddReq)returns(CommonReq);
+  //群任务编辑
+  rpc GroupNoticeUpdate(GroupNoticeUpdateReq)returns(CommonReq);
+  //群任务详情
+  rpc GroupNoticeGet(ChatGroupPersonReq)returns(GroupNoticeGetResp);
   //通讯录 -企业人员列表
   rpc EntPersonsList(EntPersonsListReq) returns(EntPersonListResp);
   //用户撤回消息

+ 78 - 14
rpc/messagecenter/messagecenter/messagecenter.go

@@ -1,4 +1,4 @@
-// Code generated by goctl. DO NOT EDIT.
+// Code generated by goctl. DO NOT EDIT!
 // Source: messagecenter.proto
 
 package messagecenter
@@ -12,30 +12,46 @@ import (
 
 type (
 	MessageCenter interface {
-		// 查询数量
+		//  查询数量
 		Count(ctx context.Context, in *CountReq, opts ...grpc.CallOption) (*CountResp, error)
-		// 用户列表查询
+		//  用户列表查询
 		UserList(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserResp, error)
-		// 聊天内容查询
+		//  聊天内容查询
 		FindMessage(ctx context.Context, in *MessageReq, opts ...grpc.CallOption) (*MessageResp, error)
-		// 聊天保存
+		//  聊天保存
 		SaveMessage(ctx context.Context, in *MessageEntity, opts ...grpc.CallOption) (*SaveMessageResp, error)
-		// 会话创建
+		//  会话创建
 		CreateChatSession(ctx context.Context, in *ChatSessionReq, opts ...grpc.CallOption) (*ChatSessionResp, error)
-		// 会话关闭
+		//  会话关闭
 		CloseChatSession(ctx context.Context, in *CloseSessionReq, opts ...grpc.CallOption) (*ChatSessionResp, error)
 		// 创建会话并且保存信息
 		SaveAutoReplyMsg(ctx context.Context, in *SaveAutoReplyReq, opts ...grpc.CallOption) (*MessageResp, error)
 		// 根据消息修改已读状态
 		UpdateReadById(ctx context.Context, in *ReadStateReq, opts ...grpc.CallOption) (*CurrencyResp, error)
-		// 通讯录 -企业人员列表
-		EntPersonsList(ctx context.Context, in *EntPersonsListReq, opts ...grpc.CallOption) (*EntPersonListResp, error)
+		// 群组列表查询
+		ChatGroupList(ctx context.Context, in *ChatGroupListReq, opts ...grpc.CallOption) (*ChatGroupListResp, error)
+		// 群组新增
+		ChatGroupAdd(ctx context.Context, in *ChatGroupAddReq, opts ...grpc.CallOption) (*CommonReq, error)
+		// 群组成员查询
+		ChatGroupPerson(ctx context.Context, in *ChatGroupPersonReq, opts ...grpc.CallOption) (*ChatGroupPersonResp, error)
+		// 加入群组
+		ChatGroupJoin(ctx context.Context, in *ChatGroupJoinReq, opts ...grpc.CallOption) (*CommonReq, error)
+		// 群组名称修改
+		GroupNameUpdate(ctx context.Context, in *GroupNameUpdateReq, opts ...grpc.CallOption) (*CommonReq, error)
+		// 群任务新增
+		GroupNoticeAdd(ctx context.Context, in *GroupNoticeAddReq, opts ...grpc.CallOption) (*CommonReq, error)
+		// 群任务编辑
+		GroupNoticeUpdate(ctx context.Context, in *GroupNoticeUpdateReq, opts ...grpc.CallOption) (*CommonReq, error)
+		// 群任务详情
+		GroupNoticeGet(ctx context.Context, in *ChatGroupPersonReq, opts ...grpc.CallOption) (*GroupNoticeGetResp, error)
 		// 用户撤回消息
 		WithdrawMessage(ctx context.Context, in *ReadWithdrawReq, opts ...grpc.CallOption) (*CurrencyResp, error)
-		// 用户评价回复
+		//  用户评价回复
 		AppraiseMessage(ctx context.Context, in *AppraiseReq, opts ...grpc.CallOption) (*CurrencyResp, error)
-		// 客服列表查询
+		//  客服列表查询
 		ConversationList(ctx context.Context, in *ConversationReq, opts ...grpc.CallOption) (*UserResp, error)
+		//  群聊
+		GroupChat(ctx context.Context, in *MessageSaveReq, opts ...grpc.CallOption) (*CommonReq, error)
 	}
 
 	defaultMessageCenter struct {
@@ -97,10 +113,52 @@ func (m *defaultMessageCenter) UpdateReadById(ctx context.Context, in *ReadState
 	return client.UpdateReadById(ctx, in, opts...)
 }
 
-// 通讯录 -企业人员列表
-func (m *defaultMessageCenter) EntPersonsList(ctx context.Context, in *EntPersonsListReq, opts ...grpc.CallOption) (*EntPersonListResp, error) {
+// 群组列表查询
+func (m *defaultMessageCenter) ChatGroupList(ctx context.Context, in *ChatGroupListReq, opts ...grpc.CallOption) (*ChatGroupListResp, error) {
 	client := NewMessageCenterClient(m.cli.Conn())
-	return client.EntPersonsList(ctx, in, opts...)
+	return client.ChatGroupList(ctx, in, opts...)
+}
+
+// 群组新增
+func (m *defaultMessageCenter) ChatGroupAdd(ctx context.Context, in *ChatGroupAddReq, opts ...grpc.CallOption) (*CommonReq, error) {
+	client := NewMessageCenterClient(m.cli.Conn())
+	return client.ChatGroupAdd(ctx, in, opts...)
+}
+
+// 群组成员查询
+func (m *defaultMessageCenter) ChatGroupPerson(ctx context.Context, in *ChatGroupPersonReq, opts ...grpc.CallOption) (*ChatGroupPersonResp, error) {
+	client := NewMessageCenterClient(m.cli.Conn())
+	return client.ChatGroupPerson(ctx, in, opts...)
+}
+
+// 加入群组
+func (m *defaultMessageCenter) ChatGroupJoin(ctx context.Context, in *ChatGroupJoinReq, opts ...grpc.CallOption) (*CommonReq, error) {
+	client := NewMessageCenterClient(m.cli.Conn())
+	return client.ChatGroupJoin(ctx, in, opts...)
+}
+
+// 群组名称修改
+func (m *defaultMessageCenter) GroupNameUpdate(ctx context.Context, in *GroupNameUpdateReq, opts ...grpc.CallOption) (*CommonReq, error) {
+	client := NewMessageCenterClient(m.cli.Conn())
+	return client.GroupNameUpdate(ctx, in, opts...)
+}
+
+// 群任务新增
+func (m *defaultMessageCenter) GroupNoticeAdd(ctx context.Context, in *GroupNoticeAddReq, opts ...grpc.CallOption) (*CommonReq, error) {
+	client := NewMessageCenterClient(m.cli.Conn())
+	return client.GroupNoticeAdd(ctx, in, opts...)
+}
+
+// 群任务编辑
+func (m *defaultMessageCenter) GroupNoticeUpdate(ctx context.Context, in *GroupNoticeUpdateReq, opts ...grpc.CallOption) (*CommonReq, error) {
+	client := NewMessageCenterClient(m.cli.Conn())
+	return client.GroupNoticeUpdate(ctx, in, opts...)
+}
+
+// 群任务详情
+func (m *defaultMessageCenter) GroupNoticeGet(ctx context.Context, in *ChatGroupPersonReq, opts ...grpc.CallOption) (*GroupNoticeGetResp, error) {
+	client := NewMessageCenterClient(m.cli.Conn())
+	return client.GroupNoticeGet(ctx, in, opts...)
 }
 
 // 用户撤回消息
@@ -120,3 +178,9 @@ func (m *defaultMessageCenter) ConversationList(ctx context.Context, in *Convers
 	client := NewMessageCenterClient(m.cli.Conn())
 	return client.ConversationList(ctx, in, opts...)
 }
+
+// 群聊
+func (m *defaultMessageCenter) GroupChat(ctx context.Context, in *MessageSaveReq, opts ...grpc.CallOption) (*CommonReq, error) {
+	client := NewMessageCenterClient(m.cli.Conn())
+	return client.GroupChat(ctx, in, opts...)
+}

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1016 - 171
rpc/messagecenter/messagecenter/messagecenter.pb.go


+ 327 - 23
rpc/messagecenter/messagecenter/messagecenter_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.15.1
+// - protoc             v3.19.4
 // source: messagecenter.proto
 
 package messagecenter
@@ -34,18 +34,34 @@ type MessageCenterClient interface {
 	CreateChatSession(ctx context.Context, in *ChatSessionReq, opts ...grpc.CallOption) (*ChatSessionResp, error)
 	// 会话关闭
 	CloseChatSession(ctx context.Context, in *CloseSessionReq, opts ...grpc.CallOption) (*ChatSessionResp, error)
-	//创建会话并且保存信息
+	// 创建会话并且保存信息
 	SaveAutoReplyMsg(ctx context.Context, in *SaveAutoReplyReq, opts ...grpc.CallOption) (*MessageResp, error)
-	//根据消息修改已读状态
+	// 根据消息修改已读状态
 	UpdateReadById(ctx context.Context, in *ReadStateReq, opts ...grpc.CallOption) (*CurrencyResp, error)
-	//通讯录 -企业人员列表
-	EntPersonsList(ctx context.Context, in *EntPersonsListReq, opts ...grpc.CallOption) (*EntPersonListResp, error)
-	//用户撤回消息
+	// 群组列表查询
+	ChatGroupList(ctx context.Context, in *ChatGroupListReq, opts ...grpc.CallOption) (*ChatGroupListResp, error)
+	// 群组新增
+	ChatGroupAdd(ctx context.Context, in *ChatGroupAddReq, opts ...grpc.CallOption) (*CommonReq, error)
+	// 群组成员查询
+	ChatGroupPerson(ctx context.Context, in *ChatGroupPersonReq, opts ...grpc.CallOption) (*ChatGroupPersonResp, error)
+	// 加入群组
+	ChatGroupJoin(ctx context.Context, in *ChatGroupJoinReq, opts ...grpc.CallOption) (*CommonReq, error)
+	// 群组名称修改
+	GroupNameUpdate(ctx context.Context, in *GroupNameUpdateReq, opts ...grpc.CallOption) (*CommonReq, error)
+	// 群任务新增
+	GroupNoticeAdd(ctx context.Context, in *GroupNoticeAddReq, opts ...grpc.CallOption) (*CommonReq, error)
+	// 群任务编辑
+	GroupNoticeUpdate(ctx context.Context, in *GroupNoticeUpdateReq, opts ...grpc.CallOption) (*CommonReq, error)
+	// 群任务详情
+	GroupNoticeGet(ctx context.Context, in *ChatGroupPersonReq, opts ...grpc.CallOption) (*GroupNoticeGetResp, error)
+	// 用户撤回消息
 	WithdrawMessage(ctx context.Context, in *ReadWithdrawReq, opts ...grpc.CallOption) (*CurrencyResp, error)
 	// 用户评价回复
 	AppraiseMessage(ctx context.Context, in *AppraiseReq, opts ...grpc.CallOption) (*CurrencyResp, error)
 	// 客服列表查询
 	ConversationList(ctx context.Context, in *ConversationReq, opts ...grpc.CallOption) (*UserResp, error)
+	// 群聊
+	GroupChat(ctx context.Context, in *MessageSaveReq, opts ...grpc.CallOption) (*CommonReq, error)
 }
 
 type messageCenterClient struct {
@@ -128,9 +144,72 @@ func (c *messageCenterClient) UpdateReadById(ctx context.Context, in *ReadStateR
 	return out, nil
 }
 
-func (c *messageCenterClient) EntPersonsList(ctx context.Context, in *EntPersonsListReq, opts ...grpc.CallOption) (*EntPersonListResp, error) {
-	out := new(EntPersonListResp)
-	err := c.cc.Invoke(ctx, "/messagecenter.messageCenter/EntPersonsList", in, out, opts...)
+func (c *messageCenterClient) ChatGroupList(ctx context.Context, in *ChatGroupListReq, opts ...grpc.CallOption) (*ChatGroupListResp, error) {
+	out := new(ChatGroupListResp)
+	err := c.cc.Invoke(ctx, "/messagecenter.messageCenter/ChatGroupList", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *messageCenterClient) ChatGroupAdd(ctx context.Context, in *ChatGroupAddReq, opts ...grpc.CallOption) (*CommonReq, error) {
+	out := new(CommonReq)
+	err := c.cc.Invoke(ctx, "/messagecenter.messageCenter/ChatGroupAdd", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *messageCenterClient) ChatGroupPerson(ctx context.Context, in *ChatGroupPersonReq, opts ...grpc.CallOption) (*ChatGroupPersonResp, error) {
+	out := new(ChatGroupPersonResp)
+	err := c.cc.Invoke(ctx, "/messagecenter.messageCenter/ChatGroupPerson", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *messageCenterClient) ChatGroupJoin(ctx context.Context, in *ChatGroupJoinReq, opts ...grpc.CallOption) (*CommonReq, error) {
+	out := new(CommonReq)
+	err := c.cc.Invoke(ctx, "/messagecenter.messageCenter/ChatGroupJoin", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *messageCenterClient) GroupNameUpdate(ctx context.Context, in *GroupNameUpdateReq, opts ...grpc.CallOption) (*CommonReq, error) {
+	out := new(CommonReq)
+	err := c.cc.Invoke(ctx, "/messagecenter.messageCenter/GroupNameUpdate", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *messageCenterClient) GroupNoticeAdd(ctx context.Context, in *GroupNoticeAddReq, opts ...grpc.CallOption) (*CommonReq, error) {
+	out := new(CommonReq)
+	err := c.cc.Invoke(ctx, "/messagecenter.messageCenter/GroupNoticeAdd", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *messageCenterClient) GroupNoticeUpdate(ctx context.Context, in *GroupNoticeUpdateReq, opts ...grpc.CallOption) (*CommonReq, error) {
+	out := new(CommonReq)
+	err := c.cc.Invoke(ctx, "/messagecenter.messageCenter/GroupNoticeUpdate", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *messageCenterClient) GroupNoticeGet(ctx context.Context, in *ChatGroupPersonReq, opts ...grpc.CallOption) (*GroupNoticeGetResp, error) {
+	out := new(GroupNoticeGetResp)
+	err := c.cc.Invoke(ctx, "/messagecenter.messageCenter/GroupNoticeGet", in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -164,6 +243,15 @@ func (c *messageCenterClient) ConversationList(ctx context.Context, in *Conversa
 	return out, nil
 }
 
+func (c *messageCenterClient) GroupChat(ctx context.Context, in *MessageSaveReq, opts ...grpc.CallOption) (*CommonReq, error) {
+	out := new(CommonReq)
+	err := c.cc.Invoke(ctx, "/messagecenter.messageCenter/GroupChat", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // MessageCenterServer is the server API for MessageCenter service.
 // All implementations must embed UnimplementedMessageCenterServer
 // for forward compatibility
@@ -180,18 +268,34 @@ type MessageCenterServer interface {
 	CreateChatSession(context.Context, *ChatSessionReq) (*ChatSessionResp, error)
 	// 会话关闭
 	CloseChatSession(context.Context, *CloseSessionReq) (*ChatSessionResp, error)
-	//创建会话并且保存信息
+	// 创建会话并且保存信息
 	SaveAutoReplyMsg(context.Context, *SaveAutoReplyReq) (*MessageResp, error)
-	//根据消息修改已读状态
+	// 根据消息修改已读状态
 	UpdateReadById(context.Context, *ReadStateReq) (*CurrencyResp, error)
-	//通讯录 -企业人员列表
-	EntPersonsList(context.Context, *EntPersonsListReq) (*EntPersonListResp, error)
-	//用户撤回消息
+	// 群组列表查询
+	ChatGroupList(context.Context, *ChatGroupListReq) (*ChatGroupListResp, error)
+	// 群组新增
+	ChatGroupAdd(context.Context, *ChatGroupAddReq) (*CommonReq, error)
+	// 群组成员查询
+	ChatGroupPerson(context.Context, *ChatGroupPersonReq) (*ChatGroupPersonResp, error)
+	// 加入群组
+	ChatGroupJoin(context.Context, *ChatGroupJoinReq) (*CommonReq, error)
+	// 群组名称修改
+	GroupNameUpdate(context.Context, *GroupNameUpdateReq) (*CommonReq, error)
+	// 群任务新增
+	GroupNoticeAdd(context.Context, *GroupNoticeAddReq) (*CommonReq, error)
+	// 群任务编辑
+	GroupNoticeUpdate(context.Context, *GroupNoticeUpdateReq) (*CommonReq, error)
+	// 群任务详情
+	GroupNoticeGet(context.Context, *ChatGroupPersonReq) (*GroupNoticeGetResp, error)
+	// 用户撤回消息
 	WithdrawMessage(context.Context, *ReadWithdrawReq) (*CurrencyResp, error)
 	// 用户评价回复
 	AppraiseMessage(context.Context, *AppraiseReq) (*CurrencyResp, error)
 	// 客服列表查询
 	ConversationList(context.Context, *ConversationReq) (*UserResp, error)
+	// 群聊
+	GroupChat(context.Context, *MessageSaveReq) (*CommonReq, error)
 	mustEmbedUnimplementedMessageCenterServer()
 }
 
@@ -223,8 +327,29 @@ func (UnimplementedMessageCenterServer) SaveAutoReplyMsg(context.Context, *SaveA
 func (UnimplementedMessageCenterServer) UpdateReadById(context.Context, *ReadStateReq) (*CurrencyResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method UpdateReadById not implemented")
 }
-func (UnimplementedMessageCenterServer) EntPersonsList(context.Context, *EntPersonsListReq) (*EntPersonListResp, error) {
-	return nil, status.Errorf(codes.Unimplemented, "method EntPersonsList not implemented")
+func (UnimplementedMessageCenterServer) ChatGroupList(context.Context, *ChatGroupListReq) (*ChatGroupListResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method ChatGroupList not implemented")
+}
+func (UnimplementedMessageCenterServer) ChatGroupAdd(context.Context, *ChatGroupAddReq) (*CommonReq, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method ChatGroupAdd not implemented")
+}
+func (UnimplementedMessageCenterServer) ChatGroupPerson(context.Context, *ChatGroupPersonReq) (*ChatGroupPersonResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method ChatGroupPerson not implemented")
+}
+func (UnimplementedMessageCenterServer) ChatGroupJoin(context.Context, *ChatGroupJoinReq) (*CommonReq, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method ChatGroupJoin not implemented")
+}
+func (UnimplementedMessageCenterServer) GroupNameUpdate(context.Context, *GroupNameUpdateReq) (*CommonReq, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GroupNameUpdate not implemented")
+}
+func (UnimplementedMessageCenterServer) GroupNoticeAdd(context.Context, *GroupNoticeAddReq) (*CommonReq, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GroupNoticeAdd not implemented")
+}
+func (UnimplementedMessageCenterServer) GroupNoticeUpdate(context.Context, *GroupNoticeUpdateReq) (*CommonReq, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GroupNoticeUpdate not implemented")
+}
+func (UnimplementedMessageCenterServer) GroupNoticeGet(context.Context, *ChatGroupPersonReq) (*GroupNoticeGetResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GroupNoticeGet not implemented")
 }
 func (UnimplementedMessageCenterServer) WithdrawMessage(context.Context, *ReadWithdrawReq) (*CurrencyResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method WithdrawMessage not implemented")
@@ -235,6 +360,9 @@ func (UnimplementedMessageCenterServer) AppraiseMessage(context.Context, *Apprai
 func (UnimplementedMessageCenterServer) ConversationList(context.Context, *ConversationReq) (*UserResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method ConversationList not implemented")
 }
+func (UnimplementedMessageCenterServer) GroupChat(context.Context, *MessageSaveReq) (*CommonReq, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GroupChat not implemented")
+}
 func (UnimplementedMessageCenterServer) mustEmbedUnimplementedMessageCenterServer() {}
 
 // UnsafeMessageCenterServer may be embedded to opt out of forward compatibility for this service.
@@ -392,20 +520,146 @@ func _MessageCenter_UpdateReadById_Handler(srv interface{}, ctx context.Context,
 	return interceptor(ctx, in, info, handler)
 }
 
-func _MessageCenter_EntPersonsList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
-	in := new(EntPersonsListReq)
+func _MessageCenter_ChatGroupList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(ChatGroupListReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(MessageCenterServer).ChatGroupList(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/messagecenter.messageCenter/ChatGroupList",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(MessageCenterServer).ChatGroupList(ctx, req.(*ChatGroupListReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _MessageCenter_ChatGroupAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(ChatGroupAddReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(MessageCenterServer).ChatGroupAdd(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/messagecenter.messageCenter/ChatGroupAdd",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(MessageCenterServer).ChatGroupAdd(ctx, req.(*ChatGroupAddReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _MessageCenter_ChatGroupPerson_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(ChatGroupPersonReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(MessageCenterServer).ChatGroupPerson(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/messagecenter.messageCenter/ChatGroupPerson",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(MessageCenterServer).ChatGroupPerson(ctx, req.(*ChatGroupPersonReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _MessageCenter_ChatGroupJoin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(ChatGroupJoinReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(MessageCenterServer).ChatGroupJoin(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/messagecenter.messageCenter/ChatGroupJoin",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(MessageCenterServer).ChatGroupJoin(ctx, req.(*ChatGroupJoinReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _MessageCenter_GroupNameUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GroupNameUpdateReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(MessageCenterServer).GroupNameUpdate(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/messagecenter.messageCenter/GroupNameUpdate",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(MessageCenterServer).GroupNameUpdate(ctx, req.(*GroupNameUpdateReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _MessageCenter_GroupNoticeAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GroupNoticeAddReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(MessageCenterServer).GroupNoticeAdd(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/messagecenter.messageCenter/GroupNoticeAdd",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(MessageCenterServer).GroupNoticeAdd(ctx, req.(*GroupNoticeAddReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _MessageCenter_GroupNoticeUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GroupNoticeUpdateReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(MessageCenterServer).GroupNoticeUpdate(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/messagecenter.messageCenter/GroupNoticeUpdate",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(MessageCenterServer).GroupNoticeUpdate(ctx, req.(*GroupNoticeUpdateReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+func _MessageCenter_GroupNoticeGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(ChatGroupPersonReq)
 	if err := dec(in); err != nil {
 		return nil, err
 	}
 	if interceptor == nil {
-		return srv.(MessageCenterServer).EntPersonsList(ctx, in)
+		return srv.(MessageCenterServer).GroupNoticeGet(ctx, in)
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/messagecenter.messageCenter/EntPersonsList",
+		FullMethod: "/messagecenter.messageCenter/GroupNoticeGet",
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
-		return srv.(MessageCenterServer).EntPersonsList(ctx, req.(*EntPersonsListReq))
+		return srv.(MessageCenterServer).GroupNoticeGet(ctx, req.(*ChatGroupPersonReq))
 	}
 	return interceptor(ctx, in, info, handler)
 }
@@ -464,6 +718,24 @@ func _MessageCenter_ConversationList_Handler(srv interface{}, ctx context.Contex
 	return interceptor(ctx, in, info, handler)
 }
 
+func _MessageCenter_GroupChat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(MessageSaveReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(MessageCenterServer).GroupChat(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/messagecenter.messageCenter/GroupChat",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(MessageCenterServer).GroupChat(ctx, req.(*MessageSaveReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // MessageCenter_ServiceDesc is the grpc.ServiceDesc for MessageCenter service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -504,8 +776,36 @@ var MessageCenter_ServiceDesc = grpc.ServiceDesc{
 			Handler:    _MessageCenter_UpdateReadById_Handler,
 		},
 		{
-			MethodName: "EntPersonsList",
-			Handler:    _MessageCenter_EntPersonsList_Handler,
+			MethodName: "ChatGroupList",
+			Handler:    _MessageCenter_ChatGroupList_Handler,
+		},
+		{
+			MethodName: "ChatGroupAdd",
+			Handler:    _MessageCenter_ChatGroupAdd_Handler,
+		},
+		{
+			MethodName: "ChatGroupPerson",
+			Handler:    _MessageCenter_ChatGroupPerson_Handler,
+		},
+		{
+			MethodName: "ChatGroupJoin",
+			Handler:    _MessageCenter_ChatGroupJoin_Handler,
+		},
+		{
+			MethodName: "GroupNameUpdate",
+			Handler:    _MessageCenter_GroupNameUpdate_Handler,
+		},
+		{
+			MethodName: "GroupNoticeAdd",
+			Handler:    _MessageCenter_GroupNoticeAdd_Handler,
+		},
+		{
+			MethodName: "GroupNoticeUpdate",
+			Handler:    _MessageCenter_GroupNoticeUpdate_Handler,
+		},
+		{
+			MethodName: "GroupNoticeGet",
+			Handler:    _MessageCenter_GroupNoticeGet_Handler,
 		},
 		{
 			MethodName: "WithdrawMessage",
@@ -519,6 +819,10 @@ var MessageCenter_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "ConversationList",
 			Handler:    _MessageCenter_ConversationList_Handler,
 		},
+		{
+			MethodName: "GroupChat",
+			Handler:    _MessageCenter_GroupChat_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "messagecenter.proto",

+ 9 - 1
service/chat_group.go

@@ -35,8 +35,16 @@ func EntPerson(entId int64, isAll bool) (map[string]string, map[string]string) {
 				nameData[common.InterfaceToStr(v["name"])] = common.InterfaceToStr(v["phone"])
 			}
 		}
+		//查询企业人员职位
+		positionList := IC.BaseMysql.SelectBySql("SELECT a.phone,b.id FROM base_user a LEFT JOIN base_position b ON a.id = b.user_id WHERE b.ent_id = ?", entId)
+		if positionList != nil && len(*positionList) > 0 {
+			for _, v := range *positionList {
+				positionData[common.IntAll(v["positionId"])] = phoneData[common.ObjToString(v["phone"])]
+			}
+		}
 	}
-	return phoneData, nameData
+
+	return phoneData, nameData, positionData
 }
 
 //用户名换取职位标识(测试)

+ 0 - 59
service/ent_address_book.go

@@ -1,59 +0,0 @@
-package service
-
-import (
-	"app.yhyue.com/moapp/jybase/go-xweb/log"
-	IC "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/init"
-	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
-)
-
-func (b ChatGroupService) EntPersonsList(param *messagecenter.EntPersonsListReq) {
-	var sql string
-	if param.Name != "" {
-		sql = "SELECT a.id,a.pid,a.name,c.id as user_id,c.name as user_name,c.phone as user_phone,c.power as user_power,e.name as role from entniche_department a " +
-			"INNER JOIN entniche_department_user b on (a.ent_id=? and a.id=b.dept_id) " +
-			"INNER JOIN entniche_user c on (b.user_id=c.id and c.name like '%" + param.Name + "%') " +
-			"LEFT JOIN entniche_user_role d on (c.id=d.user_id) " +
-			"LEFT JOIN entniche_role e on (d.role_id=e.id) " +
-			"order by a.id,convert(c.name using gbk) COLLATE gbk_chinese_ci asc"
-	} else {
-		sql = `SELECT a.id,a.pid,a.name,c.id as user_id,c.name as user_name,c.phone as user_phone,c.power as user_power,e.name as role from entniche_department a 
-			INNER JOIN entniche_department_user b on (a.ent_id=? and a.id=b.dept_id) 
-			INNER JOIN entniche_user c on (b.user_id=c.id) 
-			LEFT JOIN entniche_user_role d on (c.id=d.user_id) 
-			LEFT JOIN entniche_role e on (d.role_id=e.id) 
-			order by a.id,convert(c.name using gbk) COLLATE gbk_chinese_ci asc`
-	}
-	data := IC.MainMysql.SelectBySql(sql, param.EntId)
-	if data != nil && len(*data) > 0 {
-		for _, v := range *data {
-			log.Println(v)
-			//id := cm.IntAll(v["id"])
-
-			/*user := map[string]interface{}{
-				"user_id":  cm.IntAll(v["user_id"]),
-				"power":    user_power,
-				"username": cm.ObjToString(v["user_name"]),
-				"phone":    cm.ObjToString(v["user_phone"]),
-				"role":     cm.ObjToString(v["role"]),
-			}
-			//log.Println("权限:", user_power)
-
-			list = append(list, map[string]interface{}{
-				"id":    id,
-				"pid":   cm.IntAll(v["pid"]),
-				"name":  cm.ObjToString(v["name"]),
-				"users": []map[string]interface{}{user},
-			})*/
-		}
-	}
-
-	//log.Println(checkedArr)
-	/*this.ServeJson(Result{Data: M{
-		"entname":     this.GetSession("entName"),
-		"checked":     checked,
-		"quota":       VarEntInfo.GetById(entId).Quota,
-		"mystaff":     Mysql.Count(Entniche_user, map[string]interface{}{"ent_id": entId}),
-		"list":        list,
-		"checkedList": checkedArr,
-	}})*/
-}

+ 0 - 34
service/ent_address_book_test.go

@@ -1,34 +0,0 @@
-package service
-
-import (
-	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
-	"testing"
-)
-
-func TestChatGroupService_EntPersonsList(t *testing.T) {
-	type args struct {
-		param *messagecenter.EntPersonsListReq
-	}
-	tests := []struct {
-		name string
-		args args
-	}{
-		// TODO: Add test cases.
-		{
-			name: "企业列表",
-			args: args{
-				&messagecenter.EntPersonsListReq{
-					EntId:   14929,
-					Name:    "",
-					GroupId: 0,
-				},
-			},
-		},
-	}
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			b := ChatGroupService{}
-			b.EntPersonsList(tt.args.param)
-		})
-	}
-}

+ 446 - 221
service/message_mail_box.go

@@ -1,60 +1,47 @@
 package service
 
 import (
-	quitl "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/encrypt"
-	util "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/entity"
-	IC "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/init"
-	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
 	"database/sql"
 	"fmt"
 	"log"
+	"strconv"
 	"strings"
 	"sync"
 	"time"
+
+	quitl "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/date"
+	"app.yhyue.com/moapp/jybase/encrypt"
+	util "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/entity"
+	IC "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/init"
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
+	"github.com/gogf/gf/v2/util/gconv"
 )
 
 type MessaggeService struct{}
 
+var rwLock = new(sync.RWMutex)
+
 // 未读消息查询
 func (b MessaggeService) Count(newUserId, userType, entUserId int64, isClean bool) (count int, last map[string]interface{}, err error) {
 	log.Printf("用户id:%d,userType:%d,entUserId:%d,isClean:%v", newUserId, userType, entUserId, isClean)
 	v := make([]interface{}, 0)
 	sqlStr := ""
-	if userType == 1 {
-		//查询缓存里边是否有数据
-		pc_a, err := util.GetData(userType, entUserId)
-		if err == nil && pc_a != nil {
-			// 缓存有值
-			if !isClean {
-				return pc_a.Count, pc_a.Data, err
-			}
-		}
-		sqlStr = fmt.Sprintf("select  count(b.id) from   %s a  "+
-			"LEFT  JOIN  %s  b ON a.id=b.own_id "+
-			"where  b.type=5 "+
-			"AND   a.customer_service_id=%d  "+
-			"AND b.iswithdraw = 0  "+
-			"AND  b.isread=0  "+
-			"AND own_type = 1 "+
-			"order by create_time", util.SOCIALIZE_CHAT_SESSION, util.SOCIALIZE_MESSAGE_MAILBOX, entUserId)
 
-	} else {
-		pc_a, err := util.GetData(userType, newUserId)
-		if err == nil && pc_a != nil {
-			if !isClean {
-				return pc_a.Count, pc_a.Data, err
-			}
+	pc_a, err := util.GetData(userType, newUserId)
+	if err == nil && pc_a != nil {
+		if !isClean {
+			return pc_a.Count, pc_a.Data, err
 		}
-		sqlStr = fmt.Sprintf("select  count(b.id) from    %s  b "+
-			"where   b.send_user_id != %d    "+
-			"AND   b.own_id=%d "+
-			"AND b.iswithdraw = 0  "+
-			"AND  b.isread=0 "+
-			"AND own_type = 2 "+
-			"order by create_time", util.SOCIALIZE_MESSAGE_MAILBOX, newUserId, newUserId)
-
 	}
+	sqlStr = fmt.Sprintf("select  count(b.id) from    %s  b "+
+		"where   b.send_user_id != %d    "+
+		"AND   b.own_id=%d "+
+		"AND b.iswithdraw = 0  "+
+		"AND  b.isread=0 "+
+		"AND own_type = 2 "+
+		"order by create_time", util.SOCIALIZE_MESSAGE_MAILBOX, newUserId, newUserId)
+
 	log.Println(sqlStr, v)
 	rs := IC.BaseMysql.CountBySql(sqlStr, v...)
 	log.Println(rs)
@@ -85,7 +72,7 @@ func (b MessaggeService) Count(newUserId, userType, entUserId int64, isClean boo
 			util.SetData(userType, newUserId, map[string]interface{}{"data": map[string]interface{}{}, "count": count}, IC.SurvivalTime)
 		}
 	}
-	return
+	return positionStr
 }
 
 // 用户列表查询
@@ -93,133 +80,166 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 	sqlStr := ""
 	tm := time.Now()
 	if in.UserType == 2 {
-		//用户最后一次信息查询
-		userSql := fmt.Sprintf("SELECT  MAX( c.id )   as messageId  FROM  socialize_message_mailbox c "+
-			"WHERE  c.own_id = %d  "+
-			"AND c.iswithdraw = 0  "+
-			"AND c.type = 2   "+
-			"AND c.own_type = 2 "+
-			"GROUP BY  (  CASE  WHEN c.send_user_id > c.receive_user_id "+
-			"THEN    CONCAT( c.send_user_id, c.receive_user_id )  "+
-			"WHEN c.send_user_id < c.receive_user_id "+
-			"THEN  CONCAT( c.receive_user_id, c.send_user_id )  END  ) ", in.NewUserId,
+		var (
+			allSql string
+			sqlArr []string
 		)
-		data = IC.BaseMysql.SelectBySql(userSql)
-		userMessageId := util.Inhandle(data)
-		//客服最后一次信息查询
-		customerSql := fmt.Sprintf("SELECT   MAX( c.id )   as messageId  FROM   %s c "+
-			"LEFT JOIN %s d ON  IF   ( c.send_user_type = 1, d.id = c.send_user_id, d.id = c.receive_user_id ) "+
-			"WHERE   c.own_id = %d  "+
-			"AND c.iswithdraw = 0 "+
-			"AND ( c.type = 4 OR c.type = 5  or c.type=6 or  c.type=7 ) "+
-			"AND c.own_type = 2 "+
-			"AND   d.user_id=c.own_id "+
-			"GROUP BY   d.ent_id  ", util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_CHAT_SESSION, in.NewUserId)
-		data = IC.BaseMysql.SelectBySql(customerSql)
-		customerMessageId := util.Inhandle(data)
-		//用户的列表
-		sqlStr = fmt.Sprintf("SELECT "+
-			"(  CASE        WHEN SUBSTR( b.nickname, 1, 3 ) = 'JY_' THEN    CONCAT( SUBSTR( b.phone, 1, 3 ), '****', SUBSTR( b.phone, 8, 11 ) )     WHEN b.nickname = '' or b.nickname is null THEN    CONCAT( SUBSTR( b.phone, 1, 3 ), '****', SUBSTR( b.phone, 8, 11 ) ) ELSE b.nickname    END    )"+
-			"AS name, b.id, e.title, b.headimg, e.type, e.link, e.content, 2 AS userType, a.create_time, a.type AS itemType, "+
-			"( SELECT  count( h.id )  FROM  %s h  "+
-			"WHERE  h.type = 2  "+
-			"AND h.own_id = %d  "+
-			"AND h.own_type = 2  "+
-			"AND   h.send_user_id=b.id   "+
-			"AND h.isread = 0 AND h.iswithdraw = 0  ) AS number  FROM  %s a "+
-			"LEFT JOIN  %s b ON  b.id = a.receive_user_id or  b.id = a.send_user_id  "+
-			"LEFT JOIN  %s e ON e.id = a.messag_id  "+
-			"WHERE a.id IN ( %s )  AND b.id != %d "+
-			"UNION ALL "+
-			"SELECT  f.nickname AS name,    b.ent_id AS id,  e.title,f.headimage AS headimg,  e.type,  e.link,  e.content,  1 AS userType,  a.create_time,  a.type AS itemType, "+
-			"(  SELECT   count( h.id )   FROM    %s h   WHERE   ( h.type = 4 OR h.type = 5  )    AND h.own_id = %d    AND h.own_type = 2   AND  h.send_user_type = 1 AND  h.receive_user_id = %d    AND h.isread = 0   ) AS number "+
-			"FROM  %s a  "+
-			"LEFT JOIN %s b ON IF  ( a.send_user_type = 1, a.send_user_id, a.receive_user_id ) = b.id  "+
-			"LEFT JOIN %s e ON e.id = a.messag_id  "+
-			"LEFT join %s  f on f.ent_id=b.ent_id   "+
-			"WHERE  a.id IN (  %s )  "+
-			"ORDER BY create_time DESC",
-			util.SOCIALIZE_MESSAGE_MAILBOX,
-			in.NewUserId,
-			util.SOCIALIZE_MESSAGE_MAILBOX,
-			util.BASE_USER,
-			util.SOCIALIZE_MESSAGE,
-			userMessageId,
-			in.NewUserId,
-			util.SOCIALIZE_MESSAGE_MAILBOX,
-			in.NewUserId,
-			in.NewUserId,
-			util.SOCIALIZE_MESSAGE_MAILBOX,
-			util.SOCIALIZE_CHAT_SESSION,
-			util.SOCIALIZE_MESSAGE,
-			util.SOCIALIZE_TENANT_ROBOT,
-			customerMessageId)
-	} else {
-		idSql := fmt.Sprintf(" (a.customer_service_id = %d OR a.customer_service_id = 0) ", in.EntUserId)
-		if in.IsArtificial == 1 {
-			idSql = fmt.Sprintf(" a.customer_service_id = %d ", in.EntUserId)
-		} else if in.IsArtificial == 2 {
-			idSql = " a.customer_service_id = 0 "
+
+		//一对一
+		oneSql := fmt.Sprintf(`(SELECT
+							a.your_position_id AS id,
+							1 AS userType,
+							c.nickname AS name,
+							c.headimg,
+							d.content,
+							d.type 
+							d.create_time,
+							a.unread as number,
+						    a.timestamp,
+							c.phone
+						FROM
+							socialize_summary a
+							INNER JOIN base_position b ON ( a.my_position_id = %d AND a.your_position_id = b.id )
+							INNER JOIN base_user c ON ( b.user_id = c.id )
+							LEFT JOIN socialize_message d ON ( a.message_id = d.id ))`, in.PositionId)
+		//客服列表
+		serviceSql := fmt.Sprintf(` (
+						SELECT
+							a.ent_id AS id,
+							2 AS userType,
+							b.nickname AS name,
+							b.headimage as headimg,
+							c.content,
+							c.type,
+							c.create_time,
+							a.unread as number,
+							a.timestamp,
+							"" as phone
+						FROM
+							socialize_summary a
+							INNER JOIN socialize_tenant_robot b ON ( a.user_id = %d AND a.ent_id = b.ent_id)
+							LEFT JOIN socialize_message c ON ( a.message_id = c.id ) 
+						) `, in.NewUserId)
+		//群列表
+		groupSql := fmt.Sprintf(` (
+						SELECT
+							b.id,
+							3 AS userType,
+							b.name,
+							'' AS headimg,
+							d.content,
+							d.type,
+							d.create_time,
+							a.unread as number,
+							c.timestamp,
+							"" as phone
+						FROM
+							socialize_chat_group_person a
+							INNER JOIN socialize_chat_group b ON ( a.position_id = %d AND a.chat_group_id = b.id AND b.isdismiss = 0)
+							INNER JOIN socialize_summary c ON ( b.id = c.chat_group_id )
+							LEFT JOIN socialize_message d ON ( c.message_id = d.id ) 
+						) `, in.PositionId)
+		switch in.QueryType {
+		case 1: //分享列表
+			allSql = strings.Join(append(sqlArr, oneSql, groupSql), " UNION ALL ")
+		case 2: //历史会话列表
+			allSql = strings.Join(append(sqlArr, oneSql, groupSql, serviceSql), " UNION ALL ")
 		}
+
+		sqlStr = fmt.Sprintf(`SELECT * FROM
+					(
+						%s
+					) a 
+				a.ORDER BY a.timestamp DESC`, allSql)
+	} else {
+		var timeSql, phoneSql, filtrationSql string
 		if in.StartTime != "" {
-			idSql += " AND  DATE_FORMAT(a.update_time,'%Y-%m-%d') >= '" + in.StartTime + "' "
+			timeSql += fmt.Sprintf(" AND a.timestamp > %s", in.StartTime)
 		}
 		if in.EndTime != "" {
-			idSql += "AND DATE_FORMAT(a.update_time,'%Y-%m-%d') <= '" + in.EndTime + "' "
+			timeSql += fmt.Sprintf(" AND a.timestamp < %s", in.EndTime)
 		}
 		if in.Phone != "" {
-			idSql += " AND  b.phone like '%" + in.Phone + "%'"
+			phoneSql = " AND b.phone  like '%" + in.Phone + "%"
 		}
 		if in.FiltrationId != "" {
 			var ids []string
 			for _, v := range strings.Split(in.FiltrationId, ",") {
 				ids = append(ids, encrypt.SE.Decode4Hex(v))
 			}
-			idSql += fmt.Sprintf(" AND  b.id not in (%s)", strings.Join(ids, ","))
+			filtrationSql += fmt.Sprintf(" AND  b.id not in (%s)", strings.Join(ids, ","))
+		}
+		aiSql := fmt.Sprintf(`(SELECT
+		   				a.user_id,
+		   				a.message_id,
+		   				a.timestamp,
+		   				b.nickname,
+		   				0 as unread,
+		   				b.headimg,
+						"" as phone,
+						0 as userType
+	   				FROM
+		   				socialize_summary a
+		   				INNER JOIN base_user b ON  (a.user_id = b.id AND a.ent_id = %d AND a.customer_service_access = 0)) 
+		   				%s %s %s)`, in.EntId, timeSql, phoneSql, filtrationSql)
+
+		serviceSql := fmt.Sprintf(`(SELECT
+		   				a.user_id,
+		   				c.message_id,
+		   				c.timestamp,
+		   				b.nickname,
+		   				a.unread,
+		   				b.headimg,
+						"" as phone,
+						0 as userType
+	   				FROM
+		   				socialize_customer_service_user a
+		   				INNER JOIN base_user b ON  ( a.customer_service_id = %d AND a.user_id = b.id %s %s)
+						INNER JOIN socialize_summary c ON ( a.ent_id = c.ent_id AND a.user_id = c.user_id %s))`, in.EntUserId, filtrationSql, phoneSql,
+			strings.ReplaceAll(timeSql, "a.", "c."))
+		var restrictionSql string
+		switch in.IsArtificial {
+		case 1:
+			restrictionSql = serviceSql
+		case 2:
+			restrictionSql = aiSql
+		default:
+			restrictionSql = aiSql + " UNION ALL " + serviceSql
 		}
+
 		if in.Page <= 0 {
 			in.Page = 1
 		}
 		if in.Size <= 0 || in.Size > 100 {
 			in.Size = 50
 		}
-		sqlStr = fmt.Sprintf(`SELECT(
-			 CASE
-            	WHEN SUBSTR( b.nickname, 1, 3 ) = 'JY_' THEN
-            	CONCAT( SUBSTR( b.phone, 1, 3 ), '****', SUBSTR( b.phone, 8, 11 ) ) 
-            	WHEN b.nickname = '' 
-            	OR b.nickname IS NULL THEN
-            	CONCAT( SUBSTR( b.phone, 1, 3 ), '****', SUBSTR( b.phone, 8, 11 ) ) ELSE b.nickname 
-            	END 
-            ) AS name,
-			b.id,
-			e.title,
-			b.headimg,
-			e.type,
-			e.link,
-			e.content,
-			a.update_time as create_time,
-			(
-			SELECT
-				count( h.id ) 
-			FROM
-				 %s h
-				LEFT JOIN  %s i ON h.own_id = i.id 
-			WHERE
-				h.own_type = 1 
-				AND i.ent_id = a.ent_id 
-				AND i.user_id = a.user_id 
-				AND h.isread = 0 
-				AND h.iswithdraw = 0 
-				AND i.customer_service_id = %d 
-			) AS number 
-		FROM
-			%s a
-			INNER JOIN %s b ON  a.ent_id = %d and %s 
-			AND a.user_id = b.id
-			LEFT JOIN  %s e ON e.id = a.message_id 
-	ORDER BY
-	a.update_time DESC`, util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_CHAT_SESSION, in.EntUserId, util.User_message_list, util.BASE_USER, in.EntId, idSql, util.SOCIALIZE_MESSAGE)
+		sqlStr = fmt.Sprintf(`SELECT 
+    				(
+						CASE
+							WHEN SUBSTR( a.nickname, 1, 3 ) = 'JY_' THEN
+								CONCAT( SUBSTR( a.phone, 1, 3 ), '****', SUBSTR( a.phone, 8, 11 ) ) 
+							WHEN a.nickname = '' 
+							OR a.nickname IS NULL THEN
+								CONCAT( SUBSTR( a.phone, 1, 3 ), '****', SUBSTR( a.phone, 8, 11 ) ) ELSE a.nickname 
+						END 
+					) AS name,
+    				c.content,
+    				c.title,
+    				c.type,
+    				c.link,
+    				c.create_time,
+    				a.message_id,
+    				a.timestamp,
+    				a.unread as number,
+    				a.user_id as id,
+    				a.headimg,
+    				a.phone,
+    				a.userType
+   				FROM
+	   				(%s) a
+				LEFT JOIN socialize_message c ON ( a.message_id = c.id )
+			ORDER BY
+			a.timestamp DESC`, restrictionSql)
 	}
 	dataSize := []map[string]interface{}{}
 	if sqlStr != "" {
@@ -234,11 +254,21 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 				} else {
 					dataSize = (*data)[(in.Page-1)*in.Size : in.Page*in.Size]
 				}
-				return &dataSize, count, err
+			} else {
+				phoneMap, _, _ := EntPerson(in.EntId, false)
+				for _, v := range *data {
+					if name, ok := phoneMap[quitl.InterfaceToStr(v["phone"])]; ok && quitl.IntAll(v["userType"]) == 1 {
+						v["name"] = name
+					}
+					if in.NameSearch != "" && !strings.Contains(quitl.InterfaceToStr(v["name"]), in.NameSearch) {
+						continue
+					}
+					dataSize = append(dataSize, v)
+				}
 			}
 		}
 	}
-	return
+	return &dataSize, count, err
 }
 
 // 客服会话列表
@@ -250,43 +280,31 @@ func (b MessaggeService) ConversationList(in *messagecenter.ConversationReq) (da
 		for _, v := range strings.Split(in.FiltrationId, ",") {
 			ids = append(ids, encrypt.SE.Decode4Hex(v))
 		}
-		idSql := fmt.Sprintf("a.customer_service_id = %d AND  b.id  in (%s) ", in.EntUserId, strings.Join(ids, ","))
-		sqlStr = fmt.Sprintf(`SELECT(
-			CASE
-            	WHEN SUBSTR( b.nickname, 1, 3 ) = 'JY_' THEN
-            	CONCAT( SUBSTR( b.phone, 1, 3 ), '****', SUBSTR( b.phone, 8, 11 ) ) 
-            	WHEN b.nickname = '' 
-            	OR b.nickname IS NULL THEN
-            	CONCAT( SUBSTR( b.phone, 1, 3 ), '****', SUBSTR( b.phone, 8, 11 ) ) ELSE b.nickname 
-            	END 
-            ) AS name,
-			b.id,
-			e.title,
-			b.headimg,
-			e.type,
-			e.link,
-			e.content,
-			a.update_time as create_time,
-			(
-			SELECT
-				count( h.id ) 
-			FROM
-				 %s h
-				LEFT JOIN  %s i ON h.own_id = i.id 
-			WHERE
-				h.own_type = 1 
-				AND i.ent_id = a.ent_id 
-				AND i.user_id = a.user_id 
-				AND h.isread = 0 
-				AND h.iswithdraw = 0 
-				AND i.customer_service_id = %d 
-			) AS number 
-		FROM
-			%s a
-			INNER JOIN %s b ON  %s 
-			AND a.user_id = b.id
-			LEFT JOIN  %s e ON e.id = a.message_id`,
-			util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_CHAT_SESSION, in.EntUserId, util.User_message_list, util.BASE_USER, idSql, util.SOCIALIZE_MESSAGE)
+		filtrationSql := fmt.Sprintf(" AND  b.id in (%s)", strings.Join(ids, ","))
+		aiSql := fmt.Sprintf(`(SELECT
+		   				a.user_id,
+		   				a.message_id,
+		   				a.timestamp,
+		   				b.nickname,
+		   				0 as unread,
+		   				b.headimg
+	   				FROM
+		   				socialize_summary a
+		   				INNER JOIN base_user b ON  (a.user_id = b.id AND a.ent_id = %d AND a.customer_service_access = 0 
+		   				%s ))`, in.EntId, filtrationSql)
+
+		serviceSql := fmt.Sprintf(`(SELECT
+		   				a.user_id,
+		   				c.message_id,
+		   				c.timestamp,
+		   				b.nickname,
+		   				a.unread,
+		   				b.headimg
+	   				FROM
+		   				socialize_customer_service_user a
+		   				INNER JOIN base_user b ON  ( a.customer_service_id = %d AND a.user_id = b.id %s)
+						INNER JOIN socialize_summary c ON ( a.ent_id = c.ent_id AND a.user_id = c.user_id))`, in.EntUserId, filtrationSql)
+		sqlStr = aiSql + " UNION ALL " + serviceSql
 	}
 
 	if sqlStr != "" {
@@ -524,8 +542,6 @@ func (b MessaggeService) SaveMessage(in *messagecenter.MessageEntity) (fool bool
 	return fool, "", in.Content, messageId, nowForm.Unix()
 }
 
-var rwLock = new(sync.RWMutex)
-
 // 客服 用户聊天消息列表同步
 func UserSynchronousList(customerServiceId, userId, entId, messageId int64, createTime string) {
 	log.Printf("同步最后消息参数customerServiceId:%d,userId:%d,entId%d,messageId:%d", customerServiceId, userId, entId, messageId)
@@ -562,6 +578,7 @@ func UserSynchronousList(customerServiceId, userId, entId, messageId int64, crea
 func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string]interface{} {
 	sqlStr := ""
 	lastStr := ""
+	positionStr := ""
 	if in.LastId > 0 {
 		if in.Sort == "asc" {
 			lastStr = fmt.Sprintf("AND  a.messag_id > %d ", in.LastId)
@@ -584,7 +601,22 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 			util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.BASE_USER, util.BASE_USER,
 			in.NewUserId, in.NewUserId, in.SendId, in.SendId, in.NewUserId, lastStr, in.PageSize)
 		break
+	case 3: //群聊天
+
+		sqlStr = fmt.Sprintf("SELECT a.messag_id AS messageId,b.*,"+
+			"IF ( a.own_id = a.send_user_id, 1, 2 ) AS fool,"+
+			"IF ( a.own_id = a.send_user_id, 0, a.send_user_id ) AS send_position_id,"+
+			"a.send_user_type,a.type AS itemType FROM %s a "+
+			"LEFT JOIN %s b ON a.messag_id = b.id "+
+			"WHERE a.own_type = 1 AND a.own_id = %d "+
+			"AND chat_group_id = %d AND a.type IN ( 3, 6 ) "+
+			"ORDER BY a.create_time desc,a.id DESC "+
+			"LIMIT 0, %d",
+			util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, in.SendId,
+			in.ChatGroupId, in.PageSize)
 	case 4, 5, 6, 7: //客服聊天
+		//查询用户所有的职位id
+		positionStr = GetUserAllPosition(in.NewUserId)
 		if in.UserType == 1 {
 			//客服聊天记录查看
 			sqlStr = fmt.Sprintf("SELECT   a.messag_id as messageId,b.*,   IF   ( a.own_id = a.send_user_id, 1, 2 ) AS fool,   a.send_user_type,   a.type AS itemType,   '' AS robotName,   '' AS robotImg,   c.customer_service_name AS setName ,   c.user_id   "+
@@ -594,11 +626,11 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 				"WHERE   a.own_type = 1 and a.iswithdraw = 0  "+
 				"AND (a.type = 5 or a.type=4 or a.type=6 or  a.type=7 or a.type=8 )   "+
 				"AND c.ent_id =   %d "+
-				"AND c.user_id =   %d  %s "+
-				"ORDER BY a.create_time desc ,a.id asc "+
+				"AND c.user_id in (%s)  %s "+
+				"ORDER BY a.create_time desc ,a.id   asc "+
 				"limit 0 ,  %d ",
 				util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.SOCIALIZE_CHAT_SESSION,
-				in.EntId, in.SendId, lastStr, in.PageSize)
+				in.EntId, positionStr, lastStr, in.PageSize)
 		} else {
 			//用户聊天记录查看
 			sqlStr = fmt.Sprintf("SELECT a.messag_id as messageId,e.appraise as appraise, b.*,   IF ( a.own_id = a.send_user_id, 1, 2 ) AS fool ,   a.send_user_type,   a.type as  itemType,   d.nickname as  robotName,   d.headimage as  robotImg,   c.customer_service_name as  setName   "+
@@ -606,21 +638,21 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 				"LEFT JOIN %s b ON a.messag_id = b.id   "+
 				"LEFT JOIN %s c ON   IF   ( a.send_user_type = 1, a.send_user_id, a.receive_user_id ) = c.id AND  c.ent_id = %d AND c.user_id = %d "+
 				"LEFT JOIN  %s d on  c.ent_id=d.ent_id    "+
-				"LEFT JOIN %s e on  e.messag_id=b.id "+
-				"WHERE   a.own_type = 2  and a.iswithdraw = 0  "+
-				"AND a.own_id =  %d "+
+				"WHERE   a.own_type = 2    "+
+				"AND a.own_id in  (%s) "+
 				"AND  c.ent_id = %d "+
-				"AND c.user_id =  %d "+
-				"AND ( a.type = 4 OR a.type = 5 or a.type=6 or  a.type=7 or  a.type=8)  %s "+
-				"ORDER BY a.create_time  desc,a.id   asc "+
+				"AND c.user_id in  (%s) "+
+				"AND ( a.type = 4 OR a.type = 5 or a.type=6 or  a.type=7)  %s "+
+				"ORDER BY a.create_time desc ,a.id   asc "+
 				"limit 0 ,   %d ",
-				util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.SOCIALIZE_CHAT_SESSION, in.SendId, in.NewUserId, util.SOCIALIZE_TENANT_ROBOT, util.SOCIALIZE_APPRAISE,
-				in.NewUserId, in.SendId, in.NewUserId, lastStr, in.PageSize)
+				util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.SOCIALIZE_CHAT_SESSION, in.SendId, in.NewUserId, util.SOCIALIZE_TENANT_ROBOT,
+				positionStr, in.SendId, positionStr, lastStr, in.PageSize)
 		}
 		break
 	}
 	log.Println(sqlStr)
 	data := IC.BaseMysql.SelectBySql(sqlStr)
+	//查询非自己发送消息得发送人名字
 	//自己头像处理
 	if in.UserType == 2 {
 		userData := IC.BaseMysql.FindOne(util.BASE_USER, map[string]interface{}{"id": in.NewUserId}, "headimg", "")
@@ -631,6 +663,15 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 		}
 
 	}
+	if in.MsgType == 3 && data != nil && len(*data) > 0 {
+		_, _, positionData := EntPerson(in.EntId, true)
+		for _, v := range *data {
+			positionId := quitl.IntAll(v["send_user_id"])
+			if positionId != 0 {
+				v["userName"] = positionData[positionId]
+			}
+		}
+	}
 	go func() {
 		updateMap := map[string]interface{}{}
 		if len(*data) > 0 && data != nil {
@@ -638,35 +679,61 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 			//未读信息修改
 			switch in.MsgType {
 			case 2: //点对点聊天
+
 				updateMap = map[string]interface{}{
-					"own_type": 2,
-					"own_id":   in.NewUserId,
-					"type":     2,
-					"isread":   0,
+					"own_type":     2,
+					"own_id":       in.NewUserId,
+					"send_user_id": in.SendId,
+					"type":         2,
+					"isread":       0,
 				}
 				IC.BaseMysql.Update(util.SOCIALIZE_MESSAGE_MAILBOX, updateMap, map[string]interface{}{"isread": 1, "read_time": time.Now().Local().Format(util.Date_Full_Layout)})
+				//更新socialize_summary表未读消息数量
+				updateQuery := map[string]interface{}{
+					"my_position_id":   in.NewUserId,
+					"your_position_id": in.SendId,
+				}
+				IC.BaseMysql.Update(util.SOCIALIZE_SUMMARY, updateQuery, map[string]interface{}{"unread": 0})
 				break
+			case 3: //群聊天
+				sqlStr = fmt.Sprintf("UPDATE %s a  SET a.isread = 1, a.read_time = now( ) "+
+					"WHERE a.own_type = 1 "+
+					"AND a.type IN (3,6) "+
+					"AND a.isread = 0 "+
+					"AND a.own_id = %d AND a.chat_group_id = %d",
+					util.SOCIALIZE_MESSAGE_MAILBOX, in.SendId, in.ChatGroupId)
+				IC.BaseMysql.UpdateOrDeleteBySql(sqlStr)
+				//更新socialize_summary表未读消息数量
+				updateQuery := map[string]interface{}{
+					"my_position_id": in.NewUserId,
+					"chat_group_id":  in.ChatGroupId,
+				}
+				IC.BaseMysql.Update(util.SOCIALIZE_SUMMARY, updateQuery, map[string]interface{}{"unread": 0})
 			case 4, 5:
 				sqlStr := ""
-				if in.UserType == 1 {
+				unreadSql := ""
+				if in.UserType == 1 { //1客服
 					sqlStr = fmt.Sprintf("UPDATE %s a  SET a.isread = 1,    a.read_time = now( )  "+
 						"WHERE    a.own_type = 1 and a.iswithdraw = 0 "+
 						"AND a.type IN ( 4,5,6,7)  "+
 						"AND a.isread = 0    "+
-						"AND a.own_id IN ( SELECT b.id FROM %s b WHERE   b.customer_service_id=%d AND    b.user_id=%d  )",
-						util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_CHAT_SESSION, in.EntUserId, in.SendId)
-				} else {
+						"AND a.own_id IN (SELECT id FROM %s WHERE user_id = %d)",
+						util.SOCIALIZE_MESSAGE_MAILBOX, util.BASE_POSITION, in.UserId)
+					unreadSql = fmt.Sprintf("UPDATE %s SET unread = 0 WHERE user_id = %d", util.Socialize_customer_service_user, in.UserId)
+				} else { //2用户
 					sqlStr = fmt.Sprintf("UPDATE %s a  SET a.isread = 1,    a.read_time = now( )  "+
 						"WHERE    a.own_type = 2 and a.iswithdraw = 0 "+
 						"AND a.type IN ( 4,5,6,7 )  "+
 						"AND a.isread = 0    "+
-						"AND a.own_id =%d ", util.SOCIALIZE_MESSAGE_MAILBOX, in.NewUserId)
+						"AND a.own_id  in (%s) ", util.SOCIALIZE_MESSAGE_MAILBOX, positionStr)
+					unreadSql = fmt.Sprintf("UPDATE %s SET unread = 0 WHERE user_id = %d", util.SOCIALIZE_SUMMARY, in.UserId)
 				}
 				IC.BaseMysql.UpdateOrDeleteBySql(sqlStr)
+				IC.BaseMysql.UpdateOrDeleteBySql(unreadSql)
 				break
 			}
 			//redis缓存处理
-			b.Count(in.NewUserId, in.UserType, in.EntUserId, true)
+			//b.Count(in.NewUserId, in.UserType, in.EntUserId, true)
 		}
 	}()
 	return data
@@ -799,7 +866,6 @@ func (b MessaggeService) UpdateReadById(in *messagecenter.ReadStateReq) bool {
 // WithdrawMessage 撤回消息
 func (b MessaggeService) WithdrawMessage(in *messagecenter.ReadWithdrawReq) bool {
 	messageId := encrypt.SE.Decode4Hex(in.MessageId)
-	newUserId, entUserId := NewEndId(quitl.Int64All(messageId), in.UserType)
 	msg := IC.BaseMysql.FindOne(util.SOCIALIZE_MESSAGE, map[string]interface{}{"id": messageId}, "create_time", "")
 	if msg == nil || len(*msg) <= 0 {
 		log.Println("查询消息id失败")
@@ -814,13 +880,42 @@ func (b MessaggeService) WithdrawMessage(in *messagecenter.ReadWithdrawReq) bool
 	m := IC.BaseMysql.Update(util.SOCIALIZE_MESSAGE_MAILBOX,
 		map[string]interface{}{"messag_id": messageId}, map[string]interface{}{"iswithdraw": 1, "withdraw_time": nowForm.Format(util.Date_Full_Layout)})
 	if m {
-		//消息撤回 更新对方私信
-		in.UserType = quitl.Int64All(quitl.If(in.UserType == 1, 2, 1))
-		b.Count(newUserId, in.UserType, entUserId, true)
+		go SynchronousInfo(in.SenderId, in.RecipientId, in.ConversationType, quitl.Int64All(messageId), in.UserType, in.EntId, in.ChatGroupId)
 	}
 	return m
 }
 
+// 撤回消息同步信息
+func SynchronousInfo(sender, recipient, conversationType, messageId, userType, entId, chatGroupId int64) {
+	switch conversationType {
+	case 1: //一对一用户聊天
+		if IC.BaseMysql.Count(util.SOCIALIZE_MESSAGE, map[string]interface{}{"id": messageId, "own_id": recipient, "isread": 0}) > 0 {
+			IC.BaseMysql.SelectBySql(fmt.Sprintf("update %s set unread=CASE WHEN unread > 0 and my_position_id = %d and your_position_id = %d THEN unread-1 ELSE 0 END;", util.Socialize_summary, recipient, sender))
+		}
+	case 2: //用户与客服
+		if IC.BaseMysql.Count(util.SOCIALIZE_MESSAGE, map[string]interface{}{"id": messageId, "own_id": recipient, "isread": 0}) > 0 {
+			if userType == 2 { //发送人是用户
+				//接收人是会话标识 查询客服id
+				data := IC.BaseMysql.FindOne(util.SOCIALIZE_CHAT_SESSION, map[string]interface{}{"id": recipient}, "", "")
+				if data != nil && len(*data) > 0 {
+					IC.BaseMysql.SelectBySql(fmt.Sprintf("update %s set unread=CASE WHEN unread > 0 and user_id = %d and customer_service_id = %d and entId = %d THEN unread-1 ELSE 0 END;", util.Socialize_customer_service_user, sender, quitl.IntAll((*data)["customer_service_id"]), entId))
+				}
+			} else { //发送人是客服
+				IC.BaseMysql.SelectBySql(fmt.Sprintf("update %s set unread=CASE WHEN unread > 0 and user_id = %d and ent_id = %d THEN unread-1 ELSE 0 END;", util.Socialize_summary, recipient, entId))
+			}
+		}
+	case 3: //一对群
+		data := IC.BaseMysql.Find(util.SOCIALIZE_MESSAGE, map[string]interface{}{"id": messageId, "chat_group_id": chatGroupId, "isread": 0}, "own_id", "", -1, -1)
+		if data != nil && len(*data) > 0 {
+			var ownIds []string
+			for _, v := range *data {
+				ownIds = append(ownIds, quitl.InterfaceToStr(v["own_id"]))
+			}
+			IC.BaseMysql.SelectBySql(fmt.Sprintf("update %s set unread=CASE WHEN unread > 0 and  chat_group_id = %d and position_id in (%s) THEN unread-1 ELSE 0 END;", util.SOCIALIZE_CHAT_GROUP_PERSON, chatGroupId, strings.Join(ownIds, ",")))
+		}
+	}
+}
+
 // AppraiseMessage 消息评价
 func (b MessaggeService) AppraiseMessage(in *messagecenter.AppraiseReq) error {
 	messageId := encrypt.SE.Decode4Hex(in.MessageId)
@@ -851,18 +946,148 @@ func (b MessaggeService) AppraiseMessage(in *messagecenter.AppraiseReq) error {
 	return fmt.Errorf("评价消息异常")
 }
 
-// NewEndId 消息撤回 获取对方userid
-func NewEndId(messageId, iType int64) (newUserId, entUserId int64) {
-	data := IC.BaseMysql.FindOne(util.SOCIALIZE_MESSAGE_MAILBOX, map[string]interface{}{"messag_id": messageId, "own_type": iType}, "", "")
-	if data != nil && len(*data) > 0 {
-		if iType == 1 { //客服撤回消息 获取客服id与用户id
-			entUserId = quitl.Int64All((*data)["send_user_id"])
-			newUserId = quitl.Int64All((*data)["receive_user_id"])
+// 聊天
+// 包含 1v1 ,群聊,群发
+/*
+入参 appid,title,content,sendid,link,item,messagetype,receiverIds,groupIds
+*/
+func (this *MessaggeService) Chat(in *messagecenter.MessageSaveReq) (fool bool, errorMsg string, content string, messageId, nowInt int64) {
+	now := time.Now()
+	nowTime := now.Format(date.Date_Full_Layout)
+	messageId = int64(0)
+	fool = IC.BaseMysql.ExecTx("消息存储", func(tx *sql.Tx) bool {
+		isGroup := len(in.GroupIds) > 0
+		isOneToOne := len(in.ReceiverIds) > 0
+		createperson := strconv.Itoa(int(in.SendId))
+		messageId = MessageAdd(tx, in.Appid, in.Title, in.Content, createperson, in.Link, in.Item, in.MessageType)
+		//是否客服介入
+		isCustomerServiceAccess := 0
+
+		//群聊
+		if isGroup {
+			fieids := []string{"appid", "messag_id", "type", "send_user_id", "send_user_type", "receive_user_id", "receive_user_type", "own_type", "own_id", "create_time", "chat_group_id", "isread"}
+			for _, v := range in.GroupIds {
+				args := []interface{}{}
+				summaryArgs := []interface{}{}
+				args = append(args, in.Appid, messageId, in.Type, in.SendId, 2, in.SendId, 2, 2, in.SendId, nowTime, v, 1)
+				groupUser := GetUserByGroupId(tx, v, in.SendId)
+				for _, vv := range groupUser {
+					log.Println("获取到群组下员工:", vv)
+					args = append(args, in.Appid, messageId, in.Type, in.SendId, 2, vv, 2, 2, vv, nowTime, v, 0)
+				}
+				summaryArgs = append(summaryArgs, in.SendId, nil, nil, v, messageId, nil, isCustomerServiceAccess, nowTime)
+				MessageMailBoxAdd(tx, fieids, args)
+				//最后一次聊天
+				SocializeSummaryAdd(tx, summaryArgs)
+				//更新未读消息
+				GroupUserUnReadUpdate(tx, groupUser)
+			}
+		}
+		//1v1
+		if isOneToOne {
+			fieids := []string{"appid", "messag_id", "type", "send_user_id", "send_user_type", "receive_user_id", "receive_user_type", "own_type", "own_id", "create_time", "isread"}
+			args := []interface{}{}
+			summaryArgs := []interface{}{}
+			args = append(args, in.Appid, messageId, in.Type, in.SendId, 2, in.SendId, 2, 2, in.SendId, nowTime, 1)
+			for _, v := range in.ReceiverIds {
+				args = append(args, in.Appid, messageId, in.Type, in.SendId, 2, v, 2, 2, v, nowTime, 0)
+				//发送方,未读消息应该是0
+				summaryArgs = append(summaryArgs, in.SendId, v, nil, nil, messageId, 0, isCustomerServiceAccess, nowTime)
+				//接收方,未读消息应该是1
+				summaryArgs = append(summaryArgs, v, in.SendId, nil, nil, messageId, 1, isCustomerServiceAccess, nowTime)
+			}
+			MessageMailBoxAdd(tx, fieids, args)
+			//最后一次聊天
+			SocializeSummaryAdd(tx, summaryArgs)
+		}
+		return true
+	})
+
+	return fool, "", in.Content, messageId, now.Unix()
+}
+
+// 消息存储
+func MessageAdd(tx *sql.Tx, appid, title, content, createperson, link string, item, messageType int64) int64 {
+	nowTime := time.Now()
+	message := map[string]interface{}{
+		"appid":         appid,
+		"title":         title,
+		"content":       content,
+		"item":          item,
+		"type":          messageType,
+		"link":          link,
+		"create_time":   nowTime.Format(date.Date_Full_Layout),
+		"create_person": createperson, //系统消息时,创建人是群聊id或接收人id
+	}
+	return IC.BaseMysql.InsertByTx(tx, util.SOCIALIZE_MESSAGE, message)
+}
+
+// 消息信息箱存储
+// types 2:点对点 3:群消息
+func MessageMailBoxAdd(tx *sql.Tx, fieids []string, args []interface{}) (int64, int64) {
+	length, lastId := IC.BaseMysql.InsertBatchByTx(tx, util.SOCIALIZE_MESSAGE_MAILBOX, fieids, args)
+	log.Println("MessageMailBoxAdd length:", length, "MessageMailBoxAdd lastId:", lastId)
+	return length, lastId
+}
+
+// 获取除发送人以外的群成员
+func GetUserByGroupId(tx *sql.Tx, groupId, sendId int64) []int64 {
+	arr := []int64{}
+	data := IC.BaseMysql.SelectBySqlByTx(tx, "select position_id from "+util.SOCIALIZE_CHAT_GROUP_PERSON+" where status = 1 and chat_group_id = ? AND position_id != ? ", groupId, sendId)
+	log.Println("~~~~", data)
+	if data == nil || len(*data) <= 0 {
+		return arr
+	}
+	for _, v := range *data {
+		position_id := quitl.Int64All(v["position_id"])
+		if position_id == 0 {
+			continue
+		}
+		arr = append(arr, position_id)
+	}
+	return arr
+}
+
+// 最后一次聊天存储
+func SocializeSummaryAdd(tx *sql.Tx, args []interface{}) (int64, int64) {
+	fieids := []string{"my_position_id", "your_position_id", "ent_id", "chat_group_id", "message_id", "unread", "customer_service_access", "timestamp"}
+
+	length, lastId := IC.BaseMysql.InsertBatchByTx(tx, util.SOCIALIZE_SUMMARY, fieids, args)
+
+	log.Println("SocializeSummaryAdd length:", length, "SocializeSummaryAdd lastId:", lastId)
+
+	return length, lastId
+}
+
+// 群组人员未读消息更新
+func GroupUserUnReadUpdate(tx *sql.Tx, ids []int64) bool {
+	whs := []string{}
+	for i := 0; i < len(ids); i++ {
+		whs = append(whs, "?")
+	}
+	wh := strings.Join(whs, ",")
+	interfaces := gconv.Interfaces(ids)
+	count := IC.BaseMysql.UpdateOrDeleteBySql(`UPDATE `+util.SOCIALIZE_CHAT_GROUP_PERSON+` SET unread = unread + 1 WHERE id in (`+wh+`)`, interfaces...)
+	if count > 0 {
+		return true
+	}
+	return true
+}
+
+// GetUserAllPosition 用户下所有职位id
+func GetUserAllPosition(positionId int64) (positionStr string) {
+	//查询用户所有的职位id
+	sqlPosition := fmt.Sprintf("SELECT b.id FROM %s a LEFT JOIN %s b ON a.id = b.user_id "+
+		"WHERE a.phone = (SELECT a.phone FROM %s a LEFT JOIN %s b ON a.id = b.user_id "+
+		"WHERE b.id = %d)",
+		util.BASE_USER, util.BASE_POSITION, util.BASE_USER, util.BASE_POSITION, positionId)
+	positionArr := IC.BaseMysql.SelectBySql(sqlPosition)
+	for k, val := range *positionArr {
+		if k < len(*positionArr)-1 {
+			positionStr += quitl.ObjToString(val["id"]) + ","
 		} else {
-			//用户撤回消息 获取客服id与用户id
-			newUserId = quitl.Int64All((*data)["send_user_id"])
-			entUserId = quitl.Int64All((*data)["receive_user_id"])
+			positionStr += quitl.ObjToString(val["id"])
 		}
 	}
-	return
+	return positionStr
 }

+ 87 - 5
service/message_mail_box_test.go

@@ -1,15 +1,16 @@
 package service
 
 import (
+	"log"
+	"reflect"
+	"strings"
+	"testing"
+
 	"app.yhyue.com/moapp/jybase/mysql"
 	"app.yhyue.com/moapp/jybase/redis"
 	IC "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/init"
 	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
 	_ "github.com/go-sql-driver/mysql"
-	"log"
-	"reflect"
-	"strings"
-	"testing"
 )
 
 func initMysql() {
@@ -31,7 +32,7 @@ func initMysql() {
 		MaxIdleConns: 5,
 	}
 	IC.MainMysql.Init()
-	redis.InitRedisBySize(strings.Join([]string{"other=127.0.0.1:6379"}, ","), 100, 30, 300)
+	redis.InitRedisBySize(strings.Join([]string{"other=192.168.3.11:1712"}, ","), 100, 30, 300)
 }
 func init() {
 	initMysql()
@@ -155,6 +156,7 @@ func TestMessaggeService_CreateChatSession(t *testing.T) {
 	}
 }
 
+/*
 func TestMessaggeService_FindMessage(t *testing.T) {
 	type args struct {
 		in *messagecenter.MessageReq
@@ -264,6 +266,8 @@ func TestMessaggeService_FindMessage(t *testing.T) {
 	}
 }
 
+*/
+
 func TestMessaggeService_SaveAutoReplyMsg(t *testing.T) {
 	type args struct {
 		userType  int64
@@ -642,3 +646,81 @@ func TestMessaggeService_UpdateReadById(t *testing.T) {
 		})
 	}
 }
+
+func TestChat(t *testing.T) {
+	type args struct {
+		in *messagecenter.MessageSaveReq
+	}
+	tests := []struct {
+		name          string
+		args          args
+		wantErrorCode bool
+		wantErrorMsg  string
+		wantContent   string
+		wantMessageId int64
+	}{
+		{name: "发送群聊",
+			args: args{
+				in: &messagecenter.MessageSaveReq{
+					Title:       "标题?",
+					Content:     "hello world1",
+					Item:        8,
+					MessageType: 1,
+					Link:        "",
+					Appid:       "10000",
+					ReceiverIds: []int64{1, 2, 3},
+					GroupIds:    []int64{8},
+					Type:        1,
+					SendId:      333,
+				},
+			},
+		},
+	}
+
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			b := MessaggeService{}
+			b.Chat(tt.args.in)
+
+		})
+	}
+}
+
+func TestChat(t *testing.T) {
+	type args struct {
+		in *messagecenter.MessageSaveReq
+	}
+	tests := []struct {
+		name          string
+		args          args
+		wantErrorCode bool
+		wantErrorMsg  string
+		wantContent   string
+		wantMessageId int64
+	}{
+		{name: "发送群聊",
+			args: args{
+				in: &messagecenter.MessageSaveReq{
+					Title:       "标题?",
+					Content:     "hello world1",
+					Item:        8,
+					MessageType: 1,
+					Link:        "",
+					Appid:       "10000",
+					ReceiverIds: []int64{1, 2, 3},
+					GroupIds:    []int64{8},
+					Type:        1,
+					SendId:      333,
+				},
+			},
+		},
+	}
+
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			b := MessaggeService{}
+			b.Chat(tt.args.in)
+
+		})
+	}
+}

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.