|
@@ -27,6 +27,9 @@ use App\Model\Good;
|
|
|
use App\Model\Book;
|
|
|
use App\Model\JobRecruiting;
|
|
|
use App\Model\JobHunting;
|
|
|
+use App\Model\Notice;
|
|
|
+use App\Model\Complaint;
|
|
|
+use App\Model\Order;
|
|
|
|
|
|
|
|
|
use Hyperf\DbConnection\Db;
|
|
@@ -691,8 +694,34 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
switch ($data['type_id']) {
|
|
|
case 4:
|
|
|
$result = Db::select('SELECT DATE(created_at) AS date,COUNT(*) AS total_count FROM letter_of_complaint WHERE created_at >= CURDATE() - INTERVAL 30 DAY GROUP BY DATE(created_at) ORDER BY date ASC;');
|
|
|
- return Result::success($result);
|
|
|
- break;
|
|
|
+ $res = [];
|
|
|
+ //查询已审核文章
|
|
|
+ $user_id = $data['user_id'];
|
|
|
+ $article = Article::where('status', 1)
|
|
|
+ ->where('admin_user_id', $user_id)
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->limit(10)
|
|
|
+ ->get();
|
|
|
+ $res['letterOfComplaintList'] = $result;
|
|
|
+ $res['article'] = $article;
|
|
|
+ $res['article']['count'] = Article::whereNotIn('status', ['404'])->where('admin_user_id', $user_id)->count();
|
|
|
+ $res['good']['count'] = Good::where([])->where('user_id', $user_id)->count();
|
|
|
+ $res['book']['count'] = Book::where([])->where('user_id', $user_id)->count();
|
|
|
+ $res['jobHunting']['count'] = JobHunting::where([])->where('user_id', $user_id)->count();
|
|
|
+ $res['jobRecruiting']['count'] = JobRecruiting::where([])->where('user_id', $user_id)->count();
|
|
|
+ $res['complaint']['count'] = Complaint::where([])->where('user_id', $user_id)->count();
|
|
|
+ $res['notice']['count'] = Notice::where([])->where('user_id', $user_id)->count();
|
|
|
+
|
|
|
+ //待审核数据
|
|
|
+ $res['apply']['article'] = Article::where(['status' => 0])->where('admin_user_id', $user_id)->count(); //
|
|
|
+ $res['apply']['good'] = Good::where(['status' => 1])->where('user_id', $user_id)->count();
|
|
|
+ $res['apply']['book'] = Book::where(['status' => 1])->where('user_id', $user_id)->count();
|
|
|
+ $res['apply']['jobHunting'] = JobHunting::where(['status' => 1])->where('user_id', $user_id)->count();
|
|
|
+ $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();
|
|
|
+
|
|
|
+ return Result::success($res);
|
|
|
case 10000:
|
|
|
$res = [];
|
|
|
//网站
|
|
@@ -709,8 +738,6 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
$res['book']['count'] = 0;
|
|
|
$res['jobHunting']['count'] = 0;
|
|
|
$res['jobRecruiting']['count'] = 0;
|
|
|
-
|
|
|
-
|
|
|
//近一月数据
|
|
|
$res['monthArticle'] = [];
|
|
|
//用户类型
|
|
@@ -722,15 +749,39 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
$res['book']['count'] = Book::where([])->count();
|
|
|
$res['jobHunting']['count'] = JobHunting::where([])->count();
|
|
|
$res['jobRecruiting']['count'] = JobRecruiting::where([])->count();
|
|
|
+ $res['complaint']['count'] = Complaint::where([])->count();
|
|
|
+ $res['notice']['count'] = Notice::where([])->count();
|
|
|
|
|
|
// $res['monthArticle'] = Db::select('SELECT DATE(created_at) AS date,COUNT(*) AS total_count FROM article WHERE created_at >= CURDATE() - INTERVAL 30 DAY GROUP BY DATE(created_at) ORDER BY date ASC;');
|
|
|
$res['monthArticle'] = Db::select(' SELECT DATE(article.created_at) AS date,COUNT(*) AS count ,user.type_id FROM article left JOIN user on article.admin_user_id = user.id WHERE article.created_at >= CURDATE() - INTERVAL 30 DAY GROUP BY DATE(article.created_at),`user`.type_id ORDER BY date ASC');
|
|
|
|
|
|
+ $res['monthGood'] = Db::select(' SELECT DATE(article.created_at) AS date,COUNT(*) AS count ,user.type_id FROM article left JOIN user on article.admin_user_id = user.id WHERE article.created_at >= CURDATE() - INTERVAL 30 DAY GROUP BY DATE(article.created_at),`user`.type_id ORDER BY date ASC');
|
|
|
+
|
|
|
+
|
|
|
+ $res['monthBook'] = Db::select(' SELECT DATE(book.created_at) AS date,COUNT(*) AS count ,user.type_id FROM book left JOIN user on book.user_id = user.id WHERE book.created_at >= CURDATE() - INTERVAL 30 DAY GROUP BY DATE(book.created_at),`user`.type_id ORDER BY date ASC');
|
|
|
+
|
|
|
+ $res['monthJobHunting'] = Db::select(' SELECT DATE(job_hunting.created_at) AS date,COUNT(*) AS count ,user.type_id FROM job_hunting left JOIN user on job_hunting.user_id = user.id WHERE job_hunting.created_at >= CURDATE() - INTERVAL 30 DAY GROUP BY DATE(job_hunting.created_at),`user`.type_id ORDER BY date ASC');
|
|
|
+
|
|
|
+ $res['monthJobRecruiting'] = Db::select(' SELECT DATE(job_hunting.created_at) AS date,COUNT(*) AS count ,user.type_id FROM job_hunting left JOIN user on job_hunting.user_id = user.id WHERE job_hunting.created_at >= CURDATE() - INTERVAL 30 DAY GROUP BY DATE(job_hunting.created_at),`user`.type_id ORDER BY date ASC');
|
|
|
+
|
|
|
|
|
|
|
|
|
$res['userType'] = User::where([])->selectRaw("count(*) as counts,type_id")->groupBy('type_id')->get();
|
|
|
+
|
|
|
+ //待审核数据
|
|
|
+ $res['apply']['article'] = Article::where(['status' => 0])->count(); //
|
|
|
+ $res['apply']['good'] = Good::where(['status' => 1])->count();
|
|
|
+ $res['apply']['book'] = Book::where(['status' => 1])->count();
|
|
|
+ $res['apply']['jobHunting'] = JobHunting::where(['status' => 1])->count();
|
|
|
+ $res['apply']['jobRecruiting'] = JobRecruiting::where(['status' => 0])->count();
|
|
|
+ $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();
|
|
|
+
|
|
|
return Result::success($res);
|
|
|
case 1:
|
|
|
+ case 2:
|
|
|
+ case 3:
|
|
|
$res = [];
|
|
|
//查询已审核文章
|
|
|
$user_id = $data['user_id'];
|
|
@@ -739,7 +790,24 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->limit(10)
|
|
|
->get();
|
|
|
+
|
|
|
$res['article'] = $article;
|
|
|
+ $res['article']['count'] = Article::whereNotIn('status', ['404'])->where('admin_user_id', $user_id)->count();
|
|
|
+ $res['good']['count'] = Good::where([])->where('user_id', $user_id)->count();
|
|
|
+ $res['book']['count'] = Book::where([])->where('user_id', $user_id)->count();
|
|
|
+ $res['jobHunting']['count'] = JobHunting::where([])->where('user_id', $user_id)->count();
|
|
|
+ $res['jobRecruiting']['count'] = JobRecruiting::where([])->where('user_id', $user_id)->count();
|
|
|
+ $res['complaint']['count'] = Complaint::where([])->where('user_id', $user_id)->count();
|
|
|
+ $res['notice']['count'] = Notice::where([])->where('user_id', $user_id)->count();
|
|
|
+
|
|
|
+ //待审核数据
|
|
|
+ $res['apply']['article'] = Article::where(['status' => 0])->where('admin_user_id', $user_id)->count(); //
|
|
|
+ $res['apply']['good'] = Good::where(['status' => 1])->where('user_id', $user_id)->count();
|
|
|
+ $res['apply']['book'] = Book::where(['status' => 1])->where('user_id', $user_id)->count();
|
|
|
+ $res['apply']['jobHunting'] = JobHunting::where(['status' => 1])->where('user_id', $user_id)->count();
|
|
|
+ $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();
|
|
|
return Result::success($res);
|
|
|
}
|
|
|
|