作者 lyh

gx

@@ -80,26 +80,6 @@ class ServerConfigLogic extends BaseLogic @@ -80,26 +80,6 @@ class ServerConfigLogic extends BaseLogic
80 return $this->success(); 80 return $this->success();
81 } 81 }
82 82
83 -  
84 - /**  
85 - * @remark :初始化数据库  
86 - * @name :initializationMysql  
87 - * @author :lyh  
88 - * @method :post  
89 - * @time :2023/8/4 15:08  
90 - */  
91 - public function initializationMysql($param){  
92 - if ($param['type'] == ServerConfig::TYPE_MYSQL) {  
93 - //切换数据库配置  
94 - $project = ProjectServer::useProject($param['project_id']);  
95 - //创建数据库  
96 - ProjectServer::createDatabase($project);  
97 - //创建表  
98 - ProjectServer::initTable($project);  
99 - }  
100 - return true;  
101 - }  
102 -  
103 /** 83 /**
104 * @remark :删除记录 84 * @remark :删除记录
105 * @name :delServiceConfig 85 * @name :delServiceConfig
@@ -24,6 +24,7 @@ use App\Models\Project\DeployOptimize; @@ -24,6 +24,7 @@ use App\Models\Project\DeployOptimize;
24 use App\Models\Project\Payment; 24 use App\Models\Project\Payment;
25 use App\Models\Project\Project; 25 use App\Models\Project\Project;
26 use App\Models\Task\Task; 26 use App\Models\Task\Task;
  27 +use App\Services\ProjectServer;
27 use App\Utils\EncryptUtils; 28 use App\Utils\EncryptUtils;
28 use Hashids\Hashids; 29 use Hashids\Hashids;
29 use Illuminate\Support\Facades\Cache; 30 use Illuminate\Support\Facades\Cache;
@@ -149,6 +150,10 @@ class ProjectLogic extends BaseLogic @@ -149,6 +150,10 @@ class ProjectLogic extends BaseLogic
149 $this->saveDeployBuild($param); 150 $this->saveDeployBuild($param);
150 $this->saveDeployOptimize($param); 151 $this->saveDeployOptimize($param);
151 $this->saveAfter($param); 152 $this->saveAfter($param);
  153 + if(isset($param['mysql_id']) && !empty($param['mysql_id'])){
  154 + $this->initializationMysql($res['id']);
  155 + }
  156 + //创建数据库
152 DB::commit(); 157 DB::commit();
153 }catch (\Exception $e){ 158 }catch (\Exception $e){
154 DB::rollBack(); 159 DB::rollBack();
@@ -159,6 +164,22 @@ class ProjectLogic extends BaseLogic @@ -159,6 +164,22 @@ class ProjectLogic extends BaseLogic
159 } 164 }
160 165
161 /** 166 /**
  167 + * @remark :初始化数据库
  168 + * @name :initializationMysql
  169 + * @author :lyh
  170 + * @method :post
  171 + * @time :2023/8/4 15:08
  172 + */
  173 + public function initializationMysql($project_id){
  174 + //切换数据库配置
  175 + $project = ProjectServer::useProject($project_id);
  176 + //创建数据库
  177 + ProjectServer::createDatabase($project);
  178 + //创建表
  179 + ProjectServer::initTable($project);
  180 + return true;
  181 + }
  182 + /**
162 * @remark :验证域名 183 * @remark :验证域名
163 * @name :verifyDomain 184 * @name :verifyDomain
164 * @author :lyh 185 * @author :lyh