3 Commits 53d4649094 ... f2fecacb8c

Author SHA1 Message Date
  LiuJ f2fecacb8c Merge branch 'master' of http://git.bjzxtw.org.cn:3000/zxt/news_producer 2 days ago
  LiuJ 3df01357f8 1 2 days ago
  LiuJ 19622e0555 1 3 days ago
3 changed files with 263 additions and 202 deletions
  1. 258 201
      app/JsonRpc/NewsService.php
  2. 3 1
      app/JsonRpc/NewsServiceInterface.php
  3. 2 0
      app/Model/complaint.php

+ 258 - 201
app/JsonRpc/NewsService.php

@@ -725,9 +725,9 @@ class NewsService implements NewsServiceInterface
                             $article->pinyin = $pinyin;
                             return $article;
                         });
-                        if (empty($result)) {
-                            return Result::success();
-                        }
+                    if (empty($result)) {
+                        return Result::success();
+                    }
                     return Result::success($result);
                 } else {
                     return Result::error("参数错误level=7,id不能为空", 0);
@@ -1028,10 +1028,10 @@ class NewsService implements NewsServiceInterface
             if (empty($website)) {
                 return Result::error("暂无此网站", 0);
             }
-            if(isset($data['sur_id']) && !empty($data['sur_id'])){
-                $survey = ArticleSurvey::where('sur_id',$data['sur_id'])->where('is_other',1)->where('other_id',0)->first(); 
-                if(empty($survey)){
-                    return Result::error("此调查问卷不可添加选项",0); 
+            if (isset($data['sur_id']) && !empty($data['sur_id'])) {
+                $survey = ArticleSurvey::where('sur_id', $data['sur_id'])->where('is_other', 1)->where('other_id', 0)->first();
+                if (empty($survey)) {
+                    return Result::error("此调查问卷不可添加选项", 0);
                 }
                 if (isset($data['choice_name']) && !empty($data['choice_name'])) {
                     $choice = [
@@ -1085,19 +1085,19 @@ class NewsService implements NewsServiceInterface
                         $data['choice_id'] = [$data['choice_id']];
                     }
                     $data['choice_id'] = array_map('intval', $data['choice_id']);
-                    $other = ArticleSurvey::whereIn('id',$data['choice_id'])
-                    // ->where('website_id',$data['website_id'])
-                    ->where('is_other',1)
-                    ->where('other_id',0)
-                    ->first();
-                    if(!empty($other)){
-                        return Result::error("请选择已有的选项!",0);
+                    $other = ArticleSurvey::whereIn('id', $data['choice_id'])
+                        // ->where('website_id',$data['website_id'])
+                        ->where('is_other', 1)
+                        ->where('other_id', 0)
+                        ->first();
+                    if (!empty($other)) {
+                        return Result::error("请选择已有的选项!", 0);
                     }
-                    $choice['other'] = ArticleSurvey::whereIn('id',$data['choice_id'])
-                    // ->where('website_id',$data['website_id'])
-                    ->where('is_other',1)
-                    ->where('other_id','!=',0)
-                    ->first();
+                    $choice['other'] = ArticleSurvey::whereIn('id', $data['choice_id'])
+                        // ->where('website_id',$data['website_id'])
+                        ->where('is_other', 1)
+                        ->where('other_id', '!=', 0)
+                        ->first();
                     // return Result::success($choice['other']);
                     $choice_id = $data['choice_id'];
                     if (!empty($choice['other'])) {
@@ -1115,16 +1115,16 @@ class NewsService implements NewsServiceInterface
                         array_push($data['choice_id'], $choice['other']['other_id']);
                     }
                     // return Result::success($data);
-                    $choice = ArticleSurvey::whereIn('id',$data['choice_id'])
-                    // ->where('website_id',$data['website_id'])
-                    ->increment('results', 1);                 
-                    if(empty($choice)){
-                        return Result::error("请选择已有的选项!",0);
+                    $choice = ArticleSurvey::whereIn('id', $data['choice_id'])
+                        // ->where('website_id',$data['website_id'])
+                        ->increment('results', 1);
+                    if (empty($choice)) {
+                        return Result::error("请选择已有的选项!", 0);
                     }
-                    $survey['data'] = ArticleSurvey::where('sur_id',$data['sur_id'])
-                    // ->where('website_id',$data['website_id'])
-                    ->where('other_id', 0)
-                    ->get();
+                    $survey['data'] = ArticleSurvey::where('sur_id', $data['sur_id'])
+                        // ->where('website_id',$data['website_id'])
+                        ->where('other_id', 0)
+                        ->get();
                     $survey['choice'] = $choice_id;
                     return Result::success($survey);
                 }
@@ -1416,79 +1416,79 @@ class NewsService implements NewsServiceInterface
         // 使用 array_map 处理每个元素
         $result = array_map(function ($item) use ($input) {
             // 检查parent元素是否存在且不是undefined
-            if (isset($item['parent']) && $item['parent'] != 'undefined' && $item['parent']!= "") {
+            if (isset($item['parent']) && $item['parent'] != 'undefined' && $item['parent'] != "") {
                 list($parentCatId, $parentImgNum, $parentTextNum) = explode(',', $item['parent']);
                 $website = [
                     'website_id' => $input['website_id'],
                 ];
                 // 查询栏目名称
-                $category = WebsiteCategory::where('category_id', $parentCatId)->where($website)->first(['alias', 'category_id','aLIas_pinyin']);
-               
-                if(empty($category)){
+                $category = WebsiteCategory::where('category_id', $parentCatId)->where($website)->first(['alias', 'category_id', 'aLIas_pinyin']);
+
+                if (empty($category)) {
                     $parent_alias = '';
                     $parent_pinyin = null;
                     $imgArticles = [];
                     $textArticles = [];
-                }else{
+                } else {
                     $parent_alias = $category->alias ?? '';
                     $parent_pinyin = $category->aLIas_pinyin ? $category->aLIas_pinyin : null;
                     // 查找子分类ID数组
                     $childCategoryIds = WebsiteCategory::where('pid', $parentCatId)->where($website)->pluck('category_id')->toArray();
-                    array_push($childCategoryIds,$parentCatId);
+                    array_push($childCategoryIds, $parentCatId);
                     $childCategoryIds = json_encode(array_values(array_unique($childCategoryIds)));
-                    if($parentImgNum!=0){
+                    if ($parentImgNum != 0) {
                         // 查询图片新闻
                         $imgArticles = Article::where('article.status', 1)
-                        ->where(function($query) use ($parentCatId) {
-                            $query->whereRaw("JSON_CONTAINS(cat_arr_id, '\"$parentCatId\"')")
+                            ->where(function ($query) use ($parentCatId) {
+                                $query->whereRaw("JSON_CONTAINS(cat_arr_id, '\"$parentCatId\"')")
                                     ->orWhereRaw("JSON_CONTAINS(cat_arr_id, '$parentCatId')");
-                        })
-                        ->where(function ($query) use ($website) {
-                            $query->where(function ($subQuery) use ($website) {
-                                $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($website['website_id'])."') = 0")
-                                    ->orWhereNull("ignore_ids");
-                            });
-                        })
-                        ->where('imgurl', '!=', '')
-                        ->leftJoin('website_category', function($join) use ($website) {
-                            $join->on('article.catid', '=', 'website_category.category_id')
-                                ->where('website_category.website_id', '=', $website['website_id']);
-                        })
-                        ->select(
-                            'article.id',
-                            'article.title',
-                            'article.imgurl',
-                            'article.author',
-                            'article.updated_at',
-                            'article.introduce',
-                            'article.islink',
-                            'article.linkurl',
-                            'article.copyfrom',
-                            'article.catid',
-                            'website_category.alias as category_name',
-                            DB::raw("CASE WHEN article.catid = $parentCatId THEN '$parent_pinyin' 
+                            })
+                            ->where(function ($query) use ($website) {
+                                $query->where(function ($subQuery) use ($website) {
+                                    $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($website['website_id']) . "') = 0")
+                                        ->orWhereNull("ignore_ids");
+                                });
+                            })
+                            ->where('imgurl', '!=', '')
+                            ->leftJoin('website_category', function ($join) use ($website) {
+                                $join->on('article.catid', '=', 'website_category.category_id')
+                                    ->where('website_category.website_id', '=', $website['website_id']);
+                            })
+                            ->select(
+                                'article.id',
+                                'article.title',
+                                'article.imgurl',
+                                'article.author',
+                                'article.updated_at',
+                                'article.introduce',
+                                'article.islink',
+                                'article.linkurl',
+                                'article.copyfrom',
+                                'article.catid',
+                                'website_category.alias as category_name',
+                                DB::raw("CASE WHEN article.catid = $parentCatId THEN '$parent_pinyin' 
                                     ELSE CONCAT('$parent_pinyin', '/', website_category.aLIas_pinyin) END as pinyin")
-                        )
-                        ->orderBy('updated_at', 'desc')
-                        ->limit($parentImgNum)
-                        ->get()->all();
-                                                
-                            // 查询文字新闻
+                            )
+                            ->orderBy('updated_at', 'desc')
+                            ->limit($parentImgNum)
+                            ->get()->all();
+
+                        // 查询文字新闻
                     }
-                    if($parentTextNum!=0){  
+                    if ($parentTextNum != 0) {
                         $textArticles = [];
                         $textArticles = Article::where('article.status', 1)
-                            ->where(function($query) use ($parentCatId) {
+                            ->where(function ($query) use ($parentCatId) {
                                 $query->whereRaw("JSON_CONTAINS(cat_arr_id, '\"$parentCatId\"')")
-                                        ->orWhereRaw("JSON_CONTAINS(cat_arr_id, '$parentCatId')");
+                                    ->orWhereRaw("JSON_CONTAINS(cat_arr_id, '$parentCatId')");
                             })
                             ->where(function ($query) use ($website) {
                                 $query->where(function ($subQuery) use ($website) {
-                                    $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($website['website_id'])."') = 0")
+                                    $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($website['website_id']) . "') = 0")
                                         ->orWhereNull("ignore_ids");
                                 });
                             })
-                            ->leftJoin('website_category', function($join) use ($website) {
+                            ->leftJoin('website_category', function ($join) use ($website) {
                                 $join->on('article.catid', '=', 'website_category.category_id')
                                     ->where('website_category.website_id', '=', $website['website_id']);
                             })
@@ -1512,7 +1512,6 @@ class NewsService implements NewsServiceInterface
                             ->get()->all();
                     }
                 }
-                
             }
             $resultItem = [
                 'alias' => $parent_alias ?? '',
@@ -1521,8 +1520,8 @@ class NewsService implements NewsServiceInterface
                 'imgnum' => $imgArticles ?? [],
                 'textnum' => $textArticles ?? [],
             ];
-            if(isset($item['child']) && $item['child'] != 'undefined' && $item['child'] != ""){
-                $parent_pinyin_str = is_string($parent_pinyin) ? $parent_pinyin.'/' : '';
+            if (isset($item['child']) && $item['child'] != 'undefined' && $item['child'] != "") {
+                $parent_pinyin_str = is_string($parent_pinyin) ? $parent_pinyin . '/' : '';
                 $childCategory = WebsiteCategory::where('pid', $parentCatId)->where($website)
                     ->selectRaw("category_id, alias, CONCAT( ?, aLIas_pinyin) as aLIas_pinyin", [$parent_pinyin_str])
                     ->get()->all();
@@ -1532,12 +1531,12 @@ class NewsService implements NewsServiceInterface
                     $childCategoryInfo = WebsiteCategory::where('category_id', $childCatId)->where($website)
                         ->selectRaw("category_id, alias, CONCAT( ?, aLIas_pinyin) as aLIas_pinyin", [$parent_pinyin_str])
                         ->first();
-                    if(empty($childCategoryInfo) || ($childImgNum==0 && $childTextNum==0)){
+                    if (empty($childCategoryInfo) || ($childImgNum == 0 && $childTextNum == 0)) {
                         $childImgArticles = [];
                         $childTextArticles = [];
                         $resultItem['child'] = [];
-                    }else{
-                        $child_pinyin = $childCategoryInfo->aLIas_pinyin? $childCategoryInfo->aLIas_pinyin : null;
+                    } else {
+                        $child_pinyin = $childCategoryInfo->aLIas_pinyin ? $childCategoryInfo->aLIas_pinyin : null;
                         // 查询子栏目图片新闻
                         $childImgArticles = Article::where('catid', $childCatId)
                             ->where('status', 1)
@@ -1559,10 +1558,10 @@ class NewsService implements NewsServiceInterface
                                 DB::raw("'$child_pinyin' as pinyin")
                             )
                             ->where('imgurl', '!=', '')
-                                ->orderBy('updated_at', 'desc')
-                                ->limit($childImgNum)
-                                ->get()->all();
-                            // 查询子栏目文字新闻
+                            ->orderBy('updated_at', 'desc')
+                            ->limit($childImgNum)
+                            ->get()->all();
+                        // 查询子栏目文字新闻
                         $childTextArticles = Article::where('catid', $childCatId)
                             ->where('status', 1)
                             ->where(function ($query) use ($website) {
@@ -1591,19 +1590,18 @@ class NewsService implements NewsServiceInterface
                             'all_childcat' => $childCategory,
                             'imgnum' => $childImgArticles,
                             'textnum' => $childTextArticles,
-                        ];   
+                        ];
                     }
-                   
+
                     // $resultItem['pinyin'] = $childCategoryInfo->aLIas_pinyin ?? '';
                 }
-              
-            }else{
+            } else {
                 $resultItem['child'] = [];
             }
-        return $resultItem;
-    }, $data);
-    return Result::success($result);
-                // return Result::success($data);
+            return $resultItem;
+        }, $data);
+        return Result::success($result);
+        // return Result::success($data);
     }
 
     /**
@@ -1629,47 +1627,25 @@ class NewsService implements NewsServiceInterface
                 $imgArticles = [];
                 $textArticles = [];
                 // return Result::error("暂无此栏目",0); 
-            }else{ 
+            } else {
                 $child_category = WebsiteCategory::where('pid', $parentCatId)->where($website)->pluck('category_id')->toArray();
-                $parent_alias = $category->aLIas_pinyin ? $category->aLIas_pinyin.'/' : null;
+                $parent_alias = $category->aLIas_pinyin ? $category->aLIas_pinyin . '/' : null;
                 // return Result::success($website);
                 // 查询图片新闻 
                 // 合并查询条件
                 $baseQuery = Article::where(function ($query) use ($website) {
-                        $query->where(function ($subQuery) use ($website) {
-                            $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($website['website_id']) . "') = 0");
-                        })->orWhereNull("ignore_ids");
-                    })
-                    
+                    $query->where(function ($subQuery) use ($website) {
+                        $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($website['website_id']) . "') = 0");
+                    })->orWhereNull("ignore_ids");
+                })
+
                     ->where('article.status', 1)
                     ->leftJoin('website_category', 'website_category.category_id', 'article.catid')
                     ->where('website_category.website_id', $website['website_id']);
-                    
-                 // 查询文字新闻
-                 $textArticles = clone $baseQuery;
-                 $textArticles = $textArticles->whereIn('catid',$child_category)
-                 ->select(
-                    'article.id',
-                    'article.title',
-                    // 'article.imgurl',
-                    'article.author',
-                    'article.updated_at',
-                    'article.introduce',
-                    'article.islink',
-                    'article.linkurl',
-                    'article.copyfrom',
-                    'website_category.category_id',
-                    'website_category.alias',
-                    'website_category.aLIas_pinyin'
-                )
-                ->selectRaw("CONCAT(?, aLIas_pinyin) as aLIas_pinyin", [$parent_alias])
-                ->orderBy('article.updated_at', 'desc')
-                ->limit($parentTextNum)
-                ->get()
-                ->all();
-                 if(empty($textArticles)){
-                    $textArticles = clone $baseQuery;
-                    $textArticles = $textArticles->where('catid',$parentCatId)
+
+                // 查询文字新闻
+                $textArticles = clone $baseQuery;
+                $textArticles = $textArticles->whereIn('catid', $child_category)
                     ->select(
                         'article.id',
                         'article.title',
@@ -1689,33 +1665,55 @@ class NewsService implements NewsServiceInterface
                     ->limit($parentTextNum)
                     ->get()
                     ->all();
+                if (empty($textArticles)) {
+                    $textArticles = clone $baseQuery;
+                    $textArticles = $textArticles->where('catid', $parentCatId)
+                        ->select(
+                            'article.id',
+                            'article.title',
+                            // 'article.imgurl',
+                            'article.author',
+                            'article.updated_at',
+                            'article.introduce',
+                            'article.islink',
+                            'article.linkurl',
+                            'article.copyfrom',
+                            'website_category.category_id',
+                            'website_category.alias',
+                            'website_category.aLIas_pinyin'
+                        )
+                        ->selectRaw("CONCAT(?, aLIas_pinyin) as aLIas_pinyin", [$parent_alias])
+                        ->orderBy('article.updated_at', 'desc')
+                        ->limit($parentTextNum)
+                        ->get()
+                        ->all();
                 }
                 // 查询图片新闻
                 $imgArticles = clone $baseQuery;
-                $imgArticles = $imgArticles->where('imgurl', '!=', '')->whereIn('catid',$child_category)
-                ->select(
-                    'article.id',
-                    'article.title',
-                    'article.imgurl',
-                    'article.author',
-                    'article.updated_at',
-                    'article.introduce',
-                    'article.islink',
-                    'article.linkurl',
-                    'article.copyfrom',
-                    'website_category.category_id',
-                    'website_category.alias',
-                    'website_category.aLIas_pinyin'
-                )
-                ->selectRaw("CONCAT(?, aLIas_pinyin) as aLIas_pinyin", [$parent_alias])
-                ->orderBy('article.updated_at', 'desc')
-                ->limit($parentImgNum)
-                ->get()
-                ->all();
-                if(empty($imgArticles)){
-                    $imgArticles = clone $baseQuery;
-                    $imgArticles = $imgArticles->where('imgurl', '!=', '')->where('catid',$parentCatId)
+                $imgArticles = $imgArticles->where('imgurl', '!=', '')->whereIn('catid', $child_category)
                     ->select(
+                        'article.id',
+                        'article.title',
+                        'article.imgurl',
+                        'article.author',
+                        'article.updated_at',
+                        'article.introduce',
+                        'article.islink',
+                        'article.linkurl',
+                        'article.copyfrom',
+                        'website_category.category_id',
+                        'website_category.alias',
+                        'website_category.aLIas_pinyin'
+                    )
+                    ->selectRaw("CONCAT(?, aLIas_pinyin) as aLIas_pinyin", [$parent_alias])
+                    ->orderBy('article.updated_at', 'desc')
+                    ->limit($parentImgNum)
+                    ->get()
+                    ->all();
+                if (empty($imgArticles)) {
+                    $imgArticles = clone $baseQuery;
+                    $imgArticles = $imgArticles->where('imgurl', '!=', '')->where('catid', $parentCatId)
+                        ->select(
                             'article.id',
                             'article.title',
                             'article.imgurl',
@@ -1733,25 +1731,24 @@ class NewsService implements NewsServiceInterface
                         ->orderBy('article.updated_at', 'desc')
                         ->limit($parentImgNum)
                         ->get()
-                        ->all(); 
+                        ->all();
                 }
-               
             }
-            $resultItem = [ 
-                'alias' => $category ? $category->alias : null, 
-                'category_id' => $parentCatId, 
-                'pinyin' => $pinyin ? $pinyin : null, 
-                'imgnum' => $imgArticles ?? [], 
-                'textnum' => $textArticles ?? [], 
-                
-            ]; 
+            $resultItem = [
+                'alias' => $category ? $category->alias : null,
+                'category_id' => $parentCatId,
+                'pinyin' => $pinyin ? $pinyin : null,
+                'imgnum' => $imgArticles ?? [],
+                'textnum' => $textArticles ?? [],
+
+            ];
 
 
             return $resultItem;
         }, $data);
         return Result::success($result);
     }
-     /**
+    /**
      *获取头条类新闻模块-合集(暂时用不到)
      * @param array $data
      * @return array
@@ -2170,20 +2167,20 @@ class NewsService implements NewsServiceInterface
         $where = [];
         //title
         if (isset($data['title']) && !empty($data['title'])) {
-            $where[] = ['title', 'like', '%' . $data['title'] . '%'];
+            $where[] = ['notice.title', 'like', '%' . $data['title'] . '%'];
         }
         //level
         if (isset($data['level']) && !empty($data['level'])) {
-            $where[] = ['level', '=', $data['level']];
+            $where[] = ['notice.level', '=', $data['level']];
         }
         //status
         if (isset($data['status']) && !empty($data['status'])) {
-            $where[] = ['status', '=', $data['status']];
+            $where[] = ['notice.status', '=', $data['status']];
         }
         var_dump($data['type_id'], '-----------------test---------');
         if ($data['type_id'] == 10000) {
             $result = Notice::when(!empty($data['status1']), function ($query) use ($data) {
-                return $query->whereIn('status', [1, 3]);   //1待审核2已审核3已拒绝
+                return $query->whereIn('notice.status', [1, 3]);   //1待审核2已审核3已拒绝
             })
                 ->where($where)
                 ->orderBy('updated_at', 'desc')
@@ -2391,27 +2388,31 @@ class NewsService implements NewsServiceInterface
     }
     public function getComplaintList(array $data): array
     {
-
+        var_dump($data, '00000001000000000000');
         $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['user_id'] = $user_id;
+            $where['complaint.user_id'] = $user_id;
         }
         if (!empty($data['title'])) {
-            $where['title'] = ['like', '%' . $data['title'] . '%'];
+            $where['complaint.title'] = ['like', '%' . $data['title'] . '%'];
         }
         if (!empty($data['deal'])) {
-            $where['deal'] =  ['=', $data['deal']];
+            $where['complaint.deal'] =   $data['deal'];
         }
         if (!empty($data['status'])) {
-            $where['status'] =  ['=', $data['status']];
+            $where['complaint.status'] =  $data['status'];
         }
-
+        var_dump(!empty($data['deal_user']), '----------1');
         $result = Complaint::where($where)
-            ->when(!empty($data['sattus1']), function ($query) use ($data) {
-                $query->whereIn('status', [1, 3]);   //1待审核2已审核3已拒绝
+            ->when(!empty($data['status1']), function ($query) use ($data) {
+                $query->whereIn('complaint.status', [1, 3]);   //1待审核2已审核3已拒绝
+            })
+            ->when(!empty($data['deal_user']), function ($query) use ($data) {
+                //json  re_user_ids   data[user_id]是不是在里面 
+                $query->whereRaw('JSON_CONTAINS(complaint.re_user_ids, \'' . $data['user_id'] . '\')');
             })
             ->leftJoin('department', 'complaint.department_id', '=', 'department.id')
             // ->leftJoin('user', 'complaint.user_id', '=', 'user.id')
@@ -2419,10 +2420,11 @@ class NewsService implements NewsServiceInterface
             ->select('complaint.*', 'department.name as department_name', 'district.name as cityname')
             ->orderBy('updated_at', 'desc')
             ->paginate($data['page_size'], ['*'], 'page', $data['page']);
+        //sql输出
+
         if (empty($result)) {
             return Result::error("暂无投诉信息", 0);
         }
-
         // 取出数据
         $rows = $result->items();
         $count = $result->total();
@@ -2451,8 +2453,13 @@ class NewsService implements NewsServiceInterface
     }
     public function updateComplaint(array $data): array
     {
+
         date_default_timezone_set('Asia/Shanghai');
         $data['updated_at'] = date('Y-m-d H:i:s');
+        $user_id = $data['user_id'] ?? 0;
+        $type_id = $data['type_id'] ?? 0;
+        unset($data['user_id']);
+        unset($data['type_id']);
         $result = Complaint::where('id', $data['id'])->update($data);
         return Result::success($result);
     }
@@ -2471,24 +2478,74 @@ class NewsService implements NewsServiceInterface
     }
     public function updateComplaintStatus(array $data): array
     {
+        date_default_timezone_set('Asia/Shanghai');
+        $data['updated_at'] = date('Y-m-d H:i:s');
+        $user_id = $data['user_id'] ?? 0;
+        $type_id = $data['type_id'] ?? 0;
+
+        unset($data['user_id']);
+        unset($data['type_id']);
+        //处理, 写入处理人
+        if (isset($data['deal']) && ($data['deal'] == 1 || $data['deal'] == 4)) {
+            $data['real_deal_user'] = $user_id;
+        }
         $result = complaint::where('id', $data['id'])->update($data);
         return Result::success($result);
     }
     public function updateGoodStatus(array $data): array
     {
+        $user_id = $data['user_id'] ?? 0;
+        $type_id = $data['type_id'] ?? 0;
+        unset($data['user_id']);
+        unset($data['type_id']);
+
         $result = Good::where('id', $data['id'])->update($data);
         return Result::success($result);
     }
     public function updateJobHuntingStatus(array $data): array
     {
+        $user_id = $data['user_id'] ?? 0;
+        $type_id = $data['type_id'] ?? 0;
+        unset($data['user_id']);
+        unset($data['type_id']);
         $result = JobHunting::where('id', $data['id'])->update($data);
         return Result::success($result);
     }
     public function updateNoticeStatus(array $data): array
     {
+        $user_id = $data['user_id'] ?? 0;
+        $type_id = $data['type_id'] ?? 0;
+        unset($data['user_id']);
+        unset($data['type_id']);
         $result = Notice::where('id', $data['id'])->update($data);
         return Result::success($result);
     }
+    public function getDUser(array $data): array
+    {
+        if (!empty($data['ids'])) {
+            $user = User::whereIn('id', $data['ids'])->getall();
+            if (empty($user)) {
+                return Result::error('无数据', 0);
+            }
+            return Result::success($user);
+        }
+        $where = [];
+        if (!empty($data['department_id'])) {
+            $where['department_id'] = $data['department_id'];
+        }
+        if (!empty($data['city_id'])) {
+            $where['city_id'] = $data['city_id'];
+        }
+        $result = User::where('type_id', 2)
+            ->where('status', 1)
+            ->where($where)
+            ->leftJoin('user_info', 'user.id', '=', 'user_info.user_id')
+            ->get();
+        if (empty($result)) {
+            return Result::error("查询失败", 0);
+        }
+        return Result::success($result);
+    }
 
     //20250324  通知,公告,消息
 
@@ -2501,13 +2558,13 @@ class NewsService implements NewsServiceInterface
     {
         $where = [];
         // 状态   0:待审核;1:已审核通过;(只有企业会员需要审核);2:已拒绝;3;已撤回;
-        if($data['checkout'] == 0){
+        if ($data['checkout'] == 0) {
             $job_status = [0, 2];
-        }else{
+        } else {
             $job_status = [1];
         }
-        if(isset($data['keyword']) && !empty($data['keyword'])){
-            array_push($where, ['job_recruiting.title', 'like', '%'. $data['keyword']. '%']);
+        if (isset($data['keyword']) && !empty($data['keyword'])) {
+            array_push($where, ['job_recruiting.title', 'like', '%' . $data['keyword'] . '%']);
         }
         $user = User::where('id', $data['user_id'])->first();
         if (empty($user)) {
@@ -2518,24 +2575,24 @@ class NewsService implements NewsServiceInterface
             array_push($where, ['job_recruiting.user_id', $data['user_id']]);
             array_push($where, ['job_recruiting.website_id', $data['website_id']]);
         }
-        
+
         // 如果 $where 为空,则不添加 where 条件
         $result['rows'] = JobRecruiting::when(!empty($where), function ($query) use ($where) {
-                    return $query->where($where);
-                })
-                ->whereIn('job_recruiting.status',$job_status)
-                ->leftJoin('website', 'job_recruiting.website_id', '=', 'website.id')
-                ->leftJoin('user', 'job_recruiting.user_id', '=', 'user.id')
-                ->select('job_recruiting.*', 'website.website_name as website_name', 'user.user_name as user_name')
-                ->orderBy("updated_at", "desc")
-                ->offset(($data['page'] - 1) * $data['page_size'])
-                ->limit($data['page_size'])
-                ->get()
-                ->all();
+            return $query->where($where);
+        })
+            ->whereIn('job_recruiting.status', $job_status)
+            ->leftJoin('website', 'job_recruiting.website_id', '=', 'website.id')
+            ->leftJoin('user', 'job_recruiting.user_id', '=', 'user.id')
+            ->select('job_recruiting.*', 'website.website_name as website_name', 'user.user_name as user_name')
+            ->orderBy("updated_at", "desc")
+            ->offset(($data['page'] - 1) * $data['page_size'])
+            ->limit($data['page_size'])
+            ->get()
+            ->all();
         $result['count'] = JobRecruiting::when(!empty($where), function ($query) use ($where) {
             return $query->where($where);
-            })
-            ->whereIn('job_recruiting.status',$job_status)
+        })
+            ->whereIn('job_recruiting.status', $job_status)
             ->count();
         if (empty($result)) {
             return Result::error("暂无招聘信息", 0);
@@ -2605,8 +2662,8 @@ class NewsService implements NewsServiceInterface
         Db::beginTransaction();
         try {
             // 先添加职位相关信息
-            if($user['type_id'] == 10000){
-               $job['status'] = 1;  
+            if ($user['type_id'] == 10000) {
+                $job['status'] = 1;
             }
             $jobId = JobRecruiting::insertGetId($job);
             if (empty($jobId)) {
@@ -2753,7 +2810,7 @@ class NewsService implements NewsServiceInterface
                 $data['website_id'] = $web;
                 $company['website_id'] = $data['website_id'];
                 $data['status'] = 1;
-            }else{
+            } else {
                 $data['status'] = 0;
             }
             // Db::rollBack();
@@ -3033,32 +3090,32 @@ class NewsService implements NewsServiceInterface
         }
         return Result::success($result);
     }
-    
+
     /*
     * 招聘信息审核
     * */
     public function checkJobRecruiting(array $data): array
     {
         $user = User::where('id', $data['user_id'])->first();
-        if(empty($user)){
+        if (empty($user)) {
             return Result::error("用户不存在", 0);
         }
         $job = JobRecruiting::where('id', $data['id'])->first();
-        if(empty($job)){
+        if (empty($job)) {
             return Result::error("招聘信息不存在", 0);
-        } 
+        }
         // 状态   0:待审核;1:已审核通过;;2:已驳回;
-        if($user['type_id'] != 10000){
-            return Result::error("用户暂无权限审核此招聘信息!", 0); 
+        if ($user['type_id'] != 10000) {
+            return Result::error("用户暂无权限审核此招聘信息!", 0);
         }
         // 驳回原因
-        if($data['status'] == 2){
-            $data['refuse_reason'] = $data['refuse_reason']?? null;
+        if ($data['status'] == 2) {
+            $data['refuse_reason'] = $data['refuse_reason'] ?? null;
         }
         $data['action_id'] = $data['user_id'];
         unset($data['user_id']);
         $result = JobRecruiting::where('id', $data['id'])->update($data);
-        if(empty($result)){
+        if (empty($result)) {
             return Result::error("审核失败", 0);
         }
         return Result::success($result);

+ 3 - 1
app/JsonRpc/NewsServiceInterface.php

@@ -295,5 +295,7 @@ interface NewsServiceInterface
      * @param array $data
      * @return array
      */
-    public function checkJobRecruiting(array $data):array;
+    public function getDUser(array $data): array;
+
+    public function checkJobRecruiting(array $data): array;
 }

+ 2 - 0
app/Model/complaint.php

@@ -10,6 +10,8 @@ use Hyperf\DbConnection\Model\Model;
  */
 class Complaint extends Model
 {
+
+
     /**
      * The table associated with the model.
      */