正在显示
13 个修改的文件
包含
25 行增加
和
21 行删除
| @@ -8,7 +8,7 @@ use App\Helper\Arr; | @@ -8,7 +8,7 @@ use App\Helper\Arr; | ||
| 8 | use App\Helper\FormGlobalsoApi; | 8 | use App\Helper\FormGlobalsoApi; |
| 9 | use App\Http\Logic\Aside\BaseLogic; | 9 | use App\Http\Logic\Aside\BaseLogic; |
| 10 | use App\Http\Logic\Aside\Manage\ManageLogic; | 10 | use App\Http\Logic\Aside\Manage\ManageLogic; |
| 11 | -use App\Models\ASide\Product; | 11 | +use App\Models\ASide\APublicModel; |
| 12 | use App\Models\Blog\Blog; | 12 | use App\Models\Blog\Blog; |
| 13 | use App\Models\Channel\Channel; | 13 | use App\Models\Channel\Channel; |
| 14 | use App\Models\Channel\User; | 14 | use App\Models\Channel\User; |
| @@ -67,7 +67,7 @@ class ProjectLogic extends BaseLogic | @@ -67,7 +67,7 @@ class ProjectLogic extends BaseLogic | ||
| 67 | 'domain' => $item['deploy_optimize']['domain'] ?? 0, | 67 | 'domain' => $item['deploy_optimize']['domain'] ?? 0, |
| 68 | 'created_at' => date('Y年m月d日', strtotime($item['created_at'])), | 68 | 'created_at' => date('Y年m月d日', strtotime($item['created_at'])), |
| 69 | 'autologin_code' => $this->getAutoLoginCode($item['id']), | 69 | 'autologin_code' => $this->getAutoLoginCode($item['id']), |
| 70 | - 'product_num' => Product::getNumByProjectId($item['id']), | 70 | + 'product_num' => APublicModel::getNumByProjectId($item['id']), |
| 71 | 'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0, | 71 | 'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0, |
| 72 | 'article_num' => Blog::getNumByProjectId($item['id']) + News::getNumByProjectId($item['id']), | 72 | 'article_num' => Blog::getNumByProjectId($item['id']) + News::getNumByProjectId($item['id']), |
| 73 | 'task_finish_num' => Task::getNumByProjectId($item['id'], Task::STATUS_DOWN), | 73 | 'task_finish_num' => Task::getNumByProjectId($item['id'], Task::STATUS_DOWN), |
| @@ -7,7 +7,7 @@ use App\Models\Product\Attr; | @@ -7,7 +7,7 @@ use App\Models\Product\Attr; | ||
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| 9 | * Class AttrLogic | 9 | * Class AttrLogic |
| 10 | - * @package App\Http\Logic\Bside\Product | 10 | + * @package App\Http\Logic\Bside\APublicModel |
| 11 | * @author zbj | 11 | * @author zbj |
| 12 | * @date 2023/4/15 | 12 | * @date 2023/4/15 |
| 13 | */ | 13 | */ |
| @@ -14,7 +14,7 @@ use Illuminate\Support\Facades\DB; | @@ -14,7 +14,7 @@ use Illuminate\Support\Facades\DB; | ||
| 14 | 14 | ||
| 15 | /** | 15 | /** |
| 16 | * Class CategoryLogic | 16 | * Class CategoryLogic |
| 17 | - * @package App\Http\Logic\Bside\Product | 17 | + * @package App\Http\Logic\Bside\APublicModel |
| 18 | * @author zbj | 18 | * @author zbj |
| 19 | * @date 2023/4/14 | 19 | * @date 2023/4/14 |
| 20 | */ | 20 | */ |
| @@ -8,7 +8,7 @@ use App\Models\Product\Describe; | @@ -8,7 +8,7 @@ use App\Models\Product\Describe; | ||
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | * Class DescribeLogic | 10 | * Class DescribeLogic |
| 11 | - * @package App\Http\Logic\Bside\Product | 11 | + * @package App\Http\Logic\Bside\APublicModel |
| 12 | * @author zbj | 12 | * @author zbj |
| 13 | * @date 2023/4/15 | 13 | * @date 2023/4/15 |
| 14 | */ | 14 | */ |
| @@ -12,7 +12,7 @@ use Illuminate\Support\Facades\DB; | @@ -12,7 +12,7 @@ use Illuminate\Support\Facades\DB; | ||
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| 14 | * Class KeywordLogic | 14 | * Class KeywordLogic |
| 15 | - * @package App\Http\Logic\Bside\Product | 15 | + * @package App\Http\Logic\Bside\APublicModel |
| 16 | * @author zbj | 16 | * @author zbj |
| 17 | * @date 2023/4/15 | 17 | * @date 2023/4/15 |
| 18 | */ | 18 | */ |
| @@ -14,7 +14,7 @@ use Illuminate\Support\Facades\DB; | @@ -14,7 +14,7 @@ use Illuminate\Support\Facades\DB; | ||
| 14 | 14 | ||
| 15 | /** | 15 | /** |
| 16 | * Class ProductLogic | 16 | * Class ProductLogic |
| 17 | - * @package App\Http\Logic\Bside\Product | 17 | + * @package App\Http\Logic\Bside\APublicModel |
| 18 | * @author zbj | 18 | * @author zbj |
| 19 | * @date 2023/4/14 | 19 | * @date 2023/4/14 |
| 20 | */ | 20 | */ |
| 1 | <?php | 1 | <?php |
| 2 | /** | 2 | /** |
| 3 | * @remark : | 3 | * @remark : |
| 4 | - * @name :Product.php | 4 | + * @name :APublicModel.php |
| 5 | * @author :lyh | 5 | * @author :lyh |
| 6 | * @method :post | 6 | * @method :post |
| 7 | * @time :2023/8/10 18:16 | 7 | * @time :2023/8/10 18:16 |
| @@ -13,13 +13,21 @@ use App\Models\Base; | @@ -13,13 +13,21 @@ use App\Models\Base; | ||
| 13 | use App\Services\ProjectServer; | 13 | use App\Services\ProjectServer; |
| 14 | use Illuminate\Support\Facades\DB; | 14 | use Illuminate\Support\Facades\DB; |
| 15 | 15 | ||
| 16 | -class Product extends Base | 16 | +class APublicModel extends Base |
| 17 | { | 17 | { |
| 18 | - protected $table = 'gl_product'; | ||
| 19 | - | ||
| 20 | const STATUS_ON = 1; | 18 | const STATUS_ON = 1; |
| 21 | - public static function getNumByProjectId($project_id){ | 19 | + public static function getProductNumByProjectId($project_id){ |
| 22 | ProjectServer::useProject($project_id); | 20 | ProjectServer::useProject($project_id); |
| 23 | return DB::connection('custom_mysql')->table('gl_product')->where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); | 21 | return DB::connection('custom_mysql')->table('gl_product')->where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); |
| 24 | } | 22 | } |
| 23 | + | ||
| 24 | + public static function getBlogNumByProjectId($project_id){ | ||
| 25 | + ProjectServer::useProject($project_id); | ||
| 26 | + return DB::connection('custom_mysql')->table('gl_blog')->where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public static function getNewsNumByProjectId($project_id){ | ||
| 30 | + ProjectServer::useProject($project_id); | ||
| 31 | + return DB::connection('custom_mysql')->table('gl_news')->where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); | ||
| 32 | + } | ||
| 25 | } | 33 | } |
| @@ -13,10 +13,6 @@ class Blog extends Base | @@ -13,10 +13,6 @@ class Blog extends Base | ||
| 13 | public function user(){ | 13 | public function user(){ |
| 14 | return $this->hasMany(User::class,'operator_id','id'); | 14 | return $this->hasMany(User::class,'operator_id','id'); |
| 15 | } | 15 | } |
| 16 | - | ||
| 17 | - public static function getNumByProjectId($project_id){ | ||
| 18 | - return self::where('project_id', $project_id)->where('status', 1)->count(); | ||
| 19 | - } | ||
| 20 | } | 16 | } |
| 21 | 17 | ||
| 22 | 18 |
| @@ -12,6 +12,6 @@ class BlogCategory extends Base | @@ -12,6 +12,6 @@ class BlogCategory extends Base | ||
| 12 | { | 12 | { |
| 13 | protected $table = 'gl_blog_category'; | 13 | protected $table = 'gl_blog_category'; |
| 14 | //连接数据库 | 14 | //连接数据库 |
| 15 | -// protected $connection = 'custom_mysql'; | 15 | + protected $connection = 'custom_mysql'; |
| 16 | 16 | ||
| 17 | } | 17 | } |
| @@ -8,7 +8,7 @@ class News extends Base | @@ -8,7 +8,7 @@ class News extends Base | ||
| 8 | { | 8 | { |
| 9 | protected $table = 'gl_news'; | 9 | protected $table = 'gl_news'; |
| 10 | //连接数据库 | 10 | //连接数据库 |
| 11 | -// protected $connection = 'custom_mysql'; | 11 | + protected $connection = 'custom_mysql'; |
| 12 | 12 | ||
| 13 | public static function getNumByProjectId($project_id){ | 13 | public static function getNumByProjectId($project_id){ |
| 14 | return self::where('project_id', $project_id)->where('status', 1)->count(); | 14 | return self::where('project_id', $project_id)->where('status', 1)->count(); |
| @@ -12,5 +12,5 @@ class NewsCategory extends Base | @@ -12,5 +12,5 @@ class NewsCategory extends Base | ||
| 12 | { | 12 | { |
| 13 | protected $table = 'gl_news_category'; | 13 | protected $table = 'gl_news_category'; |
| 14 | //连接数据库 | 14 | //连接数据库 |
| 15 | -// protected $connection = 'custom_mysql'; | 15 | + protected $connection = 'custom_mysql'; |
| 16 | } | 16 | } |
-
请 注册 或 登录 后发表评论