|
...
|
...
|
@@ -38,71 +38,10 @@ class ProjectLogic extends BaseLogic |
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
$this->param = $this->requestAll;
|
|
|
|
$this->model = new Project();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20)
|
|
|
|
{
|
|
|
|
|
|
|
|
parent::setWith(['payment', 'deploy_build', 'deploy_optimize','online_check']);
|
|
|
|
$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'],
|
|
|
|
'channel' => Channel::getChannelText($item['channel']['user_id'] ?? 0),
|
|
|
|
'key' => $item['deploy_build']['keyword_num'] ?? 0,
|
|
|
|
'day' => $item['deploy_build']['service_duration'] ?? 0,
|
|
|
|
'amount' => $item['payment']['amount'] ?? 0,
|
|
|
|
'build_leader' => $managerLogic->getCacheName($item['deploy_build']['leader_mid'] ?? 0), //组长
|
|
|
|
'build_manager' => $managerLogic->getCacheName($item['deploy_build']['manager_mid'] ?? 0), //项目经理
|
|
|
|
'build_designer' => $managerLogic->getCacheName($item['deploy_build']['designer_mid'] ?? 0), //设计师
|
|
|
|
'build_tech' => $managerLogic->getCacheName($item['deploy_build']['tech_mid'] ?? 0), //技术助理
|
|
|
|
'optimize_manager' => $managerLogic->getCacheName($item['deploy_optimize']['manager_mid'] ?? 0), //优化服务经理
|
|
|
|
'optimize_optimist' => $managerLogic->getCacheName($item['deploy_optimize']['optimist_mid'] ?? 0), //优化师
|
|
|
|
'optimize_assist' => $managerLogic->getCacheName($item['deploy_optimize']['assist_mid'] ?? 0), //优化助理
|
|
|
|
'optimize_tech' => $managerLogic->getCacheName($item['deploy_optimize']['tech_mid'] ?? 0), //售后技术
|
|
|
|
'type' => $item['type'],
|
|
|
|
'test_domain' => $item['deploy_build']['test_domain'] ?? 0,
|
|
|
|
'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' => $data['product'] ?? 0,
|
|
|
|
'keyword_num' => $item['deploy_build']['keyword_num'] ?? 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,
|
|
|
|
'qa_status'=>$item['online_check']['qa_status'] ?? 0,
|
|
|
|
'service_day'=>$item['deploy_build']['service_duration'] - $this->compliance_day($item['id']),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
return $list;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $yesterday
|
|
|
|
* @name :(服务达标天数)compliance_day
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/14 15:48
|
|
|
|
*/
|
|
|
|
public function compliance_day($project_id){
|
|
|
|
//服务达标天数
|
|
|
|
$rank_info = DB::table('gl_rank_data')->where(['project_id'=>$project_id,'lang'=>''])->select(['compliance_day'])->first();
|
|
|
|
if(empty($rank_info)){
|
|
|
|
$compliance_day = 0;
|
|
|
|
}else{
|
|
|
|
$compliance_day = $rank_info->compliance_day;
|
|
|
|
}
|
|
|
|
return $compliance_day;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取当前数据详情
|
|
|
|
* @name :getProjectInfo
|
|
...
|
...
|
@@ -130,6 +69,160 @@ class ProjectLogic extends BaseLogic |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存项目数据
|
|
|
|
* @name :projectSave
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/30 11:57
|
|
|
|
*/
|
|
|
|
public function projectSave(){
|
|
|
|
// DB::beginTransaction();
|
|
|
|
// try {
|
|
|
|
$this->createProjectData($this->param);
|
|
|
|
//保存项目信息
|
|
|
|
$this->saveProject($this->param);
|
|
|
|
//保存建站部署信息
|
|
|
|
$this->saveProjectDeployBuild($this->param['deploy_build']);
|
|
|
|
//保存付费信息
|
|
|
|
$this->saveProjectPayment($this->param['payment']);
|
|
|
|
//保存优化信息
|
|
|
|
$this->saveProjectDeployOptimize($this->param['deploy_optimize']);
|
|
|
|
//保存售后信息
|
|
|
|
$this->saveProjectAfter($this->param['deploy_build']);
|
|
|
|
// }catch (\Exception $e){
|
|
|
|
// DB::rollBack();
|
|
|
|
// $this->fail('error');
|
|
|
|
// }
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :未续费项目单独保存
|
|
|
|
* @name :setExtendType
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/30 12:14
|
|
|
|
*/
|
|
|
|
public function saveProject($param){
|
|
|
|
//未续费项目
|
|
|
|
if($param['type'] == Project::TYPE_FIVE){
|
|
|
|
$param['extend_type'] == Project::TYPE_FIVE;
|
|
|
|
unset($param['type']);
|
|
|
|
}
|
|
|
|
if(isset($param['level']) && !empty($param['level'])){
|
|
|
|
$param['level'] = Arr::arrToSet($param['level']);
|
|
|
|
}
|
|
|
|
if(isset($param['channel']) && !empty($param['channel'])){
|
|
|
|
$param['channel'] = Arr::a2s($param['channel']);
|
|
|
|
}
|
|
|
|
if(isset($param['notice_file']) && !empty($param['notice_file'])){
|
|
|
|
foreach ($param['notice_file'] as &$v1) {
|
|
|
|
$v1['url'] = basename($v1['url']);
|
|
|
|
}
|
|
|
|
$param['notice_file'] = Arr::a2s($param['notice_file']);
|
|
|
|
}
|
|
|
|
if(isset($param['confirm_file']) && !empty($param['confirm_file'])){
|
|
|
|
foreach ($param['confirm_file'] as &$v2) {
|
|
|
|
$v2['url'] = basename($v2['url']);
|
|
|
|
}
|
|
|
|
$param['confirm_file'] = Arr::a2s($param['confirm_file']);
|
|
|
|
}
|
|
|
|
$this->model->edit($param,['id'=>$param['id']]);
|
|
|
|
Common::del_user_cache($this->model->getTable(),$param['id']);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存付款续费
|
|
|
|
* @name :savePayment
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/29 16:19
|
|
|
|
*/
|
|
|
|
protected function saveProjectPayment($payment){
|
|
|
|
$paymentModel = new Payment();
|
|
|
|
// $payment['contract'] = Arr::a2s($payment['contract']);
|
|
|
|
if(isset($payment['renewal_record']) && !empty($payment['renewal_record'])){
|
|
|
|
$payment['renewal_record'] = Arr::a2s($payment['renewal_record']);
|
|
|
|
}
|
|
|
|
$paymentModel->edit($payment,['id'=>$payment['id']]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存建站部署
|
|
|
|
* @name :saveDeployBuild
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/29 16:19
|
|
|
|
*/
|
|
|
|
protected function saveProjectDeployBuild($deploy_build){
|
|
|
|
$deployBuildModel = new DeployBuild();
|
|
|
|
$deployBuildModel->edit($deploy_build,['id'=>$deploy_build['id']]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存优化部署
|
|
|
|
* @name :saveDeployOptimize
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/30 13:45
|
|
|
|
*/
|
|
|
|
protected function saveProjectDeployOptimize($deploy_optimize){
|
|
|
|
if(isset($deploy_optimize['domain']) && !$deploy_optimize($deploy_optimize['domain'])){
|
|
|
|
if (!preg_match('/http/', $deploy_optimize['domain'])) {
|
|
|
|
$deploy_optimize['domain'] = 'https://'.trim($deploy_optimize['domain'],'/').'/';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(isset($deploy_optimize['minor_languages']) && !empty($deploy_optimize['minor_languages'])){
|
|
|
|
$deploy_optimize['minor_languages'] = Arr::a2s($deploy_optimize['minor_languages']);
|
|
|
|
}
|
|
|
|
$this->model->edit($deploy_optimize,['id'=>$this->param['id']]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存为售后部署
|
|
|
|
* @name :saveProjectAfter
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/30 13:57
|
|
|
|
*/
|
|
|
|
protected function saveProjectAfter($project_after){
|
|
|
|
//查询数据是否存在
|
|
|
|
$afterModel = new After();
|
|
|
|
$afterModel->edit($project_after,['id'=>$project_after['id']]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :创建初始数据
|
|
|
|
* @name :createProjectData
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/30 14:30
|
|
|
|
*/
|
|
|
|
public function createProjectData($param){
|
|
|
|
//创建默认数据库
|
|
|
|
if($param['type'] == Project::TYPE_ONE){
|
|
|
|
//初始化数据库
|
|
|
|
if(isset($param['mysql_id']) && !empty($param['mysql_id'])){
|
|
|
|
$this->initializationMysql($param['id']);
|
|
|
|
}
|
|
|
|
//初始账号
|
|
|
|
if(isset($param['mobile']) && !empty($param['mobile'])){
|
|
|
|
$this->createUser($param['mobile'],$param['id'],$param['lead_name']);
|
|
|
|
}
|
|
|
|
//更改服务器状态
|
|
|
|
if(isset($param['serve_id']) && !empty($param['serve_id'])){
|
|
|
|
$this->updateServe($param['serve_id']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存项目配置数据
|
|
|
|
* @name :save
|
|
|
|
* @author :lyh
|
|
...
|
...
|
@@ -145,7 +238,6 @@ class ProjectLogic extends BaseLogic |
|
|
|
}
|
|
|
|
$res = parent::save($param);
|
|
|
|
$param['id'] = $res['id'];
|
|
|
|
Common::del_user_cache($this->model->getTable(),$param['id']);
|
|
|
|
$this->savePayment($param);
|
|
|
|
$this->saveDeployBuild($param);
|
|
|
|
$this->saveDeployOptimize($param);
|
|
...
|
...
|
@@ -203,6 +295,8 @@ class ProjectLogic extends BaseLogic |
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :创建用户
|
|
|
|
* @name :createUser
|
...
|
...
|
|