作者 lyh

gx

... ... @@ -18,6 +18,7 @@ use App\Models\Devops\ServerConfig;
use App\Models\Inquiry\InquirySet;
use App\Models\Manage\Manage;
use App\Models\News\News;
use App\Models\Project\After;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Payment;
... ... @@ -109,7 +110,8 @@ class ProjectLogic extends BaseLogic
*/
public function getProjectInfo($id){
$info = $this->model->with('payment')->with('deploy_build')
->with('deploy_optimize')->with('online_check')->where(['id'=>$id])->first();
->with('deploy_optimize')->with('online_check')
->with('project_after')->where(['id'=>$id])->first();
$info['online_check']['name'] = (new Manage())->read(['id'=>$info['online_check']['created_manage_id']])['name'] ?? '';
$info['deploy_optimize']['minor_keywords'] = json_decode($info['deploy_optimize']['minor_keywords']) ?? '';
if($info['extend_type'] != 0){
... ... @@ -126,18 +128,8 @@ class ProjectLogic extends BaseLogic
* @time :2023/8/17 14:19
*/
public function save($param){
if(!empty($param['deploy_optimize']['domain'])){
$param['deploy_optimize']['domain'] = checkDomain($param['deploy_optimize']['domain']);
if(!$param['deploy_optimize']['domain']){
$this->fail('正式域名格式不正确');
}
}
DB::beginTransaction();
try {
if(!empty($param['payment']['amount'])) unset($param['payment']['amount']);
if(!empty($param['deploy_build']['test_domain'])) unset($param['deploy_build']['test_domain']);
if(!empty($param['deploy_build']['plan'])) unset($param['deploy_build']['plan']);
if(!empty($param['deploy_optimize']['api_no'])) unset($param['deploy_optimize']['api_no']);
if($param['type'] == 5){
$param['extend_type'] == 5;
unset($param['type']);
... ... @@ -147,6 +139,7 @@ class ProjectLogic extends BaseLogic
$this->savePayment($param);
$this->saveDeployBuild($param);
$this->saveDeployOptimize($param);
$this->saveAfter($param);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
... ... @@ -157,6 +150,22 @@ class ProjectLogic extends BaseLogic
}
/**
* @remark :验证域名
* @name :verifyDomain
* @author :lyh
* @method :post
* @time :2023/8/17 16:22
*/
public function verifyDomain($domain){
if(!empty($domain)){
$domain = checkDomain($domain);
if(!$domain){
$this->fail('正式域名格式不正确');
}
return $this->success();
}
}
/**
* 保存付款续费
* @author zbj
* @date 2023/4/26
... ... @@ -207,7 +216,27 @@ class ProjectLogic extends BaseLogic
// Arr::forget($data, ['api_no']);
return (new DeployOptimizeLogic)->save($data);
}
/**
* 保存优化部署
* @author zbj
* @date 2023/4/26
*/
protected function saveAfter($param){
if(empty($param['project_after'])){
return true;
}
$data = $param['project_after'];
$data['project_id'] = $param['id'];
//查询数据是否存在
$afterModel = new After();
$info = $afterModel->read(['project_id'=>$data['project_id']]);
if($info === false){
$rs = $afterModel->add($data);
}else{
$rs = $afterModel->edit($data,['id'=>$info['id']]);
}
return $rs;
}
public function clearCache($id)
{
parent::clearCache($id);
... ...
<?php
/**
* @remark :
* @name :After.php
* @author :lyh
* @method :post
* @time :2023/8/17 16:12
*/
namespace App\Models\Project;
use App\Models\Base;
class After extends Base
{
protected $table = 'gl_project_after';
}
... ...
... ... @@ -164,6 +164,18 @@ class Project extends Base
return self::hasOne(DeployOptimize::class, 'project_id', 'id');
}
/**
* @remark :转售后
* @name :after
* @author :lyh
* @method :post
* @time :2023/8/17 16:24
*/
public function project_after()
{
return self::hasOne(After::class, 'project_id', 'id');
}
public function setLevelAttribute($value)
{
$this->attributes['level'] = Arr::arrToSet($value);
... ...