Merge branch 'develop' into zbj
正在显示
11 个修改的文件
包含
858 行增加
和
12 行删除
app/Console/Commands/ProjectInit.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * Created by PhpStorm. | ||
| 4 | + * User: zhl | ||
| 5 | + * Date: 2023/4/12 | ||
| 6 | + * Time: 15:33 | ||
| 7 | + */ | ||
| 8 | +namespace App\Console\Commands; | ||
| 9 | + | ||
| 10 | +use App\Models\Project; | ||
| 11 | +use Illuminate\Console\Command; | ||
| 12 | +use Illuminate\Support\Facades\DB; | ||
| 13 | +use Illuminate\Support\Facades\Schema; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * Class ProjectInitDatabase | ||
| 17 | + * @package App\Console\Commands | ||
| 18 | + */ | ||
| 19 | +class ProjectInit extends Command | ||
| 20 | +{ | ||
| 21 | + /** | ||
| 22 | + * The name and signature of the console command. | ||
| 23 | + * | ||
| 24 | + * @var string | ||
| 25 | + */ | ||
| 26 | + protected $signature = 'project:init'; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * The console command description. | ||
| 30 | + * | ||
| 31 | + * @var string | ||
| 32 | + */ | ||
| 33 | + protected $description = '项目数据库初始化'; | ||
| 34 | + | ||
| 35 | + protected $connect = null; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * Create a new command instance. | ||
| 39 | + * | ||
| 40 | + * @return void | ||
| 41 | + */ | ||
| 42 | + public function __construct() | ||
| 43 | + { | ||
| 44 | + parent::__construct(); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * @return bool | ||
| 49 | + */ | ||
| 50 | + public function handle() | ||
| 51 | + { | ||
| 52 | + #TODO 通过项目ID获取项目部署数据库配置, 创建数据库, 同步数据表 | ||
| 53 | + $project_id = 102; | ||
| 54 | + $project = Project::getProjectById($project_id); | ||
| 55 | + if (empty($project) || empty($project->mysqlConfig())) | ||
| 56 | + return true; | ||
| 57 | + $this->initDatabase($project); | ||
| 58 | + | ||
| 59 | + return true; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * @param Project $project | ||
| 64 | + * @return bool | ||
| 65 | + */ | ||
| 66 | + public function initDatabase($project) | ||
| 67 | + { | ||
| 68 | + $create_flag = $this->createDatabase($project); | ||
| 69 | + | ||
| 70 | + if (!$create_flag) { | ||
| 71 | + // 创建数据库失败 添加通知以及再次处理 | ||
| 72 | + } | ||
| 73 | + // 设置 database.connections.custom_mysql 数据 | ||
| 74 | + config(['database.connections.custom_mysql.host' => $project->mysqlConfig()->host]); | ||
| 75 | + config(['database.connections.custom_mysql.port' => $project->mysqlConfig()->port]); | ||
| 76 | + config(['database.connections.custom_mysql.database' => $project->databaseName()]); | ||
| 77 | + config(['database.connections.custom_mysql.username' => $project->mysqlConfig()->user]); | ||
| 78 | + config(['database.connections.custom_mysql.password' => $project->mysqlConfig()->password]); | ||
| 79 | + | ||
| 80 | + // TODO 创建对应库 初始化数据表 | ||
| 81 | + $this->initTable(); | ||
| 82 | + return true; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * @return bool | ||
| 87 | + */ | ||
| 88 | + public function initTable() | ||
| 89 | + { | ||
| 90 | +// $table = DB::select('show tables'); | ||
| 91 | +// $table = array_column($table, 'Tables_in_globalso_dev'); | ||
| 92 | +// $table = DB::connection('custom_tmp_mysql')->select('show tables'); | ||
| 93 | +// $table_in = DB::connection('custom_tmp_mysql')->getDatabaseName(); | ||
| 94 | +// dd($table, $table_in); | ||
| 95 | + | ||
| 96 | + $database_name = DB::connection('custom_tmp_mysql')->getDatabaseName(); | ||
| 97 | + | ||
| 98 | + $table = Schema::connection('custom_tmp_mysql')->getAllTables(); | ||
| 99 | + $table = array_column($table, 'Tables_in_' . $database_name); | ||
| 100 | + foreach ($table as $v) { | ||
| 101 | + $has_table = Schema::connection('custom_mysql')->hasTable($v); | ||
| 102 | + if ($has_table) | ||
| 103 | + continue; | ||
| 104 | + | ||
| 105 | + $connection = DB::connection('custom_tmp_mysql'); | ||
| 106 | + $sql = $connection->getDoctrineSchemaManager() | ||
| 107 | + ->getDatabasePlatform() | ||
| 108 | + ->getCreateTableSQL($connection->getDoctrineSchemaManager()->listTableDetails($v)); | ||
| 109 | + | ||
| 110 | + DB::connection('custom_mysql')->select($sql[0]); | ||
| 111 | + } | ||
| 112 | + return true; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + /** | ||
| 116 | + * 创建数据库 | ||
| 117 | + * 链接mysql 查询数据库是否存在 创建数据库 | ||
| 118 | + * @param Project $project | ||
| 119 | + * @return bool|\mysqli_result|null | ||
| 120 | + */ | ||
| 121 | + public function createDatabase($project) | ||
| 122 | + { | ||
| 123 | + # 该方法需要:composer require parity-bit/laravel-db-commands | ||
| 124 | +// $result = Artisan::call('db:create', [ | ||
| 125 | +// '--database' => $database_name, | ||
| 126 | +// ]); | ||
| 127 | +// | ||
| 128 | +// return $result; | ||
| 129 | + | ||
| 130 | + if ($this->connect) | ||
| 131 | + return $this->connect; | ||
| 132 | + | ||
| 133 | + //连接到 MySQL 服务器 | ||
| 134 | + $servername = $project->mysqlConfig()->host; | ||
| 135 | + $username = $project->mysqlConfig()->user; | ||
| 136 | + $password = $project->mysqlConfig()->password; | ||
| 137 | + $conn = new \mysqli($servername, $username, $password); | ||
| 138 | + //检查连接是否成功 | ||
| 139 | + if ($conn->connect_error) { | ||
| 140 | + die("连接失败: " . $conn->connect_error); | ||
| 141 | + } | ||
| 142 | + $this->connect = $conn; | ||
| 143 | +// $result = $conn->query('SHOW DATABASES LIKE \'' . $database_name . '\';'); | ||
| 144 | +// if ($result) | ||
| 145 | +// return true; | ||
| 146 | + $result = $conn->query('CREATE DATABASE ' . $project->databaseName() . ';'); | ||
| 147 | + return $result; | ||
| 148 | + } | ||
| 149 | +} |
app/Console/Commands/Test/Demo.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * Created by PhpStorm. | ||
| 4 | + * User: zhl | ||
| 5 | + * Date: 2023/2/7 | ||
| 6 | + * Time: 17:58 | ||
| 7 | + */ | ||
| 8 | +namespace App\Console\Commands\Test; | ||
| 9 | + | ||
| 10 | +use GuzzleHttp\Client; | ||
| 11 | +use Illuminate\Console\Command; | ||
| 12 | +use Illuminate\Support\Facades\DB; | ||
| 13 | + | ||
| 14 | +class Demo extends Command | ||
| 15 | +{ | ||
| 16 | + /** | ||
| 17 | + * The name and signature of the console command. | ||
| 18 | + * | ||
| 19 | + * @var string | ||
| 20 | + */ | ||
| 21 | + protected $signature = 'demo'; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * The console command description. | ||
| 25 | + * | ||
| 26 | + * @var string | ||
| 27 | + */ | ||
| 28 | + protected $description = 'demo'; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Create a new command instance. | ||
| 32 | + * | ||
| 33 | + * @return void | ||
| 34 | + */ | ||
| 35 | + public function __construct() | ||
| 36 | + { | ||
| 37 | + parent::__construct(); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * @return bool | ||
| 42 | + */ | ||
| 43 | + public function handle() | ||
| 44 | + { | ||
| 45 | + $sql = 'CREATE DATABASE database_name;'; | ||
| 46 | + $results = DB::select($sql); | ||
| 47 | + dd($results); | ||
| 48 | + return true; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public function printMessage() | ||
| 52 | + { | ||
| 53 | + $client = new Client(); | ||
| 54 | + $headers = [ | ||
| 55 | + 'Accept-Language' => 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7', | ||
| 56 | + 'Cache-Control' => 'no-cache', | ||
| 57 | + 'Content-Type' => 'application/json', | ||
| 58 | + 'DNT' => '1', | ||
| 59 | + 'Origin' => 'http://openai.waimaoq.com', | ||
| 60 | + 'Pragma' => 'no-cache', | ||
| 61 | + 'Proxy-Connection' => 'keep-alive', | ||
| 62 | + 'Referer' => 'http://openai.waimaoq.com/docs', | ||
| 63 | + 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36', | ||
| 64 | + 'accept' => 'application/json', | ||
| 65 | + 'Access-Control-Allow-Origin' => '*' | ||
| 66 | + ]; | ||
| 67 | + $body = '{ | ||
| 68 | + "prompt": "Human: 我需要一篇100字的英文原创博客并包含标题,内容结合:“cnc machine”。AI:" | ||
| 69 | + }'; | ||
| 70 | + $response = $client->post('http://openai.waimaoq.com/v1/openai_chat_stream', [ | ||
| 71 | + 'stream' => true, | ||
| 72 | + 'headers' => $headers, | ||
| 73 | + 'body' => $body | ||
| 74 | + ]); | ||
| 75 | + // 获取响应流对象 | ||
| 76 | + $stream = $response->getBody(); | ||
| 77 | + | ||
| 78 | + // 设置输出缓冲区 | ||
| 79 | + ob_start(); | ||
| 80 | + | ||
| 81 | + // 读取流中的数据并输出到页面 | ||
| 82 | + while (!$stream->eof()) { | ||
| 83 | + echo $stream->read(4); | ||
| 84 | + ob_flush(); | ||
| 85 | + flush(); | ||
| 86 | + } | ||
| 87 | + dd(1); | ||
| 88 | + } | ||
| 89 | +} |
| @@ -5,6 +5,7 @@ namespace App\Http\Middleware\Bside; | @@ -5,6 +5,7 @@ namespace App\Http\Middleware\Bside; | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Models\ProjectMenu; | 6 | use App\Models\ProjectMenu; |
| 7 | use App\Models\ProjectRole as ProjectRoleModel; | 7 | use App\Models\ProjectRole as ProjectRoleModel; |
| 8 | +use App\Services\ProjectServer; | ||
| 8 | use Closure; | 9 | use Closure; |
| 9 | use Illuminate\Http\Request; | 10 | use Illuminate\Http\Request; |
| 10 | use Illuminate\Http\Response; | 11 | use Illuminate\Http\Response; |
| @@ -29,6 +30,9 @@ class LoginAuthMiddleware | @@ -29,6 +30,9 @@ class LoginAuthMiddleware | ||
| 29 | if(empty($info)){ | 30 | if(empty($info)){ |
| 30 | return response(['code'=>Code::USER_ERROR,'msg'=>'当前用户未登录']); | 31 | return response(['code'=>Code::USER_ERROR,'msg'=>'当前用户未登录']); |
| 31 | } | 32 | } |
| 33 | + // 设置数据信息 | ||
| 34 | + ProjectServer::useProject($info['project_id']); | ||
| 35 | + | ||
| 32 | //操作权限设置 | 36 | //操作权限设置 |
| 33 | $projectRoleModel = new ProjectRoleModel(); | 37 | $projectRoleModel = new ProjectRoleModel(); |
| 34 | $role_info = $projectRoleModel->read(['id'=>$info['role_id']]); | 38 | $role_info = $projectRoleModel->read(['id'=>$info['role_id']]); |
| @@ -12,6 +12,8 @@ class Project extends Base | @@ -12,6 +12,8 @@ class Project extends Base | ||
| 12 | public $timestamps = true; | 12 | public $timestamps = true; |
| 13 | protected $dateFormat = 'Y-m-d'; | 13 | protected $dateFormat = 'Y-m-d'; |
| 14 | 14 | ||
| 15 | + const DATABASE_NAME_FIX = 'globalso_project_'; | ||
| 16 | + | ||
| 15 | /** | 17 | /** |
| 16 | * @name:获取当前对象不分页列表 | 18 | * @name:获取当前对象不分页列表 |
| 17 | */ | 19 | */ |
| @@ -19,4 +21,52 @@ class Project extends Base | @@ -19,4 +21,52 @@ class Project extends Base | ||
| 19 | $lists = DB::table($this->table)->select(['*'])->where($this->map)->orderBy($this->order)->get(); | 21 | $lists = DB::table($this->table)->select(['*'])->where($this->map)->orderBy($this->order)->get(); |
| 20 | return $lists; | 22 | return $lists; |
| 21 | } | 23 | } |
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 通过ID获取项目信息 | ||
| 27 | + * @param $id | ||
| 28 | + * @return self | ||
| 29 | + */ | ||
| 30 | + public static function getProjectById($id) | ||
| 31 | + { | ||
| 32 | + return self::where(['id' => $id])->first(); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 项目部署服务器信息 | ||
| 37 | + * @return \Illuminate\Database\Eloquent\Relations\HasOne | ||
| 38 | + */ | ||
| 39 | + public function serverConfig() | ||
| 40 | + { | ||
| 41 | + return self::hasOne(ServeConfig::class, 'id', 'serve_id'); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 项目部署mysql数据库信息 | ||
| 46 | + * @return \Illuminate\Database\Eloquent\Relations\HasOne | ||
| 47 | + */ | ||
| 48 | + public function mysqlConfig() | ||
| 49 | + { | ||
| 50 | + return self::hasOne(ServeConfig::class, 'id', 'mysql_id'); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 项目使用Redis服务器信息, 如果没有即使用默认配置 | ||
| 55 | + * @return \Illuminate\Database\Eloquent\Relations\HasOne | ||
| 56 | + */ | ||
| 57 | + public function redisConfig() | ||
| 58 | + { | ||
| 59 | + return self::hasOne(ServeConfig::class, 'id', 'redis_id'); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 获取项目对应数据库名称 | ||
| 64 | + * 初始化数据库、数据表迭代等功能使用 | ||
| 65 | + * TODO 如果前缀变更,请使用该方法进行处理 | ||
| 66 | + * @return string | ||
| 67 | + */ | ||
| 68 | + public function databaseName() | ||
| 69 | + { | ||
| 70 | + return self::DATABASE_NAME_FIX . $this->id; | ||
| 71 | + } | ||
| 22 | } | 72 | } |
app/Models/ServeConfig.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * Created by PhpStorm. | ||
| 4 | + * User: zhl | ||
| 5 | + * Date: 2023/4/17 | ||
| 6 | + * Time: 10:04 | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +namespace App\Models; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 服务账户信息 | ||
| 13 | + * Class ServeConfig | ||
| 14 | + * @package App\Models | ||
| 15 | + */ | ||
| 16 | +class ServeConfig extends Base | ||
| 17 | +{ | ||
| 18 | + /** | ||
| 19 | + * @var string | ||
| 20 | + */ | ||
| 21 | + protected $table = 'gl_server_config'; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * @var array | ||
| 25 | + */ | ||
| 26 | + protected $guarded = ['updated_at']; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 1:服务器, 2:MySQL, 3:Redis | ||
| 30 | + */ | ||
| 31 | + const TYPE_SERVER = 1; | ||
| 32 | + const TYPE_MYSQL = 2; | ||
| 33 | + const TYPE_REDIS = 3; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 用户名加密 | ||
| 37 | + * @param $value | ||
| 38 | + */ | ||
| 39 | + public function setUserAttribute($value) | ||
| 40 | + { | ||
| 41 | + $this->attributes['user'] = encrypt($value); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 密码加密 | ||
| 46 | + * @param $value | ||
| 47 | + */ | ||
| 48 | + public function setPasswordAttribute($value) | ||
| 49 | + { | ||
| 50 | + $this->attributes['password'] = encrypt($value); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 端口加密 | ||
| 55 | + * @param $value | ||
| 56 | + */ | ||
| 57 | + public function setPortAttribute($value) | ||
| 58 | + { | ||
| 59 | + $this->attributes['Port'] = encrypt($value); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * @return mixed | ||
| 64 | + */ | ||
| 65 | + public function getUserAttribute() | ||
| 66 | + { | ||
| 67 | + return decrypt($this->user); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * @return mixed | ||
| 72 | + */ | ||
| 73 | + public function getPasswordAttribute() | ||
| 74 | + { | ||
| 75 | + return decrypt($this->password); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * @return mixed | ||
| 80 | + */ | ||
| 81 | + public function getPortAttribute() | ||
| 82 | + { | ||
| 83 | + return decrypt($this->port); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | +} |
| @@ -42,16 +42,16 @@ class RouteServiceProvider extends ServiceProvider | @@ -42,16 +42,16 @@ class RouteServiceProvider extends ServiceProvider | ||
| 42 | $this->mapBsideRoute(); | 42 | $this->mapBsideRoute(); |
| 43 | 43 | ||
| 44 | // 暂时无用 | 44 | // 暂时无用 |
| 45 | -// $this->routes(function () { | ||
| 46 | -// Route::prefix('api') | ||
| 47 | -// ->middleware('api') | ||
| 48 | -// ->namespace($this->namespace) | ||
| 49 | -// ->group(base_path('routes/api.php')); | ||
| 50 | -// | ||
| 51 | -// Route::middleware('web') | ||
| 52 | -// ->namespace($this->namespace) | ||
| 53 | -// ->group(base_path('routes/web.php')); | ||
| 54 | -// }); | 45 | + $this->routes(function () { |
| 46 | + Route::prefix('api') | ||
| 47 | + ->middleware('api') | ||
| 48 | + ->namespace($this->namespace) | ||
| 49 | + ->group(base_path('routes/api.php')); | ||
| 50 | + | ||
| 51 | + Route::middleware('web') | ||
| 52 | + ->namespace($this->namespace) | ||
| 53 | + ->group(base_path('routes/web.php')); | ||
| 54 | + }); | ||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | /** | 57 | /** |
app/Services/ProjectServer.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * Created by PhpStorm. | ||
| 4 | + * User: zhl | ||
| 5 | + * Date: 2023/4/17 | ||
| 6 | + * Time: 15:16 | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +namespace App\Services; | ||
| 10 | + | ||
| 11 | +use App\Models\Project; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * Class ProjectServer | ||
| 15 | + * @package App\Services | ||
| 16 | + */ | ||
| 17 | +class ProjectServer extends BaseService | ||
| 18 | +{ | ||
| 19 | + /** | ||
| 20 | + * @param $project_id | ||
| 21 | + * @return bool | ||
| 22 | + */ | ||
| 23 | + public static function useProject($project_id) | ||
| 24 | + { | ||
| 25 | + $project = Project::getProjectById($project_id); | ||
| 26 | + if (empty($project)) | ||
| 27 | + return false; | ||
| 28 | + // 设置 database.connections.custom_mysql 配置 | ||
| 29 | + config(['database.connections.custom_mysql.host' => $project->mysqlConfig()->host]); | ||
| 30 | + config(['database.connections.custom_mysql.port' => $project->mysqlConfig()->port]); | ||
| 31 | + config(['database.connections.custom_mysql.database' => $project->databaseName()]); | ||
| 32 | + config(['database.connections.custom_mysql.username' => $project->mysqlConfig()->user]); | ||
| 33 | + config(['database.connections.custom_mysql.password' => $project->mysqlConfig()->password]); | ||
| 34 | + // 设置 redis 配置 | ||
| 35 | + return true; | ||
| 36 | + } | ||
| 37 | +} |
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | "require": { | 7 | "require": { |
| 8 | "php": "^7.3|^8.0", | 8 | "php": "^7.3|^8.0", |
| 9 | "bensampo/laravel-enum": "^4.2", | 9 | "bensampo/laravel-enum": "^4.2", |
| 10 | + "doctrine/dbal": "^3.6", | ||
| 10 | "fruitcake/laravel-cors": "^2.0", | 11 | "fruitcake/laravel-cors": "^2.0", |
| 11 | "guzzlehttp/guzzle": "^7.0.1", | 12 | "guzzlehttp/guzzle": "^7.0.1", |
| 12 | "laravel/framework": "^8.75", | 13 | "laravel/framework": "^8.75", |
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", | 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", |
| 5 | "This file is @generated automatically" | 5 | "This file is @generated automatically" |
| 6 | ], | 6 | ], |
| 7 | - "content-hash": "ec0188ad5b235cba39d53baaa3d96767", | 7 | + "content-hash": "6c3880102ef840b5bed38e672d350800", |
| 8 | "packages": [ | 8 | "packages": [ |
| 9 | { | 9 | { |
| 10 | "name": "asm89/stack-cors", | 10 | "name": "asm89/stack-cors", |
| @@ -305,6 +305,346 @@ | @@ -305,6 +305,346 @@ | ||
| 305 | "time": "2021-08-13T13:06:58+00:00" | 305 | "time": "2021-08-13T13:06:58+00:00" |
| 306 | }, | 306 | }, |
| 307 | { | 307 | { |
| 308 | + "name": "doctrine/cache", | ||
| 309 | + "version": "2.2.0", | ||
| 310 | + "source": { | ||
| 311 | + "type": "git", | ||
| 312 | + "url": "https://github.com/doctrine/cache.git", | ||
| 313 | + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb" | ||
| 314 | + }, | ||
| 315 | + "dist": { | ||
| 316 | + "type": "zip", | ||
| 317 | + "url": "https://api.github.com/repos/doctrine/cache/zipball/1ca8f21980e770095a31456042471a57bc4c68fb", | ||
| 318 | + "reference": "1ca8f21980e770095a31456042471a57bc4c68fb", | ||
| 319 | + "shasum": "" | ||
| 320 | + }, | ||
| 321 | + "require": { | ||
| 322 | + "php": "~7.1 || ^8.0" | ||
| 323 | + }, | ||
| 324 | + "conflict": { | ||
| 325 | + "doctrine/common": ">2.2,<2.4" | ||
| 326 | + }, | ||
| 327 | + "require-dev": { | ||
| 328 | + "cache/integration-tests": "dev-master", | ||
| 329 | + "doctrine/coding-standard": "^9", | ||
| 330 | + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", | ||
| 331 | + "psr/cache": "^1.0 || ^2.0 || ^3.0", | ||
| 332 | + "symfony/cache": "^4.4 || ^5.4 || ^6", | ||
| 333 | + "symfony/var-exporter": "^4.4 || ^5.4 || ^6" | ||
| 334 | + }, | ||
| 335 | + "type": "library", | ||
| 336 | + "autoload": { | ||
| 337 | + "psr-4": { | ||
| 338 | + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" | ||
| 339 | + } | ||
| 340 | + }, | ||
| 341 | + "notification-url": "https://packagist.org/downloads/", | ||
| 342 | + "license": [ | ||
| 343 | + "MIT" | ||
| 344 | + ], | ||
| 345 | + "authors": [ | ||
| 346 | + { | ||
| 347 | + "name": "Guilherme Blanco", | ||
| 348 | + "email": "guilhermeblanco@gmail.com" | ||
| 349 | + }, | ||
| 350 | + { | ||
| 351 | + "name": "Roman Borschel", | ||
| 352 | + "email": "roman@code-factory.org" | ||
| 353 | + }, | ||
| 354 | + { | ||
| 355 | + "name": "Benjamin Eberlei", | ||
| 356 | + "email": "kontakt@beberlei.de" | ||
| 357 | + }, | ||
| 358 | + { | ||
| 359 | + "name": "Jonathan Wage", | ||
| 360 | + "email": "jonwage@gmail.com" | ||
| 361 | + }, | ||
| 362 | + { | ||
| 363 | + "name": "Johannes Schmitt", | ||
| 364 | + "email": "schmittjoh@gmail.com" | ||
| 365 | + } | ||
| 366 | + ], | ||
| 367 | + "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", | ||
| 368 | + "homepage": "https://www.doctrine-project.org/projects/cache.html", | ||
| 369 | + "keywords": [ | ||
| 370 | + "abstraction", | ||
| 371 | + "apcu", | ||
| 372 | + "cache", | ||
| 373 | + "caching", | ||
| 374 | + "couchdb", | ||
| 375 | + "memcached", | ||
| 376 | + "php", | ||
| 377 | + "redis", | ||
| 378 | + "xcache" | ||
| 379 | + ], | ||
| 380 | + "support": { | ||
| 381 | + "issues": "https://github.com/doctrine/cache/issues", | ||
| 382 | + "source": "https://github.com/doctrine/cache/tree/2.2.0" | ||
| 383 | + }, | ||
| 384 | + "funding": [ | ||
| 385 | + { | ||
| 386 | + "url": "https://www.doctrine-project.org/sponsorship.html", | ||
| 387 | + "type": "custom" | ||
| 388 | + }, | ||
| 389 | + { | ||
| 390 | + "url": "https://www.patreon.com/phpdoctrine", | ||
| 391 | + "type": "patreon" | ||
| 392 | + }, | ||
| 393 | + { | ||
| 394 | + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", | ||
| 395 | + "type": "tidelift" | ||
| 396 | + } | ||
| 397 | + ], | ||
| 398 | + "time": "2022-05-20T20:07:39+00:00" | ||
| 399 | + }, | ||
| 400 | + { | ||
| 401 | + "name": "doctrine/dbal", | ||
| 402 | + "version": "3.6.1", | ||
| 403 | + "source": { | ||
| 404 | + "type": "git", | ||
| 405 | + "url": "https://github.com/doctrine/dbal.git", | ||
| 406 | + "reference": "57815c7bbcda3cd18871d253c1dd8cbe56f8526e" | ||
| 407 | + }, | ||
| 408 | + "dist": { | ||
| 409 | + "type": "zip", | ||
| 410 | + "url": "https://api.github.com/repos/doctrine/dbal/zipball/57815c7bbcda3cd18871d253c1dd8cbe56f8526e", | ||
| 411 | + "reference": "57815c7bbcda3cd18871d253c1dd8cbe56f8526e", | ||
| 412 | + "shasum": "" | ||
| 413 | + }, | ||
| 414 | + "require": { | ||
| 415 | + "composer-runtime-api": "^2", | ||
| 416 | + "doctrine/cache": "^1.11|^2.0", | ||
| 417 | + "doctrine/deprecations": "^0.5.3|^1", | ||
| 418 | + "doctrine/event-manager": "^1|^2", | ||
| 419 | + "php": "^7.4 || ^8.0", | ||
| 420 | + "psr/cache": "^1|^2|^3", | ||
| 421 | + "psr/log": "^1|^2|^3" | ||
| 422 | + }, | ||
| 423 | + "require-dev": { | ||
| 424 | + "doctrine/coding-standard": "11.1.0", | ||
| 425 | + "fig/log-test": "^1", | ||
| 426 | + "jetbrains/phpstorm-stubs": "2022.3", | ||
| 427 | + "phpstan/phpstan": "1.10.3", | ||
| 428 | + "phpstan/phpstan-strict-rules": "^1.5", | ||
| 429 | + "phpunit/phpunit": "9.6.4", | ||
| 430 | + "psalm/plugin-phpunit": "0.18.4", | ||
| 431 | + "squizlabs/php_codesniffer": "3.7.2", | ||
| 432 | + "symfony/cache": "^5.4|^6.0", | ||
| 433 | + "symfony/console": "^4.4|^5.4|^6.0", | ||
| 434 | + "vimeo/psalm": "4.30.0" | ||
| 435 | + }, | ||
| 436 | + "suggest": { | ||
| 437 | + "symfony/console": "For helpful console commands such as SQL execution and import of files." | ||
| 438 | + }, | ||
| 439 | + "bin": [ | ||
| 440 | + "bin/doctrine-dbal" | ||
| 441 | + ], | ||
| 442 | + "type": "library", | ||
| 443 | + "autoload": { | ||
| 444 | + "psr-4": { | ||
| 445 | + "Doctrine\\DBAL\\": "src" | ||
| 446 | + } | ||
| 447 | + }, | ||
| 448 | + "notification-url": "https://packagist.org/downloads/", | ||
| 449 | + "license": [ | ||
| 450 | + "MIT" | ||
| 451 | + ], | ||
| 452 | + "authors": [ | ||
| 453 | + { | ||
| 454 | + "name": "Guilherme Blanco", | ||
| 455 | + "email": "guilhermeblanco@gmail.com" | ||
| 456 | + }, | ||
| 457 | + { | ||
| 458 | + "name": "Roman Borschel", | ||
| 459 | + "email": "roman@code-factory.org" | ||
| 460 | + }, | ||
| 461 | + { | ||
| 462 | + "name": "Benjamin Eberlei", | ||
| 463 | + "email": "kontakt@beberlei.de" | ||
| 464 | + }, | ||
| 465 | + { | ||
| 466 | + "name": "Jonathan Wage", | ||
| 467 | + "email": "jonwage@gmail.com" | ||
| 468 | + } | ||
| 469 | + ], | ||
| 470 | + "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", | ||
| 471 | + "homepage": "https://www.doctrine-project.org/projects/dbal.html", | ||
| 472 | + "keywords": [ | ||
| 473 | + "abstraction", | ||
| 474 | + "database", | ||
| 475 | + "db2", | ||
| 476 | + "dbal", | ||
| 477 | + "mariadb", | ||
| 478 | + "mssql", | ||
| 479 | + "mysql", | ||
| 480 | + "oci8", | ||
| 481 | + "oracle", | ||
| 482 | + "pdo", | ||
| 483 | + "pgsql", | ||
| 484 | + "postgresql", | ||
| 485 | + "queryobject", | ||
| 486 | + "sasql", | ||
| 487 | + "sql", | ||
| 488 | + "sqlite", | ||
| 489 | + "sqlserver", | ||
| 490 | + "sqlsrv" | ||
| 491 | + ], | ||
| 492 | + "support": { | ||
| 493 | + "issues": "https://github.com/doctrine/dbal/issues", | ||
| 494 | + "source": "https://github.com/doctrine/dbal/tree/3.6.1" | ||
| 495 | + }, | ||
| 496 | + "funding": [ | ||
| 497 | + { | ||
| 498 | + "url": "https://www.doctrine-project.org/sponsorship.html", | ||
| 499 | + "type": "custom" | ||
| 500 | + }, | ||
| 501 | + { | ||
| 502 | + "url": "https://www.patreon.com/phpdoctrine", | ||
| 503 | + "type": "patreon" | ||
| 504 | + }, | ||
| 505 | + { | ||
| 506 | + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal", | ||
| 507 | + "type": "tidelift" | ||
| 508 | + } | ||
| 509 | + ], | ||
| 510 | + "time": "2023-03-02T19:26:24+00:00" | ||
| 511 | + }, | ||
| 512 | + { | ||
| 513 | + "name": "doctrine/deprecations", | ||
| 514 | + "version": "v1.0.0", | ||
| 515 | + "source": { | ||
| 516 | + "type": "git", | ||
| 517 | + "url": "https://github.com/doctrine/deprecations.git", | ||
| 518 | + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" | ||
| 519 | + }, | ||
| 520 | + "dist": { | ||
| 521 | + "type": "zip", | ||
| 522 | + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", | ||
| 523 | + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", | ||
| 524 | + "shasum": "" | ||
| 525 | + }, | ||
| 526 | + "require": { | ||
| 527 | + "php": "^7.1|^8.0" | ||
| 528 | + }, | ||
| 529 | + "require-dev": { | ||
| 530 | + "doctrine/coding-standard": "^9", | ||
| 531 | + "phpunit/phpunit": "^7.5|^8.5|^9.5", | ||
| 532 | + "psr/log": "^1|^2|^3" | ||
| 533 | + }, | ||
| 534 | + "suggest": { | ||
| 535 | + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" | ||
| 536 | + }, | ||
| 537 | + "type": "library", | ||
| 538 | + "autoload": { | ||
| 539 | + "psr-4": { | ||
| 540 | + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" | ||
| 541 | + } | ||
| 542 | + }, | ||
| 543 | + "notification-url": "https://packagist.org/downloads/", | ||
| 544 | + "license": [ | ||
| 545 | + "MIT" | ||
| 546 | + ], | ||
| 547 | + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", | ||
| 548 | + "homepage": "https://www.doctrine-project.org/", | ||
| 549 | + "support": { | ||
| 550 | + "issues": "https://github.com/doctrine/deprecations/issues", | ||
| 551 | + "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" | ||
| 552 | + }, | ||
| 553 | + "time": "2022-05-02T15:47:09+00:00" | ||
| 554 | + }, | ||
| 555 | + { | ||
| 556 | + "name": "doctrine/event-manager", | ||
| 557 | + "version": "1.2.0", | ||
| 558 | + "source": { | ||
| 559 | + "type": "git", | ||
| 560 | + "url": "https://github.com/doctrine/event-manager.git", | ||
| 561 | + "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520" | ||
| 562 | + }, | ||
| 563 | + "dist": { | ||
| 564 | + "type": "zip", | ||
| 565 | + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/95aa4cb529f1e96576f3fda9f5705ada4056a520", | ||
| 566 | + "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520", | ||
| 567 | + "shasum": "" | ||
| 568 | + }, | ||
| 569 | + "require": { | ||
| 570 | + "doctrine/deprecations": "^0.5.3 || ^1", | ||
| 571 | + "php": "^7.1 || ^8.0" | ||
| 572 | + }, | ||
| 573 | + "conflict": { | ||
| 574 | + "doctrine/common": "<2.9" | ||
| 575 | + }, | ||
| 576 | + "require-dev": { | ||
| 577 | + "doctrine/coding-standard": "^9 || ^10", | ||
| 578 | + "phpstan/phpstan": "~1.4.10 || ^1.8.8", | ||
| 579 | + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", | ||
| 580 | + "vimeo/psalm": "^4.24" | ||
| 581 | + }, | ||
| 582 | + "type": "library", | ||
| 583 | + "autoload": { | ||
| 584 | + "psr-4": { | ||
| 585 | + "Doctrine\\Common\\": "src" | ||
| 586 | + } | ||
| 587 | + }, | ||
| 588 | + "notification-url": "https://packagist.org/downloads/", | ||
| 589 | + "license": [ | ||
| 590 | + "MIT" | ||
| 591 | + ], | ||
| 592 | + "authors": [ | ||
| 593 | + { | ||
| 594 | + "name": "Guilherme Blanco", | ||
| 595 | + "email": "guilhermeblanco@gmail.com" | ||
| 596 | + }, | ||
| 597 | + { | ||
| 598 | + "name": "Roman Borschel", | ||
| 599 | + "email": "roman@code-factory.org" | ||
| 600 | + }, | ||
| 601 | + { | ||
| 602 | + "name": "Benjamin Eberlei", | ||
| 603 | + "email": "kontakt@beberlei.de" | ||
| 604 | + }, | ||
| 605 | + { | ||
| 606 | + "name": "Jonathan Wage", | ||
| 607 | + "email": "jonwage@gmail.com" | ||
| 608 | + }, | ||
| 609 | + { | ||
| 610 | + "name": "Johannes Schmitt", | ||
| 611 | + "email": "schmittjoh@gmail.com" | ||
| 612 | + }, | ||
| 613 | + { | ||
| 614 | + "name": "Marco Pivetta", | ||
| 615 | + "email": "ocramius@gmail.com" | ||
| 616 | + } | ||
| 617 | + ], | ||
| 618 | + "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", | ||
| 619 | + "homepage": "https://www.doctrine-project.org/projects/event-manager.html", | ||
| 620 | + "keywords": [ | ||
| 621 | + "event", | ||
| 622 | + "event dispatcher", | ||
| 623 | + "event manager", | ||
| 624 | + "event system", | ||
| 625 | + "events" | ||
| 626 | + ], | ||
| 627 | + "support": { | ||
| 628 | + "issues": "https://github.com/doctrine/event-manager/issues", | ||
| 629 | + "source": "https://github.com/doctrine/event-manager/tree/1.2.0" | ||
| 630 | + }, | ||
| 631 | + "funding": [ | ||
| 632 | + { | ||
| 633 | + "url": "https://www.doctrine-project.org/sponsorship.html", | ||
| 634 | + "type": "custom" | ||
| 635 | + }, | ||
| 636 | + { | ||
| 637 | + "url": "https://www.patreon.com/phpdoctrine", | ||
| 638 | + "type": "patreon" | ||
| 639 | + }, | ||
| 640 | + { | ||
| 641 | + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager", | ||
| 642 | + "type": "tidelift" | ||
| 643 | + } | ||
| 644 | + ], | ||
| 645 | + "time": "2022-10-12T20:51:15+00:00" | ||
| 646 | + }, | ||
| 647 | + { | ||
| 308 | "name": "doctrine/inflector", | 648 | "name": "doctrine/inflector", |
| 309 | "version": "2.0.4", | 649 | "version": "2.0.4", |
| 310 | "source": { | 650 | "source": { |
| @@ -2597,6 +2937,55 @@ | @@ -2597,6 +2937,55 @@ | ||
| 2597 | "time": "2023-02-25T19:38:58+00:00" | 2937 | "time": "2023-02-25T19:38:58+00:00" |
| 2598 | }, | 2938 | }, |
| 2599 | { | 2939 | { |
| 2940 | + "name": "psr/cache", | ||
| 2941 | + "version": "1.0.1", | ||
| 2942 | + "source": { | ||
| 2943 | + "type": "git", | ||
| 2944 | + "url": "https://github.com/php-fig/cache.git", | ||
| 2945 | + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" | ||
| 2946 | + }, | ||
| 2947 | + "dist": { | ||
| 2948 | + "type": "zip", | ||
| 2949 | + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", | ||
| 2950 | + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", | ||
| 2951 | + "shasum": "" | ||
| 2952 | + }, | ||
| 2953 | + "require": { | ||
| 2954 | + "php": ">=5.3.0" | ||
| 2955 | + }, | ||
| 2956 | + "type": "library", | ||
| 2957 | + "extra": { | ||
| 2958 | + "branch-alias": { | ||
| 2959 | + "dev-master": "1.0.x-dev" | ||
| 2960 | + } | ||
| 2961 | + }, | ||
| 2962 | + "autoload": { | ||
| 2963 | + "psr-4": { | ||
| 2964 | + "Psr\\Cache\\": "src/" | ||
| 2965 | + } | ||
| 2966 | + }, | ||
| 2967 | + "notification-url": "https://packagist.org/downloads/", | ||
| 2968 | + "license": [ | ||
| 2969 | + "MIT" | ||
| 2970 | + ], | ||
| 2971 | + "authors": [ | ||
| 2972 | + { | ||
| 2973 | + "name": "PHP-FIG", | ||
| 2974 | + "homepage": "http://www.php-fig.org/" | ||
| 2975 | + } | ||
| 2976 | + ], | ||
| 2977 | + "description": "Common interface for caching libraries", | ||
| 2978 | + "keywords": [ | ||
| 2979 | + "cache", | ||
| 2980 | + "psr", | ||
| 2981 | + "psr-6" | ||
| 2982 | + ], | ||
| 2983 | + "support": { | ||
| 2984 | + "source": "https://github.com/php-fig/cache/tree/master" | ||
| 2985 | + }, | ||
| 2986 | + "time": "2016-08-06T20:24:11+00:00" | ||
| 2987 | + }, | ||
| 2988 | + { | ||
| 2600 | "name": "psr/container", | 2989 | "name": "psr/container", |
| 2601 | "version": "1.1.2", | 2990 | "version": "1.1.2", |
| 2602 | "source": { | 2991 | "source": { |
| @@ -8574,5 +8963,5 @@ | @@ -8574,5 +8963,5 @@ | ||
| 8574 | "php": "^7.3|^8.0" | 8963 | "php": "^7.3|^8.0" |
| 8575 | }, | 8964 | }, |
| 8576 | "platform-dev": [], | 8965 | "platform-dev": [], |
| 8577 | - "plugin-api-version": "2.3.0" | 8966 | + "plugin-api-version": "2.1.0" |
| 8578 | } | 8967 | } |
| @@ -63,6 +63,46 @@ return [ | @@ -63,6 +63,46 @@ return [ | ||
| 63 | ]) : [], | 63 | ]) : [], |
| 64 | ], | 64 | ], |
| 65 | 65 | ||
| 66 | + 'custom_tmp_mysql' => [ | ||
| 67 | + 'driver' => 'mysql', | ||
| 68 | + 'url' => env('DATABASE_URL'), | ||
| 69 | + 'host' => env('DB_HOST', '127.0.0.1'), | ||
| 70 | + 'port' => env('DB_PORT', '3306'), | ||
| 71 | + 'database' => env('DB_DATABASE_TMP', 'globalso_project_tmp'), | ||
| 72 | + 'username' => env('DB_USERNAME', 'forge'), | ||
| 73 | + 'password' => env('DB_PASSWORD', ''), | ||
| 74 | + 'unix_socket' => env('DB_SOCKET', ''), | ||
| 75 | + 'charset' => 'utf8mb4', | ||
| 76 | + 'collation' => 'utf8mb4_unicode_ci', | ||
| 77 | + 'prefix' => '', | ||
| 78 | + 'prefix_indexes' => true, | ||
| 79 | + 'strict' => true, | ||
| 80 | + 'engine' => null, | ||
| 81 | + 'options' => extension_loaded('pdo_mysql') ? array_filter([ | ||
| 82 | + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), | ||
| 83 | + ]) : [], | ||
| 84 | + ], | ||
| 85 | + | ||
| 86 | + 'custom_mysql' => [ | ||
| 87 | + 'driver' => 'mysql', | ||
| 88 | + 'url' => '', // DB_DATABASE_URL | ||
| 89 | + 'host' => '', // DB_DATABASE_HOST | ||
| 90 | + 'port' => '', // DB_DATABASE_PORT | ||
| 91 | + 'database' => '', // DB_DATABASE_CUSTOM | ||
| 92 | + 'username' => '', // DB_DATABASE_USER | ||
| 93 | + 'password' => '', // DB_DATABASE_PASSWORD | ||
| 94 | + 'unix_socket' => env('DB_SOCKET', ''), | ||
| 95 | + 'charset' => 'utf8mb4', | ||
| 96 | + 'collation' => 'utf8mb4_unicode_ci', | ||
| 97 | + 'prefix' => '', | ||
| 98 | + 'prefix_indexes' => true, | ||
| 99 | + 'strict' => true, | ||
| 100 | + 'engine' => null, | ||
| 101 | + 'options' => extension_loaded('pdo_mysql') ? array_filter([ | ||
| 102 | + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), | ||
| 103 | + ]) : [], | ||
| 104 | + ], | ||
| 105 | + | ||
| 66 | 'pgsql' => [ | 106 | 'pgsql' => [ |
| 67 | 'driver' => 'pgsql', | 107 | 'driver' => 'pgsql', |
| 68 | 'url' => env('DATABASE_URL'), | 108 | 'url' => env('DATABASE_URL'), |
-
请 注册 或 登录 后发表评论