renjiaojiao %!s(int64=2) %!d(string=hai) anos
pai
achega
52881fb519
Modificáronse 3 ficheiros con 30 adicións e 30 borrados
  1. 13 13
      .idea/workspace.xml
  2. 3 4
      rpc/messagecenter/test/message_test.go
  3. 14 13
      service/message_mail_box.go

+ 13 - 13
.idea/workspace.xml

@@ -11,7 +11,6 @@
       <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/test/message_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/test/message_test.go" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/service/chat_group_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" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
@@ -92,7 +91,7 @@
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\api" />
     </key>
   </component>
-  <component name="RunManager" selected="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_Count">
+  <component name="RunManager" selected="Go 构建.messageRpc">
     <configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
       <module name="messageCenter" />
       <working_directory value="$PROJECT_DIR$" />
@@ -183,19 +182,19 @@
       <pattern value="^\QTest_Count\E$" />
       <method v="2" />
     </configuration>
-    <configuration name="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_ChatGroupAdd/群组新增" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
+    <configuration name="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_test1" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
       <module name="messageCenter" />
-      <working_directory value="$PROJECT_DIR$/service" />
+      <working_directory value="$PROJECT_DIR$/rpc/messagecenter/test" />
       <root_directory value="$PROJECT_DIR$" />
       <kind value="PACKAGE" />
-      <package value="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
+      <package value="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test" />
       <directory value="$PROJECT_DIR$" />
       <filePath value="$PROJECT_DIR$" />
       <framework value="gotest" />
-      <pattern value="^\QTestChatGroupService_ChatGroupAdd\E$/^\Q群组新增\E$" />
+      <pattern value="^\QTest_test1\E$" />
       <method v="2" />
     </configuration>
-    <configuration name="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_EntPersonsList/企业列表" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
+    <configuration name="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_ChatGroupAdd/群组新增" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
       <module name="messageCenter" />
       <working_directory value="$PROJECT_DIR$/service" />
       <root_directory value="$PROJECT_DIR$" />
@@ -204,7 +203,7 @@
       <directory value="$PROJECT_DIR$" />
       <filePath value="$PROJECT_DIR$" />
       <framework value="gotest" />
-      <pattern value="^\QTestChatGroupService_EntPersonsList\E$/^\Q企业列表\E$" />
+      <pattern value="^\QTestChatGroupService_ChatGroupAdd\E$/^\Q群组新增\E$" />
       <method v="2" />
     </configuration>
     <configuration name="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestMessaggeService_Count/未读信息总数" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
@@ -224,19 +223,19 @@
       <item itemvalue="Go 构建.messageApi_win" />
       <item itemvalue="Go 构建.messageRpc" />
       <item itemvalue="Go 构建.messageRpc_win" />
-      <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_EntPersonsList/企业列表" />
-      <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_ChatGroupAdd/群组新增" />
       <item itemvalue="Go 构建.go build bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter" />
+      <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_ChatGroupAdd/群组新增" />
       <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestMessaggeService_Count/未读信息总数" />
       <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_Count" />
+      <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_test1" />
     </list>
     <recent_temporary>
       <list>
+        <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_test1" />
         <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_Count" />
         <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestMessaggeService_Count/未读信息总数" />
         <item itemvalue="Go 构建.go build bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter" />
         <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_ChatGroupAdd/群组新增" />
-        <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_EntPersonsList/企业列表" />
       </list>
     </recent_temporary>
   </component>
@@ -271,12 +270,13 @@
     <MESSAGE value="信息过滤" />
     <MESSAGE value="聊天提交" />
     <MESSAGE value="已读状态修改" />
-    <MESSAGE value="提交" />
     <MESSAGE value="历史消息列表" />
     <MESSAGE value="删除查询企业人员接口" />
     <MESSAGE value="查看消息修改未读消息数量" />
     <MESSAGE value="未读消息数量sql修改" />
-    <option name="LAST_COMMIT_MESSAGE" value="未读消息数量sql修改" />
+    <MESSAGE value="未读sql修改" />
+    <MESSAGE value="提交" />
+    <option name="LAST_COMMIT_MESSAGE" value="提交" />
   </component>
   <component name="VgoProject">
     <integration-enabled>true</integration-enabled>

+ 3 - 4
rpc/messagecenter/test/message_test.go

@@ -4,6 +4,7 @@ import (
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/internal/config"
 	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
+	"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service"
 	"context"
 	"flag"
 	"github.com/zeromicro/go-zero/core/conf"
@@ -96,8 +97,6 @@ func Test_SaveMessage(t *testing.T) {
 
 //
 func Test_test1(t *testing.T) {
-	a := encrypt.SE.EncodeString("0")
-	log.Println(a)
-	log.Println(encrypt.SE.DecodeString("0"))
-	log.Println(encrypt.SE.DecodeString(""))
+	b := service.GetUserAllPosition(74175)
+	log.Println(b)
 }

+ 14 - 13
service/message_mail_box.go

@@ -632,6 +632,7 @@ func UserSynchronousList(customerServiceId, userId, entId, messageId int64, crea
 
 // 历史信息查询
 func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string]interface{} {
+	log.Println(in.PositionId, in.NewUserId, in.EntId, in.ChatGroupId)
 	sqlStr := ""
 	lastStr := ""
 	positionStr := ""
@@ -692,8 +693,9 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 			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   "+
 				"FROM   %s a   "+
 				"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 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  b.id=e.messag_id  "+
 				"WHERE   a.own_type = 2    "+
 				"AND a.own_id in  (%s) "+
 				"AND  c.ent_id = %d "+
@@ -702,7 +704,7 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 				"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,
-				positionStr, in.SendId, positionStr, lastStr, in.PageSize)
+				util.SOCIALIZE_APPRAISE, positionStr, in.SendId, positionStr, lastStr, in.PageSize)
 		}
 		break
 	}
@@ -1131,18 +1133,17 @@ func GroupUserUnReadUpdate(tx *sql.Tx, ids []int64) bool {
 }
 
 // GetUserAllPosition 用户下所有职位id
-func GetUserAllPosition(positionId int64) (positionStr string) {
+func GetUserAllPosition(baseUserId 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)
+	sqlPosition := fmt.Sprintf("SELECT id FROM %s WHERE user_id = %d", util.BASE_POSITION, baseUserId)
 	positionArr := IC.BaseMysql.SelectBySql(sqlPosition)
-	for k, val := range *positionArr {
-		if k < len(*positionArr)-1 {
-			positionStr += quitl.ObjToString(val["id"]) + ","
-		} else {
-			positionStr += quitl.ObjToString(val["id"])
+	if positionArr != nil && len(*positionArr) > 0 {
+		for k, val := range *positionArr {
+			if k < len(*positionArr)-1 {
+				positionStr += strconv.Itoa(quitl.IntAll(val["id"])) + ","
+			} else {
+				positionStr += strconv.Itoa(quitl.IntAll(val["id"]))
+			}
 		}
 	}
 	return positionStr