rkljw 5 mesiacov pred
rodič
commit
7648e8ad07

+ 27 - 1
app/JsonRpc/UserService.php

@@ -2,6 +2,7 @@
 
 namespace App\JsonRpc;
 
+use App\Model\ImContact;
 use App\Model\Role;
 use App\Model\RoleLog;
 use App\Model\RoleUser;
@@ -14,7 +15,7 @@ use App\Tools\Result;
 use Hamcrest\Arrays\IsArray;
 use Hyperf\DbConnection\Db;
 use Hyperf\RpcServer\Annotation\RpcService;
-
+use App\Model\ImGroupMember;
 #[RpcService(name: "UserService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
 class UserService implements UserServiceInterface
 {
@@ -656,4 +657,29 @@ class UserService implements UserServiceInterface
             return Result::error('查询失败');
         }
     }
+    /**
+     * 获取群里面的用户,不包含子集
+     */
+    public function getImGroupMember(array $data): array
+    {
+        $result = ImGroupMember::leftjoin("im_group", "im_group.id", "=", "im_group_member.group_id")->when($data, function ($query) use ($data) {
+            if (isset($data['user_id']) && $data['user_id']) {
+                $query->where('im_group_member.user_id', '<>', $data['user_id']);
+            }
+        })
+            ->where('im_group_member.group_id', $data['group_id'])
+            ->select("im_group_member.*", "im_group.group_name")
+            ->get();
+        return Result::success($result??[]);
+    }
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getImContact(array $data): array
+    {
+        $result = ImContact::where($data)->first();
+        return Result::success($result??[]);
+    }
 }

+ 12 - 0
app/JsonRpc/UserServiceInterface.php

@@ -131,5 +131,17 @@ interface UserServiceInterface
      * @return array
      */
     public function getTypeUserList(array $data): array;
+    /**
+     * 获取用户信息
+     * @param array $data
+     * @return array
+     */
+    public function getImGroupMember(array $data): array;
+    /**
+     * 获取用户备注信息
+     * @param array $data
+     * @return array
+     */
+    public function getImContact(array $data): array;
 
 }

+ 28 - 0
app/Model/ImContact.php

@@ -0,0 +1,28 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+
+class ImContact extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'im_contact';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+
+   
+}

+ 28 - 0
app/Model/ImGroupMember.php

@@ -0,0 +1,28 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+
+class ImGroupMember extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'im_group_member';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+
+   
+}