作者 赵彬吉

update

@@ -2,7 +2,8 @@ @@ -2,7 +2,8 @@
2 2
3 namespace App\Http\Logic\Aside; 3 namespace App\Http\Logic\Aside;
4 4
5 -use App\Models\Product\Product; 5 +
  6 +use App\Http\Logic\Aside\User\ProjectLogic;
6 use App\Models\ServerConfig; 7 use App\Models\ServerConfig;
7 use Illuminate\Support\Facades\DB; 8 use Illuminate\Support\Facades\DB;
8 9
@@ -28,18 +29,22 @@ class ServerConfigLogic extends BaseLogic @@ -28,18 +29,22 @@ class ServerConfigLogic extends BaseLogic
28 try { 29 try {
29 $res = parent::save($param); 30 $res = parent::save($param);
30 31
31 - $data = ['sql_id' => $res['id']]; 32 + $data['id'] = $param['project_id'];
32 if ($param['type'] == ServerConfig::TYPE_SERVER) { 33 if ($param['type'] == ServerConfig::TYPE_SERVER) {
33 - $data = ['serve_id' => $res['id']]; 34 + $data['serve_id'] = $res['id'];
  35 + }else{
  36 + $data['mysql_id'] = $res['id'];
34 } 37 }
35 - ProjectLogic::save($data); 38 +
  39 + //todo 创建数据库 初始化表
  40 +
  41 + (new ProjectLogic)->save($data);
36 42
37 DB::commit(); 43 DB::commit();
38 } catch (\Exception $e) { 44 } catch (\Exception $e) {
39 DB::rollBack(); 45 DB::rollBack();
40 -  
41 - dump($e->getMessage());  
42 $this->fail('保存失败'); 46 $this->fail('保存失败');
43 } 47 }
  48 + return $this->success();
44 } 49 }
45 } 50 }
@@ -25,6 +25,9 @@ class ServerConfig extends Base @@ -25,6 +25,9 @@ class ServerConfig extends Base
25 */ 25 */
26 protected $guarded = ['updated_at']; 26 protected $guarded = ['updated_at'];
27 27
  28 + const UPDATED_AT = null;
  29 +
  30 +
28 /** 31 /**
29 * 1:服务器, 2:MySQL, 3:Redis 32 * 1:服务器, 2:MySQL, 3:Redis
30 */ 33 */