Bladeren bron

增加父级栏目名称

rkljw 1 maand geleden
bovenliggende
commit
b3ee3c763c

+ 2 - 2
.env

@@ -4,11 +4,11 @@ APP_ENV=dev
 HOST = http://101.254.114.211:13306/
 
 DB_DRIVER=mysql
-DB_HOST=192.168.1.123
+DB_HOST=101.254.114.211
 DB_PORT=13306
 DB_DATABASE=hyperf
 DB_USERNAME=root
-DB_PASSWORD=zxt_mysql_dev
+DB_PASSWORD=xKmapDpKCxMMSkbe
 DB_CHARSET=utf8mb4
 DB_COLLATION=utf8mb4_unicode_ci
 DB_PREFIX=

+ 208 - 128
app/JsonRpc/NewsService.php

@@ -8,8 +8,8 @@ use App\Model\Website;
 use App\Model\WebsiteCategory;
 use App\Model\ArticleSurvey;
 use App\Model\District;
+use App\Model\jobHunting;
 use App\Model\Good;
-
 use App\Model\JobRecruiting;
 use App\Model\JobIndustry;
 use App\Model\JobPosition;
@@ -56,7 +56,8 @@ class NewsService implements NewsServiceInterface
             })
             ->leftJoin('district', 'category.city_id', 'district.id')
             ->leftJoin('department', 'category.department_id', 'department.id')
-            ->select("category.*", "district.name as city_name", "department.name as department_name")
+            ->leftJoin('category as c', 'c.pid', 'category.id')
+            ->select("category.*", "district.name as city_name", "department.name as department_name","c.name as parent_name")
             ->limit($data['pageSize'])->orderByDesc('category.updated_at')->offset(($data['page'] - 1) * $data['pageSize'])->get();
         $count = Category::where($where)->when($city_id, function ($query) use ($city_id) {
             if (isset($city_id) && $city_id) {
@@ -196,6 +197,7 @@ class NewsService implements NewsServiceInterface
         unset($data['user_id']);
 
         $where = [];
+        $status1 = [];
 
         if (isset($data['title']) && $data['title']) {
             array_push($where, ['article.title', 'like', '%' . $data['title'] . '%']);
@@ -212,6 +214,9 @@ class NewsService implements NewsServiceInterface
         if (isset($data['status']) && $data['status'] !== "") {
             array_push($where, ['article.status', '=', $data['status']]);
         }
+        if (isset($data['status1'])) {
+            $status1 = json_decode(($data['status1']));
+        }
         //不是管理员展示个人数据;
         if ($type_id != 10000) {
             $where[] = ['article.admin_user_id', '=', $user_id];
@@ -219,12 +224,22 @@ class NewsService implements NewsServiceInterface
 
         $rep = Article::where($where)
             ->whereNotIn('article.status', [404])
+            ->when($status1, function ($query) use ($status1) {
+                if (isset($status1) && $status1) {
+                    $query->whereIn('article.status', $status1);
+                }
+            })
             ->leftJoin('category', 'article.catid', 'category.id')
             ->select("article.*", "category.name as category_name")
             ->orderBy("article.id", "desc")
             ->limit($data['pageSize'])
             ->offset(($data['page'] - 1) * $data['pageSize'])->get();
         $count = Article::where($where)->whereNotIn('article.status', [404])
+            ->when($status1, function ($query) use ($status1) {
+                if (isset($status1) && $status1) {
+                    $query->whereIn('article.status', $status1);
+                }
+            })
             ->leftJoin('category', 'article.catid', 'category.id')->count();
         $data = [
             'rows' => $rep->toArray(),
@@ -259,7 +274,7 @@ class NewsService implements NewsServiceInterface
             unset($data['survey_name']);
             unset($data['suvey_array']);
             unset($data['website_id']);
-
+            $data['web_site_id'] = is_array($data['web_site_id']) ? json_encode($data['web_site_id']) : ($data['web_site_id']);
             if ($data['hits'] == '') {
                 $data['hits'] = 0;
             }
@@ -269,7 +284,6 @@ class NewsService implements NewsServiceInterface
             if ($data['status'] == '') {
                 $data['status'] = 0;
             }
-
             $articleData = $data;
             unset($articleData['content']);
             $id = Article::insertGetId($articleData);
@@ -377,6 +391,7 @@ class NewsService implements NewsServiceInterface
             unset($data['survey_name']);
             unset($data['suvey_array']);
             unset($data['website_id']);
+            $data['web_site_id'] = is_array($data['web_site_id']) ? json_encode($data['web_site_id']) : ($data['web_site_id']);
             if ($data['hits'] == '') {
                 $data['hits'] = 0;
             }
@@ -615,6 +630,7 @@ class NewsService implements NewsServiceInterface
 
     }
 
+
     /**
      *获取新闻列表
      * @param array $data
@@ -864,6 +880,142 @@ class NewsService implements NewsServiceInterface
         return Result::error("参数必填!");
     }
     /**
+<<<<<<< HEAD
+=======
+     * 后端-获取网站调查问卷列表
+     * @param array $data
+     * @return array
+     */
+    public function getSurveyList(array $data): array
+    {
+        $where = [];
+        if (isset($data['survey_name']) && !empty($data['survey_name'])) {
+            array_push($where, ['survey_name', 'like', '%' . $data['survey_name'] . '%']);
+        }
+        if (isset($data['survey_type']) && $data['survey_type'] != null) {
+            array_push($where, ['survey_type', '=', $data['survey_type']]);
+        }
+        if (isset($data['is_survey']) && $data['is_survey'] != null) {
+            array_push($where, ['is_survey', '=', $data['is_survey']]);
+        }
+        // return Result::success($where);
+        if (!empty($where)) {
+            $query = Article::where($where)->whereNotNull('survey_name');
+        } else {
+            $query = Article::whereNotNull('survey_name');
+        }
+        $count = $query->count();
+        $survey = $query->orderByDesc('id')
+            ->limit($data['pageSize'])
+            ->offset(($data['page'] - 1) * $data['pageSize'])
+            ->get();
+        if (empty($survey->toArray())) {
+            return Result::error("暂无调查问卷!", 0);
+        }
+        $result = [
+            'rows' => $survey,
+            'count' => $count,
+        ];
+        return Result::success($result);
+    }
+    /**
+     * 后端-获取网站调查问卷详情
+     * @param array $data
+     * @return array
+     */
+    public function getSurveyInfo(array $data): array
+    {
+        if (isset($data['sur_id']) && !empty($data['sur_id'])) {
+            $where = ['sur_id' => $data['sur_id']];
+            $choose = ArticleSurvey::where($where)->where('is_other', 0)
+                ->leftJoin('article', 'article_survey.art_id', 'article.id')
+                ->select('article_survey.*', 'article.survey_type')
+                ->get()->all();
+            if (empty($choose)) {
+                return Result::error("此调查问卷不存在", 0);
+            }
+            $resultsArray = array_column($choose, 'results');
+            $total = array_sum($resultsArray);
+            $other = ArticleSurvey::where($where)->where('is_other', 1)->where('other_id', 0)->first();
+            $others = ArticleSurvey::where($where)->where('is_other', 1)->where('other_id', '!=', 0)->orderByDesc('created_at')->get()->all();
+            // $total = 0;
+            if (!empty($other)) {
+                $total = $total + $other['results'];
+                $other['choice_name'] = $other['choice_name'] . '(其他)';
+                if (!empty($others)) {
+                    $other['hasChildren'] = true;
+                    // array_push($other,['hasChildren','=',true]);
+                    $other['children'] = $others;
+                    $other_choices = [$other->toArray()];
+                    $mer_choice = array_merge($choose, $other_choices);
+                    $value_choice = array_values($mer_choice);
+                } else {
+                    // return Result::error('1111');
+                    $other_choices = [$other->toArray()];
+                    $other_choices = array_merge($choose, $other_choices);
+                    $value_choice = array_values($other_choices);
+                    // return Result::success($result);
+                }
+            } else {
+                $value_choice = $choose;
+            }
+            $result = [
+                'choose' => $value_choice,
+                'total' => $total,
+            ];
+        }
+        return Result::success($result);
+    }
+
+     /**
+     * 前端-搜索新闻列表
+     * @param array $data
+     * @return array
+     */
+    public function selectWebsiteArticle(array $data): array
+    {
+        $where = [];
+        // 初始化查询构造器
+        $category = WebsiteCategory::where('website_id',$data['website_id'])->pluck('category_id');
+        $query = Article::where('status', 1)
+            ->whereIn('catid', $category)
+            ->where(function ($query) use ($data) {
+                $query->where(function ($subQuery) use ($data) {
+                    $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($data['website_id'])."') = 0");
+                })->orWhereNull("ignore_ids");
+            });
+        // return Result::success($all_articles);
+        // 检查是否存在 cityid 参数
+        if (isset($data['cityid']) && !empty($data['cityid'])) {
+            $query->whereRaw("JSON_CONTAINS(city_arr_id, '".intval($data['cityid'])."')");
+        }
+        // 检查是否存在 department_id 参数
+        if (isset($data['department_id']) && !empty($data['department_id'])) {
+            $query->whereRaw("JSON_CONTAINS(department_arr_id, '".intval($data['department_id'])."')");
+        }
+        // 检查是否存在 keyword 参数
+        if (isset($data['keyword']) && !empty($data['keyword'])) {
+            $query->where('title', 'like', '%'.$data['keyword'].'%');
+        }
+        // 计算总数
+        $count = $query->count();
+        // 分页查询
+        $articles = $query->orderBy("updated_at", "desc")
+            ->limit($data['pageSize'])
+            ->offset(($data['page'] - 1) * $data['pageSize'])
+            ->get()->all();
+        if (empty($articles)) {
+            return Result::error("没有符合条件的资讯数据");
+        }
+        $data = [
+            'rows' => $articles,
+            'count' => $count
+        ];
+        return Result::success($data);
+    }
+
+    /**
+>>>>>>> bugfix_03_13_admin_liu
      * 验证导航名称是否重复
      * @return void
      */
@@ -999,139 +1151,33 @@ class NewsService implements NewsServiceInterface
 
     //20250226  产品列表
 
-    /**
-     * 后端-获取网站调查问卷列表
-     * @param array $data
-     * @return array
-     */
-    public function getSurveyList(array $data): array
+    //20250306  求职信息
+    public function getJobHuntingList(array $data): array
     {
         $where = [];
-        if (isset($data['survey_name']) && !empty($data['survey_name'])) {
-            array_push($where, ['survey_name', 'like', '%' . $data['survey_name'] . '%']);
-        }
-        if (isset($data['survey_type']) && $data['survey_type'] != null) {
-            array_push($where, ['survey_type', '=', $data['survey_type']]);
-        }
-        if (isset($data['is_survey']) && $data['is_survey'] != null) {
-            array_push($where, ['is_survey', '=', $data['is_survey']]);
-        }
-        // return Result::success($where);
-        if (!empty($where)) {
-            $query = Article::where($where)->whereNotNull('survey_name');
-        } else {
-            $query = Article::whereNotNull('survey_name');
-        }
-        $count = $query->count();
-        $survey = $query->orderByDesc('id')
-            ->limit($data['pageSize'])
-            ->offset(($data['page'] - 1) * $data['pageSize'])
-            ->get();
-        if (empty($survey->toArray())) {
-            return Result::error("暂无调查问卷!", 0);
-        }
-        $result = [
-            'rows' => $survey,
-            'count' => $count,
-        ];
-        return Result::success($result);
-    }
-    /**
-     * 后端-获取网站调查问卷详情
-     * @param array $data
-     * @return array
-     */
-    public function getSurveyInfo(array $data): array
-    {
-        if (isset($data['sur_id']) && !empty($data['sur_id'])) {
-            $where = ['sur_id' => $data['sur_id']];
-            $choose = ArticleSurvey::where($where)->where('is_other', 0)
-                ->leftJoin('article', 'article_survey.art_id', 'article.id')
-                ->select('article_survey.*', 'article.survey_type')
-                ->get()->all();
-            if (empty($choose)) {
-                return Result::error("此调查问卷不存在", 0);
-            }
-            $resultsArray = array_column($choose, 'results');
-            $total = array_sum($resultsArray);
-            $other = ArticleSurvey::where($where)->where('is_other', 1)->where('other_id', 0)->first();
-            $others = ArticleSurvey::where($where)->where('is_other', 1)->where('other_id', '!=', 0)->orderByDesc('created_at')->get()->all();
-            // $total = 0;
-            if (!empty($other)) {
-                $total = $total + $other['results'];
-                $other['choice_name'] = $other['choice_name'] . '(其他)';
-                if (!empty($others)) {
-                    $other['hasChildren'] = true;
-                    // array_push($other,['hasChildren','=',true]);
-                    $other['children'] = $others;
-                    $other_choices = [$other->toArray()];
-                    $mer_choice = array_merge($choose, $other_choices);
-                    $value_choice = array_values($mer_choice);
-                } else {
-                    // return Result::error('1111');
-                    $other_choices = [$other->toArray()];
-                    $other_choices = array_merge($choose, $other_choices);
-                    $value_choice = array_values($other_choices);
-                    // return Result::success($result);
-                }
-            } else {
-                $value_choice = $choose;
-            }
-            $result = [
-                'choose' => $value_choice,
-                'total' => $total,
-            ];
-        }
-        return Result::success($result);
-    }
+        if (isset($data['name']) && !empty($data['name'])) {
 
-     /**
-     * 前端-搜索新闻列表
-     * @param array $data
-     * @return array
-     */
-    public function selectWebsiteArticle(array $data): array
-    {
-        $where = [];
-        // 初始化查询构造器
-        $category = WebsiteCategory::where('website_id',$data['website_id'])->pluck('category_id');
-        $query = Article::where('status', 1)
-            ->whereIn('catid', $category)
-            ->where(function ($query) use ($data) {
-                $query->where(function ($subQuery) use ($data) {
-                    $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($data['website_id'])."') = 0");
-                })->orWhereNull("ignore_ids");
-            });
-        // return Result::success($all_articles);
-        // 检查是否存在 cityid 参数
-        if (isset($data['cityid']) && !empty($data['cityid'])) {
-            $query->whereRaw("JSON_CONTAINS(city_arr_id, '".intval($data['cityid'])."')");
-        }
-        // 检查是否存在 department_id 参数
-        if (isset($data['department_id']) && !empty($data['department_id'])) {
-            $query->whereRaw("JSON_CONTAINS(department_arr_id, '".intval($data['department_id'])."')");
-        }
-        // 检查是否存在 keyword 参数
-        if (isset($data['keyword']) && !empty($data['keyword'])) {
-            $query->where('title', 'like', '%'.$data['keyword'].'%');
+            $where[] = ['name', 'like', '%' . $data['name'] . '%'];
         }
-        // 计算总数
-        $count = $query->count();
-        // 分页查询
-        $articles = $query->orderBy("updated_at", "desc")
-            ->limit($data['pageSize'])
-            ->offset(($data['page'] - 1) * $data['pageSize'])
-            ->get()->all();
-        if (empty($articles)) {
-            return Result::error("没有符合条件的资讯数据");
+        $result = JobHunting::where($where)
+            ->leftJoin('user', 'user.id', '=', 'job_hunting.user_id')
+            ->leftJoin('website', 'website.id', '=', 'job_hunting.website_id')
+            ->select('job_hunting.*', 'user.nickname as nickname', 'user.user_name as username', 'website.website_name as website_name')
+            ->orderBy("updated_at", "desc")
+            ->limit($data['page_size'])
+            ->offset(($data['page'] - 1) * $data['page_size'])
+            ->get();
+        if (empty($result)) {
+            return Result::error("查询失败", 0);
         }
+        $count = JobHunting::where($where)->count();
         $data = [
-            'rows' => $articles,
-            'count' => $count
+            'rows' => $result->toArray(),
+            'count' => $count,
         ];
         return Result::success($data);
     }
-    
+
     // 20250306 招聘
     /*
     * 招聘列表
@@ -1404,4 +1450,38 @@ class NewsService implements NewsServiceInterface
         return Result::success($result);
     }
     // 20250306 招聘
+    public function addJobHunting(array $data): array
+    {
+        $data['created_at'] = date('Y-m-d H:i:s');
+        $data['updated_at'] = date('Y-m-d H:i:s');
+        $result = JobHunting::create($data);
+        if (empty($result)) {
+            return Result::error("添加失败", 0);
+        }
+        return Result::success($result);
+    }
+    public function delJobHunting(array $data): array
+    {
+        $result = JobHunting::where('id', $data['id'])->delete();
+        if (empty($result)) {
+            return Result::error("删除失败", 0);
+        }
+        return Result::success($result);
+    }
+    public function updateJobHunting(array $data): array
+    {
+        $result = JobHunting::where('id', $data['id'])->update($data);
+        if (empty($result)) {
+            return Result::error("更新失败", 0);
+        }
+        return Result::success($result);
+    }
+    public function getJobHuntingInfo(array $data): array
+    {
+        $result = JobHunting::where('id', $data['id'])->first();
+        if (empty($result)) {
+            return Result::error("查询失败", 0);
+        }
+        return Result::success($result);
+    }
 }

+ 12 - 1
app/JsonRpc/NewsServiceInterface.php

@@ -132,8 +132,19 @@ interface NewsServiceInterface
     public function addGood(array $data): array;
     public function delGood(array $data): array;
     public function updateGood(array $data): array;
-
     //20250226  产品列表
+    //20250306  求职信息
+    public function getJobHuntingList(array $data): array;
+    public function getJobHuntingInfo(array $data): array;
+    public function addJobHunting(array $data): array;
+    public function delJobHunting(array $data): array;
+    public function updateJobHunting(array $data): array;
+    //20250306  求职信息
+
+     /**
+     * @param array $data
+     * @return array
+     */
     public function getSurveyList(array $data):array;
     /**
      * @param array $data

+ 27 - 0
app/Model/jobHunting.php

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

File diff suppressed because it is too large
+ 0 - 0
runtime/container/classes.cache


File diff suppressed because it is too large
+ 0 - 0
runtime/container/scan.cache


+ 1 - 1
runtime/hyperf.pid

@@ -1 +1 @@
-39344
+48352

+ 0 - 1
vendor/composer/autoload_classmap.php

@@ -17,7 +17,6 @@ return array(
     'App\\Listener\\ResumeExitCoordinatorListener' => $baseDir . '/app/Listener/ResumeExitCoordinatorListener.php',
     'App\\Model\\Article' => $baseDir . '/app/Model/Article.php',
     'App\\Model\\ArticleData' => $baseDir . '/app/Model/ArticleData.php',
-    'App\\Model\\ArticleSurvey' => $baseDir . '/app/Model/ArticleSurvey.php',
     'App\\Model\\Category' => $baseDir . '/app/Model/Category.php',
     'App\\Model\\Link' => $baseDir . '/app/Model/Link.php',
     'App\\Model\\Model' => $baseDir . '/app/Model/Model.php',

+ 0 - 1
vendor/composer/autoload_static.php

@@ -701,7 +701,6 @@ class ComposerStaticInit88f2a4d4a4e81dc7d415bcdf39930654
         'App\\Listener\\ResumeExitCoordinatorListener' => __DIR__ . '/../..' . '/app/Listener/ResumeExitCoordinatorListener.php',
         'App\\Model\\Article' => __DIR__ . '/../..' . '/app/Model/Article.php',
         'App\\Model\\ArticleData' => __DIR__ . '/../..' . '/app/Model/ArticleData.php',
-        'App\\Model\\ArticleSurvey' => __DIR__ . '/../..' . '/app/Model/ArticleSurvey.php',
         'App\\Model\\Category' => __DIR__ . '/../..' . '/app/Model/Category.php',
         'App\\Model\\Link' => __DIR__ . '/../..' . '/app/Model/Link.php',
         'App\\Model\\Model' => __DIR__ . '/../..' . '/app/Model/Model.php',

Some files were not shown because too many files changed in this diff