Forráskód Böngészése

Merge remote-tracking branch 'origin/feature/v1.2.6' into dev/v1.2.6_dx

duxin 2 éve
szülő
commit
dd2253b7bb

+ 42 - 36
.idea/workspace.xml

@@ -6,6 +6,13 @@
   <component name="ChangeListManager">
     <list default="true" id="f5220264-ecf0-4305-ada3-6105184077a7" name="Changes" comment="提交">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" 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/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" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -56,6 +63,8 @@
     <option name="showLibraryContents" value="true" />
   </component>
   <component name="PropertiesComponent">
+    <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
+    <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
     <property name="WebServerToolWindowFactoryState" value="false" />
     <property name="configurable..is.expanded" value="false" />
     <property name="configurable.GoLibrariesConfigurable.is.expanded" value="true" />
@@ -83,7 +92,7 @@
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\api" />
     </key>
   </component>
-  <component name="RunManager" selected="Go 构建.messageApi_win">
+  <component name="RunManager" selected="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_Count">
     <configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
       <module name="messageCenter" />
       <working_directory value="$PROJECT_DIR$" />
@@ -93,6 +102,15 @@
       <filePath value="$PROJECT_DIR$" />
       <method v="2" />
     </configuration>
+    <configuration name="go build bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
+      <module name="messageCenter" />
+      <working_directory value="$PROJECT_DIR$" />
+      <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="messageApi" type="GoApplicationRunConfiguration" factoryName="Go Application">
       <module name="messageCenter" />
       <working_directory value="$PROJECT_DIR$/api/messagecenter" />
@@ -143,31 +161,17 @@
       <filePath value="$PROJECT_DIR$" />
       <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">
-      <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_SaveMessage\E$/^\Q7、机器人给用户发送信息\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 default="true" type="GoTestRunConfiguration" factoryName="Go Test">
       <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" />
+      <working_directory value="$PROJECT_DIR$" />
+      <go_parameters value="-i" />
+      <kind value="DIRECTORY" />
       <directory value="$PROJECT_DIR$" />
       <filePath value="$PROJECT_DIR$" />
       <framework value="gotest" />
-      <pattern value="^\QTestMessaggeService_UpdateReadById\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">
+    <configuration name="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_Count" 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$" />
@@ -176,20 +180,22 @@
       <directory value="$PROJECT_DIR$" />
       <filePath value="$PROJECT_DIR$" />
       <framework value="gotest" />
-      <pattern value="^\QTest_test1\E$" />
+      <pattern value="^\QTest_Count\E$" />
       <method v="2" />
     </configuration>
-    <configuration default="true" type="GoTestRunConfiguration" factoryName="Go Test">
+    <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$" />
-      <go_parameters value="-i" />
-      <kind value="DIRECTORY" />
+      <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="^\QTestChatGroupService_ChatGroupAdd\E$/^\Q群组新增\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/service 中的 TestChatGroupService_EntPersonsList/企业列表" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
       <module name="messageCenter" />
       <working_directory value="$PROJECT_DIR$/service" />
       <root_directory value="$PROJECT_DIR$" />
@@ -198,10 +204,10 @@
       <directory value="$PROJECT_DIR$" />
       <filePath value="$PROJECT_DIR$" />
       <framework value="gotest" />
-      <pattern value="^\QTestChatGroupService_ChatGroupAdd\E$/^\Q群组新增\E$" />
+      <pattern value="^\QTestChatGroupService_EntPersonsList\E$/^\Q企业列表\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 中的 TestMessaggeService_Count/未读信息总数" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
       <module name="messageCenter" />
       <working_directory value="$PROJECT_DIR$/service" />
       <root_directory value="$PROJECT_DIR$" />
@@ -210,7 +216,7 @@
       <directory value="$PROJECT_DIR$" />
       <filePath value="$PROJECT_DIR$" />
       <framework value="gotest" />
-      <pattern value="^\QTestChatGroupService_EntPersonsList\E$/^\Q企业列表\E$" />
+      <pattern value="^\QTestMessaggeService_Count\E$/^\Q未读信息总数\E$" />
       <method v="2" />
     </configuration>
     <list>
@@ -218,19 +224,19 @@
       <item itemvalue="Go 构建.messageApi_win" />
       <item itemvalue="Go 构建.messageRpc" />
       <item itemvalue="Go 构建.messageRpc_win" />
-      <item itemvalue="Go 测试.TestMessaggeService_SaveMessage/7、机器人给用户发送信息 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
-      <item itemvalue="Go 测试.TestMessaggeService_UpdateReadById in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
-      <item itemvalue="Go 测试.Test_test1 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test (1)" />
-      <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_ChatGroupAdd/群组新增" />
       <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 中的 TestMessaggeService_Count/未读信息总数" />
+      <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_Count" />
     </list>
     <recent_temporary>
       <list>
+        <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/企业列表" />
-        <item itemvalue="Go 测试.Test_test1 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test (1)" />
-        <item itemvalue="Go 测试.TestMessaggeService_UpdateReadById in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
-        <item itemvalue="Go 测试.TestMessaggeService_SaveMessage/7、机器人给用户发送信息 in bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
       </list>
     </recent_temporary>
   </component>

+ 12 - 6
rpc/messagecenter/test/message_test.go

@@ -27,7 +27,7 @@ func Test_Count(t *testing.T) {
 	TestSystem := messagecenter.NewMessageCenter(zrpc.MustNewClient(c.TestConf))
 	req := &messagecenter.CountReq{
 		UserType:  2,
-		NewUserId: 831,
+		NewUserId: 5524,
 	}
 	res, err := TestSystem.Count(ctx, req)
 	log.Println("res ", res)
@@ -56,11 +56,17 @@ func Test_FindMessage(t *testing.T) {
 	ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
 	TestSystem := messagecenter.NewMessageCenter(zrpc.MustNewClient(c.TestConf))
 	req := &messagecenter.MessageReq{
-		MsgType:  4,
-		UserType: 1,
-		SendId:   68826,
-		PageSize: 10,
-		EntId:    14929,
+		MsgType:   2,
+		UserType:  2,
+		SendId:    68826,
+		PageSize:  10,
+		EntId:     14929,
+		LastId:    0,
+		NewUserId: 74175,
+		EntUserId: 0,
+		Sort:      "",
+		//ChatGroupId: 1,
+		PositionId: 584,
 	}
 	res, err := TestSystem.FindMessage(ctx, req)
 	log.Println("res ", res)

+ 0 - 285
service/chat_group_test.go

@@ -1,285 +0,0 @@
-package service
-
-import (
-	"reflect"
-	"testing"
-)
-
-func TestChatGroupService_ChatGroupAdd(t *testing.T) {
-	type args struct {
-		entId      int64
-		positionId int64
-		userIdArr  []int64
-		appid      string
-	}
-	tests := []struct {
-		name string
-		args args
-		want bool
-	}{
-		// TODO: Add test cases.
-		{
-			name: "群组新增",
-			args: args{
-				entId:      15755,
-				positionId: 1204781623,
-				userIdArr:  []int64{1204841316},
-				appid:      "10000",
-			},
-		},
-	}
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			b := ChatGroupService{}
-			if got := b.ChatGroupAdd(tt.args.entId, tt.args.positionId, tt.args.userIdArr, tt.args.appid); got != tt.want {
-				t.Errorf("ChatGroupAdd() = %v, want %v", got, tt.want)
-			}
-		})
-	}
-}
-
-func TestChatGroupService_ChatGroupJoin(t *testing.T) {
-	type args struct {
-		chatGroupId int64
-		positionId  int64
-		userIdArr   []int64
-		appid       string
-	}
-	tests := []struct {
-		name string
-		args args
-		want bool
-	}{
-		// TODO: Add test cases.
-		{
-			name: "拉人进群",
-			args: args{
-				chatGroupId: 3,
-				positionId:  1204781623,
-				userIdArr:   []int64{1204841317},
-				appid:       "10000",
-			},
-		},
-	}
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			b := ChatGroupService{}
-			if got := b.ChatGroupJoin(tt.args.chatGroupId, tt.args.positionId, tt.args.userIdArr, tt.args.appid); got != tt.want {
-				t.Errorf("ChatGroupJoin() = %v, want %v", got, tt.want)
-			}
-		})
-	}
-}
-
-func TestChatGroupService_ChatGroupList(t *testing.T) {
-	type args struct {
-		entId      int64
-		positionId int64
-		userName   string
-		groupName  string
-		appid      string
-	}
-	tests := []struct {
-		name string
-		args args
-		want []map[string]interface{}
-	}{
-		// TODO: Add test cases.
-		{name: "我的群聊列表默认",
-			args: args{
-				entId:      15755,
-				positionId: 1204781623,
-				userName:   "张",
-				groupName:  "",
-				appid:      "10000",
-			},
-		},
-	}
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			b := ChatGroupService{}
-			if got := b.ChatGroupList(tt.args.entId, tt.args.positionId, tt.args.userName, tt.args.groupName, tt.args.appid); !reflect.DeepEqual(got, tt.want) {
-				t.Errorf("ChatGroupList() = %v, want %v", got, tt.want)
-			}
-		})
-	}
-}
-
-func TestChatGroupService_ChatGroupPerson(t *testing.T) {
-	type args struct {
-		ChatGroupId int64
-		entId       int64
-		appid       string
-	}
-	tests := []struct {
-		name string
-		args args
-		want map[string][]map[string]interface{}
-	}{
-		// TODO: Add test cases.
-		{
-			name: "群成员",
-			args: args{
-				ChatGroupId: 3,
-				entId:       15755,
-				appid:       "10000",
-			},
-		},
-	}
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			b := ChatGroupService{}
-			if got := b.ChatGroupPerson(tt.args.ChatGroupId, tt.args.entId, tt.args.appid); !reflect.DeepEqual(got, tt.want) {
-				t.Errorf("ChatGroupPerson() = %v, want %v", got, tt.want)
-			}
-		})
-	}
-}
-
-func TestChatGroupService_GroupNameUpdate(t *testing.T) {
-	type args struct {
-		chatGroupId int64
-		groupName   string
-		appid       string
-	}
-	tests := []struct {
-		name string
-		args args
-		want bool
-	}{
-		// TODO: Add test cases.
-		{
-			name: "表名修改",
-			args: args{
-				chatGroupId: 3,
-				groupName:   "策士",
-				appid:       "10000",
-			},
-		},
-	}
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			b := ChatGroupService{}
-			if got := b.GroupNameUpdate(tt.args.chatGroupId, tt.args.groupName, tt.args.appid); got != tt.want {
-				t.Errorf("GroupNameUpdate() = %v, want %v", got, tt.want)
-			}
-		})
-	}
-}
-
-func TestChatGroupService_GroupNoticeAdd(t *testing.T) {
-	type args struct {
-		chatGroupId int64
-		content     string
-		appid       string
-	}
-	tests := []struct {
-		name string
-		args args
-		want bool
-	}{
-		// TODO: Add test cases.
-		{
-			name: "公告新增",
-			args: args{
-				chatGroupId: 3,
-				content:     "一起来玩啊",
-				appid:       "10000",
-			},
-		},
-	}
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			b := ChatGroupService{}
-			if got := b.GroupNoticeAdd(tt.args.chatGroupId, tt.args.content, tt.args.appid); got != tt.want {
-				t.Errorf("GroupNoticeAdd() = %v, want %v", got, tt.want)
-			}
-		})
-	}
-}
-
-func TestChatGroupService_GroupNoticeGet(t *testing.T) {
-	type args struct {
-		chatGroupId int64
-		appid       string
-	}
-	tests := []struct {
-		name string
-		args args
-		want map[string]interface{}
-	}{
-		// TODO: Add test cases.
-		{
-			name: "公告获取",
-			args: args{
-				chatGroupId: 3,
-				appid:       "10000",
-			},
-		},
-	}
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			b := ChatGroupService{}
-			if got := b.GroupNoticeGet(tt.args.chatGroupId, tt.args.appid); !reflect.DeepEqual(got, tt.want) {
-				t.Errorf("GroupNoticeGet() = %v, want %v", got, tt.want)
-			}
-		})
-	}
-}
-
-func TestChatGroupService_GroupNoticeUpdate(t *testing.T) {
-	type args struct {
-		groupNoticeId int64
-		content       string
-		appid         string
-	}
-	tests := []struct {
-		name string
-		args args
-		want bool
-	}{
-		// TODO: Add test cases.
-		{
-			name: "公告修改",
-			args: args{
-				groupNoticeId: 1,
-				content:       "一起来吗qqqqq",
-				appid:         "10000",
-			},
-		},
-	}
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			b := ChatGroupService{}
-			if got := b.GroupNoticeUpdate(tt.args.groupNoticeId, tt.args.content, tt.args.appid); got != tt.want {
-				t.Errorf("GroupNoticeUpdate() = %v, want %v", got, tt.want)
-			}
-		})
-	}
-}
-
-func TestEntPerson(t *testing.T) {
-	type args struct {
-		entId int64
-		isAll bool
-	}
-	tests := []struct {
-		name  string
-		args  args
-		want  map[string]string
-		want1 map[string]string
-	}{
-		// TODO: Add test cases.
-	}
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			got, got1 := EntPerson(tt.args.entId, tt.args.isAll)
-			if !reflect.DeepEqual(got, tt.want) {
-				t.Errorf("EntPerson() got = %v, want %v", got, tt.want)
-			}
-			if !reflect.DeepEqual(got1, tt.want1) {
-				t.Errorf("EntPerson() got1 = %v, want %v", got1, tt.want1)
-			}
-		})
-	}
-}

+ 3 - 8
service/message_mail_box.go

@@ -37,7 +37,7 @@ func (b MessaggeService) Count(newUserId int64) (count int, last map[string]inte
 							c.nickname AS name,
 							c.headimg,
 							d.content,
-							d.type 
+							d.type,
 							d.create_time,
 							a.unread as number,
 						    a.timestamp
@@ -84,13 +84,8 @@ func (b MessaggeService) Count(newUserId int64) (count int, last map[string]inte
 
 	allSql = strings.Join(append(sqlArr, oneSql, groupSql, serviceSql), " union ")
 
-	sqlStr := fmt.Sprintf(`SELECT * FROM
-					(
-						%s
-					) a 
-				a.ORDER BY a.timestamp DESC`, allSql)
-	log.Println("查询sql", sqlStr)
-	data := IC.BaseMysql.SelectBySql(sqlStr)
+	log.Println("查询sql", allSql)
+	data := IC.BaseMysql.SelectBySql(allSql)
 	log.Println("查询数据:", data)
 	return
 }