|
@@ -8,26 +8,36 @@ use App\Model\Category;
|
|
|
use App\Model\WebsiteCategory;
|
|
|
use App\Model\ArticleSurvey;
|
|
|
use App\Model\jobHunting;
|
|
|
-use App\Model\JobEnum;
|
|
|
+use App\Model\District;
|
|
|
+use App\Model\Good;
|
|
|
+use App\Model\JobCompany;
|
|
|
+use App\Model\Website;
|
|
|
+use App\Model\JobRecruiting;
|
|
|
use App\Model\JobIndustry;
|
|
|
use App\Model\JobPosition;
|
|
|
use App\Model\Notice;
|
|
|
-use App\Model\JobRecruiting;
|
|
|
-use App\Model\Good;
|
|
|
+
|
|
|
use App\Model\JobNature;
|
|
|
-use App\Model\Website;
|
|
|
+use App\Model\JobEnum;
|
|
|
+use App\Model\User;
|
|
|
+use App\Model\UserRole;
|
|
|
+use App\Model\News;
|
|
|
+use App\Model\UserInfo;
|
|
|
+use App\Model\WebsiteGroup;;
|
|
|
+
|
|
|
use Hyperf\DbConnection\Db;
|
|
|
use Hyperf\RpcServer\Annotation\RpcService;
|
|
|
use App\Tools\Result;
|
|
|
+use Directory;
|
|
|
use Ramsey\Uuid\Uuid;
|
|
|
use Hyperf\Utils\Random;
|
|
|
use Fukuball\Jieba\Jieba;
|
|
|
use Fukuball\Jieba\Finalseg;
|
|
|
use App\Model\ChatRecords;
|
|
|
-use App\Model\User;
|
|
|
-use App\Model\UserInfo;
|
|
|
use Hyperf\Utils\Collection;
|
|
|
|
|
|
+use function Hyperf\Support\retry;
|
|
|
+
|
|
|
#[RpcService(name: "NewsService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
|
|
|
class NewsService implements NewsServiceInterface
|
|
|
{
|
|
@@ -663,6 +673,7 @@ class NewsService implements NewsServiceInterface
|
|
|
public function getWebsiteArticlett(array $data): array
|
|
|
{
|
|
|
$category = WebsiteCategory::where('website_id', $data['website_id'])->pluck('category_id');
|
|
|
+ $category = array_values(array_unique($category->toArray()));
|
|
|
$result = [];
|
|
|
if ($category) {
|
|
|
$placeid = isset($data['placeid']) && !empty($data['placeid']) ? $data['placeid'] - 1 : 0;
|
|
@@ -681,11 +692,24 @@ class NewsService implements NewsServiceInterface
|
|
|
foreach ($keywordArray as $k => $v) {
|
|
|
$whereL7[] = ['keyword', 'like', '%' . $v . '%'];
|
|
|
}
|
|
|
+ // 原始查询
|
|
|
$result = Article::where($whereL7)
|
|
|
->offset($placeid)
|
|
|
->limit($data['pageSize'])
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
- ->get();
|
|
|
+ ->get()
|
|
|
+ ->map(function ($article) use ($data) {
|
|
|
+ $catid = $article->catid;
|
|
|
+ $pinyin = '';
|
|
|
+ $category = WebsiteCategory::where('category_id', $catid)->where('website_category.website_id', $data['website_id'])->first();
|
|
|
+ $pinyin = $category->aLIas_pinyin ? $category->aLIas_pinyin : null;
|
|
|
+ if ($category->pid != 0 && !empty($category->aLIas_pinyin)) {
|
|
|
+ $childCategory = WebsiteCategory::where('category_id', $category->pid)->where('website_category.website_id', $data['website_id'])->first();
|
|
|
+ $pinyin = $childCategory->aLIas_pinyin ? $childCategory->aLIas_pinyin . '/' . $category->aLIas_pinyin : null;
|
|
|
+ }
|
|
|
+ $article->pinyin = $pinyin;
|
|
|
+ return $article;
|
|
|
+ });
|
|
|
if (empty($result)) {
|
|
|
return Result::success([]);
|
|
|
}
|
|
@@ -699,6 +723,8 @@ class NewsService implements NewsServiceInterface
|
|
|
var_dump($where, 'where-----------------');
|
|
|
$result = Article::where($where)
|
|
|
->whereIn("catid", $category)
|
|
|
+ // ->leftJoin('website_category', 'article.catid', 'website_category.category_id')
|
|
|
+ // ->where('website_category.website_id', $data['website_id'])
|
|
|
->where(function ($query) use ($data) {
|
|
|
$query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
|
->orWhereNull("ignore_ids");
|
|
@@ -710,17 +736,35 @@ class NewsService implements NewsServiceInterface
|
|
|
->where('updated_at', '>', date("Y-m-d H:i:s", strtotime("-30 day")));
|
|
|
})
|
|
|
->when($data['level'] == 4, function ($query) {
|
|
|
- $query->orderBy("updated_at", "desc");
|
|
|
+ $query->orderBy("article.updated_at", "desc");
|
|
|
})
|
|
|
->when(!empty($data['level']), function ($query) use ($data) {
|
|
|
if ($data['level'] != 4 && $data['level'] != 5) {
|
|
|
$query->whereRaw("JSON_CONTAINS(level, '" . intval($data['level']) . "') = 1")
|
|
|
- ->orderBy("updated_at", "desc");
|
|
|
+ ->orderBy("article.updated_at", "desc");
|
|
|
}
|
|
|
})
|
|
|
+ ->select('article.*')
|
|
|
->offset($placeid)
|
|
|
->limit($data['pageSize'])
|
|
|
- ->get();
|
|
|
+ ->get()
|
|
|
+ ->map(function ($article) use ($data) {
|
|
|
+ $catid = $article->catid;
|
|
|
+ $pinyin = '';
|
|
|
+ // $category = WebsiteCategory::whereIn('category_id', $catArrId)->where('website_category.website_id', $data['website_id'])->get()->all();
|
|
|
+ // if ($catArrId) {
|
|
|
+ // foreach ($catArrId as $categoryId) {
|
|
|
+ $category = WebsiteCategory::where('category_id', $catid)->where('website_category.website_id', $data['website_id'])->first();
|
|
|
+ $pinyin = $category->aLIas_pinyin ? $category->aLIas_pinyin : null;
|
|
|
+ if ($category->pid != 0 && !empty($category->aLIas_pinyin)) {
|
|
|
+ $childCategory = WebsiteCategory::where('category_id', $category->pid)->where('website_category.website_id', $data['website_id'])->first();
|
|
|
+ $pinyin = $childCategory->aLIas_pinyin ? $childCategory->aLIas_pinyin . '/' . $category->aLIas_pinyin : null;
|
|
|
+ }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ $article->pinyin = $pinyin;
|
|
|
+ return $article;
|
|
|
+ });
|
|
|
if (empty($result)) {
|
|
|
return Result::error("暂无头条新闻", 0);
|
|
|
}
|
|
@@ -782,10 +826,8 @@ class NewsService implements NewsServiceInterface
|
|
|
*/
|
|
|
public function getWebsiteArticleList(array $data): array
|
|
|
{
|
|
|
+ // return Result::success($data);
|
|
|
$where[] = ['status', '=', 1];
|
|
|
- if (isset($data['keyword']) && !empty($data['keyword'])) {
|
|
|
- array_push($where, ['article.title', 'like', '%' . $data['keyword'] . '%']);
|
|
|
- }
|
|
|
if (isset($data['catid']) && !empty($data['catid'])) {
|
|
|
if (is_array($data['catid'])) {
|
|
|
$category = WebsiteCategory::where('website_id', $data['website_id'])->whereIn('category_id', $data['catid'])->pluck('category_id');
|
|
@@ -812,10 +854,34 @@ class NewsService implements NewsServiceInterface
|
|
|
$query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
|
->orWhereNull("ignore_ids");
|
|
|
})
|
|
|
+ ->select(
|
|
|
+ 'article.id',
|
|
|
+ 'article.title',
|
|
|
+ 'article.imgurl',
|
|
|
+ 'article.author',
|
|
|
+ 'article.updated_at',
|
|
|
+ 'article.introduce',
|
|
|
+ 'article.islink',
|
|
|
+ 'article.linkurl',
|
|
|
+ 'article.copyfrom',
|
|
|
+ 'article.catid'
|
|
|
+ )
|
|
|
->orderBy("updated_at", "desc")
|
|
|
->limit($data['pageSize'])
|
|
|
->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
- ->get();
|
|
|
+ ->get()
|
|
|
+ ->map(function ($article) use ($data) {
|
|
|
+ $catid = $article->catid ?? 0;
|
|
|
+ $pinyin = '';
|
|
|
+ $category = WebsiteCategory::where('category_id', $catid)->where('website_category.website_id', $data['website_id'])->first();
|
|
|
+ $pinyin = $category->aLIas_pinyin ? $category->aLIas_pinyin : null;
|
|
|
+ if ($category->pid != 0 && !empty($category->aLIas_pinyin)) {
|
|
|
+ $childCategory = WebsiteCategory::where('category_id', $category->pid)->where('website_category.website_id', $data['website_id'])->first();
|
|
|
+ $pinyin = $childCategory->aLIas_pinyin ? $childCategory->aLIas_pinyin . '/' . $category->aLIas_pinyin : null;
|
|
|
+ }
|
|
|
+ $article->pinyin = $pinyin;
|
|
|
+ return $article;
|
|
|
+ });
|
|
|
|
|
|
$count = Article::where(function ($query) use ($where) {
|
|
|
foreach ($where as $condition) {
|
|
@@ -1179,10 +1245,37 @@ class NewsService implements NewsServiceInterface
|
|
|
// 计算总数
|
|
|
$count = $query->count();
|
|
|
// 分页查询
|
|
|
- $articles = $query->orderBy("updated_at", "desc")
|
|
|
- ->limit($data['pageSize'])
|
|
|
+ $articles = $query
|
|
|
+ ->select(
|
|
|
+ 'article.id',
|
|
|
+ 'article.title',
|
|
|
+ 'article.imgurl',
|
|
|
+ 'article.author',
|
|
|
+ 'article.updated_at',
|
|
|
+ 'article.introduce',
|
|
|
+ 'article.islink',
|
|
|
+ 'article.linkurl',
|
|
|
+ 'article.copyfrom',
|
|
|
+ 'article.catid',
|
|
|
+ 'article.department_arr_id',
|
|
|
+ 'article.city_arr_id',
|
|
|
+ )
|
|
|
+ ->orderBy("updated_at", "desc")
|
|
|
->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
- ->get()->all();
|
|
|
+ ->limit($data['pageSize'])
|
|
|
+ ->get()
|
|
|
+ ->map(function ($article) use ($data) {
|
|
|
+ $catid = $article->catid ?? 0;
|
|
|
+ $pinyin = '';
|
|
|
+ $category = WebsiteCategory::where('category_id', $catid)->where('website_category.website_id', $data['website_id'])->first();
|
|
|
+ $pinyin = $category->aLIas_pinyin ? $category->aLIas_pinyin : null;
|
|
|
+ if ($category->pid != 0 && !empty($category->aLIas_pinyin)) {
|
|
|
+ $childCategory = WebsiteCategory::where('category_id', $category->pid)->where('website_category.website_id', $data['website_id'])->first();
|
|
|
+ $pinyin = $childCategory->aLIas_pinyin ? $childCategory->aLIas_pinyin . '/' . $category->aLIas_pinyin : null;
|
|
|
+ }
|
|
|
+ $article->pinyin = $pinyin;
|
|
|
+ return $article;
|
|
|
+ });
|
|
|
if (empty($articles)) {
|
|
|
return Result::error("没有符合条件的资讯数据");
|
|
|
}
|
|
@@ -1319,6 +1412,8 @@ class NewsService implements NewsServiceInterface
|
|
|
$textArticles = [];
|
|
|
// return Result::error("暂无此栏目",0);
|
|
|
} else {
|
|
|
+ $parent_alias = $category->alias ?? '';
|
|
|
+ $parent_pinyin = $category->aLIas_pinyin ? $category->aLIas_pinyin : null;
|
|
|
// 查询图片新闻
|
|
|
$imgArticles = Article::where('catid', $parentCatId)
|
|
|
->where('status', 1)
|
|
@@ -1328,6 +1423,18 @@ class NewsService implements NewsServiceInterface
|
|
|
})->orWhereNull("ignore_ids");
|
|
|
})
|
|
|
->where('imgurl', '!=', '')
|
|
|
+ ->select(
|
|
|
+ 'article.id',
|
|
|
+ 'article.title',
|
|
|
+ 'article.imgurl',
|
|
|
+ 'article.author',
|
|
|
+ 'article.updated_at',
|
|
|
+ 'article.introduce',
|
|
|
+ 'article.islink',
|
|
|
+ 'article.linkurl',
|
|
|
+ 'article.copyfrom',
|
|
|
+ DB::raw("'$parent_pinyin' as pinyin") // 添加 pinyin 字段
|
|
|
+ )
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->limit($parentImgNum)
|
|
|
->get()->all();
|
|
@@ -1340,27 +1447,42 @@ class NewsService implements NewsServiceInterface
|
|
|
$subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($website['website_id']) . "') = 0");
|
|
|
})->orWhereNull("ignore_ids");
|
|
|
})
|
|
|
+ ->select(
|
|
|
+ 'article.id',
|
|
|
+ 'article.title',
|
|
|
+ 'article.author',
|
|
|
+ 'article.updated_at',
|
|
|
+ 'article.introduce',
|
|
|
+ 'article.islink',
|
|
|
+ 'article.linkurl',
|
|
|
+ 'article.copyfrom',
|
|
|
+ DB::raw("'$parent_pinyin' as pinyin")
|
|
|
+ )
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->limit($parentTextNum)
|
|
|
->get()->all();
|
|
|
}
|
|
|
$resultItem = [
|
|
|
- 'alias' => $category ? $category->alias : null,
|
|
|
+ 'alias' => $parent_alias,
|
|
|
'category_id' => $parentCatId,
|
|
|
- 'pinyin' => $category->aLIas_pinyin ?? '',
|
|
|
+ 'pinyin' => $parent_pinyin,
|
|
|
'imgnum' => $imgArticles,
|
|
|
'textnum' => $textArticles,
|
|
|
|
|
|
];
|
|
|
|
|
|
if (!empty($item['child']) && $item['child'] != "") {
|
|
|
- // 查询第一个pid等于parent中第一个参数的category来获取child的category_id
|
|
|
- $childCategory = WebsiteCategory::where('pid', $parentCatId)->where($website)->select('category_id', 'alias', 'aLIas_pinyin')->get()->all();
|
|
|
+ $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();
|
|
|
if ($childCategory) {
|
|
|
list($childCatId, $childImgNum, $childTextNum) = explode(',', $item['child']);
|
|
|
// 查询子栏目名称
|
|
|
- $childCategoryInfo = WebsiteCategory::where('category_id', $childCatId)->where($website)->first(['alias', 'category_id', 'aLIas_pinyin']);
|
|
|
- // $childAllCartegory = WebsiteCategory::where('pid', $childCatId)->where($website)->first(['category_id']);
|
|
|
+ $childCategoryInfo = WebsiteCategory::where('category_id', $childCatId)->where($website)
|
|
|
+ ->selectRaw("category_id, alias, CONCAT( ?, aLIas_pinyin) as aLIas_pinyin", [$parent_pinyin_str])
|
|
|
+ ->first();
|
|
|
+ $child_pinyin = $childCategoryInfo->aLIas_pinyin ? $childCategoryInfo->aLIas_pinyin : null;
|
|
|
if (empty($childCategoryInfo)) {
|
|
|
$childImgArticles = [];
|
|
|
$childTextArticles = [];
|
|
@@ -1373,6 +1495,18 @@ class NewsService implements NewsServiceInterface
|
|
|
$subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($website['website_id']) . "') = 0");
|
|
|
})->orWhereNull("ignore_ids");
|
|
|
})
|
|
|
+ ->select(
|
|
|
+ 'article.id',
|
|
|
+ 'article.title',
|
|
|
+ 'article.imgurl',
|
|
|
+ 'article.author',
|
|
|
+ 'article.updated_at',
|
|
|
+ 'article.introduce',
|
|
|
+ 'article.islink',
|
|
|
+ 'article.linkurl',
|
|
|
+ 'article.copyfrom',
|
|
|
+ DB::raw("'$child_pinyin' as pinyin")
|
|
|
+ )
|
|
|
->where('imgurl', '!=', '')
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->limit($childImgNum)
|
|
@@ -1385,6 +1519,17 @@ class NewsService implements NewsServiceInterface
|
|
|
$subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($website['website_id']) . "') = 0");
|
|
|
})->orWhereNull("ignore_ids");
|
|
|
})
|
|
|
+ ->select(
|
|
|
+ 'article.id',
|
|
|
+ 'article.title',
|
|
|
+ 'article.author',
|
|
|
+ 'article.updated_at',
|
|
|
+ 'article.introduce',
|
|
|
+ 'article.islink',
|
|
|
+ 'article.linkurl',
|
|
|
+ 'article.copyfrom',
|
|
|
+ DB::raw("'$child_pinyin' as pinyin")
|
|
|
+ )
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->limit($childTextNum)
|
|
|
->get()->all();
|
|
@@ -1415,65 +1560,126 @@ class NewsService implements NewsServiceInterface
|
|
|
*/
|
|
|
public function getWebsiteArticles(array $data): array
|
|
|
{
|
|
|
- // 修正传入的字符串,将单引号替换为双引号
|
|
|
$input['id'] = $data['id'];
|
|
|
$input['website_id'] = $data['website_id'];
|
|
|
- // 将 JSON 字符串转换为 PHP 数组
|
|
|
$data = json_decode($input['id'], true);
|
|
|
- // 使用 array_map 处理每个元素
|
|
|
+ // 使用 array_map 处理每个元素
|
|
|
$result = array_map(function ($item) use ($input) {
|
|
|
list($parentCatId, $parentImgNum, $parentTextNum) = explode(',', $item['parent']);
|
|
|
$website = [
|
|
|
- 'website_id' => $input['website_id'],
|
|
|
+ 'website_id' => $input['website_id']
|
|
|
];
|
|
|
- // 查询栏目名称
|
|
|
+ // 查询栏目名称
|
|
|
$category = WebsiteCategory::where('category_id', $parentCatId)->where($website)->first(['alias', 'category_id', 'aLIas_pinyin']);
|
|
|
+ $pinyin = $category->aLIas_pinyin ? $category->aLIas_pinyin : null;
|
|
|
if (empty($category)) {
|
|
|
$imgArticles = [];
|
|
|
$textArticles = [];
|
|
|
- // return Result::error("暂无此栏目",0);
|
|
|
+ // return Result::error("暂无此栏目",0);
|
|
|
} else {
|
|
|
- // 查询图片新闻
|
|
|
- $imgArticles = Article::where('status', 1)
|
|
|
- ->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', '!=', '')
|
|
|
+ $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");
|
|
|
+ })
|
|
|
->whereRaw("JSON_CONTAINS(category_arr_id, '" . intval($parentCatId) . "')")
|
|
|
->leftJoin('website_category', 'website_category.category_id', 'article.catid')
|
|
|
- ->select('article.*', 'website_category.category_id', 'website_category.alias', 'website_category.aLIas_pinyin')
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
- ->limit($parentImgNum)
|
|
|
- ->get()->all();
|
|
|
+ ->where('website_category.website_id', $website['website_id'])
|
|
|
+ ->where('article.status', 1);
|
|
|
+
|
|
|
// 查询文字新闻
|
|
|
- $textArticles = Article::where('status', 1)
|
|
|
- ->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");
|
|
|
- })
|
|
|
- ->whereRaw("JSON_CONTAINS(category_arr_id, '" . intval($parentCatId) . "')")
|
|
|
- ->leftJoin('website_category', 'website_category.category_id', 'article.catid')
|
|
|
- ->select('article.*', 'website_category.category_id', 'website_category.alias', 'website_category.aLIas_pinyin')
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
+ $textArticles = clone $baseQuery;
|
|
|
+ $textArticles = $textArticles
|
|
|
+ ->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();
|
|
|
+ ->get()
|
|
|
+ ->all();
|
|
|
+ // 查询图片新闻
|
|
|
+ $imgArticles = clone $baseQuery;
|
|
|
+ $imgArticles = $imgArticles
|
|
|
+ ->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')
|
|
|
+ ->where('imgurl', '!=', '')
|
|
|
+ ->limit($parentImgNum)
|
|
|
+ ->get()
|
|
|
+ ->all();
|
|
|
}
|
|
|
+
|
|
|
$resultItem = [
|
|
|
'alias' => $category ? $category->alias : null,
|
|
|
'category_id' => $parentCatId,
|
|
|
- 'pinyin' => $category->aLIas_pinyin ?? '',
|
|
|
- 'imgnum' => $imgArticles,
|
|
|
- 'textnum' => $textArticles,
|
|
|
+ 'pinyin' => $pinyin ? $pinyin : null,
|
|
|
+ 'imgnum' => $imgArticles ?? [],
|
|
|
+ 'textnum' => $textArticles ?? [],
|
|
|
|
|
|
];
|
|
|
|
|
|
+
|
|
|
return $resultItem;
|
|
|
}, $data);
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
+ /**
|
|
|
+ *获取头条类新闻模块-合集
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getWebsiteAllArticlett(array $data): array
|
|
|
+ {
|
|
|
+ $input['id'] = $data['id'];
|
|
|
+ $input['website_id'] = $data['website_id'];
|
|
|
+ $data = json_decode($input['id'], true);
|
|
|
+ // 使用 array_map 处理每个元素
|
|
|
+ $result = array_map(function ($item) use ($input) {
|
|
|
+ list($parentCatId, $parentImgNum, $parentTextNum) = explode(',', $item['parent']);
|
|
|
+ $website = [
|
|
|
+ 'website_id' => $input['website_id']
|
|
|
+ ];
|
|
|
+ $category = WebsiteCategory::where('website_id', $input['website_id'])->pluck('category_id');
|
|
|
+ $category = array_values(array_unique($category->toArray()));
|
|
|
+ $placeid = isset($data['placeid']) && !empty($data['placeid']) ? $data['placeid'] - 1 : 0;
|
|
|
+ $where = [
|
|
|
+ 'status' => 1,
|
|
|
+ ];
|
|
|
+
|
|
|
+ return $category;
|
|
|
+ }, $data); // 添加第二个参数 $data,确保 array_map 函数有两个参数
|
|
|
+
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 验证导航名称是否重复
|
|
@@ -2004,4 +2210,529 @@ class NewsService implements NewsServiceInterface
|
|
|
|
|
|
//20250324 通知,公告,消息
|
|
|
|
|
|
+
|
|
|
+ // 20250306 -------招聘--------fr
|
|
|
+ /*
|
|
|
+ * 招聘列表
|
|
|
+ * */
|
|
|
+ public function getJobRecruitingList(array $data): array
|
|
|
+ {
|
|
|
+ $where = [];
|
|
|
+ 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)) {
|
|
|
+ return Result::error("用户不存在", 0);
|
|
|
+ }
|
|
|
+ // 3:企业会员
|
|
|
+ if ($user['type_id'] == 3) {
|
|
|
+ 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);
|
|
|
+ })
|
|
|
+ ->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);
|
|
|
+ })
|
|
|
+ ->count();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无招聘信息", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 招聘信息添加
|
|
|
+ * */
|
|
|
+ public function addJobRecruiting(array $data): array
|
|
|
+ {
|
|
|
+ // return Result::success($data);
|
|
|
+ $user = User::where('user.id', $data['user_id'])
|
|
|
+ ->where('user.status', 1)
|
|
|
+ ->leftJoin('user_info', 'user_info.user_id', 'user.id')
|
|
|
+ ->select(
|
|
|
+ 'user.type_id',
|
|
|
+ 'user.mobile',
|
|
|
+ 'user.email',
|
|
|
+ 'user_info.business_name',
|
|
|
+ 'user_info.hy_id',
|
|
|
+ 'user_info.company_nature',
|
|
|
+ 'user_info.company_size',
|
|
|
+ 'user_info.introduction',
|
|
|
+ 'user_info.real_name',
|
|
|
+ 'user_info.company_url',
|
|
|
+ 'user_info.address_arr_id',
|
|
|
+ 'user_info.address'
|
|
|
+ )
|
|
|
+ ->first();
|
|
|
+ if (empty($user) || $user['type_id'] != $data['user_type']) {
|
|
|
+ return Result::error("用户不存在", 0);
|
|
|
+ }
|
|
|
+ $web = Website::where('id', $data['website_id'])->first();
|
|
|
+ if (empty($web)) {
|
|
|
+ return Result::error("网站不存在", 0);
|
|
|
+ }
|
|
|
+ // return Result::success($user);
|
|
|
+ $data['action_id'] = $data['user_id'];
|
|
|
+ $data['user_type'] = $user['type_id'];
|
|
|
+ $data['cat_arr_id'] = array_values(array_unique($data['cat_arr_id']));
|
|
|
+ $data['city_arr_id'] = array_values(array_unique($data['city_arr_id']));
|
|
|
+ $data['cat_arr_id'] = isset($data['cat_arr_id']) ? json_encode(array_map('intval', $data['cat_arr_id'])) : '';
|
|
|
+ $data['city_arr_id'] = isset($data['city_arr_id']) ? json_encode(array_map('intval', $data['city_arr_id'])) : '';
|
|
|
+ // 公司地址 管理员必填
|
|
|
+ $data['address_arr_id'] = array_values(array_unique($data['address_arr_id']));
|
|
|
+ $data['address_arr_id'] = isset($data['address_arr_id']) ? json_encode(array_map('intval', $data['address_arr_id'])) : '';
|
|
|
+ // 管理员-企业相关信息
|
|
|
+ $company = [
|
|
|
+ // 'user_id' => $data['user_id']?? null,
|
|
|
+ 'business_name' => $data['business_name'] ?? null,
|
|
|
+ 'company_hy_id' => $data['company_hy_id'] ?? null,
|
|
|
+ 'company_size' => $data['company_size'] ?? null,
|
|
|
+ 'company_nature' => $data['company_nature'] ?? null,
|
|
|
+ 'introduction' => $data['introduction'] ?? null,
|
|
|
+ 'real_name' => $data['real_name'] ?? null,
|
|
|
+ 'mobile' => $data['mobile'] ?? null,
|
|
|
+ 'company_url' => $data['company_url'] ?? null,
|
|
|
+ 'address_arr_id' => $data['address_arr_id'] ?? null,
|
|
|
+ 'address' => $data['address'] ?? null,
|
|
|
+ 'email' => $data['email'] ?? null,
|
|
|
+ ];
|
|
|
+ //去掉相关企业信息
|
|
|
+ $job = array_diff_key($data, array_flip(array_keys($company)));
|
|
|
+ Db::beginTransaction();
|
|
|
+ try {
|
|
|
+ // 先添加职位相关信息
|
|
|
+ $jobId = JobRecruiting::insertGetId($job);
|
|
|
+ if (empty($jobId)) {
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error("添加失败");
|
|
|
+ }
|
|
|
+ // 添加公司信息
|
|
|
+ $company['user_id'] = $data['user_id'] ?? null;
|
|
|
+ $company['job_id'] = $jobId;
|
|
|
+ $company['user_type'] = $user['type_id'] ?? null;
|
|
|
+ $company['website_id'] = $data['website_id'] ?? null;
|
|
|
+ if ($user['type_id'] == 10000) {
|
|
|
+ // 管理员添加企业信息
|
|
|
+ // return Result::success($company);
|
|
|
+ $companyId = JobCompany::insertGetId($company);
|
|
|
+ if (empty($companyId)) {
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error("添加失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 企业会员添加企业信息
|
|
|
+ $company = [
|
|
|
+ 'user_id' => $data['user_id'] ?? null,
|
|
|
+ 'business_name' => $user['business_name'] ?? null,
|
|
|
+ 'company_hy_id' => $user['hy_id'] ?? null,
|
|
|
+ 'company_size' => $user['company_size'] ?? null,
|
|
|
+ 'company_nature' => $user['company_nature'] ?? null,
|
|
|
+ 'introduction' => $user['introduction'] ?? null,
|
|
|
+ 'real_name' => $user['real_name'] ?? null,
|
|
|
+ 'mobile' => $user['mobile'] ?? null,
|
|
|
+ 'company_url' => $user['company_url'] ?? null,
|
|
|
+ 'address_arr_id' => $user['address_arr_id'] ?? null,
|
|
|
+ 'address' => $user['address'] ?? null,
|
|
|
+ 'email' => $user['email'] ?? null,
|
|
|
+ 'website_id' => $data['website_id'] ?? null,
|
|
|
+ 'user_type' => $user['type_id'] ?? null,
|
|
|
+ 'job_id' => $jobId,
|
|
|
+ ];
|
|
|
+ $companyId = JobCompany::insertGetId($company);
|
|
|
+ if (empty($companyId)) {
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error("添加失败");
|
|
|
+ }
|
|
|
+ // return Result::success($company);
|
|
|
+ }
|
|
|
+ Db::commit();
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error($e->getMessage(), 0);
|
|
|
+ }
|
|
|
+ $result = [
|
|
|
+ 'job_id' => $jobId,
|
|
|
+ 'company_id' => $companyId,
|
|
|
+ ];
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("添加失败", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 获取招聘信息详情
|
|
|
+ * */
|
|
|
+ public function getJobRecruitingInfo(array $data): array
|
|
|
+ {
|
|
|
+ $result = JobRecruiting::where('job_recruiting.id', $data['id'])
|
|
|
+ ->leftJoin('website', 'job_recruiting.website_id', '=', 'website.id')
|
|
|
+ ->leftJoin('job_company', 'job_recruiting.id', '=', 'job_company.job_id')
|
|
|
+ ->select(
|
|
|
+ 'job_recruiting.*',
|
|
|
+ 'website.website_name as website_name',
|
|
|
+ 'job_company.business_name',
|
|
|
+ 'job_company.company_hy_id',
|
|
|
+ 'job_company.company_size',
|
|
|
+ 'job_company.company_nature',
|
|
|
+ 'job_company.introduction',
|
|
|
+ 'job_company.real_name',
|
|
|
+ 'job_company.mobile',
|
|
|
+ 'job_company.company_url',
|
|
|
+ 'job_company.address_arr_id',
|
|
|
+ 'job_company.address',
|
|
|
+ 'job_company.email'
|
|
|
+ )
|
|
|
+ ->first();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("招聘信息不存在", 0);
|
|
|
+ }
|
|
|
+ // return Result::success($job);
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 修改招聘信息
|
|
|
+ * */
|
|
|
+ public function upJobRecruiting(array $data): array
|
|
|
+ {
|
|
|
+ $job = JobRecruiting::where('job_recruiting.id', $data['id'])->first();
|
|
|
+ // return Result::success($job);
|
|
|
+ if (empty($job)) {
|
|
|
+ return Result::error("招聘信息不存在", 0);
|
|
|
+ }
|
|
|
+ $user = User::where('id', $data['user_id'])->first();
|
|
|
+ // return Result::success($user);
|
|
|
+ if (empty($user) || $user['type_id'] != $data['user_type']) {
|
|
|
+ return Result::error("用户不存在", 0);
|
|
|
+ }
|
|
|
+ if ($user['type_id'] == 3 && $job['user_id'] != $user['id']) {
|
|
|
+ return Result::error("用户暂无权限修改此招聘信息!", 0);
|
|
|
+ }
|
|
|
+ $data['cat_arr_id'] = array_values(array_unique($data['cat_arr_id']));
|
|
|
+ $data['city_arr_id'] = array_values(array_unique($data['city_arr_id']));
|
|
|
+ $data['cat_arr_id'] = isset($data['cat_arr_id']) ? json_encode(array_map('intval', $data['cat_arr_id'])) : '';
|
|
|
+ $data['city_arr_id'] = isset($data['city_arr_id']) ? json_encode(array_map('intval', $data['city_arr_id'])) : '';
|
|
|
+
|
|
|
+ // 公司地址 管理员必填
|
|
|
+ $data['address_arr_id'] = array_values(array_unique($data['address_arr_id']));
|
|
|
+ $data['address_arr_id'] = isset($data['address_arr_id']) ? json_encode(array_map('intval', $data['address_arr_id'])) : '';
|
|
|
+ // 管理员-企业相关信息
|
|
|
+ $company = [
|
|
|
+ 'business_name' => $data['business_name'] ?? null,
|
|
|
+ 'company_hy_id' => $data['hy_id'] ?? null,
|
|
|
+ 'company_size' => $data['company_size'] ?? null,
|
|
|
+ 'company_nature' => $data['company_nature'] ?? null,
|
|
|
+ 'introduction' => $data['introduction'] ?? null,
|
|
|
+ 'real_name' => $data['real_name'] ?? null,
|
|
|
+ 'mobile' => $data['mobile'] ?? null,
|
|
|
+ 'company_url' => $data['company_url'] ?? null,
|
|
|
+ 'address_arr_id' => $data['address_arr_id'] ?? null,
|
|
|
+ 'address' => $data['address'] ?? null,
|
|
|
+ 'email' => $data['email'] ?? null,
|
|
|
+ ];
|
|
|
+ //去掉相关企业信息
|
|
|
+ $data = array_diff_key($data, array_flip(array_keys($company)));
|
|
|
+ $jobId = $data['id'];
|
|
|
+ $web = $data['website_id'];
|
|
|
+ $data['action_id'] = $data['user_id'];
|
|
|
+ unset($data['user_id']);
|
|
|
+ unset($data['user_type']);
|
|
|
+ unset($data['id']);
|
|
|
+ unset($data['website_id']);
|
|
|
+ // return Result::success($data);
|
|
|
+ Db::beginTransaction();
|
|
|
+ try {
|
|
|
+ // 管理员修改招聘信息
|
|
|
+ if ($user['type_id'] == 10000) {
|
|
|
+ $data['website_id'] = $web;
|
|
|
+ $company['website_id'] = $data['website_id'];
|
|
|
+ }
|
|
|
+ // Db::rollBack();
|
|
|
+ // return Result::success($company);
|
|
|
+ $result['job'] = JobRecruiting::where('id', $jobId)->update($data);
|
|
|
+ if (empty($result['job'])) {
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error("修改招聘信息失败");
|
|
|
+ }
|
|
|
+ // 管理员修改企业相关信息
|
|
|
+ $result['company'] = JobCompany::where('job_id', $jobId)->update($company);
|
|
|
+ if (empty($result['company'])) {
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error("修改企业相关信息失败");
|
|
|
+ }
|
|
|
+ Db::commit();
|
|
|
+ // return Result::success($result);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error($e->getMessage(), 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 招聘信息删除
|
|
|
+ * */
|
|
|
+ public function delJobRecruiting(array $data): array
|
|
|
+ {
|
|
|
+ $user = User::where('id', $data['user_id'])->first();
|
|
|
+ if (empty($user)) {
|
|
|
+ return Result::error("用户不存在", 0);
|
|
|
+ }
|
|
|
+ $job = JobRecruiting::where('id', $data['id'])->first();
|
|
|
+ if (empty($job)) {
|
|
|
+ return Result::error("招聘信息不存在", 0);
|
|
|
+ }
|
|
|
+ if ($user['type_id'] == 3 && $job['user_id'] != $user['id']) {
|
|
|
+ return Result::error("用户暂无权限修改此招聘信息!", 0);
|
|
|
+ }
|
|
|
+ Db::beginTransaction();
|
|
|
+ try {
|
|
|
+ $result['job'] = JobRecruiting::where('id', $data['id'])->delete();
|
|
|
+ if (empty($result['job'])) {
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error("删除招聘信息失败");
|
|
|
+ }
|
|
|
+ $result['company'] = JobCompany::where('job_id', $data['id'])->delete();
|
|
|
+ if (empty($result['company'])) {
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error("删除企业相关信息失败");
|
|
|
+ }
|
|
|
+ Db::commit();
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error($e->getMessage(), 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 获取公司信息
|
|
|
+ * */
|
|
|
+ public function getJobCompany(array $data): array
|
|
|
+ {
|
|
|
+ $user = User::where('user.id', $data['user_id'])
|
|
|
+ ->leftJoin('user_info', 'user_info.user_id', 'user.id')
|
|
|
+ ->select('user.user_name', 'user.mobile', 'user.email', 'user.type_id', 'user_info.*')
|
|
|
+ ->first();
|
|
|
+ // return Result::success($user);
|
|
|
+ if (empty($user)) {
|
|
|
+ return Result::error("用户不存在", 0);
|
|
|
+ }
|
|
|
+ if ($user['type_id'] == 3) {
|
|
|
+ $result = [
|
|
|
+ // 'id' => 0,
|
|
|
+ 'user_id' => $data['user_id'],
|
|
|
+ 'website_id' => $data['website_id'],
|
|
|
+ 'business_name' => $user['business_name'], // 企业名称
|
|
|
+ 'company_hy_id' => $user['company_hy_id'], // 企业所属行业
|
|
|
+ 'company_nature' => $user['company_nature'], // 公司性质
|
|
|
+ 'company_size' => $user['company_size'], // 公司规模
|
|
|
+ 'introduction' => $user['introduction'], // 公司简介
|
|
|
+ 'real_name' => $user['real_name'], // 企业联系人
|
|
|
+ 'mobile' => $user['mobile'], // 企业联系电话
|
|
|
+ 'company_url' => $user['company_url'], // 企业网址
|
|
|
+ 'address_arr_id' => $user['address_arr_id'], // 企业网址
|
|
|
+ 'address' => $user['address'], // 企业地址
|
|
|
+ 'email' => $user['email'], // 企业邮箱
|
|
|
+ ];
|
|
|
+ } else {
|
|
|
+ return Result::error("用户类型错误", 0);
|
|
|
+ }
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("公司信息不存在", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 修改公司信息
|
|
|
+ * */
|
|
|
+ public function upJobCompany(array $data): array
|
|
|
+ {
|
|
|
+ // return Result::success($data);
|
|
|
+ $user = User::where('user.id', $data['user_id'])
|
|
|
+ ->where('user.status', 1)
|
|
|
+ ->leftJoin('user_info', 'user_info.user_id', 'user.id')
|
|
|
+ ->select('user.user_name', 'user.type_id', 'user_info.*')
|
|
|
+ ->first();
|
|
|
+ if (empty($user)) {
|
|
|
+ return Result::error("用户不存在", 0);
|
|
|
+ }
|
|
|
+ $data['address_arr_id'] = isset($data['address_arr_id']) ? json_encode(array_map('intval', $data['address_arr_id'])) : '';
|
|
|
+ $company = [
|
|
|
+ 'business_name' => $data['business_name'], // 企业名称
|
|
|
+ 'company_hy_id' => $data['company_hy_id'], // 企业所属行业
|
|
|
+ 'company_nature' => $data['company_nature'], // 公司性质
|
|
|
+ 'company_size' => $data['company_size'], // 公司规模
|
|
|
+ 'introduction' => $data['introduction'], // 公司简介
|
|
|
+ 'real_name' => $data['real_name'], // 企业联系人
|
|
|
+ 'company_url' => $data['company_url'], // 企业网址
|
|
|
+ 'address_arr_id' => $data['address_arr_id'], // 企业地址
|
|
|
+ 'address' => $data['address'], // 企业详细地址
|
|
|
+ ];
|
|
|
+ if ($user['type_id'] == 3) {
|
|
|
+ $result['user'] = User::where('user.id', $data['user_id'])->update([
|
|
|
+ 'mobile' => $data['mobile'], // 企业联系电话
|
|
|
+ 'email' => $data['email'], // 企业邮箱
|
|
|
+ ]);
|
|
|
+ $result['userinfo'] = UserInfo::where('user_id', $data['user_id'])->update([
|
|
|
+ 'business_name' => $data['business_name'], // 企业名称
|
|
|
+ 'company_hy_id' => $data['company_hy_id'], // 企业所属行业
|
|
|
+ 'company_nature' => $data['company_nature'], // 公司性质
|
|
|
+ 'company_size' => $data['company_size'], // 公司规模
|
|
|
+ 'introduction' => $data['introduction'], // 公司简介
|
|
|
+ 'real_name' => $data['real_name'], // 企业联系人
|
|
|
+ 'company_url' => $data['company_url'], // 企业网址
|
|
|
+ 'address_arr_id' => $data['address_arr_id'], // 企业地址
|
|
|
+ 'address' => $data['address'], // 企业详细地址
|
|
|
+ ]);
|
|
|
+ $result = JobCompany::where('user_id', $data['user_id'])->update($company);
|
|
|
+ } else {
|
|
|
+ return Result::error("用户类型错误", 0);
|
|
|
+ }
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("修改失败", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 获取省-市
|
|
|
+ * */
|
|
|
+ public function getJobRecruitingArea(array $data): array
|
|
|
+ {
|
|
|
+ if (isset($data['province_id']) && $data['province_id'] != null) {
|
|
|
+ $result = District::where('pid', $data['pid'])->get()->all();
|
|
|
+ } else {
|
|
|
+ $result = District::where('level', 1)->get()->all();
|
|
|
+ }
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无此省市", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 获取行业分类
|
|
|
+ * */
|
|
|
+ public function getIndustry(array $data): array
|
|
|
+ {
|
|
|
+ $result = JobIndustry::get()->all();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无行业分类", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 获取职位
|
|
|
+ * */
|
|
|
+ public function getPositionList(array $data): array
|
|
|
+ {
|
|
|
+ if (isset($data['zwpid']) && $data['zwpid'] != null) {
|
|
|
+ $result = JobPosition::where('zwpid', $data['zwpid'])->get()->all();
|
|
|
+ } else {
|
|
|
+ $result = JobPosition::where('zwpid', 0)->get()->all();
|
|
|
+ }
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无此职位", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 获取工作性质-菜单
|
|
|
+ * */
|
|
|
+ public function getJobNature(array $data): array
|
|
|
+ {
|
|
|
+ $result = JobEnum::where('egroup', 'nature')->get()->all();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无工作性质", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 获取工作经验-菜单
|
|
|
+ * */
|
|
|
+ public function getExperience(array $data): array
|
|
|
+ {
|
|
|
+ $result = JobEnum::where('egroup', 'years')->get()->all();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无工作经验", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 获取学历-菜单
|
|
|
+ * */
|
|
|
+ public function getEducation(array $data): array
|
|
|
+ {
|
|
|
+ $result = JobEnum::where('egroup', 'education')->get()->all();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无学历", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 获取薪资-菜单
|
|
|
+ * */
|
|
|
+ public function getSalary(array $data): array
|
|
|
+ {
|
|
|
+ $result = JobEnum::where('egroup', 'income')->get()->all();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无薪资", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 获取语言-菜单
|
|
|
+ * */
|
|
|
+ public function getLanguage(array $data): array
|
|
|
+ {
|
|
|
+ $result = JobEnum::where('egroup', 'language')->get()->all();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无语言", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 获取掌握程度-菜单
|
|
|
+ * */
|
|
|
+ public function getLevel(array $data): array
|
|
|
+ {
|
|
|
+ $result = JobEnum::where('egroup', 'languagetype')->get()->all();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无工作性质", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ // 公司信息
|
|
|
+ /*
|
|
|
+ * 获取公司性质-菜单
|
|
|
+ * */
|
|
|
+ public function getCompanyNature(array $data): array
|
|
|
+ {
|
|
|
+ $result = JobNature::get()->all();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无公司性质", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 获取公司规模-菜单
|
|
|
+ * */
|
|
|
+ public function getCompanySize(array $data): array
|
|
|
+ {
|
|
|
+ $result = JobEnum::where('egroup', 'cosize')->get()->all();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无公司规模", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+ // 20250306 招聘
|
|
|
}
|