LiuJ 6 days ago
parent
commit
605a9fc66c
1 changed files with 30 additions and 31 deletions
  1. 30 31
      app/JsonRpc/NewsService.php

+ 30 - 31
app/JsonRpc/NewsService.php

@@ -1968,20 +1968,19 @@ class NewsService implements NewsServiceInterface
                     ->limit($goodNum)
                     ->get();
                 $all_goods = $this->processGoods($all_goods, $website);
-                    
             }
             return  $all_goods;
         }, $data);
         $website = $input['website_id'];
         $result['article'] = Article::where(function ($query) use ($website) {
-                $query->where(function ($subQuery) use ($website) {
-                    $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($website) . "') = 0");
-                })->orWhereNull("ignore_ids");
-            })
+            $query->where(function ($subQuery) use ($website) {
+                $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($website) . "') = 0");
+            })->orWhereNull("ignore_ids");
+        })
             ->where('catid', $catid)
             ->where('article.status', 1)
             ->leftJoin('article_data', 'article_data.article_id', 'article.catid')
-            ->select('article.id', 'article.title', 'article.updated_at', 'introduce', 'islink', 'linkurl','article_data.content')
+            ->select('article.id', 'article.title', 'article.updated_at', 'introduce', 'islink', 'linkurl', 'article_data.content')
             ->orderBy('article.updated_at', 'desc')
             ->first();
         return Result::success($result);
@@ -1995,29 +1994,28 @@ class NewsService implements NewsServiceInterface
     {
         $website = $data['website_id'];
         $category = WebsiteCategory::where('website_id', $website)
-            ->whereRaw("JSON_CONTAINS(category_arr_id, '". intval($data['id']). "') = 1")
-            ->orWhereRaw("JSON_CONTAINS(category_arr_id, '\"". intval($data['id']). "\"') = 1")
-            ->select('category_id', 'alias','aLIas_pinyin','pid','category_arr_id')
+            ->whereRaw("JSON_CONTAINS(category_arr_id, '" . intval($data['id']) . "') = 1")
+            ->orWhereRaw("JSON_CONTAINS(category_arr_id, '\"" . intval($data['id']) . "\"') = 1")
+            ->select('category_id', 'alias', 'aLIas_pinyin', 'pid', 'category_arr_id')
             ->orderBy('sort')
             ->get();
-        
+
         $cat =  $category->map(function ($item) use ($website) {
-                $cat_arr_id = json_decode($item->category_arr_id, true) ?? [];
-                $pid = $item->pid?? 0;
-                if(!empty($cat_arr_id) && is_array($cat_arr_id) && $pid != 0){
-                    $pinyin = WebsiteCategory::whereIn('category_id', $cat_arr_id)
-                        ->where('website_id', $website)
-                        ->orderByRaw('FIELD(category_id, '. implode(',', $cat_arr_id). ')')
-                        ->get(['aLIas_pinyin'])
-                        ->pluck('aLIas_pinyin')
-                        ->implode('/');
-                }else{
-                    $pinyin = $item->aLIas_pinyin ?? '';
-                }
-                $item->pinyin = $pinyin;
-            })
-            ;
-        if(empty($category)){
+            $cat_arr_id = json_decode($item->category_arr_id, true) ?? [];
+            $pid = $item->pid ?? 0;
+            if (!empty($cat_arr_id) && is_array($cat_arr_id) && $pid != 0) {
+                $pinyin = WebsiteCategory::whereIn('category_id', $cat_arr_id)
+                    ->where('website_id', $website)
+                    ->orderByRaw('FIELD(category_id, ' . implode(',', $cat_arr_id) . ')')
+                    ->get(['aLIas_pinyin'])
+                    ->pluck('aLIas_pinyin')
+                    ->implode('/');
+            } else {
+                $pinyin = $item->aLIas_pinyin ?? '';
+            }
+            $item->pinyin = $pinyin;
+        });
+        if (empty($category)) {
             return Result::error("栏目查询失败", 0);
         }
         // $cat_tree = $this->processGoods($cat, $website);
@@ -2028,18 +2026,18 @@ class NewsService implements NewsServiceInterface
             ->offset(($data['page'] - 1) * $data['pageSize'])
             ->limit($data['pageSize'])
             ->get();
-        if($goods->isEmpty()){
+        if ($goods->isEmpty()) {
             return Result::error("商品查询失败", 0);
         }
-        if(count($goods) > 1){
+        if (count($goods) > 1) {
             $goods = $this->processGoods($goods, $website);
-        }else{
+        } else {
             $catid = $goods[0]['catid'] ?? 0;
             $good_category = WebsiteCategory::where('category_id', $catid)->where('website_id', $data['website_id'])->first();
             if (!empty($good_category->pid) && $good_category->pid != 0) {
                 $level = json_decode($good_category->category_arr_id);
                 $pinyin = WebsiteCategory::whereIn('category_id', $level)
-                    ->orderByRaw('FIELD(category_id, '. implode(',', $level). ')')
+                    ->orderByRaw('FIELD(category_id, ' . implode(',', $level) . ')')
                     ->get(['aLIas_pinyin'])
                     ->pluck('aLIas_pinyin')
                     ->implode('/');
@@ -2146,7 +2144,7 @@ class NewsService implements NewsServiceInterface
             'good.status' => 2,
             'good.website_id' => $data['website_id'],
             'good.id' => $data['id'],
-        ]; 
+        ];
         $goods = Good::where($where)
             ->where('good.id', $data['id'])
             ->leftJoin('website_category', 'website_category.category_id', 'good.catid')
@@ -3263,6 +3261,7 @@ class NewsService implements NewsServiceInterface
             ->leftJoin('district', 'district.id', '=', 'job_hunting.city_id')
             ->leftJoin('job_enum', 'job_enum.evalue', '=', 'job_hunting.salary')
             ->leftJoin('user', 'job_hunting.user_id', '=', 'user.id')
+            //职位----是申请职位
             ->leftJoin('job_position', 'job_hunting.job_name_get', '=', 'job_position.zwid')
             ->select('job_apply.*', 'job_position.zwname as job_name', 'job_hunting.salary as salary', 'district.name as cityname', 'job_enum.ename as salary_name', 'user.nickname as nickname', 'user.user_name as username')
             ->orderBy("job_hunting.updated_at", "desc")