正在显示
3 个修改的文件
包含
28 行增加
和
3 行删除
| @@ -45,6 +45,7 @@ class ProjectLogic extends BaseLogic | @@ -45,6 +45,7 @@ class ProjectLogic extends BaseLogic | ||
| 45 | 45 | ||
| 46 | public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20) | 46 | public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20) |
| 47 | { | 47 | { |
| 48 | + | ||
| 48 | parent::setWith(['payment', 'deploy_build', 'deploy_optimize','online_check']); | 49 | parent::setWith(['payment', 'deploy_build', 'deploy_optimize','online_check']); |
| 49 | $list = parent::getList($map, $sort, ['id', 'title', 'channel', 'type', 'created_at'], $limit); | 50 | $list = parent::getList($map, $sort, ['id', 'title', 'channel', 'type', 'created_at'], $limit); |
| 50 | foreach ($list['list'] as &$item){ | 51 | foreach ($list['list'] as &$item){ |
app/Models/ASide/Product.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :Product.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/8/10 18:16 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\ASide; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | +use App\Services\ProjectServer; | ||
| 14 | +use Illuminate\Support\Facades\DB; | ||
| 15 | + | ||
| 16 | +class Product extends Base | ||
| 17 | +{ | ||
| 18 | + protected $table = 'gl_product'; | ||
| 19 | + | ||
| 20 | + const STATUS_ON = 1; | ||
| 21 | + public static function getNumByProjectId($project_id){ | ||
| 22 | + ProjectServer::useProject($project_id); | ||
| 23 | + DB::connection('custom_mysql'); | ||
| 24 | + return self::where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); | ||
| 25 | + } | ||
| 26 | +} |
| @@ -20,7 +20,7 @@ class Product extends Base | @@ -20,7 +20,7 @@ class Product extends Base | ||
| 20 | //设置关联表名 | 20 | //设置关联表名 |
| 21 | protected $table = 'gl_product'; | 21 | protected $table = 'gl_product'; |
| 22 | //连接数据库 | 22 | //连接数据库 |
| 23 | -// protected $connection = 'custom_mysql'; | 23 | + protected $connection = 'custom_mysql'; |
| 24 | const STATUS_DRAFT = 0; | 24 | const STATUS_DRAFT = 0; |
| 25 | const STATUS_ON = 1; | 25 | const STATUS_ON = 1; |
| 26 | const STATUS_RECYCLE = 2; | 26 | const STATUS_RECYCLE = 2; |
| @@ -154,8 +154,6 @@ class Product extends Base | @@ -154,8 +154,6 @@ class Product extends Base | ||
| 154 | // } | 154 | // } |
| 155 | 155 | ||
| 156 | public static function getNumByProjectId($project_id){ | 156 | public static function getNumByProjectId($project_id){ |
| 157 | - $project = ProjectServer::useProject($project_id); | ||
| 158 | - DB::connection('custom_mysql')->reconnect(); // 连接到目标数据库 | ||
| 159 | return self::where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); | 157 | return self::where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); |
| 160 | } | 158 | } |
| 161 | 159 |
-
请 注册 或 登录 后发表评论