Compare commits
No commits in common. "062ec9e0098b43daf989c3c6d435b019d80fb52e" and "67efa197ea8c19fd86d1922b1a2843d2141acfc3" have entirely different histories.
062ec9e009
...
67efa197ea
|
@ -43,7 +43,7 @@ steps:
|
|||
password:
|
||||
from_secret: hub_password
|
||||
repo: anxan-docker.pkg.coding.net/d/repo/micro-php-nacos
|
||||
tags: "0.0.9"
|
||||
tags: "0.0.8"
|
||||
|
||||
- name: "完成通知"
|
||||
image: anxan-docker.pkg.coding.net/d/repo/drone-email-notify:1.0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
-
|
||||
- docker运行命令
|
||||
```bash
|
||||
docker run -d --name php-file-server -p 8000:80 -v /your/path:/var/www/html/public -e NACOS_ADDR=192.168.1.105:8848 -e SERVICE_PORT=8000 -e ORIGIN_URL=file.zeroerr.cn anxan-docker.pkg.coding.net/d/repo/micro-php-nacos:0.0.9
|
||||
docker run -d --name php-file-server -p 8000:80 -v /your/path:/var/www/html/public -e NACOS_ADDR=192.168.1.105:8848 -e SERVICE_PORT=8000 -e ORIGIN_URL=file.zeroerr.cn anxan-docker.pkg.coding.net/d/repo/micro-php-nacos:0.0.8
|
||||
```
|
||||
- docker-compose.yml
|
||||
```bash
|
||||
|
@ -12,7 +12,7 @@ networks:
|
|||
|
||||
services:
|
||||
micro-php-nacos:
|
||||
image: anxan-docker.pkg.coding.net/d/repo/micro-php-nacos:0.0.9
|
||||
image: anxan-docker.pkg.coding.net/d/repo/micro-php-nacos:0.0.8
|
||||
container_name: micro-php-nacos
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
|
@ -37,7 +37,6 @@ services:
|
|||
|`ORIGIN_URL`| 允许跨域的网址 |`{docker容器内ip}:8000`|-|
|
||||
|`NAMESPACE_ID`| 要注册NACOS命名空间 |`0a1c32f2-dea1-4ec1-b546-cb4635cd7db2`|-|
|
||||
|`SERVICE_NAME`| 微服务名称 |`zeroerroa-file`|-|
|
||||
|`APP_DEBUG`| 是否开启调试模式 |`false`|-|
|
||||
|
||||
内部暴露的端口
|
||||
-
|
||||
|
|
|
@ -32,27 +32,15 @@ class Index
|
|||
// 允许跨域的域名
|
||||
$originUrl = $env->get('ORIGIN_URL', $serverIP . ':' . $servicePort);
|
||||
|
||||
// 获取文件原文件名
|
||||
$trueName = $file->getOriginalName();
|
||||
// 获取文件后缀名
|
||||
$ext = $file->extension();
|
||||
|
||||
// 生成新文件名
|
||||
$trueName = rtrim($trueName, ".$ext");
|
||||
$fileName = $trueName . '_' . date('His') . '.' . $ext;
|
||||
|
||||
// 保存文件
|
||||
// $file = $file->move(public_path() . 'uploads', $fileName);
|
||||
|
||||
// 组装保存路径
|
||||
$savename = \think\facade\Filesystem::disk('upload')->putFileAs('uploads' . '/' . date('Ymd'), $file, $fileName);
|
||||
$savename = \think\facade\Filesystem::disk('upload')->putFile('uploads', $file);
|
||||
$savename = str_replace('\\', '/', $savename);
|
||||
|
||||
return json([
|
||||
'code' => 200,
|
||||
'msg' => null,
|
||||
'data' => [
|
||||
"name" => $trueName . '.' . $ext,
|
||||
"name" => $trueName,
|
||||
"url" => '//' . $originUrl . '/' . $savename,
|
||||
// "url" => 'http://192.168.1.105:8080/file/' . $savename,
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue