LiuJ před 4 dny
rodič
revize
61462ab6ef

+ 24 - 3
app/JsonRpc/WebsiteService.php

@@ -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']);

+ 27 - 0
app/Model/Book.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Book extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'book';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $guarded = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 29 - 0
app/Model/Good.php

@@ -0,0 +1,29 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Good extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'good';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    // protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+
+    protected array $guarded = [];
+}

+ 27 - 0
app/Model/JobHunting.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class JobHunting extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'job_hunting';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/JobRecruiting.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class JobRecruiting extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'job_recruiting';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}