Explorar o código

Merge branch 'master' of http://git.bjzxtw.org.cn:3000/zxt/chat_producer

LiuJ hai 1 día
pai
achega
b115421bba

+ 42 - 1
app/JsonRpc/ChatService.php

@@ -955,7 +955,8 @@ class ChatService implements ChatServiceInterface
     {
         $result = ChatTopic::where(['chat_topics.id' => $data['id']])
             ->leftJoin('user', 'user.id', '=', 'chat_topics.user_id')
-            ->select('chat_topics.*', 'user.nickname', 'user.avatar', 'user.user_name')
+            ->leftJoin('chat_topic_class', 'chat_topic_class.id', '=', 'chat_topics.type')
+            ->select('chat_topics.*', 'user.nickname', 'user.avatar', 'user.user_name','chat_topic_class.topicname')
             ->first();
         return Result::success($result);
     }
@@ -1167,4 +1168,44 @@ class ChatService implements ChatServiceInterface
         $result = ChatTopicClass::where(['id' => $data['id']])->first();
         return Result::success($result);
     }
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getBusinessDistrictList(array $data): array
+    {
+        $query = ChatGroupsMember::Join('chat_topics', 'chat_topics.group_id', '=', 'chat_groups_members.group_id')
+            ->leftJoin('chat_topic_class', 'chat_topic_class.id', '=', 'chat_topics.type')
+            ->where(['chat_groups_members.user_id' => $data['user_id']])
+            ->when($data, function ($query) use ($data) {
+                if(!empty($data['type'])){
+                    $query->where(['chat_topics.type' => $data['type']]);
+                }
+                if(!empty($data['title'])){
+                    $query->where('chat_topics.title','like','%'.$data['title'].'%');
+                }
+                if(!empty($data['created_at'])){
+                    $query->whereDate('chat_topics.created_at', $data['created_at']);
+                }
+            })
+            ->select(
+                'chat_topics.id',
+                'chat_topics.title',
+                'chat_topics.author',
+                'chat_topics.created_at',
+                'chat_topics.updated_at',
+                'chat_topic_class.topicname',
+            )
+            ->orderBy('chat_topics.created_at', 'desc');
+            $total = $query->count();
+            $list = $query->forPage($data['page'], $data['page_size'])->get();
+            $result = [
+                'list' => $list,
+                'total' => $total,
+                'page' => intval($data['page']),
+                'page_size' => intval($data['page_size']),
+            ];
+        return  Result::success($result);
+    }
 }

+ 1 - 0
app/JsonRpc/ChatServiceInterface.php

@@ -222,5 +222,6 @@ interface ChatServiceInterface
     public function updateTopicClass(array $data): array;
     public function deleteTopicClass(array $data): array;
     public function getTopicClassInfo(array $data): array;
+    public function getBusinessDistrictList(array $data): array;
 
 }

+ 13 - 0
runtime/logs/hyperf-2025-07-17.log

@@ -0,0 +1,13 @@
+[2025-07-17 06:42:37] sql.INFO: [14.99] select count(*) as aggregate from `chat_groups_members` inner join `chat_topics` on `chat_topics`.`group_id` = `chat_groups_members`.`group_id` left join `chat_topic_class` on `chat_topic_class`.`id` = `chat_topics`.`type` where (`chat_groups_members`.`user_id` = '214') [] []
+[2025-07-17 06:42:37] sql.INFO: [4.47] select `chat_topics`.*, `chat_topic_class`.`topicname` from `chat_groups_members` inner join `chat_topics` on `chat_topics`.`group_id` = `chat_groups_members`.`group_id` left join `chat_topic_class` on `chat_topic_class`.`id` = `chat_topics`.`type` where (`chat_groups_members`.`user_id` = '214') order by `chat_topics`.`created_at` desc limit 10 offset 0 [] []
+[2025-07-17 06:58:21] sql.INFO: [10.67] select count(*) as aggregate from `chat_groups_members` inner join `chat_topics` on `chat_topics`.`group_id` = `chat_groups_members`.`group_id` left join `chat_topic_class` on `chat_topic_class`.`id` = `chat_topics`.`type` where (`chat_groups_members`.`user_id` = '214') [] []
+[2025-07-17 06:58:21] sql.INFO: [4.68] select `chat_topics`.*, `chat_topic_class`.`topicname` from `chat_groups_members` inner join `chat_topics` on `chat_topics`.`group_id` = `chat_groups_members`.`group_id` left join `chat_topic_class` on `chat_topic_class`.`id` = `chat_topics`.`type` where (`chat_groups_members`.`user_id` = '214') order by `chat_topics`.`created_at` desc limit 10 offset 0 [] []
+[2025-07-17 06:58:59] sql.INFO: [3.62] select count(*) as aggregate from `chat_groups_members` inner join `chat_topics` on `chat_topics`.`group_id` = `chat_groups_members`.`group_id` left join `chat_topic_class` on `chat_topic_class`.`id` = `chat_topics`.`type` where (`chat_groups_members`.`user_id` = '214') [] []
+[2025-07-17 06:58:59] sql.INFO: [4.33] select `chat_topics`.*, `chat_topic_class`.`topicname` from `chat_groups_members` inner join `chat_topics` on `chat_topics`.`group_id` = `chat_groups_members`.`group_id` left join `chat_topic_class` on `chat_topic_class`.`id` = `chat_topics`.`type` where (`chat_groups_members`.`user_id` = '214') order by `chat_topics`.`created_at` desc limit 10 offset 0 [] []
+[2025-07-17 06:59:08] sql.INFO: [2.93] insert into `chat_records` (`action`, `content`, `group_receiver_id`, `is_read`, `msg_type`, `receiver_id`, `talk_type`, `user_id`) values ('said', 'kk', '214', '1', '1', '804364907431698433', '2', '214') [] []
+[2025-07-17 06:59:11] sql.INFO: [4.08] select count(*) as aggregate from `chat_groups_members` inner join `chat_topics` on `chat_topics`.`group_id` = `chat_groups_members`.`group_id` left join `chat_topic_class` on `chat_topic_class`.`id` = `chat_topics`.`type` where (`chat_groups_members`.`user_id` = '214') [] []
+[2025-07-17 06:59:11] sql.INFO: [4.49] select `chat_topics`.*, `chat_topic_class`.`topicname` from `chat_groups_members` inner join `chat_topics` on `chat_topics`.`group_id` = `chat_groups_members`.`group_id` left join `chat_topic_class` on `chat_topic_class`.`id` = `chat_topics`.`type` where (`chat_groups_members`.`user_id` = '214') order by `chat_topics`.`created_at` desc limit 10 offset 0 [] []
+[2025-07-17 07:01:55] sql.INFO: [17.13] select count(*) as aggregate from `chat_groups_members` inner join `chat_topics` on `chat_topics`.`group_id` = `chat_groups_members`.`group_id` left join `chat_topic_class` on `chat_topic_class`.`id` = `chat_topics`.`type` where (`chat_groups_members`.`user_id` = '214') [] []
+[2025-07-17 07:01:55] sql.INFO: [4.33] select `chat_topics`.`id`, `chat_topics`.`title`, `chat_topics`.`author`, `chat_topics`.`created_at`, `chat_topics`.`updated_at`, `chat_topic_class`.`topicname` from `chat_groups_members` inner join `chat_topics` on `chat_topics`.`group_id` = `chat_groups_members`.`group_id` left join `chat_topic_class` on `chat_topic_class`.`id` = `chat_topics`.`type` where (`chat_groups_members`.`user_id` = '214') order by `chat_topics`.`created_at` desc limit 10 offset 0 [] []
+[2025-07-17 07:03:06] sql.INFO: [13.7] select count(*) as aggregate from `chat_groups_members` inner join `chat_topics` on `chat_topics`.`group_id` = `chat_groups_members`.`group_id` left join `chat_topic_class` on `chat_topic_class`.`id` = `chat_topics`.`type` where (`chat_groups_members`.`user_id` = '214') [] []
+[2025-07-17 07:03:06] sql.INFO: [3.95] select `chat_topics`.`id`, `chat_topics`.`title`, `chat_topics`.`author`, `chat_topics`.`created_at`, `chat_topics`.`updated_at`, `chat_topic_class`.`topicname` from `chat_groups_members` inner join `chat_topics` on `chat_topics`.`group_id` = `chat_groups_members`.`group_id` left join `chat_topic_class` on `chat_topic_class`.`id` = `chat_topics`.`type` where (`chat_groups_members`.`user_id` = '214') order by `chat_topics`.`created_at` desc limit 10 offset 0 [] []