|
@@ -9,17 +9,18 @@ use App\Model\WebsiteCategory;
|
|
|
use App\Model\ArticleSurvey;
|
|
|
use App\Model\District;
|
|
|
use App\Model\jobHunting;
|
|
|
-use App\Model\Good;
|
|
|
-use App\Model\JobRecruiting;
|
|
|
+use App\Model\JobEnum;
|
|
|
use App\Model\JobIndustry;
|
|
|
use App\Model\JobPosition;
|
|
|
+use App\Model\JobRecruiting;
|
|
|
+use App\Model\Good;
|
|
|
use App\Model\JobNature;
|
|
|
-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;
|
|
@@ -57,7 +58,7 @@ class NewsService implements NewsServiceInterface
|
|
|
->leftJoin('district', 'category.city_id', 'district.id')
|
|
|
->leftJoin('department', 'category.department_id', 'department.id')
|
|
|
->leftJoin('category as c', 'category.pid', 'c.id')
|
|
|
- ->select("category.*", "district.name as city_name", "department.name as department_name","c.name as parent_name")
|
|
|
+ ->select("category.*", "district.name as city_name", "department.name as department_name", "c.name as parent_name")
|
|
|
->limit($data['pageSize'])->orderByDesc('category.updated_at')->offset(($data['page'] - 1) * $data['pageSize'])->get();
|
|
|
$count = Category::where($where)->when($city_id, function ($query) use ($city_id) {
|
|
|
if (isset($city_id) && $city_id) {
|
|
@@ -531,31 +532,31 @@ class NewsService implements NewsServiceInterface
|
|
|
*/
|
|
|
public function getWebsiteArticlett(array $data): array
|
|
|
{
|
|
|
-
|
|
|
- $category = WebsiteCategory::where('website_id',$data['website_id'])->pluck('category_id');
|
|
|
- $result= [];
|
|
|
- if($category){
|
|
|
- $placeid = isset($data['placeid']) && !empty($data['placeid']) ? $data['placeid'] - 1 : 0;
|
|
|
- $where = [
|
|
|
- 'status' => 1,
|
|
|
- 'level' => $data['level'],
|
|
|
- ];
|
|
|
- $result = Article::where($where)
|
|
|
- ->whereIn("catid", $category)
|
|
|
- ->where(function ($query) use ($data) {
|
|
|
- $query->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($data['website_id'])."') = 0")
|
|
|
- ->orWhereNull("ignore_ids");
|
|
|
- })
|
|
|
- ->orderBy("updated_at", "desc")
|
|
|
- ->offset($placeid)
|
|
|
- ->limit($data['pageSize'])
|
|
|
- ->get();
|
|
|
- if(empty($result)){
|
|
|
- return Result::error("暂无头条新闻",0);
|
|
|
- }
|
|
|
- return Result::success($result);
|
|
|
- }else{
|
|
|
- return Result::error("本网站下暂无相关栏目",0);
|
|
|
+
|
|
|
+ $category = WebsiteCategory::where('website_id', $data['website_id'])->pluck('category_id');
|
|
|
+ $result = [];
|
|
|
+ if ($category) {
|
|
|
+ $placeid = isset($data['placeid']) && !empty($data['placeid']) ? $data['placeid'] - 1 : 0;
|
|
|
+ $where = [
|
|
|
+ 'status' => 1,
|
|
|
+ 'level' => $data['level'],
|
|
|
+ ];
|
|
|
+ $result = Article::where($where)
|
|
|
+ ->whereIn("catid", $category)
|
|
|
+ ->where(function ($query) use ($data) {
|
|
|
+ $query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
|
+ ->orWhereNull("ignore_ids");
|
|
|
+ })
|
|
|
+ ->orderBy("updated_at", "desc")
|
|
|
+ ->offset($placeid)
|
|
|
+ ->limit($data['pageSize'])
|
|
|
+ ->get();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无头条新闻", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ } else {
|
|
|
+ return Result::error("本网站下暂无相关栏目", 0);
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
@@ -584,40 +585,40 @@ class NewsService implements NewsServiceInterface
|
|
|
3 => '0',
|
|
|
];
|
|
|
$result = Article::where($where)
|
|
|
- ->whereIn('level',$level)
|
|
|
- ->where(function ($query) use ($data) {
|
|
|
- $query->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($data['website_id'])."') = 0")
|
|
|
- ->orWhereNull("ignore_ids");
|
|
|
- })
|
|
|
- ->orderBy("updated_at","desc")
|
|
|
- ->offset($placeid)
|
|
|
- ->limit($data['pagesize'])
|
|
|
- ->get();
|
|
|
- }elseif($data['level']==2){
|
|
|
- $level='2';
|
|
|
+ ->whereIn('level', $level)
|
|
|
+ ->where(function ($query) use ($data) {
|
|
|
+ $query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
|
+ ->orWhereNull("ignore_ids");
|
|
|
+ })
|
|
|
+ ->orderBy("updated_at", "desc")
|
|
|
+ ->offset($placeid)
|
|
|
+ ->limit($data['pagesize'])
|
|
|
+ ->get();
|
|
|
+ } elseif ($data['level'] == 2) {
|
|
|
+ $level = '2';
|
|
|
$result = Article::where($where)
|
|
|
- ->where('level',$level)
|
|
|
- ->where(function ($query) use ($data) {
|
|
|
- $query->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($data['website_id'])."') = 0")
|
|
|
- ->orWhereNull("ignore_ids");
|
|
|
- })
|
|
|
- ->orderBy("updated_at","desc")
|
|
|
- ->offset($placeid)
|
|
|
- ->limit($data['pagesize'])
|
|
|
- ->get();
|
|
|
+ ->where('level', $level)
|
|
|
+ ->where(function ($query) use ($data) {
|
|
|
+ $query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
|
+ ->orWhereNull("ignore_ids");
|
|
|
+ })
|
|
|
+ ->orderBy("updated_at", "desc")
|
|
|
+ ->offset($placeid)
|
|
|
+ ->limit($data['pagesize'])
|
|
|
+ ->get();
|
|
|
|
|
|
- }else{
|
|
|
- $level='3';
|
|
|
+ } else {
|
|
|
+ $level = '3';
|
|
|
$result = Article::where($where)
|
|
|
- ->where('level',$level)
|
|
|
- ->where(function ($query) use ($data) {
|
|
|
- $query->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($data['website_id'])."') = 0")
|
|
|
- ->orWhereNull("ignore_ids");
|
|
|
- })
|
|
|
- ->orderBy("updated_at","desc")
|
|
|
- ->offset($placeid)
|
|
|
- ->limit($data['pagesize'])
|
|
|
- ->get();
|
|
|
+ ->where('level', $level)
|
|
|
+ ->where(function ($query) use ($data) {
|
|
|
+ $query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
|
+ ->orWhereNull("ignore_ids");
|
|
|
+ })
|
|
|
+ ->orderBy("updated_at", "desc")
|
|
|
+ ->offset($placeid)
|
|
|
+ ->limit($data['pagesize'])
|
|
|
+ ->get();
|
|
|
}
|
|
|
if (empty($result)) {
|
|
|
return Result::error("此栏目暂无相关新闻", 0);
|
|
@@ -630,13 +631,12 @@ class NewsService implements NewsServiceInterface
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
*获取新闻列表
|
|
|
* @param array $data
|
|
|
* @return array
|
|
|
*/
|
|
|
- public function getWebsiteArticleList(array $data): array
|
|
|
+ public function getWebsiteArticleList(array $data): array
|
|
|
{
|
|
|
$where[] = ['status', '=', 1];
|
|
|
if (isset($data['keyword']) && !empty($data['keyword'])) {
|
|
@@ -664,14 +664,14 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
- ->where(function ($query) use ($data) {
|
|
|
- $query->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($data['website_id'])."') = 0")
|
|
|
- ->orWhereNull("ignore_ids");
|
|
|
- })
|
|
|
- ->orderBy("updated_at", "desc")
|
|
|
- ->limit($data['pageSize'])
|
|
|
- ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
- ->get();
|
|
|
+ ->where(function ($query) use ($data) {
|
|
|
+ $query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
|
+ ->orWhereNull("ignore_ids");
|
|
|
+ })
|
|
|
+ ->orderBy("updated_at", "desc")
|
|
|
+ ->limit($data['pageSize'])
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
+ ->get();
|
|
|
|
|
|
$count = Article::where(function ($query) use ($where) {
|
|
|
foreach ($where as $condition) {
|
|
@@ -705,14 +705,14 @@ class NewsService implements NewsServiceInterface
|
|
|
'article.id' => $data['id'],
|
|
|
'article.status' => 1,
|
|
|
];
|
|
|
- $result = Article::where($where)->leftJoin("article_data","article.id","article_data.article_id")
|
|
|
- ->where(function ($query) use ($data) {
|
|
|
- $query->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($data['website_id'])."') = 0")
|
|
|
- ->orWhereNull("ignore_ids");
|
|
|
- })
|
|
|
- ->first();
|
|
|
- if(empty($result)){
|
|
|
- return Result::error("暂无此新闻!",0);
|
|
|
+ $result = Article::where($where)->leftJoin("article_data", "article.id", "article_data.article_id")
|
|
|
+ ->where(function ($query) use ($data) {
|
|
|
+ $query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
|
+ ->orWhereNull("ignore_ids");
|
|
|
+ })
|
|
|
+ ->first();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无此新闻!", 0);
|
|
|
}
|
|
|
$category = WebsiteCategory::where('website_id', $data['website_id'])->where(['category_id' => $result['catid']])->first();
|
|
|
if (empty($category)) {
|
|
@@ -880,8 +880,7 @@ class NewsService implements NewsServiceInterface
|
|
|
return Result::error("参数必填!");
|
|
|
}
|
|
|
/**
|
|
|
-<<<<<<< HEAD
|
|
|
-=======
|
|
|
+
|
|
|
* 后端-获取网站调查问卷列表
|
|
|
* @param array $data
|
|
|
* @return array
|
|
@@ -967,7 +966,7 @@ class NewsService implements NewsServiceInterface
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
+ /**
|
|
|
* 前端-搜索新闻列表
|
|
|
* @param array $data
|
|
|
* @return array
|
|
@@ -976,26 +975,26 @@ class NewsService implements NewsServiceInterface
|
|
|
{
|
|
|
$where = [];
|
|
|
// 初始化查询构造器
|
|
|
- $category = WebsiteCategory::where('website_id',$data['website_id'])->pluck('category_id');
|
|
|
+ $category = WebsiteCategory::where('website_id', $data['website_id'])->pluck('category_id');
|
|
|
$query = Article::where('status', 1)
|
|
|
->whereIn('catid', $category)
|
|
|
->where(function ($query) use ($data) {
|
|
|
$query->where(function ($subQuery) use ($data) {
|
|
|
- $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($data['website_id'])."') = 0");
|
|
|
+ $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0");
|
|
|
})->orWhereNull("ignore_ids");
|
|
|
});
|
|
|
// return Result::success($all_articles);
|
|
|
// 检查是否存在 cityid 参数
|
|
|
if (isset($data['cityid']) && !empty($data['cityid'])) {
|
|
|
- $query->whereRaw("JSON_CONTAINS(city_arr_id, '".intval($data['cityid'])."')");
|
|
|
+ $query->whereRaw("JSON_CONTAINS(city_arr_id, '" . intval($data['cityid']) . "')");
|
|
|
}
|
|
|
// 检查是否存在 department_id 参数
|
|
|
if (isset($data['department_id']) && !empty($data['department_id'])) {
|
|
|
- $query->whereRaw("JSON_CONTAINS(department_arr_id, '".intval($data['department_id'])."')");
|
|
|
+ $query->whereRaw("JSON_CONTAINS(department_arr_id, '" . intval($data['department_id']) . "')");
|
|
|
}
|
|
|
// 检查是否存在 keyword 参数
|
|
|
if (isset($data['keyword']) && !empty($data['keyword'])) {
|
|
|
- $query->where('title', 'like', '%'.$data['keyword'].'%');
|
|
|
+ $query->where('title', 'like', '%' . $data['keyword'] . '%');
|
|
|
}
|
|
|
// 计算总数
|
|
|
$count = $query->count();
|
|
@@ -1009,13 +1008,12 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
$data = [
|
|
|
'rows' => $articles,
|
|
|
- 'count' => $count
|
|
|
+ 'count' => $count,
|
|
|
];
|
|
|
return Result::success($data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
->>>>>>> bugfix_03_13_admin_liu
|
|
|
* 验证导航名称是否重复
|
|
|
* @return void
|
|
|
*/
|
|
@@ -1040,7 +1038,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 = [
|
|
@@ -1155,22 +1161,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,
|
|
@@ -1180,154 +1195,154 @@ class NewsService implements NewsServiceInterface
|
|
|
|
|
|
// 20250306 招聘
|
|
|
/*
|
|
|
- * 招聘列表
|
|
|
- * */
|
|
|
+ * 招聘列表
|
|
|
+ * */
|
|
|
public function getJobRecruitingList(array $data): array
|
|
|
{
|
|
|
$where = [];
|
|
|
- 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)){
|
|
|
+ if (empty($user)) {
|
|
|
return Result::error("用户不存在", 0);
|
|
|
}
|
|
|
// 3:企业会员
|
|
|
- if($user['type_id'] == 3){
|
|
|
- array_push($where,['user_id', $data['user_id']]);
|
|
|
+ if ($user['type_id'] == 3) {
|
|
|
+ array_push($where, ['user_id', $data['user_id']]);
|
|
|
}
|
|
|
$result = JobRecruiting::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();
|
|
|
+ ->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();
|
|
|
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('user_info', 'job_recruiting.user_id', 'user_info.id')
|
|
|
- ->leftJoin('user', 'job_recruiting.user_id', 'user.id')
|
|
|
- ->select(
|
|
|
- 'job_recruiting.*',
|
|
|
- 'user_info.business_name', // 企业名称
|
|
|
- 'user_info.hy_id', // 企业所属行业
|
|
|
- 'user_info.company_size', // 公司规模
|
|
|
- 'user_info.company_nature', // 公司性质
|
|
|
- 'user_info.introduction', // 公司简介
|
|
|
- 'user_info.real_name', // 企业联系人
|
|
|
- 'user.mobile', // 企业联系电话
|
|
|
- 'user_info.company_url', // 企业网址
|
|
|
- 'user_info.address_arr_id', // 企业地址
|
|
|
- 'user_info.address', // 企业地址
|
|
|
- 'user.email', // 企业邮箱
|
|
|
- )
|
|
|
- ->orderBy("updated_at", "desc")
|
|
|
- ->first();
|
|
|
+ ->leftJoin('user_info', 'job_recruiting.user_id', 'user_info.id')
|
|
|
+ ->leftJoin('user', 'job_recruiting.user_id', 'user.id')
|
|
|
+ ->select(
|
|
|
+ 'job_recruiting.*',
|
|
|
+ 'user_info.business_name', // 企业名称
|
|
|
+ 'user_info.hy_id', // 企业所属行业
|
|
|
+ 'user_info.company_size', // 公司规模
|
|
|
+ 'user_info.company_nature', // 公司性质
|
|
|
+ 'user_info.introduction', // 公司简介
|
|
|
+ 'user_info.real_name', // 企业联系人
|
|
|
+ 'user.mobile', // 企业联系电话
|
|
|
+ 'user_info.company_url', // 企业网址
|
|
|
+ 'user_info.address_arr_id', // 企业地址
|
|
|
+ 'user_info.address', // 企业地址
|
|
|
+ 'user.email', // 企业邮箱
|
|
|
+ )
|
|
|
+ ->orderBy("updated_at", "desc")
|
|
|
+ ->first();
|
|
|
if (empty($result)) {
|
|
|
return Result::error("暂无招聘信息", 0);
|
|
|
}
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
/*
|
|
|
- * 招聘信息添加
|
|
|
- * */
|
|
|
+ * 招聘信息添加
|
|
|
+ * */
|
|
|
public function addJobRecruiting(array $data): array
|
|
|
{
|
|
|
$user = User::where('id', $data['user_id'])->first();
|
|
|
- if(empty($user)){
|
|
|
+ if (empty($user)) {
|
|
|
return Result::error("用户不存在", 0);
|
|
|
}
|
|
|
// 3:企业会员
|
|
|
- if($user['type_id'] != 3){
|
|
|
- if($data['website_id'] == 0){
|
|
|
+ if ($user['type_id'] != 3) {
|
|
|
+ if ($data['website_id'] == 0) {
|
|
|
return Result::error("请选择所属网站", 0);
|
|
|
}
|
|
|
$website = Website::where('id', $data['website_id'])->first();
|
|
|
- if(empty($website)){
|
|
|
+ if (empty($website)) {
|
|
|
return Result::error("网站不存在", 0);
|
|
|
}
|
|
|
$data['website_id'] = $website['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($data['cat_arr_id']) : '';
|
|
|
- $data['city_arr_id'] = isset($data['city_arr_id'])? json_encode($data['city_arr_id']) : '';
|
|
|
+ $data['cat_arr_id'] = isset($data['cat_arr_id']) ? json_encode($data['cat_arr_id']) : '';
|
|
|
+ $data['city_arr_id'] = isset($data['city_arr_id']) ? json_encode($data['city_arr_id']) : '';
|
|
|
$result = JobRecruiting::insertGetId($data);
|
|
|
if (empty($result)) {
|
|
|
- return Result::error("添加失败", 0);
|
|
|
+ return Result::error("添加失败", 0);
|
|
|
}
|
|
|
- return Result::success($result);
|
|
|
+ return Result::success($result);
|
|
|
|
|
|
}
|
|
|
/*
|
|
|
- * 招聘信息更新
|
|
|
- * */
|
|
|
+ * 招聘信息更新
|
|
|
+ * */
|
|
|
public function upJobRecruiting(array $data): array
|
|
|
{
|
|
|
$job = JobRecruiting::where('id', $data['id'])->first();
|
|
|
- if(empty($job)){
|
|
|
+ if (empty($job)) {
|
|
|
return Result::error("招聘信息不存在", 0);
|
|
|
}
|
|
|
$user = User::where('id', $data['user_id'])->first();
|
|
|
- if(empty($user)){
|
|
|
+ if (empty($user)) {
|
|
|
return Result::error("用户不存在", 0);
|
|
|
}
|
|
|
- // 3:企业会员
|
|
|
- if($user['type_id'] != 3){
|
|
|
- if($data['website_id'] == 0){
|
|
|
+ // 3:企业会员
|
|
|
+ if ($user['type_id'] != 3) {
|
|
|
+ if ($data['website_id'] == 0) {
|
|
|
return Result::error("请选择所属网站", 0);
|
|
|
}
|
|
|
$website = Website::where('id', $data['website_id'])->first();
|
|
|
- if(empty($website)){
|
|
|
+ if (empty($website)) {
|
|
|
return Result::error("网站不存在", 0);
|
|
|
}
|
|
|
$data['website_id'] = $website['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($data['cat_arr_id']) : '';
|
|
|
- $data['city_arr_id'] = isset($data['city_arr_id'])? json_encode($data['city_arr_id']) : '';
|
|
|
+ $data['cat_arr_id'] = isset($data['cat_arr_id']) ? json_encode($data['cat_arr_id']) : '';
|
|
|
+ $data['city_arr_id'] = isset($data['city_arr_id']) ? json_encode($data['city_arr_id']) : '';
|
|
|
$result = JobRecruiting::where('id', $data['id'])->update($data);
|
|
|
if (empty($result)) {
|
|
|
- return Result::error("更新失败", 0);
|
|
|
+ return Result::error("更新失败", 0);
|
|
|
}
|
|
|
return Result::success($data);
|
|
|
}
|
|
|
/*
|
|
|
- * 招聘信息删除
|
|
|
- * */
|
|
|
+ * 招聘信息删除
|
|
|
+ * */
|
|
|
public function delJobRecruiting(array $data): array
|
|
|
{
|
|
|
$job = JobRecruiting::where('id', $data['id'])->first();
|
|
|
- if(empty($job)){
|
|
|
+ if (empty($job)) {
|
|
|
return Result::error("招聘信息不存在", 0);
|
|
|
}
|
|
|
- $result = JobRecruiting::where('id',$data['id'])->delete();
|
|
|
+ $result = JobRecruiting::where('id', $data['id'])->delete();
|
|
|
if (empty($result)) {
|
|
|
return Result::error("删除失败", 0);
|
|
|
}
|
|
|
- return Result::success($data);
|
|
|
+ return Result::success($data);
|
|
|
}
|
|
|
/*
|
|
|
- * 获取省-市
|
|
|
- * */
|
|
|
+ * 获取省-市
|
|
|
+ * */
|
|
|
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 (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);
|
|
@@ -1335,8 +1350,8 @@ class NewsService implements NewsServiceInterface
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
/*
|
|
|
- * 获取行业分类
|
|
|
- * */
|
|
|
+ * 获取行业分类
|
|
|
+ * */
|
|
|
public function getIndustry(array $data): array
|
|
|
{
|
|
|
$result = JobIndustry::get()->all();
|
|
@@ -1346,14 +1361,14 @@ class NewsService implements NewsServiceInterface
|
|
|
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 (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);
|
|
@@ -1361,66 +1376,66 @@ class NewsService implements NewsServiceInterface
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
/*
|
|
|
- * 获取工作性质-菜单
|
|
|
- * */
|
|
|
+ * 获取工作性质-菜单
|
|
|
+ * */
|
|
|
public function getJobNature(array $data): array
|
|
|
{
|
|
|
- $result = JobEnum::where('egroup','nature')->get()->all();
|
|
|
+ $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();
|
|
|
+ $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();
|
|
|
+ $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();
|
|
|
+ $result = JobEnum::where('egroup', 'income')->get()->all();
|
|
|
if (empty($result)) {
|
|
|
return Result::error("暂无薪资", 0);
|
|
|
}
|
|
|
- return Result::success($result);
|
|
|
+ return Result::success($result);
|
|
|
}
|
|
|
/*
|
|
|
- * 获取语言-菜单
|
|
|
- * */
|
|
|
+ * 获取语言-菜单
|
|
|
+ * */
|
|
|
public function getLanguage(array $data): array
|
|
|
{
|
|
|
- $result = JobEnum::where('egroup','language')->get()->all();
|
|
|
+ $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();
|
|
|
+ $result = JobEnum::where('egroup', 'languagetype')->get()->all();
|
|
|
if (empty($result)) {
|
|
|
return Result::error("暂无工作性质", 0);
|
|
|
}
|
|
@@ -1428,8 +1443,8 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
// 公司信息
|
|
|
/*
|
|
|
- * 获取公司性质-菜单
|
|
|
- * */
|
|
|
+ * 获取公司性质-菜单
|
|
|
+ * */
|
|
|
public function getCompanyNature(array $data): array
|
|
|
{
|
|
|
$result = JobNature::get()->all();
|
|
@@ -1439,11 +1454,11 @@ class NewsService implements NewsServiceInterface
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
/*
|
|
|
- * 获取公司规模-菜单
|
|
|
- * */
|
|
|
+ * 获取公司规模-菜单
|
|
|
+ * */
|
|
|
public function getCompanySize(array $data): array
|
|
|
{
|
|
|
- $result = JobEnum::where('egroup','cosize')->get()->all();
|
|
|
+ $result = JobEnum::where('egroup', 'cosize')->get()->all();
|
|
|
if (empty($result)) {
|
|
|
return Result::error("暂无公司规模", 0);
|
|
|
}
|
|
@@ -1452,8 +1467,16 @@ class NewsService implements NewsServiceInterface
|
|
|
// 20250306 招聘
|
|
|
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);
|
|
@@ -1470,6 +1493,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);
|
|
@@ -1484,4 +1517,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();
|
|
|
+ }
|
|
|
}
|