소스 검색

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

rkljw 1 개월 전
부모
커밋
7cae8ecb3a
1개의 변경된 파일209개의 추가작업 그리고 185개의 파일을 삭제
  1. 209 185
      app/JsonRpc/NewsService.php

+ 209 - 185
app/JsonRpc/NewsService.php

@@ -3192,130 +3192,130 @@ class NewsService implements NewsServiceInterface
     if (empty($web)) {
       return Result::error("该网站不存在", 0);
     }
-      if(isset($data['other_route']) && !empty($data['other_route'])) {
-          $whiteRouterInfo = WhiteRouter::whereJsonContains("website_id", $data['website_id'])->where('router_url', $data['other_route'])->first();
-          if (empty($whiteRouterInfo)) {
-              return Result::error("非法路径地址", 0);
-          }else{
-              return Result::success($whiteRouterInfo->toArray());
-          }
+    if (isset($data['other_route']) && !empty($data['other_route'])) {
+      $whiteRouterInfo = WhiteRouter::whereJsonContains("website_id", $data['website_id'])->where('router_url', $data['other_route'])->first();
+      if (empty($whiteRouterInfo)) {
+        return Result::error("非法路径地址", 0);
       } else {
-          // 验证栏目路由
-          $last_category = WebsiteCategory::where('website_id', $data['website_id'])
-              ->where('aLIas_pinyin', $data['last_route'])
-              ->first();
-          if (empty($last_category)) {
-              return Result::error("该栏目不存在", 0);
-          }
-          if (isset($data['id']) && !empty($data['id'])) {
-              //   `type` int unsigned DEFAULT '1' COMMENT '类型:1资讯(默认)2商品3书刊音像4招聘5求职类型:1资讯(默认)2商品3书刊音像4招聘5求职6招工招聘'
-              switch ($last_category['type']) {
-                  case 1:
-                      // 文章
-                      //   `status` int DEFAULT '1' COMMENT '状态: 2:已拒绝  ;1:已发布,0待发布 草稿箱 404删除(移除)
-                      $article = Article::where('status', 1)
-                          ->where('id', $data['id'])
-                          ->where(function ($query) use ($data) {
-                              $query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
-                                  ->orWhereNull("ignore_ids");
-                          })
-                          ->first(['cat_arr_id']);
-                      if (empty($article)) {
-                          return Result::error("该文章不存在", 0);
-                      }
-                      // return Result::success($article);
-                      break;
-                  case 2:
-                      // 商品
-                      // `status` int DEFAULT '1' COMMENT '审核状态,1待审核2已审核3已拒绝',
-                      $article = Good::where('website_id', $data['website_id'])
-                          ->where('status', 2)
-                          ->where('id', $data['id'])
-                          ->first(['cat_arr_id']);
-                      if (empty($article)) {
-                          return Result::error("该商品不存在", 0);
-                      }
-                      break;
-                  case 3:
-                      // 书刊信息
-                      // `status` int DEFAULT '1' COMMENT '审核状态,1待审核2已审核3已拒绝',
-                      $article = Book::where('website_id', $data['website_id'])
-                          ->where('status', 2)
-                          ->where('id', $data['id'])
-                          ->first(['id', 'cat_arr_id']);
-                      if (empty($article)) {
-                          return Result::error("该书刊不存在", 0);
-                      }
-                      break;
-                  case 4:
-                      // 招聘
-                      //   `status` int DEFAULT '0' COMMENT '状态   0:待审核;1:已审核;(只有企业会员需要审核)',
-                      $article = JobRecruiting::where('website_id', $data['website_id'])
-                          ->where('status', 1)
-                          ->where('id', $data['id'])
-                          ->first(['cat_arr_id']);
-                      if (empty($article)) {
-                          return Result::error("该招聘不存在", 0);
-                      }
-                      break;
-                  case 5:
-                      // 求职
-                      //   `status` int DEFAULT '1' COMMENT '审核状态,1待审核2已审核3已拒绝',
-                      $article = JobHunting::where('website_id', $data['website_id'])
-                          ->where('status', 2)
-                          ->where('id', $data['id'])
-                          ->first(['cat_arr_id']);
-                      if (empty($article)) {
-                          return Result::error("该求职不存在", 0);
-                      }
-                      break;
-                  case 6:
-                      // 招工招聘
-                      // `status` int DEFAULT '1' COMMENT '审核状态,1待审核2已审核3已拒绝',
-                      $article = JobRecruiting::where('website_id', $data['website_id'])
-                          ->where('status', 1)
-                          ->where('id', $data['id'])
-                          ->first(['cat_arr_id']);
-                      if (empty($article)) {
-                          $article = JobHunting::where('website_id', $data['website_id'])
-                              ->where('status', 2)
-                              ->where('id', $data['id'])
-                              ->first(['cat_arr_id']);
-                      }
-                      if (empty($article)) {
-                          return Result::error("该招工招聘不存在", 0);
-                      }
-                      break;
-                  default:
-                      return Result::error("该数据不存在", 0);
-                      break;
-              }
-              $catid = json_decode($article['cat_arr_id'], true);
-              if (empty($catid)) {
-                  return Result::error("该数据不存在", 0);
-              }
-              $pinyin = WebsiteCategory::where('website_id', $data['website_id'])
-                  ->orderByRaw('FIELD(category_id, ' . implode(',', $catid) . ')')
-                  ->whereIn('category_id', $catid)
-                  ->pluck('aLIas_pinyin')
-                  ->implode('/');
-          }
-          if ($last_category['pid'] != 0) {
-              $cat_arr = json_decode($last_category['category_arr_id'], true);
-              $pinyin = WebsiteCategory::where('website_id', $data['website_id'])
-                  ->orderByRaw('FIELD(category_id, ' . implode(',', $cat_arr) . ')')
-                  ->whereIn('category_id', $cat_arr)
-                  ->pluck('aLIas_pinyin')
-                  ->implode('/');
-          } else {
-              $pinyin = $last_category['aLIas_pinyin'];
-          }
-          if (empty($pinyin) || $pinyin != $data['all_route']) {
-              return Result::error('非法路径!');
-          } else {
-              return Result::success($pinyin);
-          }
+        return Result::success($whiteRouterInfo->toArray());
+      }
+    } else {
+      // 验证栏目路由
+      $last_category = WebsiteCategory::where('website_id', $data['website_id'])
+        ->where('aLIas_pinyin', $data['last_route'])
+        ->first();
+      if (empty($last_category)) {
+        return Result::error("该栏目不存在", 0);
+      }
+      if (isset($data['id']) && !empty($data['id'])) {
+        //   `type` int unsigned DEFAULT '1' COMMENT '类型:1资讯(默认)2商品3书刊音像4招聘5求职类型:1资讯(默认)2商品3书刊音像4招聘5求职6招工招聘'
+        switch ($last_category['type']) {
+          case 1:
+            // 文章
+            //   `status` int DEFAULT '1' COMMENT '状态: 2:已拒绝  ;1:已发布,0待发布 草稿箱 404删除(移除)
+            $article = Article::where('status', 1)
+              ->where('id', $data['id'])
+              ->where(function ($query) use ($data) {
+                $query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
+                  ->orWhereNull("ignore_ids");
+              })
+              ->first(['cat_arr_id']);
+            if (empty($article)) {
+              return Result::error("该文章不存在", 0);
+            }
+            // return Result::success($article);
+            break;
+          case 2:
+            // 商品
+            // `status` int DEFAULT '1' COMMENT '审核状态,1待审核2已审核3已拒绝',
+            $article = Good::where('website_id', $data['website_id'])
+              ->where('status', 2)
+              ->where('id', $data['id'])
+              ->first(['cat_arr_id']);
+            if (empty($article)) {
+              return Result::error("该商品不存在", 0);
+            }
+            break;
+          case 3:
+            // 书刊信息
+            // `status` int DEFAULT '1' COMMENT '审核状态,1待审核2已审核3已拒绝',
+            $article = Book::where('website_id', $data['website_id'])
+              ->where('status', 2)
+              ->where('id', $data['id'])
+              ->first(['id', 'cat_arr_id']);
+            if (empty($article)) {
+              return Result::error("该书刊不存在", 0);
+            }
+            break;
+          case 4:
+            // 招聘
+            //   `status` int DEFAULT '0' COMMENT '状态   0:待审核;1:已审核;(只有企业会员需要审核)',
+            $article = JobRecruiting::where('website_id', $data['website_id'])
+              ->where('status', 1)
+              ->where('id', $data['id'])
+              ->first(['cat_arr_id']);
+            if (empty($article)) {
+              return Result::error("该招聘不存在", 0);
+            }
+            break;
+          case 5:
+            // 求职
+            //   `status` int DEFAULT '1' COMMENT '审核状态,1待审核2已审核3已拒绝',
+            $article = JobHunting::where('website_id', $data['website_id'])
+              ->where('status', 2)
+              ->where('id', $data['id'])
+              ->first(['cat_arr_id']);
+            if (empty($article)) {
+              return Result::error("该求职不存在", 0);
+            }
+            break;
+          case 6:
+            // 招工招聘
+            // `status` int DEFAULT '1' COMMENT '审核状态,1待审核2已审核3已拒绝',
+            $article = JobRecruiting::where('website_id', $data['website_id'])
+              ->where('status', 1)
+              ->where('id', $data['id'])
+              ->first(['cat_arr_id']);
+            if (empty($article)) {
+              $article = JobHunting::where('website_id', $data['website_id'])
+                ->where('status', 2)
+                ->where('id', $data['id'])
+                ->first(['cat_arr_id']);
+            }
+            if (empty($article)) {
+              return Result::error("该招工招聘不存在", 0);
+            }
+            break;
+          default:
+            return Result::error("该数据不存在", 0);
+            break;
+        }
+        $catid = json_decode($article['cat_arr_id'], true);
+        if (empty($catid)) {
+          return Result::error("该数据不存在", 0);
+        }
+        $pinyin = WebsiteCategory::where('website_id', $data['website_id'])
+          ->orderByRaw('FIELD(category_id, ' . implode(',', $catid) . ')')
+          ->whereIn('category_id', $catid)
+          ->pluck('aLIas_pinyin')
+          ->implode('/');
+      }
+      if ($last_category['pid'] != 0) {
+        $cat_arr = json_decode($last_category['category_arr_id'], true);
+        $pinyin = WebsiteCategory::where('website_id', $data['website_id'])
+          ->orderByRaw('FIELD(category_id, ' . implode(',', $cat_arr) . ')')
+          ->whereIn('category_id', $cat_arr)
+          ->pluck('aLIas_pinyin')
+          ->implode('/');
+      } else {
+        $pinyin = $last_category['aLIas_pinyin'];
+      }
+      if (empty($pinyin) || $pinyin != $data['all_route']) {
+        return Result::error('非法路径!');
+      } else {
+        return Result::success($pinyin);
       }
+    }
   }
   /**
    * 招工招聘  -  获取推荐职位
@@ -3561,7 +3561,7 @@ class NewsService implements NewsServiceInterface
     $user_id = isset($data['user_id']) ? $data['user_id'] : '';
     unset($data['type_id']);
     if ($type_id != '10000') {
-      $where[] = ['job_apply.user_id', '=', $user_id];
+      $where[] = ['job_apply.receiver_id', '=', $user_id];
     }
 
     var_dump($where, '-----------------test---------');
@@ -3621,6 +3621,15 @@ class NewsService implements NewsServiceInterface
       return Result::error("您已添加过求职信息", 0);
     }
     var_dump($result, '-----------------test---------');
+    if (isset($data['city_arr_id']) && !empty($data['city_arr_id']) && is_string($data['city_arr_id'])) {
+      // 如果 city_arr_id 是字符串,尝试将其转换为数组,取最后一个数据
+      $cityArr = json_decode($data['city_arr_id'], true);
+      $data['city_id'] = end($cityArr);
+    } else {
+      // 如果 city_arr_id 不是字符串,直接取最后一个数据
+      $data['city_id'] = end($data['city_arr_id']);
+    }
+
     $result = JobHunting::create($data);
     if (empty($result)) {
       return Result::error("添加失败", 0);
@@ -3648,6 +3657,15 @@ class NewsService implements NewsServiceInterface
     unset($data['job_typename']); //不知道这是啥,
     $data['created_at'] = date('Y-m-d H:i:s');
     $data['updated_at'] = date('Y-m-d H:i:s');
+    if (isset($data['city_arr_id']) && !empty($data['city_arr_id']) && is_string($data['city_arr_id'])) {
+      // 如果 city_arr_id 是字符串,尝试将其转换为数组,取最后一个数据
+      $cityArr = json_decode($data['city_arr_id'], true);
+      $data['city_id'] = end($cityArr);
+    } else {
+      // 如果 city_arr_id 不是字符串,直接取最后一个数据
+      $data['city_id'] = end($data['city_arr_id']);
+    }
+
     $result = JobHunting::where('id', $data['id'])->update($data);
     if (empty($result)) {
       return Result::error("更新失败", 0);
@@ -5043,67 +5061,73 @@ class NewsService implements NewsServiceInterface
   /*
     * 获取招聘信息列表-职场机会(个人会员收到企业推送岗位)
     * */
-    public function getRecruitingList(array $data): array
-    {
-        $user = User::where('id', $data['user_id'])->first();
-        if(empty($user) || ($user['type_id']!= 10000 && $user['type_id']!= 1)){
-            return Result::error("用户不存在", 0);
-        }
-        // 1:个人会员    职场机会
-        if($user['type_id'] == 1){
-            $where['user_id'] = $user['id'];
-        }
-        $recruitingId = JobResume::when($user['type_id'] == 1, function ($query) use ($user) {
-            $query->where('receiver_id', $user['id']);
-        })
-        ->pluck('recruit_id');
-        // return Result::success($recruitingId);
-        $where = [];
-        if(isset($data['salary']) && $data['salary']!=null){
-            $where['job_recruiting.salary'] = $data['salary'];
-        }
-        if(isset($data['experience']) && $data['experience']!=null){
-            $where['job_recruiting.experience'] = $data['experience'];   
-        }
-        if(isset($data['business_name']) && $data['business_name']!=null){
-            array_push($where, ['job_company.business_name', 'like', '%' . $data['business_name'] . '%']);
-        }
-        $query = JobRecruiting::whereIn('job_recruiting.id', $recruitingId)
-            ->leftJoin('job_company', 'job_recruiting.id', '=', 'job_company.job_id')
-            ->where($where);
-            // ->count();
-        $count = $query->count();
-        $query = clone $query;
-        $job = $query
-            ->leftJoin('job_enum as income_enum', function ($join) {
-                $join->on('job_recruiting.salary', '=', 'income_enum.evalue')
-                    ->where('income_enum.egroup', 'income');
-            })
-            ->leftJoin('job_enum as years_enum', function ($join) {
-                $join->on('job_recruiting.experience', '=', 'years_enum.evalue')
-                    ->where('years_enum.egroup', 'years');
-            })
-            // ->where($where)
-            ->orderBy('job_recruiting.updated_at', 'desc')
-            ->select('job_recruiting.id','job_recruiting.title', 'job_company.business_name', 
-            'income_enum.evalue as salary_evalue', 'income_enum.ename as salary_ename',
-             'years_enum.evalue as experience_evalue', 'years_enum.ename as experience_ename'
-             ,'job_recruiting.updated_at')
-            ->offset(($data['page'] - 1) * $data['pageSize'])
-            ->limit($data['pageSize'])
-            ->get()
-            ->all();
-       
-        if (empty($job)) {
-            return Result::error("暂无招聘信息", 0);
-        }
-        $result = [
-            'row' => $job,
-            'count' => $count,
-        ];
-        return Result::success($result);
+  public function getRecruitingList(array $data): array
+  {
+    $user = User::where('id', $data['user_id'])->first();
+    if (empty($user) || ($user['type_id'] != 10000 && $user['type_id'] != 1)) {
+      return Result::error("用户不存在", 0);
+    }
+    // 1:个人会员    职场机会
+    if ($user['type_id'] == 1) {
+      $where['user_id'] = $user['id'];
+    }
+    $recruitingId = JobResume::when($user['type_id'] == 1, function ($query) use ($user) {
+      $query->where('receiver_id', $user['id']);
+    })
+      ->pluck('recruit_id');
+    // return Result::success($recruitingId);
+    $where = [];
+    if (isset($data['salary']) && $data['salary'] != null) {
+      $where['job_recruiting.salary'] = $data['salary'];
+    }
+    if (isset($data['experience']) && $data['experience'] != null) {
+      $where['job_recruiting.experience'] = $data['experience'];
+    }
+    if (isset($data['business_name']) && $data['business_name'] != null) {
+      array_push($where, ['job_company.business_name', 'like', '%' . $data['business_name'] . '%']);
+    }
+    $query = JobRecruiting::whereIn('job_recruiting.id', $recruitingId)
+      ->leftJoin('job_company', 'job_recruiting.id', '=', 'job_company.job_id')
+      ->where($where);
+    // ->count();
+    $count = $query->count();
+    $query = clone $query;
+    $job = $query
+      ->leftJoin('job_enum as income_enum', function ($join) {
+        $join->on('job_recruiting.salary', '=', 'income_enum.evalue')
+          ->where('income_enum.egroup', 'income');
+      })
+      ->leftJoin('job_enum as years_enum', function ($join) {
+        $join->on('job_recruiting.experience', '=', 'years_enum.evalue')
+          ->where('years_enum.egroup', 'years');
+      })
+      // ->where($where)
+      ->orderBy('job_recruiting.updated_at', 'desc')
+      ->select(
+        'job_recruiting.id',
+        'job_recruiting.title',
+        'job_company.business_name',
+        'income_enum.evalue as salary_evalue',
+        'income_enum.ename as salary_ename',
+        'years_enum.evalue as experience_evalue',
+        'years_enum.ename as experience_ename',
+        'job_recruiting.updated_at'
+      )
+      ->offset(($data['page'] - 1) * $data['pageSize'])
+      ->limit($data['pageSize'])
+      ->get()
+      ->all();
+
+    if (empty($job)) {
+      return Result::error("暂无招聘信息", 0);
     }
-    /*
+    $result = [
+      'row' => $job,
+      'count' => $count,
+    ];
+    return Result::success($result);
+  }
+  /*
     * 获取企业会员-招聘信息列表
     * */
   public function getRecruitingInfo(array $data): array
@@ -5449,7 +5473,7 @@ class NewsService implements NewsServiceInterface
       ])
       ->join('category', 'article.catid', '=', 'category.id')
       ->leftJoin('website_category', 'website_category.category_id', '=', 'category.id')
-      ->where('website_category.website_id',$data['website_id'])
+      ->where('website_category.website_id', $data['website_id'])
       ->where('article.status', 1)
       ->whereIn('category.id', $categoryIds)
       // ->whereRaw('article.created_at >= DATE_SUB(NOW(), INTERVAL 30 DAY)')
@@ -5472,7 +5496,7 @@ class NewsService implements NewsServiceInterface
         return [
           'category_name' => $group->first()->category_name,
           'catid' => $group->first()->category_id,
-            'pinyin' => $group->first()->pinyin,
+          'pinyin' => $group->first()->pinyin,
           'type' => 100,
           'list' => $group->take(6)->map(function ($item) {
             return [