作者 赵彬吉

update

... ... @@ -2,7 +2,8 @@
namespace App\Http\Logic\Aside;
use App\Models\Product\Product;
use App\Http\Logic\Aside\User\ProjectLogic;
use App\Models\ServerConfig;
use Illuminate\Support\Facades\DB;
... ... @@ -28,18 +29,22 @@ class ServerConfigLogic extends BaseLogic
try {
$res = parent::save($param);
$data = ['sql_id' => $res['id']];
$data['id'] = $param['project_id'];
if ($param['type'] == ServerConfig::TYPE_SERVER) {
$data = ['serve_id' => $res['id']];
$data['serve_id'] = $res['id'];
}else{
$data['mysql_id'] = $res['id'];
}
ProjectLogic::save($data);
//todo 创建数据库 初始化表
(new ProjectLogic)->save($data);
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
dump($e->getMessage());
$this->fail('保存失败');
}
return $this->success();
}
}
... ...
... ... @@ -25,6 +25,9 @@ class ServerConfig extends Base
*/
protected $guarded = ['updated_at'];
const UPDATED_AT = null;
/**
* 1:服务器, 2:MySQL, 3:Redis
*/
... ...