2 İşlemeler c0245b7b9e ... 28880be86f

Yazar SHA1 Mesaj Tarih
  houxiaohua 28880be86f Merge branch 'master' of http://101.200.220.49:8001/houxiaohua/playlet 2 ay önce
  houxiaohua 208b02afb0 获取群主列表 2 ay önce
1 değiştirilmiş dosya ile 36 ekleme ve 26 silme
  1. 36 26
      app/Service/ChatGroup/ChatGroupService.php

+ 36 - 26
app/Service/ChatGroup/ChatGroupService.php

@@ -262,35 +262,45 @@ class ChatGroupService
262 262
      * */
263 263
     public static function ownerListOfCompany($userName, $sysGroupId)
264 264
     {
265
-        # 获取公司账号下绑定的企微
266
-        $corpIds = AdminManageCorp::where('sys_user_id', $sysGroupId)->where('is_delete', 0)->pluck('corpid');
267
-        $accountList = AuthorizeCorp::select('corpid', 'corp_name')->where('enable', 1)
268
-            ->whereIn('id', $corpIds)->get();
269
-
270
-        if(empty($accountList)) return [];
271
-
272
-        $corpidList = $accountList->pluck('corpid');
273
-        $ownerList = ChatGroup::select('corpid', 'owner')->whereIn('corpid', $corpidList)->where('status', 1)->get();
274
-
275
-        $data = [];
276
-        foreach ($accountList as $account) {
277
-            $corpid = $account->corpid;
278
-            $corpName = $account->corp_name;
279
-
280
-            # 整理数据
281
-            $userIdList = $ownerList->where('corpid', $corpid)->pluck('owner');
282
-            $userList = DjUser::select(['user_id', 'name', 'avatar', 'status', 'is_active'])
283
-                ->where('corpid', $corpid)->where('enable', 1)->where('status', 1)
284
-                ->whereIn('user_id', $userIdList)
285
-                ->get();
265
+        try {
266
+            # 获取公司账号下绑定的企微
267
+            $corpIds = AdminManageCorp::where('sys_user_id', $sysGroupId)->where('is_delete', 0)->pluck('corpid');
268
+            $accountList = AuthorizeCorp::select('corpid', 'corp_name')->where('enable', 1)
269
+                ->whereIn('id', $corpIds)->get();
286 270
 
287
-            $data[] = [
288
-                'corpid' => $corpid,
289
-                'corp_name' => $corpName,
290
-                'user_list' => $userList
291
-            ];
271
+            if(empty($accountList)) return [];
272
+
273
+            $corpidList = $accountList->pluck('corpid');
274
+            $ownerList = ChatGroup::select('corpid', 'owner')->whereIn('corpid', $corpidList)->where('status', 1)->get();
275
+
276
+            $data = [];
277
+            foreach ($accountList as $account) {
278
+                $corpid = $account->corpid;
279
+                $corpName = $account->corp_name;
280
+
281
+                # 整理数据
282
+                $userIdList = $ownerList->where('corpid', $corpid)->pluck('owner');
283
+                $userList = DjUser::select(['user_id', 'name', 'avatar', 'status', 'is_active'])
284
+                    ->where('corpid', $corpid)->where('enable', 1)->where('status', 1)
285
+                    ->whereIn('user_id', $userIdList)
286
+                    ->get();
287
+
288
+                $data[] = [
289
+                    'corpid' => $corpid,
290
+                    'corp_name' => $corpName,
291
+                    'user_list' => $userList
292
+                ];
293
+            }
294
+        } catch (\Exception $e) {
295
+            Log::logError('获取账号下各企微的群主列表出现异常', [
296
+                'line' => $e->getLine(),
297
+                'msg' => $e->getTraceAsString()
298
+            ], 'ownerListOfCompany');
299
+
300
+            return [];
292 301
         }
293 302
 
303
+
294 304
         return $data;
295 305
     }
296 306