|
@@ -23,6 +23,11 @@ use App\Model\WebsiteRole;
|
|
|
use App\Model\WebsiteRoleUser;
|
|
|
use App\Model\Website;
|
|
|
use App\Model\WebsiteColumn;
|
|
|
+use App\Model\Good;
|
|
|
+use App\Model\Book;
|
|
|
+use App\Model\JobRecruiting;
|
|
|
+use App\Model\JobHunting;
|
|
|
+
|
|
|
|
|
|
use Hyperf\DbConnection\Db;
|
|
|
use Hyperf\RpcServer\Annotation\RpcService;
|
|
@@ -699,6 +704,13 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
//导航池
|
|
|
$res['category']['count'] = 0;
|
|
|
$res['category']['growth_rate'] = 0;
|
|
|
+ //商品
|
|
|
+ $res['good']['count'] = 0;
|
|
|
+ $res['book']['count'] = 0;
|
|
|
+ $res['jobHunting']['count'] = 0;
|
|
|
+ $res['jobRecruiting']['count'] = 0;
|
|
|
+
|
|
|
+
|
|
|
//近一月数据
|
|
|
$res['monthArticle'] = [];
|
|
|
//用户类型
|
|
@@ -706,7 +718,16 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
$res['website']['count'] = Website::where([])->count();
|
|
|
$res['article']['count'] = Article::whereNotIn('status', ['404'])->count();
|
|
|
$res['category']['count'] = Category::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['good']['count'] = Good::where([])->count();
|
|
|
+ $res['book']['count'] = Book::where([])->count();
|
|
|
+ $res['jobHunting']['count'] = JobHunting::where([])->count();
|
|
|
+ $res['jobRecruiting']['count'] = JobRecruiting::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['userType'] = User::where([])->selectRaw("count(*) as counts,type_id")->groupBy('type_id')->get();
|
|
|
return Result::success($res);
|
|
|
case 1:
|
|
@@ -2186,8 +2207,8 @@ class WebsiteService implements WebsiteServiceInterface
|
|
|
return Result::error("暂无该网站", 0);
|
|
|
}
|
|
|
// return Result::success($data);
|
|
|
- if (isset($data['pinyin']) &&!empty($data['pinyin'])) {
|
|
|
- $result = WebsiteCategory::where('website_id',$data['website_id'])->where('aLIas_pinyin',$data['pinyin'])->first(['category_id','alias']);
|
|
|
+ if (isset($data['pinyin']) && !empty($data['pinyin'])) {
|
|
|
+ $result = WebsiteCategory::where('website_id', $data['website_id'])->where('aLIas_pinyin', $data['pinyin'])->first(['category_id', 'alias']);
|
|
|
}
|
|
|
if (isset($data['foot_pinyin']) && !empty($data['foot_pinyin'])) {
|
|
|
$result = FooterCategory::where('website_id', $data['website_id'])->where('name_pinyin', $data['foot_pinyin'])->first(['id']);
|