正在显示
5 个修改的文件
包含
42 行增加
和
6 行删除
| @@ -95,6 +95,7 @@ class OnlineController extends BaseController | @@ -95,6 +95,7 @@ class OnlineController extends BaseController | ||
| 95 | * @time :2023/8/18 14:44 | 95 | * @time :2023/8/18 14:44 |
| 96 | */ | 96 | */ |
| 97 | public function handleParam(&$item){ | 97 | public function handleParam(&$item){ |
| 98 | + $data = APublicModel::getNumByProjectId($item['id']); | ||
| 98 | $manageModel = new Manage(); | 99 | $manageModel = new Manage(); |
| 99 | $item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0); | 100 | $item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0); |
| 100 | $item['build_leader'] = $manageModel->getName($item['leader_mid']); | 101 | $item['build_leader'] = $manageModel->getName($item['leader_mid']); |
| @@ -108,9 +109,9 @@ class OnlineController extends BaseController | @@ -108,9 +109,9 @@ class OnlineController extends BaseController | ||
| 108 | $item['plan'] = Project::planMap()[$item['plan']]; | 109 | $item['plan'] = Project::planMap()[$item['plan']]; |
| 109 | $item['created_at'] = date('Y年m月d日', strtotime($item['created_at'])); | 110 | $item['created_at'] = date('Y年m月d日', strtotime($item['created_at'])); |
| 110 | $item['autologin_code'] = getAutoLoginCode($item['id']); | 111 | $item['autologin_code'] = getAutoLoginCode($item['id']); |
| 111 | - $item['product_num'] = APublicModel::getProductNumByProjectId($item['id']); | 112 | + $item['product_num'] = $data['product'] ?? 0; |
| 112 | $item['autologin_code'] = getAutoLoginCode($item['id']); | 113 | $item['autologin_code'] = getAutoLoginCode($item['id']); |
| 113 | - $item['article_num'] = APublicModel::getBlogNumByProjectId($item['id']) + APublicModel::getNewsNumByProjectId($item['id']); | 114 | + $item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0); |
| 114 | $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN); | 115 | $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN); |
| 115 | $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]); | 116 | $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]); |
| 116 | return $item; | 117 | return $item; |
| @@ -118,6 +118,7 @@ class RenewProjectController extends BaseController | @@ -118,6 +118,7 @@ class RenewProjectController extends BaseController | ||
| 118 | */ | 118 | */ |
| 119 | public function handleParam(&$item){ | 119 | public function handleParam(&$item){ |
| 120 | $manageModel = new Manage(); | 120 | $manageModel = new Manage(); |
| 121 | + $data = APublicModel::getNumByProjectId($item['id']); | ||
| 121 | $item = [ | 122 | $item = [ |
| 122 | 'id' => $item['id'], | 123 | 'id' => $item['id'], |
| 123 | 'title' => $item['title'], | 124 | 'title' => $item['title'], |
| @@ -139,9 +140,9 @@ class RenewProjectController extends BaseController | @@ -139,9 +140,9 @@ class RenewProjectController extends BaseController | ||
| 139 | 'domain' => $item['deploy_optimize']['domain'] ?? 0, | 140 | 'domain' => $item['deploy_optimize']['domain'] ?? 0, |
| 140 | 'created_at' => date('Y年m月d日', strtotime($item['created_at'])), | 141 | 'created_at' => date('Y年m月d日', strtotime($item['created_at'])), |
| 141 | 'autologin_code' => getAutoLoginCode($item['id']), | 142 | 'autologin_code' => getAutoLoginCode($item['id']), |
| 142 | - 'product_num' => APublicModel::getProductNumByProjectId($item['id']), | 143 | + 'product_num' => $data['product'] ?? 0, |
| 143 | 'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0, | 144 | 'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0, |
| 144 | - 'article_num' => APublicModel::getBlogNumByProjectId($item['id']) + APublicModel::getNewsNumByProjectId($item['id']), | 145 | + 'article_num' => ($data['blog'] ?? 0) + ($data['news'] ?? 0), |
| 145 | 'task_finish_num' => Task::getNumByProjectId($item['id'], Task::STATUS_DOWN), | 146 | 'task_finish_num' => Task::getNumByProjectId($item['id'], Task::STATUS_DOWN), |
| 146 | 'task_pending_num' => Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]), | 147 | 'task_pending_num' => Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]), |
| 147 | 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0, | 148 | 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0, |
| @@ -54,6 +54,13 @@ class ProcessRecordsLogic extends BaseLogic | @@ -54,6 +54,13 @@ class ProcessRecordsLogic extends BaseLogic | ||
| 54 | return $this->success($data); | 54 | return $this->success($data); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | + /** | ||
| 58 | + * @remark :保存数据 | ||
| 59 | + * @name :recordSave | ||
| 60 | + * @author :lyh | ||
| 61 | + * @method :post | ||
| 62 | + * @time :2023/8/30 9:25 | ||
| 63 | + */ | ||
| 57 | public function recordSave(){ | 64 | public function recordSave(){ |
| 58 | $info = $this->model->read(['project_id'=>$this->param['project_id']]); | 65 | $info = $this->model->read(['project_id'=>$this->param['project_id']]); |
| 59 | $this->param['operator_id'] = $this->manager['id']; | 66 | $this->param['operator_id'] = $this->manager['id']; |
| @@ -48,6 +48,9 @@ class ProjectLogic extends BaseLogic | @@ -48,6 +48,9 @@ class ProjectLogic extends BaseLogic | ||
| 48 | $list = parent::getList($map, $sort, ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'created_at'], $limit); | 48 | $list = parent::getList($map, $sort, ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'created_at'], $limit); |
| 49 | $managerLogic = new ManageLogic(); | 49 | $managerLogic = new ManageLogic(); |
| 50 | foreach ($list['list'] as &$item){ | 50 | foreach ($list['list'] as &$item){ |
| 51 | + if($item['mysql_id'] != 0){ | ||
| 52 | + $data = APublicModel::getNumByProjectId($item['id']); | ||
| 53 | + } | ||
| 51 | $item = [ | 54 | $item = [ |
| 52 | 'id' => $item['id'], | 55 | 'id' => $item['id'], |
| 53 | 'title' => $item['title'], | 56 | 'title' => $item['title'], |
| @@ -68,9 +71,9 @@ class ProjectLogic extends BaseLogic | @@ -68,9 +71,9 @@ class ProjectLogic extends BaseLogic | ||
| 68 | 'plan' =>Project::planMap()[$item['deploy_build']['plan']], | 71 | 'plan' =>Project::planMap()[$item['deploy_build']['plan']], |
| 69 | 'domain' => $item['deploy_optimize']['domain'] ?? 0, | 72 | 'domain' => $item['deploy_optimize']['domain'] ?? 0, |
| 70 | 'created_at' => date('Y年m月d日', strtotime($item['created_at'])), | 73 | 'created_at' => date('Y年m月d日', strtotime($item['created_at'])), |
| 71 | - 'product_num' => ($item['mysql_id'] != 0) ? APublicModel::getProductNumByProjectId($item['id']) : 0, | 74 | + 'product_num' => $data['product'] ?? 0, |
| 72 | 'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0, | 75 | 'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0, |
| 73 | - 'article_num' => ($item['mysql_id'] != 0) ? APublicModel::getBlogNumByProjectId($item['id']) + APublicModel::getNewsNumByProjectId($item['id']) : 0, | 76 | + 'article_num' => ($data['blog'] ?? 0) + ($data['news'] ?? 0), |
| 74 | 'task_finish_num' => Task::getNumByProjectId($item['id'], Task::STATUS_DOWN), | 77 | 'task_finish_num' => Task::getNumByProjectId($item['id'], Task::STATUS_DOWN), |
| 75 | 'task_pending_num' => Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]), | 78 | 'task_pending_num' => Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]), |
| 76 | 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0, | 79 | 'optimist_status'=>$item['online_check']['optimist_status'] ?? 0, |
| @@ -148,9 +151,11 @@ class ProjectLogic extends BaseLogic | @@ -148,9 +151,11 @@ class ProjectLogic extends BaseLogic | ||
| 148 | $this->saveAfter($param); | 151 | $this->saveAfter($param); |
| 149 | //创建默认数据库 | 152 | //创建默认数据库 |
| 150 | if($param['type'] == Project::TYPE_ONE){ | 153 | if($param['type'] == Project::TYPE_ONE){ |
| 154 | + //初始化数据库 | ||
| 151 | if(isset($param['mysql_id']) && !empty($param['mysql_id'])){ | 155 | if(isset($param['mysql_id']) && !empty($param['mysql_id'])){ |
| 152 | $this->initializationMysql($res['id']); | 156 | $this->initializationMysql($res['id']); |
| 153 | } | 157 | } |
| 158 | + //初始账号 | ||
| 154 | if(isset($param['mobile']) && !empty($param['mobile'])){ | 159 | if(isset($param['mobile']) && !empty($param['mobile'])){ |
| 155 | $this->createUser($param['mobile'],$res['id'],$param['lead_name']); | 160 | $this->createUser($param['mobile'],$res['id'],$param['lead_name']); |
| 156 | } | 161 | } |
| @@ -384,6 +389,7 @@ class ProjectLogic extends BaseLogic | @@ -384,6 +389,7 @@ class ProjectLogic extends BaseLogic | ||
| 384 | 'deploy_build' => [ | 389 | 'deploy_build' => [ |
| 385 | 'service_duration' => $param['years'], | 390 | 'service_duration' => $param['years'], |
| 386 | 'plan' => $this->versionData($param['plan_marketing']), | 391 | 'plan' => $this->versionData($param['plan_marketing']), |
| 392 | + 'login_mobile'=>$param['principal_mobile'] | ||
| 387 | ], | 393 | ], |
| 388 | 'deploy_optimize' => [ | 394 | 'deploy_optimize' => [ |
| 389 | 'api_no' => $param['id'] | 395 | 'api_no' => $param['id'] |
| @@ -11,10 +11,31 @@ namespace App\Models\ASide; | @@ -11,10 +11,31 @@ namespace App\Models\ASide; | ||
| 11 | 11 | ||
| 12 | use App\Models\Base; | 12 | use App\Models\Base; |
| 13 | use App\Services\ProjectServer; | 13 | use App\Services\ProjectServer; |
| 14 | +use Illuminate\Support\Facades\Cache; | ||
| 14 | use Illuminate\Support\Facades\DB; | 15 | use Illuminate\Support\Facades\DB; |
| 15 | 16 | ||
| 16 | class APublicModel extends Base | 17 | class APublicModel extends Base |
| 17 | { | 18 | { |
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * @remark :查询对应项目对应产品博客新闻数量 | ||
| 22 | + * @name :getNumByProjectId | ||
| 23 | + * @author :lyh | ||
| 24 | + * @method :post | ||
| 25 | + * @time :2023/8/30 9:35 | ||
| 26 | + */ | ||
| 27 | + public static function getNumByProjectId($project_id){ | ||
| 28 | + ProjectServer::useProject($project_id); | ||
| 29 | + $productNumber = DB::connection('custom_mysql')->table('gl_product') | ||
| 30 | + ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); | ||
| 31 | + $blogNumber = DB::connection('custom_mysql')->table('gl_blog') | ||
| 32 | + ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); | ||
| 33 | + $newsNumber = DB::connection('custom_mysql')->table('gl_news') | ||
| 34 | + ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); | ||
| 35 | + DB::disconnect('custom_mysql'); | ||
| 36 | + return ['product'=>$productNumber,'blog'=>$blogNumber,'news'=>$newsNumber]; | ||
| 37 | + } | ||
| 38 | + | ||
| 18 | const STATUS_ON = 1; | 39 | const STATUS_ON = 1; |
| 19 | public static function getProductNumByProjectId($project_id){ | 40 | public static function getProductNumByProjectId($project_id){ |
| 20 | ProjectServer::useProject($project_id); | 41 | ProjectServer::useProject($project_id); |
-
请 注册 或 登录 后发表评论