LiuJ 4 天之前
父节点
当前提交
f68c0ab1fa
共有 1 个文件被更改,包括 278 次插入0 次删除
  1. 278 0
      app/JsonRpc/NewsService.php

+ 278 - 0
app/JsonRpc/NewsService.php

@@ -6496,4 +6496,282 @@ class NewsService implements NewsServiceInterface
     }
     }
     return Result::success($project);
     return Result::success($project);
   }
   }
+
+  public function getWebsiteCompanyInfo(array $data): array
+  {
+    $company = Company::where('id', $data['id'])
+      ->where('status', 1)
+      ->where('website_id', $data['website_id'])
+      ->select('company.*')
+      ->first();
+    if (empty($company)) {
+      return Result::error("暂无相关公司信息", 0);
+    }
+    return Result::success($company);
+  }
+  public function getMSG(array $data): array
+  {
+    $type_id = isset($data['type_id']) ? $data['type_id'] : 1;
+    // '1:个人会员 2:政务会员 3:企业会员 4:调研员 10000:管理员 20000:游客(小程序)
+    $user_id = isset($data['user_id']) ? $data['user_id'] : 0; //用户id
+    $result = [];
+    if ($type_id == 1) {
+      //最近的5篇已审的文章
+      $apply_articale = Article::where('status', 1)
+        ->where('admin_user_id', $user_id)
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //获取5条单聊未读聊天消息
+      $chat = ChatRecords::where('is_read', 0)
+        ->where('user_id', $user_id)
+        ->where('talk_type', 1)
+        ->orderBy('created_at', 'desc')
+        ->limit(5)->get();
+      //获取5条未读群聊信息
+      $chat_group = ChatRecords::where('is_read', 0)
+        ->where('user_id', $user_id)
+        ->where('talk_type', 2)
+        ->orderBy('created_at', 'desc')
+        ->limit(5)->get();
+      //获取5条用户的已审核商品
+      $good = Good::where('status', 2)
+        ->where('user_id', $user_id)
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //获取5条用户待审核的公告
+      $notice = Notice::where('status', 2)
+        ->where('user_id', $user_id)
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //获取5条用户的待审核投诉
+      $complaint = Complaint::where('status', 2)
+        ->where('user_id', $user_id)
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //获取5条用户的book
+      $book = Book::where('status', 2)
+        ->where('user_id', $user_id)
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //获取5条用户的求职
+      //获取5条用户的求职 1
+      $job_hunting = JobHunting::where('job_hunting.status', 1)
+        ->where('job_hunting.user_id', $user_id)
+        ->leftJoin('user', 'job_hunting.user_id', '=', 'user.id')
+        ->leftJoin('website', 'job_hunting.website_id', '=', 'website.id')
+        ->select('job_hunting.*', 'user.nickname as nickname', 'user.user_name as user_name', 'website.website_name as website_name')
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //获取5条用户的求职 2
+      $job_recruiting = JobRecruiting::where('job_recruiting.status', 1)
+        ->where('job_recruiting.user_id', $user_id)
+        ->leftJoin('user', 'job_recruiting.user_id', '=', 'user.id')
+        ->leftJoin('website', 'job_recruiting.website_id', '=', 'website.id')
+        ->select('job_recruiting.*', 'user.nickname as nickname', 'user.user_name as user_name', 'website.website_name as website_name')
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //人才库  1
+      $job_apply = JobApply::where('job_apply.status', 1)
+        ->where('job_apply.receiver_id', $user_id)
+        ->leftJoin('user', 'job_apply.user_id', '=', 'user.id')
+        ->leftJoin('website', 'job_apply.website_id', '=', 'website.id')
+        ->leftJoin('job_company', 'job_company.job_id', '=', 'job_apply.recruit_id')
+        ->leftJoin('job_recruiting', 'job_recruiting.id', '=', 'job_apply.recruit_id')
+        ->select('job_recruiting', 'job_recruiting.', '', '')
+        ->select('job_apply.*', 'user.nickname as nickname', 'user.user_name as user_name', 'website.website_name as website_name', 'job_company.business_name as business_name', 'job_recruiting.title as job_name')
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      // 职场机会 2
+      $job_resume = JobResume::where('job_resume.status', 1)
+        ->where('job_resume.receiver_id', $user_id)
+        ->leftJoin('user', 'job_resume.receiver_id', '=', 'user.id')
+        ->leftJoin('website', 'job_resume.website_id', '=', 'website.id')
+        ->leftJoin('job_company', 'job_company.job_id', '=', 'job_resume.recruit_id')
+        ->select('job_resume.*', 'user.nickname as nickname', 'user.user_name as user_name', 'website.website_name as website_name', 'job_company.business_name as business_name')
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      // count($chat) + count($chat_group) +
+      $count = count($apply_articale) + count($good) + count($notice) + count($complaint) + count($book) + count($job_hunting) + count($job_recruiting) + count($job_apply) + count($job_resume);
+      $result = [
+        'apply_articale' => $apply_articale,
+        'chat' => $chat,
+        'chat_group' => $chat_group,
+        'good' => $good,
+        'notice' => $notice,
+        'complaint' => $complaint,
+        'book' => $book,
+        'job_hunting' => $job_hunting,
+        'job_recruiting' => $job_recruiting,
+        'job_apply' => $job_apply,
+        'job_resume' => $job_resume,
+        'count' => $count,
+      ];
+    } elseif ($type_id == 2) {
+      //最近的5篇已审的文章
+      $apply_articale = Article::where('status', 1)
+        ->where('admin_user_id', $user_id)
+        ->limit(5)->get();
+      //获取5条单聊未读聊天消息
+      $chat = ChatRecords::where('is_read', 0)
+        ->where('user_id', $user_id)
+        ->where('talk_type', 1)
+        ->orderBy('created_at', 'desc')
+        ->limit(5)->get();
+      //获取5条未读群聊信息
+      $chat_group = ChatRecords::where('is_read', 0)
+        ->where('user_id', $user_id)
+        ->where('talk_type', 2)
+        ->orderBy('created_at', 'desc')
+        ->limit(5)->get();
+      //获取5条用户的已审核商品
+      $good = Good::where('status', 2)
+        ->where('user_id', $user_id)
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //count($chat) + count($chat_group) 
+      $count = count($apply_articale) + count($good);
+      $result = [
+        'apply_articale' => $apply_articale,
+        'chat' => $chat,
+        'chat_group' => $chat_group,
+        'good' => $good,
+        'count' => $count,
+      ];
+    } elseif ($type_id == 3) {
+      //最近的5篇已审的文章
+      $apply_articale = Article::where('status', 1)
+        ->where('admin_user_id', $user_id)
+        ->limit(5)->get();
+      //获取5条单聊未读聊天消息
+      $chat = ChatRecords::where('is_read', 0)
+        ->where('user_id', $user_id)
+        ->where('talk_type', 1)
+        ->orderBy('created_at', 'desc')
+        ->limit(5)->get();
+      //获取5条未读群聊信息
+      $chat_group = ChatRecords::where('is_read', 0)
+        ->where('user_id', $user_id)
+        ->where('talk_type', 2)
+        ->orderBy('created_at', 'desc')
+        ->limit(5)->get();
+      //获取5条用户的已审核商品
+      $good = Good::where('status', 2)
+        ->where('user_id', $user_id)
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+
+      //count($chat) + count($chat_group) +
+      $count =  count($apply_articale) + count($good);
+      $result = [
+        'apply_articale' => $apply_articale,
+        'chat' => $chat,
+        'chat_group' => $chat_group,
+        'good' => $good,
+        'count' => $count,
+      ];
+    } elseif ($type_id == 4) {
+      //最近的5篇已审的文章
+      $apply_articale = Article::where('status', 1)
+        ->where('admin_user_id', $user_id)
+        ->limit(5)->get();
+
+      //获取5条用户的已审核商品
+      $good = Good::where('status', 2)
+        ->where('user_id', $user_id)
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      $count =  count($apply_articale) + count($good);
+      $result = [
+        'apply_articale' => $apply_articale,
+        'chat' => '',
+        'chat_group' => '',
+        'good' => $good,
+        'count' => $count,
+      ];
+    } elseif ($type_id == 10000) {
+      //获取未审核的5篇文章
+      $apply_articale = Article::where('status', 0)
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //获取5条单聊未读聊天消息
+      $chat = ChatRecords::where('is_read', 0)
+        ->where('user_id', $user_id)
+        ->where('talk_type', 1)
+        ->orderBy('created_at', 'desc')
+        ->limit(5)->get();
+      //获取5条未读群聊信息
+      $chat_group = ChatRecords::where('is_read', 0)
+        ->where('user_id', $user_id)
+        ->where('talk_type', 2)
+        ->orderBy('created_at', 'desc')
+        ->limit(5)->get();
+      //获取5条用户的已审核商品
+      $good = Good::where('status', 1)
+        // ->where('user_id', $user_id)
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //获取5条用户待审核的公告
+      $notice = Notice::where('status', 1)
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //获取5条用户的待审核投诉
+      $complaint = Complaint::where('status', 1)
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //获取5条用户的book
+      $book = Book::where('status', 1)
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //获取5条用户的求职 1
+      $job_hunting = JobHunting::where('job_hunting.status', 1)
+        ->leftJoin('user', 'job_hunting.user_id', '=', 'user.id')
+        ->leftJoin('website', 'job_hunting.website_id', '=', 'website.id')
+        ->select('job_hunting.*', 'user.nickname as nickname', 'user.user_name as user_name', 'website.website_name as website_name')
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //获取5条用户的求职 2
+      $job_recruiting = JobRecruiting::where('job_recruiting.status', 1)
+        ->leftJoin('user', 'job_recruiting.user_id', '=', 'user.id')
+        ->leftJoin('website', 'job_recruiting.website_id', '=', 'website.id')
+        ->select('job_recruiting.*', 'user.nickname as nickname', 'user.user_name as user_name', 'website.website_name as website_name')
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      //人才库  1
+      $job_apply = JobApply::where('job_apply.status', 1)
+        ->leftJoin('user', 'job_apply.user_id', '=', 'user.id')
+        ->leftJoin('website', 'job_apply.website_id', '=', 'website.id')
+        ->leftJoin('job_company', 'job_company.job_id', '=', 'job_apply.recruit_id')
+        ->leftJoin('job_recruiting', 'job_recruiting.id', '=', 'job_apply.recruit_id')
+        ->select('job_apply.*', 'user.nickname as nickname', 'user.user_name as user_name', 'website.website_name as website_name', 'job_company.business_name as business_name', 'job_recruiting.title as job_name')
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+      // 职场机会 2
+      $job_resume = JobResume::where('job_resume.status', 1)
+        ->leftJoin('user', 'job_resume.receiver_id', '=', 'user.id')
+        ->leftJoin('website', 'job_resume.website_id', '=', 'website.id')
+        ->leftJoin('job_company', 'job_company.job_id', '=', 'job_resume.recruit_id')
+        ->select('job_resume.*', 'user.nickname as nickname', 'user.user_name as user_name', 'website.website_name as website_name', 'job_company.business_name as business_name')
+        ->orderBy('updated_at', 'desc')
+        ->limit(5)->get();
+
+      $count = count($chat) + count($chat_group) + count($apply_articale) + count($good) + count($notice) + count($complaint) + count($book) + count($job_hunting) + count($job_recruiting) + count($job_apply) + count($job_resume);
+      $result = [
+        'apply_articale' => $apply_articale,
+        'chat' => $chat,
+        'chat_group' => $chat_group,
+        'good' => $good,
+        'notice' => $notice,
+        'complaint' => $complaint,
+        'book' => $book,
+        'job_hunting' => $job_hunting,
+        'job_recruiting' => $job_recruiting,
+        'job_apply' => $job_apply,
+        'job_resume' => $job_resume,
+        'count' => $count,
+      ];
+    } elseif ($type_id == 20000) {
+    }
+    var_dump($type_id, '-----------------test---------');
+    return Result::success($result);
+  }
 }
 }