作者 lyh

gx

... ... @@ -95,6 +95,7 @@ class OnlineController extends BaseController
* @time :2023/8/18 14:44
*/
public function handleParam(&$item){
$data = APublicModel::getNumByProjectId($item['id']);
$manageModel = new Manage();
$item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0);
$item['build_leader'] = $manageModel->getName($item['leader_mid']);
... ... @@ -108,9 +109,9 @@ class OnlineController extends BaseController
$item['plan'] = Project::planMap()[$item['plan']];
$item['created_at'] = date('Y年m月d日', strtotime($item['created_at']));
$item['autologin_code'] = getAutoLoginCode($item['id']);
$item['product_num'] = APublicModel::getProductNumByProjectId($item['id']);
$item['product_num'] = $data['product'] ?? 0;
$item['autologin_code'] = getAutoLoginCode($item['id']);
$item['article_num'] = APublicModel::getBlogNumByProjectId($item['id']) + APublicModel::getNewsNumByProjectId($item['id']);
$item['article_num'] = ($data['blog'] ?? 0) + ($data['news'] ?? 0);
$item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN);
$item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]);
return $item;
... ...
... ... @@ -118,6 +118,7 @@ class RenewProjectController extends BaseController
*/
public function handleParam(&$item){
$manageModel = new Manage();
$data = APublicModel::getNumByProjectId($item['id']);
$item = [
'id' => $item['id'],
'title' => $item['title'],
... ... @@ -139,9 +140,9 @@ class RenewProjectController extends BaseController
'domain' => $item['deploy_optimize']['domain'] ?? 0,
'created_at' => date('Y年m月d日', strtotime($item['created_at'])),
'autologin_code' => getAutoLoginCode($item['id']),
'product_num' => APublicModel::getProductNumByProjectId($item['id']),
'product_num' => $data['product'] ?? 0,
'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0,
'article_num' => APublicModel::getBlogNumByProjectId($item['id']) + APublicModel::getNewsNumByProjectId($item['id']),
'article_num' => ($data['blog'] ?? 0) + ($data['news'] ?? 0),
'task_finish_num' => Task::getNumByProjectId($item['id'], Task::STATUS_DOWN),
'task_pending_num' => Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]),
'optimist_status'=>$item['online_check']['optimist_status'] ?? 0,
... ...
... ... @@ -54,6 +54,13 @@ class ProcessRecordsLogic extends BaseLogic
return $this->success($data);
}
/**
* @remark :保存数据
* @name :recordSave
* @author :lyh
* @method :post
* @time :2023/8/30 9:25
*/
public function recordSave(){
$info = $this->model->read(['project_id'=>$this->param['project_id']]);
$this->param['operator_id'] = $this->manager['id'];
... ...
... ... @@ -48,6 +48,9 @@ class ProjectLogic extends BaseLogic
$list = parent::getList($map, $sort, ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'created_at'], $limit);
$managerLogic = new ManageLogic();
foreach ($list['list'] as &$item){
if($item['mysql_id'] != 0){
$data = APublicModel::getNumByProjectId($item['id']);
}
$item = [
'id' => $item['id'],
'title' => $item['title'],
... ... @@ -68,9 +71,9 @@ class ProjectLogic extends BaseLogic
'plan' =>Project::planMap()[$item['deploy_build']['plan']],
'domain' => $item['deploy_optimize']['domain'] ?? 0,
'created_at' => date('Y年m月d日', strtotime($item['created_at'])),
'product_num' => ($item['mysql_id'] != 0) ? APublicModel::getProductNumByProjectId($item['id']) : 0,
'product_num' => $data['product'] ?? 0,
'keyword_num' => $item['deploy_build']['keyword_num'] ?? 0,
'article_num' => ($item['mysql_id'] != 0) ? APublicModel::getBlogNumByProjectId($item['id']) + APublicModel::getNewsNumByProjectId($item['id']) : 0,
'article_num' => ($data['blog'] ?? 0) + ($data['news'] ?? 0),
'task_finish_num' => Task::getNumByProjectId($item['id'], Task::STATUS_DOWN),
'task_pending_num' => Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]),
'optimist_status'=>$item['online_check']['optimist_status'] ?? 0,
... ... @@ -148,9 +151,11 @@ class ProjectLogic extends BaseLogic
$this->saveAfter($param);
//创建默认数据库
if($param['type'] == Project::TYPE_ONE){
//初始化数据库
if(isset($param['mysql_id']) && !empty($param['mysql_id'])){
$this->initializationMysql($res['id']);
}
//初始账号
if(isset($param['mobile']) && !empty($param['mobile'])){
$this->createUser($param['mobile'],$res['id'],$param['lead_name']);
}
... ... @@ -384,6 +389,7 @@ class ProjectLogic extends BaseLogic
'deploy_build' => [
'service_duration' => $param['years'],
'plan' => $this->versionData($param['plan_marketing']),
'login_mobile'=>$param['principal_mobile']
],
'deploy_optimize' => [
'api_no' => $param['id']
... ...
... ... @@ -11,10 +11,31 @@ namespace App\Models\ASide;
use App\Models\Base;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
class APublicModel extends Base
{
/**
* @remark :查询对应项目对应产品博客新闻数量
* @name :getNumByProjectId
* @author :lyh
* @method :post
* @time :2023/8/30 9:35
*/
public static function getNumByProjectId($project_id){
ProjectServer::useProject($project_id);
$productNumber = DB::connection('custom_mysql')->table('gl_product')
->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
$blogNumber = DB::connection('custom_mysql')->table('gl_blog')
->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
$newsNumber = DB::connection('custom_mysql')->table('gl_news')
->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
DB::disconnect('custom_mysql');
return ['product'=>$productNumber,'blog'=>$blogNumber,'news'=>$newsNumber];
}
const STATUS_ON = 1;
public static function getProductNumByProjectId($project_id){
ProjectServer::useProject($project_id);
... ...