正在显示
7 个修改的文件
包含
42 行增加
和
7 行删除
| @@ -56,7 +56,7 @@ class BaseController extends Controller | @@ -56,7 +56,7 @@ class BaseController extends Controller | ||
| 56 | if(is_array($v)){ | 56 | if(is_array($v)){ |
| 57 | $this->getParam(); | 57 | $this->getParam(); |
| 58 | }else{ | 58 | }else{ |
| 59 | - if(empty($v)){ | 59 | + if(empty($v) && ($v != 0)){ |
| 60 | unset($this->param[$k]); | 60 | unset($this->param[$k]); |
| 61 | } | 61 | } |
| 62 | $this->getMap($k,$v); | 62 | $this->getMap($k,$v); |
| @@ -101,6 +101,7 @@ class ProjectController extends BaseController | @@ -101,6 +101,7 @@ class ProjectController extends BaseController | ||
| 101 | */ | 101 | */ |
| 102 | public function save(ProjectRequest $request, ProjectLogic $logic) | 102 | public function save(ProjectRequest $request, ProjectLogic $logic) |
| 103 | { | 103 | { |
| 104 | + $request->validated(); | ||
| 104 | $logic->save($this->param); | 105 | $logic->save($this->param); |
| 105 | $this->response('success'); | 106 | $this->response('success'); |
| 106 | } | 107 | } |
| @@ -35,6 +35,12 @@ class DomainInfoLogic extends BaseLogic | @@ -35,6 +35,12 @@ class DomainInfoLogic extends BaseLogic | ||
| 35 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 35 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 36 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | 36 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 37 | }else{ | 37 | }else{ |
| 38 | + $data = $this->getDomainInfo($this->param['domain']); | ||
| 39 | + if(!empty($data['domain_start_time']) && !empty($data['domain_end_time'])){ | ||
| 40 | + $this->param['domain_start_time'] = $data['domain_start_time']; | ||
| 41 | + $this->param['domain_end_time'] = $data['domain_end_time']; | ||
| 42 | + } | ||
| 43 | + | ||
| 38 | $rs = $this->model->add($this->param); | 44 | $rs = $this->model->add($this->param); |
| 39 | } | 45 | } |
| 40 | if($rs === false){ | 46 | if($rs === false){ |
| @@ -82,6 +88,13 @@ class DomainInfoLogic extends BaseLogic | @@ -82,6 +88,13 @@ class DomainInfoLogic extends BaseLogic | ||
| 82 | * @time :2023/8/1 15:43 | 88 | * @time :2023/8/1 15:43 |
| 83 | */ | 89 | */ |
| 84 | public function editDomainStatus(){ | 90 | public function editDomainStatus(){ |
| 91 | + //查看当前域名是否有项目在使用 | ||
| 92 | + if($this->param['status'] != $this->model::STATUS_ONE){ | ||
| 93 | + $info = $this->model->read(['id'=>$this->param['id']]); | ||
| 94 | + if($info === false){ | ||
| 95 | + $this->fail('当前域名有项目正在使用中'); | ||
| 96 | + } | ||
| 97 | + } | ||
| 85 | $rs = $this->model->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]); | 98 | $rs = $this->model->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]); |
| 86 | if($rs === false){ | 99 | if($rs === false){ |
| 87 | $this->fail('error'); | 100 | $this->fail('error'); |
| @@ -15,6 +15,7 @@ use App\Models\Channel\Channel; | @@ -15,6 +15,7 @@ use App\Models\Channel\Channel; | ||
| 15 | use App\Models\Channel\User; | 15 | use App\Models\Channel\User; |
| 16 | use App\Models\Channel\Zone; | 16 | use App\Models\Channel\Zone; |
| 17 | use App\Models\Devops\ServerConfig; | 17 | use App\Models\Devops\ServerConfig; |
| 18 | +use App\Models\Domain\DomainInfo; | ||
| 18 | use App\Models\Inquiry\InquirySet; | 19 | use App\Models\Inquiry\InquirySet; |
| 19 | use App\Models\Manage\Manage; | 20 | use App\Models\Manage\Manage; |
| 20 | use App\Models\News\News; | 21 | use App\Models\News\News; |
| @@ -48,6 +49,8 @@ class ProjectLogic extends BaseLogic | @@ -48,6 +49,8 @@ class ProjectLogic extends BaseLogic | ||
| 48 | { | 49 | { |
| 49 | 50 | ||
| 50 | parent::setWith(['payment', 'deploy_build', 'deploy_optimize','online_check']); | 51 | parent::setWith(['payment', 'deploy_build', 'deploy_optimize','online_check']); |
| 52 | + var_dump($map); | ||
| 53 | + die(); | ||
| 51 | $list = parent::getList($map, $sort, ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'created_at'], $limit); | 54 | $list = parent::getList($map, $sort, ['id', 'title', 'mysql_id' ,'channel','cooperate_date' ,'type', 'created_at'], $limit); |
| 52 | $managerLogic = new ManageLogic(); | 55 | $managerLogic = new ManageLogic(); |
| 53 | foreach ($list['list'] as &$item){ | 56 | foreach ($list['list'] as &$item){ |
| @@ -152,6 +155,9 @@ class ProjectLogic extends BaseLogic | @@ -152,6 +155,9 @@ class ProjectLogic extends BaseLogic | ||
| 152 | if(isset($param['mysql_id']) && !empty($param['mysql_id'])){ | 155 | if(isset($param['mysql_id']) && !empty($param['mysql_id'])){ |
| 153 | $this->initializationMysql($res['id']); | 156 | $this->initializationMysql($res['id']); |
| 154 | } | 157 | } |
| 158 | + if(isset($param['serve_id']) && !empty($param['serve_id'])){ | ||
| 159 | + $this->updateServe($param['serve_id']); | ||
| 160 | + } | ||
| 155 | DB::commit(); | 161 | DB::commit(); |
| 156 | }catch (\Exception $e){ | 162 | }catch (\Exception $e){ |
| 157 | DB::rollBack(); | 163 | DB::rollBack(); |
| @@ -174,7 +180,20 @@ class ProjectLogic extends BaseLogic | @@ -174,7 +180,20 @@ class ProjectLogic extends BaseLogic | ||
| 174 | ProjectServer::createDatabase($project); | 180 | ProjectServer::createDatabase($project); |
| 175 | //创建表 | 181 | //创建表 |
| 176 | ProjectServer::initTable($project); | 182 | ProjectServer::initTable($project); |
| 177 | - return true; | 183 | + return $this->success(); |
| 184 | + } | ||
| 185 | + | ||
| 186 | + /** | ||
| 187 | + * @remark :更新服务器为已使用 | ||
| 188 | + * @name :updateServe | ||
| 189 | + * @author :lyh | ||
| 190 | + * @method :post | ||
| 191 | + * @time :2023/8/28 10:50 | ||
| 192 | + */ | ||
| 193 | + public function updateServe($serve_id){ | ||
| 194 | + $domainModel = new DomainInfo(); | ||
| 195 | + $domainModel->edit(['status'=>$domainModel::STATUS_ONE],['id'=>$serve_id]); | ||
| 196 | + return $this->success(); | ||
| 178 | } | 197 | } |
| 179 | /** | 198 | /** |
| 180 | * @remark :验证域名 | 199 | * @remark :验证域名 |
| @@ -57,12 +57,12 @@ class ServiceLogic extends BaseLogic | @@ -57,12 +57,12 @@ class ServiceLogic extends BaseLogic | ||
| 57 | */ | 57 | */ |
| 58 | public function serviceSave(){ | 58 | public function serviceSave(){ |
| 59 | //删除以前的配置 | 59 | //删除以前的配置 |
| 60 | -// try { | 60 | + try { |
| 61 | $this->model->del(['type'=>1]); | 61 | $this->model->del(['type'=>1]); |
| 62 | $this->model->insert($this->param['data']); | 62 | $this->model->insert($this->param['data']); |
| 63 | -// }catch (\Exception $e){ | ||
| 64 | -// $this->fail('error'); | ||
| 65 | -// } | 63 | + }catch (\Exception $e){ |
| 64 | + $this->fail('error'); | ||
| 65 | + } | ||
| 66 | return $this->success(); | 66 | return $this->success(); |
| 67 | } | 67 | } |
| 68 | 68 |
| @@ -14,6 +14,8 @@ use App\Models\Base; | @@ -14,6 +14,8 @@ use App\Models\Base; | ||
| 14 | */ | 14 | */ |
| 15 | class DomainInfo extends Base | 15 | class DomainInfo extends Base |
| 16 | { | 16 | { |
| 17 | + const STATUS_ONE = 1; | ||
| 18 | + | ||
| 17 | public $btAction = [ | 19 | public $btAction = [ |
| 18 | 'create_site' => '/site?action=AddSite', | 20 | 'create_site' => '/site?action=AddSite', |
| 19 | ]; | 21 | ]; |
-
请 注册 或 登录 后发表评论