diff --git a/.env.example b/.env.example index f927cce..8ade683 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,14 @@ # db -DB_HOST = '127.0.0.1' +DB_HOST = '1Panel-mysql-sLiG' DB_PORT = 3306 DB_NAME = 'car_info' -DB_USER = 'root' -DB_PASSWORD = 'root' +DB_USER = 'car_info' +DB_PASSWORD = 'btciadYXir7kXC6x' -WEBMAN_LISTEN = 'http://0.0.0.0:9007' -WEBMAN_COUNT = 4 \ No newline at end of file +WEBMAN_LISTEN = 'http://0.0.0.0:9021' +WEBMAN_COUNT = 2 + +OSS_ACCESS_KEY_ID=LTAI5tAGiH7bkVkmrniXnfkA +OSS_ACCESS_KEY_SECRET=nqklJBft6t3S0A4ZvxF4ci9ni91kmm +OSS_BUCKET=vehicle-album +OSS_ENDPOINT=https://oss-cn-beijing.aliyuncs.com \ No newline at end of file diff --git a/app/service/OssService.php b/app/service/OssService.php index 5e73783..f95ad54 100644 --- a/app/service/OssService.php +++ b/app/service/OssService.php @@ -15,10 +15,10 @@ class OssService public function __construct() { - $this->accessKeyId = 'LTAI5tAGiH7bkVkmrniXnfkA'; - $this->accessKeySecret = 'nqklJBft6t3S0A4ZvxF4ci9ni91kmm'; - $this->bucket = 'vehicle-album'; - $this->endpoint = 'https://oss-cn-beijing.aliyuncs.com'; + $this->accessKeyId = env('OSS_ACCESS_KEY_ID'); + $this->accessKeySecret = env('OSS_ACCESS_KEY_SECRET'); + $this->bucket = env('OSS_BUCKET', 'vehicle-album'); + $this->endpoint = env('OSS_ENDPOINT', 'https://oss-cn-beijing.aliyuncs.com'); $this->ossClient = new OssClient($this->accessKeyId, $this->accessKeySecret, $this->endpoint); } diff --git a/plugin/admin/app/controller/VehicleController.php b/plugin/admin/app/controller/VehicleController.php index 3b23389..0163f1b 100644 --- a/plugin/admin/app/controller/VehicleController.php +++ b/plugin/admin/app/controller/VehicleController.php @@ -130,7 +130,7 @@ class VehicleController extends Crud if(!str_starts_with($item['img_url'], 'http')){ $ossservice = new OssService(); - $img_url = $ossservice->generatePrivateUrl($item['img_url'],86400); + $img_url = $ossservice->generatePrivateUrl($item['img_url'], 3600); $item['img_url'] = $img_url; } }