作者 lyh

gx

... ... @@ -8,7 +8,7 @@ use App\Helper\Arr;
use App\Helper\FormGlobalsoApi;
use App\Http\Logic\Aside\BaseLogic;
use App\Http\Logic\Aside\Manage\ManageLogic;
use App\Models\ASide\Product;
use App\Models\ASide\APublicModel;
use App\Models\Blog\Blog;
use App\Models\Channel\Channel;
use App\Models\Channel\User;
... ... @@ -67,7 +67,7 @@ class ProjectLogic extends BaseLogic
'domain' => $item['deploy_optimize']['domain'] ?? 0,
'created_at' => date('Y年m月d日', strtotime($item['created_at'])),
'autologin_code' => $this->getAutoLoginCode($item['id']),
'product_num' => Product::getNumByProjectId($item['id']),
'product_num' => APublicModel::getNumByProjectId($item['id']),
'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0,
'article_num' => Blog::getNumByProjectId($item['id']) + News::getNumByProjectId($item['id']),
'task_finish_num' => Task::getNumByProjectId($item['id'], Task::STATUS_DOWN),
... ...
... ... @@ -7,7 +7,7 @@ use App\Models\Product\Attr;
/**
* Class AttrLogic
* @package App\Http\Logic\Bside\Product
* @package App\Http\Logic\Bside\APublicModel
* @author zbj
* @date 2023/4/15
*/
... ...
... ... @@ -14,7 +14,7 @@ use Illuminate\Support\Facades\DB;
/**
* Class CategoryLogic
* @package App\Http\Logic\Bside\Product
* @package App\Http\Logic\Bside\APublicModel
* @author zbj
* @date 2023/4/14
*/
... ...
... ... @@ -8,7 +8,7 @@ use App\Models\Product\Describe;
/**
* Class DescribeLogic
* @package App\Http\Logic\Bside\Product
* @package App\Http\Logic\Bside\APublicModel
* @author zbj
* @date 2023/4/15
*/
... ...
... ... @@ -12,7 +12,7 @@ use Illuminate\Support\Facades\DB;
/**
* Class KeywordLogic
* @package App\Http\Logic\Bside\Product
* @package App\Http\Logic\Bside\APublicModel
* @author zbj
* @date 2023/4/15
*/
... ...
... ... @@ -14,7 +14,7 @@ use Illuminate\Support\Facades\DB;
/**
* Class ProductLogic
* @package App\Http\Logic\Bside\Product
* @package App\Http\Logic\Bside\APublicModel
* @author zbj
* @date 2023/4/14
*/
... ...
<?php
/**
* @remark :
* @name :Product.php
* @name :APublicModel.php
* @author :lyh
* @method :post
* @time :2023/8/10 18:16
... ... @@ -13,13 +13,21 @@ use App\Models\Base;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
class Product extends Base
class APublicModel extends Base
{
protected $table = 'gl_product';
const STATUS_ON = 1;
public static function getNumByProjectId($project_id){
public static function getProductNumByProjectId($project_id){
ProjectServer::useProject($project_id);
return DB::connection('custom_mysql')->table('gl_product')->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
}
public static function getBlogNumByProjectId($project_id){
ProjectServer::useProject($project_id);
return DB::connection('custom_mysql')->table('gl_blog')->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
}
public static function getNewsNumByProjectId($project_id){
ProjectServer::useProject($project_id);
return DB::connection('custom_mysql')->table('gl_news')->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
}
}
... ...
... ... @@ -13,10 +13,6 @@ class Blog extends Base
public function user(){
return $this->hasMany(User::class,'operator_id','id');
}
public static function getNumByProjectId($project_id){
return self::where('project_id', $project_id)->where('status', 1)->count();
}
}
... ...
... ... @@ -12,6 +12,6 @@ class BlogCategory extends Base
{
protected $table = 'gl_blog_category';
//连接数据库
// protected $connection = 'custom_mysql';
protected $connection = 'custom_mysql';
}
... ...
... ... @@ -8,5 +8,5 @@ class BlogLabel extends Base
{
protected $table = 'gl_blog_label';
//连接数据库
// protected $connection = 'custom_mysql';
protected $connection = 'custom_mysql';
}
... ...
... ... @@ -8,7 +8,7 @@ class News extends Base
{
protected $table = 'gl_news';
//连接数据库
// protected $connection = 'custom_mysql';
protected $connection = 'custom_mysql';
public static function getNumByProjectId($project_id){
return self::where('project_id', $project_id)->where('status', 1)->count();
... ...
... ... @@ -12,5 +12,5 @@ class NewsCategory extends Base
{
protected $table = 'gl_news_category';
//连接数据库
// protected $connection = 'custom_mysql';
protected $connection = 'custom_mysql';
}
... ...
... ... @@ -8,5 +8,5 @@ class NewsLabel extends Base
{
protected $table = 'gl_news_label';
//连接数据库
// protected $connection = 'custom_mysql';
protected $connection = 'custom_mysql';
}
... ...