News.php
583 字节
<?php
namespace App\Models\News;
use App\Enums\Common\Code;
use App\Models\Base;
use App\Services\ProjectServer;
class News extends Base
{
protected $table = 'gl_news';
//连接数据库
protected $connection = 'custom_mysql';
public static function getNumByProjectId($project_id){
$project = ProjectServer::useProject($project_id);
if(empty($project)){
return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'数据库未配置']);
}
return self::where('project_id', $project_id)->where('status', 1)->count();
}
}