|
@@ -6677,6 +6677,8 @@ class NewsService implements NewsServiceInterface
|
|
|
$category_arr = $this->processArticlePro($data['website_id']);
|
|
$category_arr = $this->processArticlePro($data['website_id']);
|
|
|
$cat_1st_arr = $category_arr['cat_1st_arr'];
|
|
$cat_1st_arr = $category_arr['cat_1st_arr'];
|
|
|
$catiall = $category_arr['catiall'];
|
|
$catiall = $category_arr['catiall'];
|
|
|
|
|
+ $categoryIds = $category_arr['categoryIds'];
|
|
|
|
|
+ // return Result::success($category_arr);
|
|
|
foreach ($categorys as $key => $value) {
|
|
foreach ($categorys as $key => $value) {
|
|
|
if (array_key_exists('level', $value)) {
|
|
if (array_key_exists('level', $value)) {
|
|
|
$parts = explode(',', $value['level']);
|
|
$parts = explode(',', $value['level']);
|
|
@@ -6685,7 +6687,7 @@ class NewsService implements NewsServiceInterface
|
|
|
$textnum = $parts[2] ?? null;
|
|
$textnum = $parts[2] ?? null;
|
|
|
if (!empty($textnum) && $textnum > 0) {
|
|
if (!empty($textnum) && $textnum > 0) {
|
|
|
$text_num = Company::where('level', $level)
|
|
$text_num = Company::where('level', $level)
|
|
|
- ->where('website_id', $data['website_id'])
|
|
|
|
|
|
|
+ ->whereIn('category_id', $categoryIds)
|
|
|
->where('status', 1)
|
|
->where('status', 1)
|
|
|
->select(
|
|
->select(
|
|
|
'company.id',
|
|
'company.id',
|
|
@@ -6701,7 +6703,7 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
}
|
|
|
if (!empty($imgnum) && $imgnum > 0) {
|
|
if (!empty($imgnum) && $imgnum > 0) {
|
|
|
$img_num = Company::where('level', $level)
|
|
$img_num = Company::where('level', $level)
|
|
|
- ->where('website_id', $data['website_id'])
|
|
|
|
|
|
|
+ ->whereIn('category_id', $categoryIds)
|
|
|
->where('status', 1)
|
|
->where('status', 1)
|
|
|
->where('imgurl', '!=', '')
|
|
->where('imgurl', '!=', '')
|
|
|
->whereNotNull('imgurl')
|
|
->whereNotNull('imgurl')
|
|
@@ -6727,7 +6729,7 @@ class NewsService implements NewsServiceInterface
|
|
|
$category_arr = array_merge([$category_id], $cat_1st_arr[$category_id] ?? [0]);
|
|
$category_arr = array_merge([$category_id], $cat_1st_arr[$category_id] ?? [0]);
|
|
|
if (!empty($textnum) && $textnum > 0) {
|
|
if (!empty($textnum) && $textnum > 0) {
|
|
|
$text_num = Company::whereIn('category_id', $category_arr)
|
|
$text_num = Company::whereIn('category_id', $category_arr)
|
|
|
- ->where('website_id', $data['website_id'])
|
|
|
|
|
|
|
+ // ->where('website_id', $data['website_id'])
|
|
|
->where('status', 1)
|
|
->where('status', 1)
|
|
|
->select(
|
|
->select(
|
|
|
'company.id',
|
|
'company.id',
|
|
@@ -6744,7 +6746,7 @@ class NewsService implements NewsServiceInterface
|
|
|
if (!empty($imgnum) && $imgnum > 0) {
|
|
if (!empty($imgnum) && $imgnum > 0) {
|
|
|
|
|
|
|
|
$img_num = Company::whereIn('category_id', $category_arr)
|
|
$img_num = Company::whereIn('category_id', $category_arr)
|
|
|
- ->where('website_id', $data['website_id'])
|
|
|
|
|
|
|
+ // ->where('website_id', $data['website_id'])
|
|
|
->where('status', 1)
|
|
->where('status', 1)
|
|
|
->where('imgurl', '!=', '')
|
|
->where('imgurl', '!=', '')
|
|
|
->whereNotNull('imgurl')
|
|
->whereNotNull('imgurl')
|
|
@@ -6794,31 +6796,36 @@ class NewsService implements NewsServiceInterface
|
|
|
*/
|
|
*/
|
|
|
public function getWebsiteCompanyList(array $data): array
|
|
public function getWebsiteCompanyList(array $data): array
|
|
|
{
|
|
{
|
|
|
- $where['website_id'] = $data['website_id'];
|
|
|
|
|
- $where['status'] = 1;
|
|
|
|
|
- if (isset($data['category_id']) && !empty($data['category_id'])) {
|
|
|
|
|
- $where['category_id'] = $data['category_id'];
|
|
|
|
|
- }
|
|
|
|
|
- if (isset($data['keyword']) && !empty($data['keyword'])) {
|
|
|
|
|
- array_push($where, ['title', 'like', '%' . $data['keyword'] . '%']);
|
|
|
|
|
- }
|
|
|
|
|
- $query = Company::where($where);
|
|
|
|
|
- $company = $this->processArticle(
|
|
|
|
|
- $query->select('id', 'title', 'introduce', 'description', 'content', 'category_id', 'cat_arr_id', 'updated_at')
|
|
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
|
|
- ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
|
|
- ->limit($data['pageSize'])
|
|
|
|
|
- ->get(),
|
|
|
|
|
- $data
|
|
|
|
|
- );
|
|
|
|
|
- if (empty($company)) {
|
|
|
|
|
- return Result::error("暂无相关公司信息", 0);
|
|
|
|
|
- }
|
|
|
|
|
- $result = [
|
|
|
|
|
- 'count' => $query->clone()->count(),
|
|
|
|
|
- 'data' => $company,
|
|
|
|
|
- ];
|
|
|
|
|
- return Result::success($result);
|
|
|
|
|
|
|
+ $where['website_id'] = $data['website_id'];
|
|
|
|
|
+ $where['status'] = 1;
|
|
|
|
|
+ $categoryIds = [];
|
|
|
|
|
+ if(isset($data['category_id']) && !empty($data['category_id'])){
|
|
|
|
|
+
|
|
|
|
|
+ $category_id = $data['category_id'];
|
|
|
|
|
+ }
|
|
|
|
|
+ $category_arr = $this->processArticlePro($data['website_id']);
|
|
|
|
|
+ $categoryIds = $category_arr['categoryIds'];
|
|
|
|
|
+ // return Result::success($cat_1st_arr);
|
|
|
|
|
+ $company = Company::when(isset($data['keyword']) && !empty($data['keyword']), function($query) use ($data){
|
|
|
|
|
+ $query->where('title', 'like', '%' . $data['keyword'] . '%');
|
|
|
|
|
+ })
|
|
|
|
|
+ ->when(!isset($category_id) || empty($category_id), function($query) use ($categoryIds){
|
|
|
|
|
+ $query->whereIn('category_id', $categoryIds);
|
|
|
|
|
+ })
|
|
|
|
|
+ ->when(isset($data['category_id']) && !empty($data['category_id']), function($query) use ($category_id){
|
|
|
|
|
+ $query->where('category_id', $category_id);
|
|
|
|
|
+ })
|
|
|
|
|
+ ->select('id','title','introduce','description','content','category_id','cat_arr_id','updated_at')
|
|
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
|
|
+ ->paginate($data['pageSize'], ['*'], 'page', $data['page']);
|
|
|
|
|
+ if(empty($company)){
|
|
|
|
|
+ return Result::error("暂无相关公司信息", 0);
|
|
|
|
|
+ }
|
|
|
|
|
+ $result = [
|
|
|
|
|
+ 'count' => $company->total(),
|
|
|
|
|
+ 'data' => $company->items(), // 使用 items() 方法替代不存在的 data() 方法
|
|
|
|
|
+ ];
|
|
|
|
|
+ return Result::success($result);
|
|
|
}
|
|
}
|
|
|
/**
|
|
/**
|
|
|
* 获取项目列表
|
|
* 获取项目列表
|
|
@@ -7101,7 +7108,7 @@ class NewsService implements NewsServiceInterface
|
|
|
$company = Company::where('id', $data['id'])
|
|
$company = Company::where('id', $data['id'])
|
|
|
->leftJoin('job_industry', 'job_industry.hyid', 'company.hy_id')
|
|
->leftJoin('job_industry', 'job_industry.hyid', 'company.hy_id')
|
|
|
->where('status', 1)
|
|
->where('status', 1)
|
|
|
- ->where('website_id', $data['website_id'])
|
|
|
|
|
|
|
+ // ->where('website_id', $data['website_id'])
|
|
|
->select('company.*', 'job_industry.hyname as hy_name')
|
|
->select('company.*', 'job_industry.hyname as hy_name')
|
|
|
->first();
|
|
->first();
|
|
|
// 企业性质:0:市场监管;1:信访纪检;2:公检法司;3:高关注机构
|
|
// 企业性质:0:市场监管;1:信访纪检;2:公检法司;3:高关注机构
|