瀏覽代碼

Merge branch '20250210_lj_zhanqun'

AI 1 月之前
父節點
當前提交
4730b2b2b0

+ 63 - 4
app/JsonRpc/NewsService.php

@@ -7,7 +7,12 @@ use App\Model\Category;
 use App\Model\WebsiteCategory;
 use App\Model\ArticleSurvey;
 use App\Model\jobHunting;
+use App\Model\JobEnum;
+use App\Model\JobIndustry;
+use App\Model\JobPosition;
+use App\Model\JobRecruiting;
 use App\Model\Good;
+use App\Model\JobNature;
 use App\Model\Website;
 use Hyperf\DbConnection\Db;
 use Hyperf\RpcServer\Annotation\RpcService;
@@ -1023,7 +1028,15 @@ class NewsService implements NewsServiceInterface
 
     public function getGoodList(array $data): array
     {
+        $type_id = isset($data['type_id']) ? $data['type_id'] : '';
+        unset($data['type_id']);
+        $user_id = isset($data['user_id']) ? $data['user_id'] : '';
         $where = [];
+        if ($type_id != '10000') {
+            $where = [
+                'good.user_id' => $user_id,
+            ];
+        }
         //类型
         if (isset($data['type_id']) && $data['type_id']) {
             $where = [
@@ -1137,22 +1150,31 @@ class NewsService implements NewsServiceInterface
     public function getJobHuntingList(array $data): array
     {
         $where = [];
-        if (isset($data['name']) && !empty($data['name'])) {
+        if (isset($data['username']) && !empty($data['username'])) {
 
-            $where[] = ['name', 'like', '%' . $data['name'] . '%'];
+            $where[] = ['user.user_name', 'like', '%' . $data['username'] . '%'];
+        }
+        $type_id = isset($data['type_id']) ? $data['type_id'] : '';
+        $user_id = isset($data['user_id']) ? $data['user_id'] : '';
+        unset($data['type_id']);
+        if ($type_id != '10000') {
+            $where[] = ['job_hunting.user_id', '=', $user_id];
         }
         $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")
+            ->orderBy("id", "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();
+        $count = JobHunting::where($where)
+            ->leftJoin('user', 'user.id', '=', 'job_hunting.user_id')
+            ->leftJoin('website', 'website.id', '=', 'job_hunting.website_id')
+            ->count();
         $data = [
             'rows' => $result->toArray(),
             'count' => $count,
@@ -1161,8 +1183,16 @@ class NewsService implements NewsServiceInterface
     }
     public function addJobHunting(array $data): array
     {
+        date_default_timezone_set('Asia/Shanghai');
+        unset($data['company_name']);
+        unset($data['job_industry']);
+        unset($data['job_name']);
+        unset($data['department']);
+        unset($data['job_timeList']);
+        unset($data['job_content']);
         $data['created_at'] = date('Y-m-d H:i:s');
         $data['updated_at'] = date('Y-m-d H:i:s');
+        var_dump($data, '-----------------test---------');
         $result = JobHunting::create($data);
         if (empty($result)) {
             return Result::error("添加失败", 0);
@@ -1179,6 +1209,16 @@ class NewsService implements NewsServiceInterface
     }
     public function updateJobHunting(array $data): array
     {
+        //设置东八区
+        date_default_timezone_set('Asia/Shanghai');
+        unset($data['company_name']);
+        unset($data['job_industry']);
+        unset($data['job_name']);
+        unset($data['department']);
+        unset($data['job_timeList']);
+        unset($data['job_content']);
+        $data['created_at'] = date('Y-m-d H:i:s');
+        $data['updated_at'] = date('Y-m-d H:i:s');
         $result = JobHunting::where('id', $data['id'])->update($data);
         if (empty($result)) {
             return Result::error("更新失败", 0);
@@ -1193,4 +1233,23 @@ class NewsService implements NewsServiceInterface
         }
         return Result::success($result);
     }
+    public function getJobHuntingData(array $data): array
+    {
+        $jobEnum = JobEnum::get();
+        $jobIndustry = JobIndustry::get();
+        $jobNature = JobNature::get();
+        $jobPosition = JobPosition::get();
+        $data = [
+            'jobEnum' => $jobEnum,
+            'jobIndustry' => $jobIndustry,
+            'jobNature' => $jobNature,
+            'jobPosition' => $jobPosition,
+        ];
+        return Result::success($data);
+    }
+    public function delJobHuntingInfo(array $data): array
+    {
+        $result = JobHunting::where('id', $data['id'])->delete();
+        return Result::success();
+    }
 }

+ 12 - 11
app/JsonRpc/NewsServiceInterface.php

@@ -105,50 +105,51 @@ interface NewsServiceInterface
     public function addJobHunting(array $data): array;
     public function delJobHunting(array $data): array;
     public function updateJobHunting(array $data): array;
+    public function getJobHuntingData(array $data): array;
     //20250306  求职信息
 
-     /**
+    /**
      * @param array $data
      * @return array
      */
-    public function getWebsiteArticleList(array $data):array;
+    public function getWebsiteArticleList(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function selectWebsiteArticleInfo(array $data):array;
+    public function selectWebsiteArticleInfo(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function getWebsiteSurvey(array $data):array;
+    public function getWebsiteSurvey(array $data): array;
 
     /**
      * @param array $data
      * @return array
      */
-    public function addWebsiteSurveyOption(array $data):array;
+    public function addWebsiteSurveyOption(array $data): array;
 
     /**
      * @param array $data
      * @return array
      */
-    public function addWebsiteSurveyVote(array $data):array;
+    public function addWebsiteSurveyVote(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function checkCategoryName(array $data):array;
+    public function checkCategoryName(array $data): array;
 
-    public function getSurveyList(array $data):array;
+    public function getSurveyList(array $data): array;
     /**
      * @param array $data
      * @return array
      */
-    public function getSurveyInfo(array $data):array;
-     /**
+    public function getSurveyInfo(array $data): array;
+    /**
      * @param array $data
      * @return array
      */
-    public function selectWebsiteArticle(array $data):array;
+    public function selectWebsiteArticle(array $data): array;
 }

+ 27 - 0
app/Model/JobEnum.php

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

+ 27 - 0
app/Model/JobIndustry.php

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

+ 27 - 0
app/Model/JobNature.php

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

+ 27 - 0
app/Model/JobPosition.php

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

+ 27 - 0
app/Model/JobRecruiting.php

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