作者 lyh

gx

@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Http\Logic\Aside\Project; 3 namespace App\Http\Logic\Aside\Project;
4 4
  5 +use App\Models\Devops\ServerConfig;
5 use Illuminate\Support\Arr as SupArr; 6 use Illuminate\Support\Arr as SupArr;
6 use App\Helper\Arr; 7 use App\Helper\Arr;
7 use App\Helper\Common; 8 use App\Helper\Common;
@@ -228,6 +229,10 @@ class ProjectLogic extends BaseLogic @@ -228,6 +229,10 @@ class ProjectLogic extends BaseLogic
228 if(isset($param['serve_id']) && !empty($param['serve_id'])){ 229 if(isset($param['serve_id']) && !empty($param['serve_id'])){
229 $this->updateServe($param['serve_id']); 230 $this->updateServe($param['serve_id']);
230 } 231 }
  232 + //更改域名
  233 + if(isset($param['domain']) && !empty($param['domain'])){
  234 + $this->editDomainStatus($param['domain'],$param['id']);
  235 + }
231 } 236 }
232 return $this->success(); 237 return $this->success();
233 } 238 }
@@ -258,8 +263,8 @@ class ProjectLogic extends BaseLogic @@ -258,8 +263,8 @@ class ProjectLogic extends BaseLogic
258 * @time :2023/8/28 10:50 263 * @time :2023/8/28 10:50
259 */ 264 */
260 public function updateServe($serve_id){ 265 public function updateServe($serve_id){
261 - $domainModel = new DomainInfo();  
262 - $domainModel->edit(['status'=>$domainModel::STATUS_ONE],['id'=>$serve_id]); 266 + $serverModel = new ServerConfig();
  267 + $serverModel->edit(['status'=>$serverModel::STATUS_ONE],['id'=>$serve_id]);
263 return $this->success(); 268 return $this->success();
264 } 269 }
265 270
@@ -355,7 +360,21 @@ class ProjectLogic extends BaseLogic @@ -355,7 +360,21 @@ class ProjectLogic extends BaseLogic
355 } 360 }
356 361
357 362
358 - 363 + /**
  364 + * @remark :修改域名时,同时更改其状态
  365 + * @name :domainStatus
  366 + * @author :lyh
  367 + * @method :post
  368 + * @time :2023/9/4 14:29
  369 + */
  370 + public function editDomainStatus($domain,$project_id){
  371 + $domainModel = new DomainInfo();
  372 + //先清空上一次所绑定的域名
  373 + $domainModel->edit(['status'=>DomainInfo::STATUS_ZERO],['project_id'=>$project_id]);
  374 + //重新设置域名
  375 + $domainModel->edit(['status'=>DomainInfo::STATUS_ONE,'project_id'=>$project_id],['domain'=>$domain]);
  376 + return $this->success();
  377 + }
359 378
360 379
361 380
@@ -15,7 +15,7 @@ use App\Models\Base; @@ -15,7 +15,7 @@ use App\Models\Base;
15 class DomainInfo extends Base 15 class DomainInfo extends Base
16 { 16 {
17 const STATUS_ONE = 1; 17 const STATUS_ONE = 1;
18 - 18 + const STATUS_ZERO = 0;
19 public $btAction = [ 19 public $btAction = [
20 'create_site' => '/site?action=AddSite', 20 'create_site' => '/site?action=AddSite',
21 ]; 21 ];