|
@@ -33,7 +33,7 @@ use App\Model\Notice;
|
|
|
use App\Model\Complaint;
|
|
|
use App\Model\Order;
|
|
|
use App\Model\WebsiteImg;
|
|
|
-use App\Model\Commpany;
|
|
|
+use App\Model\Company;
|
|
|
use App\Model\Project;
|
|
|
use App\Model\ChatTopicsReply;
|
|
|
use Hyperf\HttpServer\Contract\RequestInterface;
|
|
@@ -664,45 +664,44 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
* @return array
|
|
|
*/
|
|
|
|
|
|
- public function getWebsiteModelCategory(array $data): array
|
|
|
- {
|
|
|
- // return Result::success($data);
|
|
|
- $website_id = [
|
|
|
- 'website_id' => $data['website_id'],
|
|
|
- ];
|
|
|
- // 初始化 $pid 数组
|
|
|
- // $pid = [];
|
|
|
- // 以下注释掉的代码是之前的逻辑,用于获取非顶级分类的 pid
|
|
|
- $pidQuery = WebsiteCategory::where($website_id)
|
|
|
- ->where('pid', '!=', 0)
|
|
|
- ->orderBy('sort')
|
|
|
- ->select('pid', 'category_id', 'alias','aLIas_pinyin');
|
|
|
- $pid = $pidQuery->pluck('pid');
|
|
|
- $pid = array_values(array_unique($pid->toArray()));
|
|
|
- // 构建查询语句
|
|
|
- $query = WebsiteCategory::where($website_id)
|
|
|
- ->where('pid', $data['pid'])
|
|
|
- ->offset($data['placeid'])
|
|
|
- ->limit($data['num'])
|
|
|
- ->orderBy('sort')
|
|
|
- ->orderBy('updated_at','desc')
|
|
|
- ;
|
|
|
- // 如果 $pid 数组不为空,添加 CASE WHEN 条件
|
|
|
- if (!empty($pid)) {
|
|
|
- $placeholders = implode(',', array_fill(0, count($pid), '?'));
|
|
|
- $query->selectRaw("website_category.*, CASE WHEN website_category.category_id IN ($placeholders) THEN 1 ELSE 0 END AS children_count", $pid);
|
|
|
- } else {
|
|
|
- // 如果 $pid 数组为空,不添加 CASE WHEN 条件,添加字段 children_count 并赋值为 0
|
|
|
- $query->select('website_category.*', DB::raw('0 as children_count'));
|
|
|
- }
|
|
|
-
|
|
|
- // 执行查询
|
|
|
- $placeid = $data['placeid'] - 1;
|
|
|
- $result = $query->offset($placeid)->limit($data['num'])->get();
|
|
|
-
|
|
|
- if (!empty($result)) {
|
|
|
- $pidResults = $pidQuery->get();
|
|
|
- if(isset($data['type']) && $data['type'] == 1){
|
|
|
+ public function getWebsiteModelCategory(array $data): array
|
|
|
+ {
|
|
|
+ // return Result::success($data);
|
|
|
+ $website_id = [
|
|
|
+ 'website_id' => $data['website_id'],
|
|
|
+ ];
|
|
|
+ // 初始化 $pid 数组
|
|
|
+ // $pid = [];
|
|
|
+ // 以下注释掉的代码是之前的逻辑,用于获取非顶级分类的 pid
|
|
|
+ $pidQuery = WebsiteCategory::where($website_id)
|
|
|
+ ->where('pid', '!=', 0)
|
|
|
+ ->orderBy('sort')
|
|
|
+ ->select('pid', 'category_id', 'alias', 'aLIas_pinyin');
|
|
|
+ $pid = $pidQuery->pluck('pid');
|
|
|
+ $pid = array_values(array_unique($pid->toArray()));
|
|
|
+ // 构建查询语句
|
|
|
+ $query = WebsiteCategory::where($website_id)
|
|
|
+ ->where('pid', $data['pid'])
|
|
|
+ ->offset($data['placeid'])
|
|
|
+ ->limit($data['num'])
|
|
|
+ ->orderBy('sort')
|
|
|
+ ->orderBy('updated_at', 'desc');
|
|
|
+ // 如果 $pid 数组不为空,添加 CASE WHEN 条件
|
|
|
+ if (!empty($pid)) {
|
|
|
+ $placeholders = implode(',', array_fill(0, count($pid), '?'));
|
|
|
+ $query->selectRaw("website_category.*, CASE WHEN website_category.category_id IN ($placeholders) THEN 1 ELSE 0 END AS children_count", $pid);
|
|
|
+ } else {
|
|
|
+ // 如果 $pid 数组为空,不添加 CASE WHEN 条件,添加字段 children_count 并赋值为 0
|
|
|
+ $query->select('website_category.*', DB::raw('0 as children_count'));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 执行查询
|
|
|
+ $placeid = $data['placeid'] - 1;
|
|
|
+ $result = $query->offset($placeid)->limit($data['num'])->get();
|
|
|
+
|
|
|
+ if (!empty($result)) {
|
|
|
+ $pidResults = $pidQuery->get();
|
|
|
+ if (isset($data['type']) && $data['type'] == 1) {
|
|
|
$result = $result->map(function ($item) use ($pidResults) {
|
|
|
$children = $pidResults->where('pid', $item->category_id)->map(function ($child) {
|
|
|
if (!empty($child)) {
|
|
@@ -835,6 +834,9 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
|
|
|
$res['monthJobRecruiting'] = Db::select(' SELECT DATE(job_recruiting.created_at) AS date,COUNT(*) AS count ,user.type_id FROM job_recruiting left JOIN user on job_recruiting.user_id = user.id WHERE job_recruiting.status =1 and job_recruiting.created_at >= CURDATE() - INTERVAL 30 DAY GROUP BY DATE(job_recruiting.created_at),`user`.type_id ORDER BY date ASC');
|
|
|
|
|
|
+ //company project 1 已审核
|
|
|
+ $res['monthCompany'] = Db::select(' SELECT DATE(company.created_at) AS date,COUNT(*) AS count ,user.type_id FROM company left JOIN user on company.user_id = user.id WHERE company.status =1 and company.created_at >= CURDATE() - INTERVAL 30 DAY GROUP BY DATE(company.created_at),`user`.type_id ORDER BY date ASC');
|
|
|
+ $res['monthProject'] = Db::select(' SELECT DATE(project.created_at) AS date,COUNT(*) AS count ,user.type_id FROM project left JOIN user on project.user_id = user.id WHERE project.status =1 and project.created_at >= CURDATE() - INTERVAL 30 DAY GROUP BY DATE(project.created_at),`user`.type_id ORDER BY date ASC');
|
|
|
|
|
|
|
|
|
$res['userType'] = User::where([])->selectRaw("count(*) as counts,type_id")->groupBy('type_id')->get();
|
|
@@ -848,6 +850,8 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
$res['apply']['complaint'] = Complaint::where(['status' => 1])->count();
|
|
|
$res['apply']['notice'] = Notice::where(['status' => 1])->count(); //订单状态:1:通过;2:驳回;3:撤回;4:修改;5:过期;6:待审核;7:结束',
|
|
|
$res['apply']['order'] = Order::where(['status' => 6])->count();
|
|
|
+ $res['apply']['company'] = Company::where(['status' => 1])->count();
|
|
|
+ $res['apply']['project'] = Project::where(['status' => 1])->count();
|
|
|
|
|
|
return Result::success($res);
|
|
|
case 1:
|
|
@@ -942,6 +946,31 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
$item->formatted_updated_at = $this->timeAgo($item->updated_at, $now);
|
|
|
return $item;
|
|
|
});
|
|
|
+ //项目 公司 待审核 :0:未审核;1:已审核;2:已拒绝
|
|
|
+
|
|
|
+ $project = Project::query()
|
|
|
+ ->where('status', 0)
|
|
|
+ ->where('user_id', $user_id)
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->get(['id', 'title', 'updated_at'])
|
|
|
+ ->map(function ($item) use ($now) {
|
|
|
+ //去掉name的属性
|
|
|
+ $item->class = "项目";
|
|
|
+ $item->formatted_updated_at = $this->timeAgo($item->updated_at, $now);
|
|
|
+ return $item;
|
|
|
+ });
|
|
|
+
|
|
|
+ $company = Company::query()
|
|
|
+ ->where('status', 0)
|
|
|
+ ->where('user_id', $user_id)
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->get(['id', 'title', 'updated_at'])
|
|
|
+ ->map(function ($item) use ($now) {
|
|
|
+ //去掉name的属性
|
|
|
+ $item->class = "公司";
|
|
|
+ $item->formatted_updated_at = $this->timeAgo($item->updated_at, $now);
|
|
|
+ return $item;
|
|
|
+ });
|
|
|
|
|
|
// var_dump($jobrecruiting, '-1--------------------11111111111111--');
|
|
|
|
|
@@ -959,6 +988,8 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
->concat($jobrecruiting)
|
|
|
->concat($notice)
|
|
|
->concat($complaint)
|
|
|
+ ->concat($project)
|
|
|
+ ->concat($company)
|
|
|
->sortByDesc(function ($item) {
|
|
|
return Carbon::createFromFormat('Y-m-d H:i:s', $item->updated_at);
|
|
|
});
|
|
@@ -1071,6 +1102,11 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
->where('user_id', $user_id)->count();
|
|
|
$res['notice']['count'] = Notice::whereIn('status', [2])
|
|
|
->where('user_id', $user_id)->count();
|
|
|
+ //company project 0 待审核 1 已审核
|
|
|
+ $res['company']['count'] = Company::whereIn('status', [1])
|
|
|
+ ->where('user_id', $user_id)->count();
|
|
|
+ $res['project']['count'] = Project::whereIn('status', [1])
|
|
|
+ ->where('user_id', $user_id)->count();
|
|
|
|
|
|
//待审核数据
|
|
|
$res['apply']['article'] = Article::where(['status' => 0])->where('admin_user_id', $user_id)->count(); //
|
|
@@ -1080,6 +1116,12 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
$res['apply']['jobRecruiting'] = JobRecruiting::where(['status' => 0])->where('user_id', $user_id)->count();
|
|
|
$res['apply']['complaint'] = Complaint::where(['status' => 1])->where('user_id', $user_id)->count();
|
|
|
$res['apply']['notice'] = Notice::where(['status' => 1])->where('user_id', $user_id)->count();
|
|
|
+ //project company
|
|
|
+ $res['apply']['project'] = Project::whereIn('status', [0])
|
|
|
+ ->where('user_id', $user_id)->count();
|
|
|
+ $res['apply']['company'] = Company::whereIn('status', [0])
|
|
|
+ ->where('user_id', $user_id)->count();
|
|
|
+
|
|
|
return Result::success($res);
|
|
|
}
|
|
|
|
|
@@ -1551,7 +1593,7 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
// ->select("website_category.*", "department.name as department_name", "district.name as city_name")
|
|
|
// ->limit($data['pageSize'])->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
->orderBy("sort", "asc")
|
|
|
- ->orderBy("updated_at","desc")
|
|
|
+ ->orderBy("updated_at", "desc")
|
|
|
->get();
|
|
|
|
|
|
// $count = WebsiteCategory::where($where)
|
|
@@ -1960,7 +2002,7 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
// if (!in_array(1, $foot_type) ) {
|
|
|
// $missingTypes[] = "列表型底部导航";
|
|
|
// }
|
|
|
- if (!in_array(0, $foot_type) ) {
|
|
|
+ if (!in_array(0, $foot_type)) {
|
|
|
$missingTypes[] = "内容型底部导航";
|
|
|
}
|
|
|
if (!empty($missingTypes)) {
|