Merge branch 'dev' of http://47.244.231.31:8099/zhl/globalso-v6 into dev
正在显示
7 个修改的文件
包含
110 行增加
和
74 行删除
| @@ -7,9 +7,7 @@ namespace App\Console\Commands; | @@ -7,9 +7,7 @@ namespace App\Console\Commands; | ||
| 7 | 7 | ||
| 8 | use App\Helper\Arr; | 8 | use App\Helper\Arr; |
| 9 | use Illuminate\Console\Command; | 9 | use Illuminate\Console\Command; |
| 10 | -use Illuminate\Support\Facades\Artisan; | ||
| 11 | use Illuminate\Support\Facades\DB; | 10 | use Illuminate\Support\Facades\DB; |
| 12 | -use Symfony\Component\Process\Process; | ||
| 13 | 11 | ||
| 14 | class DiffDb extends Command | 12 | class DiffDb extends Command |
| 15 | { | 13 | { |
| @@ -34,21 +32,12 @@ class DiffDb extends Command | @@ -34,21 +32,12 @@ class DiffDb extends Command | ||
| 34 | 32 | ||
| 35 | public function handle() | 33 | public function handle() |
| 36 | { | 34 | { |
| 37 | - //C端 | ||
| 38 | -// $process = new Process(['git', 'pull']); | ||
| 39 | -// $process->run(); | ||
| 40 | -// dump($process->getExitCodeText()); | ||
| 41 | -// dump($process->getExitCode()); | ||
| 42 | -// dump($process->getErrorOutput()); | ||
| 43 | -// $output = explode(PHP_EOL, $process->getOutput()); | ||
| 44 | -// dump($output); | ||
| 45 | -// exit; | ||
| 46 | $custom_mysql_config = [ | 35 | $custom_mysql_config = [ |
| 47 | - 'database.connections.custom_mysql.host' => '43.154.15.250', | ||
| 48 | - 'database.connections.custom_mysql.port' => '6063', | ||
| 49 | - 'database.connections.custom_mysql.database' => 'globalso_v6', | ||
| 50 | - 'database.connections.custom_mysql.username' => 'globalso_v6', | ||
| 51 | - 'database.connections.custom_mysql.password' => 'PFxFdzj4ha6w7T3j', | 36 | + 'database.connections.custom_mysql.host' => '127.0.0.1', |
| 37 | + 'database.connections.custom_mysql.port' => '3306', | ||
| 38 | + 'database.connections.custom_mysql.database' => 'globalso_project_1', | ||
| 39 | + 'database.connections.custom_mysql.username' => 'root', | ||
| 40 | + 'database.connections.custom_mysql.password' => 'root', | ||
| 52 | ]; | 41 | ]; |
| 53 | config($custom_mysql_config); | 42 | config($custom_mysql_config); |
| 54 | 43 |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Aside\Devops; | ||
| 4 | + | ||
| 5 | +use App\Http\Controllers\Bside\BaseController; | ||
| 6 | + | ||
| 7 | +use App\Http\Logic\Aside\Devops\ServerConfigLogic; | ||
| 8 | +use App\Http\Requests\Aside\Devops\ServerConfigRequest; | ||
| 9 | +use Illuminate\Http\Request; | ||
| 10 | +use Illuminate\Support\Str; | ||
| 11 | +use Illuminate\Validation\Rule; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 项目服务器、数据库配置 | ||
| 15 | + * Class ServerConfigController | ||
| 16 | + * @package App\Http\Controllers\Aside | ||
| 17 | + * @author zbj | ||
| 18 | + * @date 2023/4/24 | ||
| 19 | + */ | ||
| 20 | +class ServerConfigController extends BaseController | ||
| 21 | +{ | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 保存配置 | ||
| 25 | + * @param ServerConfigRequest $request | ||
| 26 | + * @param ServerConfigLogic $logic | ||
| 27 | + * @author zbj | ||
| 28 | + * @date 2023/4/23 | ||
| 29 | + */ | ||
| 30 | + public function save(ServerConfigRequest $request, ServerConfigLogic $logic){ | ||
| 31 | + $data = $logic->save($this->param); | ||
| 32 | + return $this->success($data); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 更新表结构 | ||
| 37 | + * @param ServerConfigLogic $logic | ||
| 38 | + * @author zbj | ||
| 39 | + * @date 2023/4/24 | ||
| 40 | + */ | ||
| 41 | + public function updateDatabase(Request $request, ServerConfigLogic $logic){ | ||
| 42 | + $request->validate([ | ||
| 43 | + 'type' => 'in:1,2,3', | ||
| 44 | + 'id'=> Rule::requiredIf($request->type == 1), | ||
| 45 | + 'sql' => ['required', function ($attribute, $value, $fail) { | ||
| 46 | + if(Str::contains(Str::lower($value), ['drop', 'delete', 'truncate'])){ | ||
| 47 | + $fail('危险操作'); | ||
| 48 | + } | ||
| 49 | + }] | ||
| 50 | + ],[ | ||
| 51 | + 'id.required' => 'ID不能为空', | ||
| 52 | + 'sql.required' => '请输入Sql语句', | ||
| 53 | + ]); | ||
| 54 | + | ||
| 55 | + switch ($this->param['type']){ | ||
| 56 | + case "1": | ||
| 57 | + $data = $logic->updateTable($this->param); | ||
| 58 | + break; | ||
| 59 | + case "2": | ||
| 60 | + $data = $logic->updateLocalTable($this->param); | ||
| 61 | + break; | ||
| 62 | + case "3": | ||
| 63 | + $data = $logic->updateAllTable($this->param); | ||
| 64 | + break; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + return $this->success($data); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * 更新代码 | ||
| 72 | + * @param ServerConfigLogic $logic | ||
| 73 | + * @author zbj | ||
| 74 | + * @date 2023/4/24 | ||
| 75 | + */ | ||
| 76 | + public function updateCode(){ | ||
| 77 | + //todo | ||
| 78 | + //C端 | ||
| 79 | +// $process = new Process(['git', 'pull']); | ||
| 80 | +// $process->run(); | ||
| 81 | +// dump($process->getExitCodeText()); | ||
| 82 | +// dump($process->getExitCode()); | ||
| 83 | +// dump($process->getErrorOutput()); | ||
| 84 | +// $output = explode(PHP_EOL, $process->getOutput()); | ||
| 85 | +// dump($output); | ||
| 86 | +// exit; | ||
| 87 | + } | ||
| 88 | +} |
| @@ -5,13 +5,7 @@ namespace App\Http\Controllers\Aside; | @@ -5,13 +5,7 @@ namespace App\Http\Controllers\Aside; | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Http\Controllers\Bside\BaseController; | 6 | use App\Http\Controllers\Bside\BaseController; |
| 7 | 7 | ||
| 8 | -use App\Http\Logic\Aside\ServerConfigLogic; | ||
| 9 | -use App\Http\Requests\Aside\ServerConfigRequest; | ||
| 10 | use App\Models\Project as ProjectModel; | 8 | use App\Models\Project as ProjectModel; |
| 11 | -use Illuminate\Http\Request; | ||
| 12 | -use Illuminate\Support\Str; | ||
| 13 | -use Illuminate\Validation\Rule; | ||
| 14 | -use Illuminate\Validation\ValidationException; | ||
| 15 | 9 | ||
| 16 | /** | 10 | /** |
| 17 | * @name:项目信息 | 11 | * @name:项目信息 |
| @@ -39,51 +33,4 @@ class ProjectController extends BaseController | @@ -39,51 +33,4 @@ class ProjectController extends BaseController | ||
| 39 | public function add(){ | 33 | public function add(){ |
| 40 | $projectModel = new ProjectModel(); | 34 | $projectModel = new ProjectModel(); |
| 41 | } | 35 | } |
| 42 | - | ||
| 43 | - /** | ||
| 44 | - * 保存配置 | ||
| 45 | - * @param ServerConfigRequest $request | ||
| 46 | - * @param ServerConfigLogic $logic | ||
| 47 | - * @author zbj | ||
| 48 | - * @date 2023/4/23 | ||
| 49 | - */ | ||
| 50 | - public function saveServerConfig(ServerConfigRequest $request, ServerConfigLogic $logic){ | ||
| 51 | - $data = $logic->save($this->param); | ||
| 52 | - return $this->success($data); | ||
| 53 | - } | ||
| 54 | - | ||
| 55 | - /** | ||
| 56 | - * 更新表结构 | ||
| 57 | - * @param ServerConfigLogic $logic | ||
| 58 | - * @author zbj | ||
| 59 | - * @date 2023/4/24 | ||
| 60 | - */ | ||
| 61 | - public function updateDatabase(Request $request, ServerConfigLogic $logic){ | ||
| 62 | - $request->validate([ | ||
| 63 | - 'type' => 'in:1,2,3', | ||
| 64 | - 'id'=> Rule::requiredIf($request->type == 1), | ||
| 65 | - 'sql' => ['required', function ($attribute, $value, $fail) { | ||
| 66 | - if(Str::contains(Str::lower($value), ['drop', 'delete', 'truncate'])){ | ||
| 67 | - $fail('危险操作'); | ||
| 68 | - } | ||
| 69 | - }] | ||
| 70 | - ],[ | ||
| 71 | - 'id.required' => 'ID不能为空', | ||
| 72 | - 'sql.required' => '请输入Sql语句', | ||
| 73 | - ]); | ||
| 74 | - | ||
| 75 | - switch ($this->param['type']){ | ||
| 76 | - case "1": | ||
| 77 | - $data = $logic->updateTable($this->param); | ||
| 78 | - break; | ||
| 79 | - case "2": | ||
| 80 | - $data = $logic->updateLocalTable($this->param); | ||
| 81 | - break; | ||
| 82 | - case "3": | ||
| 83 | - $data = $logic->updateAllTable($this->param); | ||
| 84 | - break; | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - return $this->success($data); | ||
| 88 | - } | ||
| 89 | } | 36 | } |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | -namespace App\Http\Logic\Aside; | 3 | +namespace App\Http\Logic\Aside\Devops; |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 8 | +use App\Http\Logic\Aside\Project\ProjectLogic; | ||
| 7 | use App\Models\Project; | 9 | use App\Models\Project; |
| 8 | use App\Models\ServerConfig; | 10 | use App\Models\ServerConfig; |
| 9 | use App\Services\ProjectServer; | 11 | use App\Services\ProjectServer; |
| @@ -44,8 +44,17 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w | @@ -44,8 +44,17 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w | ||
| 44 | 44 | ||
| 45 | //项目管理 | 45 | //项目管理 |
| 46 | Route::prefix('project')->group(function () { | 46 | Route::prefix('project')->group(function () { |
| 47 | - Route::post('/save_server_config', [Aside\ProjectController::class, 'saveServerConfig'])->name('admin.project.save_server_config'); | ||
| 48 | - Route::post('/update_database', [Aside\ProjectController::class, 'updateDatabase'])->name('admin.project.update_database'); | 47 | + |
| 48 | + }); | ||
| 49 | + | ||
| 50 | + //运维 | ||
| 51 | + Route::prefix('devops')->group(function () { | ||
| 52 | + //服务器配置 | ||
| 53 | + Route::prefix('server_config')->group(function () { | ||
| 54 | + Route::post('/save', [Aside\Devops\ServerConfigController::class, 'save'])->name('admin.devops.server_config.save'); | ||
| 55 | + Route::post('/update_database', [Aside\Devops\ServerConfigController::class, 'updateDatabase'])->name('admin.devops.server_config.update_database'); | ||
| 56 | + Route::post('/update_code', [Aside\Devops\ServerConfigController::class, 'updateCode'])->name('admin.devops.server_config.update_code'); | ||
| 57 | + }); | ||
| 49 | }); | 58 | }); |
| 50 | 59 | ||
| 51 | }); | 60 | }); |
-
请 注册 或 登录 后发表评论