mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
ComposerUpdate & 配置阿里云OSS下载原文件名
This commit is contained in:
parent
d155c204f5
commit
584eba4b62
@ -41,6 +41,7 @@ define(['md5'], function (SparkMD5, allowExtsMimes) {
|
||||
uploader.config.data.signature = ret.data.signature;
|
||||
uploader.config.data.OSSAccessKeyId = ret.data.OSSAccessKeyId;
|
||||
uploader.config.data.success_action_status = 200;
|
||||
uploader.config.data['Content-Disposition'] = 'attachment;filename=' + encodeURIComponent(file.name);
|
||||
}
|
||||
object.upload(index, file);
|
||||
} else if (parseInt(ret.code) === 200) {
|
||||
|
28
composer.lock
generated
28
composer.lock
generated
@ -558,16 +558,16 @@
|
||||
},
|
||||
{
|
||||
"name": "topthink/framework",
|
||||
"version": "v6.0.1",
|
||||
"version": "v6.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/top-think/framework.git",
|
||||
"reference": "501f3dd17dc6266e17b7d8df3e9fd090bd2cc85f"
|
||||
"reference": "1444cce94b40a836958380b160a5fb7bfc165daf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/framework/zipball/501f3dd17dc6266e17b7d8df3e9fd090bd2cc85f",
|
||||
"reference": "501f3dd17dc6266e17b7d8df3e9fd090bd2cc85f",
|
||||
"url": "https://api.github.com/repos/top-think/framework/zipball/1444cce94b40a836958380b160a5fb7bfc165daf",
|
||||
"reference": "1444cce94b40a836958380b160a5fb7bfc165daf",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -622,7 +622,7 @@
|
||||
"orm",
|
||||
"thinkphp"
|
||||
],
|
||||
"time": "2019-12-24T07:57:03+00:00"
|
||||
"time": "2020-01-13T05:48:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "topthink/think-helper",
|
||||
@ -721,16 +721,16 @@
|
||||
},
|
||||
{
|
||||
"name": "topthink/think-orm",
|
||||
"version": "v2.0.30",
|
||||
"version": "v2.0.31",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/top-think/think-orm.git",
|
||||
"reference": "b6f61fc243974a25cb6914b84a529b373a717626"
|
||||
"reference": "d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/think-orm/zipball/b6f61fc243974a25cb6914b84a529b373a717626",
|
||||
"reference": "b6f61fc243974a25cb6914b84a529b373a717626",
|
||||
"url": "https://api.github.com/repos/top-think/think-orm/zipball/d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4",
|
||||
"reference": "d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -768,7 +768,7 @@
|
||||
"database",
|
||||
"orm"
|
||||
],
|
||||
"time": "2020-01-02T09:09:50+00:00"
|
||||
"time": "2020-01-07T10:05:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "topthink/think-template",
|
||||
@ -909,12 +909,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
||||
"reference": "88d74e6f666cc23103da97e8e2307ecc5db1b031"
|
||||
"reference": "73ce73f61a90994e23b7616c73655440f50790a0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/88d74e6f666cc23103da97e8e2307ecc5db1b031",
|
||||
"reference": "88d74e6f666cc23103da97e8e2307ecc5db1b031",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/73ce73f61a90994e23b7616c73655440f50790a0",
|
||||
"reference": "73ce73f61a90994e23b7616c73655440f50790a0",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -958,7 +958,7 @@
|
||||
],
|
||||
"description": "ThinkPHP v6.0 Development Library",
|
||||
"homepage": "http://framework.thinkadmin.top",
|
||||
"time": "2020-01-11T07:50:11+00:00"
|
||||
"time": "2020-01-13T06:39:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zoujingli/wechat-developer",
|
||||
|
32
vendor/composer/installed.json
vendored
32
vendor/composer/installed.json
vendored
@ -569,17 +569,17 @@
|
||||
},
|
||||
{
|
||||
"name": "topthink/framework",
|
||||
"version": "v6.0.1",
|
||||
"version_normalized": "6.0.1.0",
|
||||
"version": "v6.0.2",
|
||||
"version_normalized": "6.0.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/top-think/framework.git",
|
||||
"reference": "501f3dd17dc6266e17b7d8df3e9fd090bd2cc85f"
|
||||
"reference": "1444cce94b40a836958380b160a5fb7bfc165daf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/framework/zipball/501f3dd17dc6266e17b7d8df3e9fd090bd2cc85f",
|
||||
"reference": "501f3dd17dc6266e17b7d8df3e9fd090bd2cc85f",
|
||||
"url": "https://api.github.com/repos/top-think/framework/zipball/1444cce94b40a836958380b160a5fb7bfc165daf",
|
||||
"reference": "1444cce94b40a836958380b160a5fb7bfc165daf",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -606,7 +606,7 @@
|
||||
"mockery/mockery": "^1.2",
|
||||
"phpunit/phpunit": "^7.0"
|
||||
},
|
||||
"time": "2019-12-24T07:57:03+00:00",
|
||||
"time": "2020-01-13T05:48:05+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -738,17 +738,17 @@
|
||||
},
|
||||
{
|
||||
"name": "topthink/think-orm",
|
||||
"version": "v2.0.30",
|
||||
"version_normalized": "2.0.30.0",
|
||||
"version": "v2.0.31",
|
||||
"version_normalized": "2.0.31.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/top-think/think-orm.git",
|
||||
"reference": "b6f61fc243974a25cb6914b84a529b373a717626"
|
||||
"reference": "d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/think-orm/zipball/b6f61fc243974a25cb6914b84a529b373a717626",
|
||||
"reference": "b6f61fc243974a25cb6914b84a529b373a717626",
|
||||
"url": "https://api.github.com/repos/top-think/think-orm/zipball/d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4",
|
||||
"reference": "d6965dfae21f150e29cc899ab6f9b1bd2c0f2ee4",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -764,7 +764,7 @@
|
||||
"psr/simple-cache": "^1.0",
|
||||
"topthink/think-helper": "^3.1"
|
||||
},
|
||||
"time": "2020-01-02T09:09:50+00:00",
|
||||
"time": "2020-01-07T10:05:10+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -935,12 +935,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
||||
"reference": "88d74e6f666cc23103da97e8e2307ecc5db1b031"
|
||||
"reference": "73ce73f61a90994e23b7616c73655440f50790a0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/88d74e6f666cc23103da97e8e2307ecc5db1b031",
|
||||
"reference": "88d74e6f666cc23103da97e8e2307ecc5db1b031",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/73ce73f61a90994e23b7616c73655440f50790a0",
|
||||
"reference": "73ce73f61a90994e23b7616c73655440f50790a0",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -956,7 +956,7 @@
|
||||
"ext-json": "*",
|
||||
"topthink/framework": "^6.0"
|
||||
},
|
||||
"time": "2020-01-11T07:50:11+00:00",
|
||||
"time": "2020-01-13T06:39:14+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"think": {
|
||||
|
2
vendor/services.php
vendored
2
vendor/services.php
vendored
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// This file is automatically generated at:2020-01-11 16:01:42
|
||||
// This file is automatically generated at:2020-01-13 14:48:33
|
||||
declare (strict_types = 1);
|
||||
return array (
|
||||
0 => 'think\\app\\Service',
|
||||
|
2
vendor/topthink/framework/src/think/App.php
vendored
2
vendor/topthink/framework/src/think/App.php
vendored
@ -39,7 +39,7 @@ use think\initializer\RegisterService;
|
||||
*/
|
||||
class App extends Container
|
||||
{
|
||||
const VERSION = '6.0.1';
|
||||
const VERSION = '6.0.2';
|
||||
|
||||
/**
|
||||
* 应用调试模式
|
||||
|
@ -66,7 +66,7 @@ class Middleware
|
||||
{
|
||||
$middleware = $this->buildMiddleware($middleware, $type);
|
||||
|
||||
if ($middleware) {
|
||||
if (!empty($middleware)) {
|
||||
$this->queue[$type][] = $middleware;
|
||||
$this->queue[$type] = array_unique($this->queue[$type], SORT_REGULAR);
|
||||
}
|
||||
@ -135,11 +135,11 @@ class Middleware
|
||||
return (new Pipeline())
|
||||
->through(array_map(function ($middleware) {
|
||||
return function ($request, $next) use ($middleware) {
|
||||
[$call, $param] = $middleware;
|
||||
[$call, $params] = $middleware;
|
||||
if (is_array($call) && is_string($call[0])) {
|
||||
$call = [$this->app->make($call[0]), $call[1]];
|
||||
}
|
||||
$response = call_user_func($call, $request, $next, $param);
|
||||
$response = call_user_func($call, $request, $next, ...$params);
|
||||
|
||||
if (!$response instanceof Response) {
|
||||
throw new LogicException('The middleware must return Response instance');
|
||||
@ -182,9 +182,7 @@ class Middleware
|
||||
|
||||
$handler->report($e);
|
||||
|
||||
$response = $handler->render($passable, $e);
|
||||
|
||||
return $response;
|
||||
return $handler->render($passable, $e);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -197,11 +195,11 @@ class Middleware
|
||||
protected function buildMiddleware($middleware, string $type): array
|
||||
{
|
||||
if (is_array($middleware)) {
|
||||
[$middleware, $param] = $middleware;
|
||||
[$middleware, $params] = $middleware;
|
||||
}
|
||||
|
||||
if ($middleware instanceof Closure) {
|
||||
return [$middleware, $param ?? null];
|
||||
return [$middleware, $params ?? []];
|
||||
}
|
||||
|
||||
if (!is_string($middleware)) {
|
||||
@ -220,7 +218,7 @@ class Middleware
|
||||
return [];
|
||||
}
|
||||
|
||||
return [[$middleware, 'handle'], $param ?? null];
|
||||
return [[$middleware, 'handle'], $params ?? []];
|
||||
}
|
||||
|
||||
/**
|
||||
|
26
vendor/topthink/framework/src/think/Request.php
vendored
26
vendor/topthink/framework/src/think/Request.php
vendored
@ -327,12 +327,14 @@ class Request
|
||||
}
|
||||
|
||||
$request->header = array_change_key_case($header);
|
||||
$request->server = $_SERVER;
|
||||
$request->env = $app->env;
|
||||
|
||||
$inputData = $request->getInputData($request->input);
|
||||
|
||||
$request->server = $_SERVER;
|
||||
$request->env = $app->env;
|
||||
$request->get = $_GET;
|
||||
$request->post = $_POST ?: $request->getInputData($request->input);
|
||||
$request->put = $request->getInputData($request->input);
|
||||
$request->post = $_POST ?: $inputData;
|
||||
$request->put = $inputData;
|
||||
$request->request = $_REQUEST;
|
||||
$request->cookie = $_COOKIE;
|
||||
$request->file = $_FILES ?? [];
|
||||
@ -982,11 +984,12 @@ class Request
|
||||
|
||||
protected function getInputData($content): array
|
||||
{
|
||||
if (false !== strpos($this->contentType(), 'json')) {
|
||||
return (array) json_decode($content, true);
|
||||
} elseif (strpos($content, '=')) {
|
||||
$contentType = $this->contentType();
|
||||
if ($contentType == 'application/x-www-form-urlencoded') {
|
||||
parse_str($content, $data);
|
||||
return $data;
|
||||
} elseif (false !== strpos($contentType, 'json')) {
|
||||
return (array) json_decode($content, true);
|
||||
}
|
||||
|
||||
return [];
|
||||
@ -2051,15 +2054,18 @@ class Request
|
||||
/**
|
||||
* 设置php://input数据
|
||||
* @access public
|
||||
* @param string $input RAW数据
|
||||
* @param string $input RAW数据
|
||||
* @return $this
|
||||
*/
|
||||
public function withInput(string $input)
|
||||
{
|
||||
$this->input = $input;
|
||||
if (!empty($input)) {
|
||||
$this->post = $this->getInputData($input);
|
||||
$this->put = $this->getInputData($input);
|
||||
$inputData = $this->getInputData($input);
|
||||
if (!empty($inputData)) {
|
||||
$this->post = $inputData;
|
||||
$this->put = $inputData;
|
||||
}
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ class Validate
|
||||
'chsAlphaNum' => '/^[\x{4e00}-\x{9fa5}a-zA-Z0-9]+$/u',
|
||||
'chsDash' => '/^[\x{4e00}-\x{9fa5}a-zA-Z0-9\_\-]+$/u',
|
||||
'mobile' => '/^1[3-9]\d{9}$/',
|
||||
'idCard' => '/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/',
|
||||
'idCard' => '/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$)/',
|
||||
'zip' => '/\d{6}/',
|
||||
];
|
||||
|
||||
|
@ -85,8 +85,8 @@ class Schema extends Command
|
||||
$model = new $class;
|
||||
|
||||
$table = $model->getTable();
|
||||
$dbName = $model->getConnection()->getConfig('database');
|
||||
$path = $model->getConnection()->getConfig('schema_cache_path');
|
||||
$dbName = $model->db()->getConnection()->getConfig('database');
|
||||
$path = $model->db()->getConnection()->getConfig('schema_cache_path');
|
||||
if (!is_dir($path)) {
|
||||
mkdir($path, 0755, true);
|
||||
}
|
||||
|
@ -387,17 +387,17 @@ abstract class Rule
|
||||
/**
|
||||
* 指定路由中间件
|
||||
* @access public
|
||||
* @param string|array|Closure $middleware 中间件
|
||||
* @param mixed $param 参数
|
||||
* @param string|array|Closure $middleware 中间件
|
||||
* @param mixed $params 参数
|
||||
* @return $this
|
||||
*/
|
||||
public function middleware($middleware, $param = null)
|
||||
public function middleware($middleware, ...$params)
|
||||
{
|
||||
if (is_null($param) && is_array($middleware)) {
|
||||
if (empty($params) && is_array($middleware)) {
|
||||
$this->option['middleware'] = $middleware;
|
||||
} else {
|
||||
foreach ((array) $middleware as $item) {
|
||||
$this->option['middleware'][] = [$item, $param];
|
||||
$this->option['middleware'][] = [$item, $params];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,8 @@ class Controller extends Dispatch
|
||||
->send($this->request)
|
||||
->then(function () use ($instance) {
|
||||
// 获取当前操作名
|
||||
$action = $this->actionName . $this->rule->config('action_suffix');
|
||||
$suffix = $this->rule->config('action_suffix');
|
||||
$action = $this->actionName . $suffix;
|
||||
|
||||
if (is_callable([$instance, $action])) {
|
||||
$vars = $this->request->param();
|
||||
@ -91,6 +92,10 @@ class Controller extends Dispatch
|
||||
$reflect = new ReflectionMethod($instance, $action);
|
||||
// 严格获取当前操作方法名
|
||||
$actionName = $reflect->getName();
|
||||
if ($suffix) {
|
||||
$actionName = substr($actionName, 0, -strlen($suffix));
|
||||
}
|
||||
|
||||
$this->request->setAction($actionName);
|
||||
} catch (ReflectionException $e) {
|
||||
$reflect = new ReflectionMethod($instance, '__call');
|
||||
@ -127,12 +132,12 @@ class Controller extends Dispatch
|
||||
foreach ($middlewares as $key => $val) {
|
||||
if (!is_int($key)) {
|
||||
if (isset($val['only']) && !in_array($this->request->action(true), array_map(function ($item) {
|
||||
return strtolower($item);
|
||||
}, is_string($val['only']) ? explode(",", $val['only']) : $val['only']))) {
|
||||
return strtolower($item);
|
||||
}, is_string($val['only']) ? explode(",", $val['only']) : $val['only']))) {
|
||||
continue;
|
||||
} elseif (isset($val['except']) && in_array($this->request->action(true), array_map(function ($item) {
|
||||
return strtolower($item);
|
||||
}, is_string($val['except']) ? explode(',', $val['except']) : $val['except']))) {
|
||||
return strtolower($item);
|
||||
}, is_string($val['except']) ? explode(',', $val['except']) : $val['except']))) {
|
||||
continue;
|
||||
} else {
|
||||
$val = $key;
|
||||
|
@ -118,7 +118,7 @@ class Store
|
||||
*/
|
||||
public function setId($id = null): void
|
||||
{
|
||||
$this->id = is_string($id) && strlen($id) === 32 ? $id : md5(microtime(true) . session_create_id());
|
||||
$this->id = is_string($id) && strlen($id) === 32 && ctype_alnum($id) ? $id : md5(microtime(true) . session_create_id());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,8 +119,8 @@ class CacheTest extends TestCase
|
||||
$redis->shouldReceive("set")->once()->with('foo', 5)->andReturnTrue();
|
||||
$redis->shouldReceive("incrby")->once()->with('foo', 1)->andReturnTrue();
|
||||
$redis->shouldReceive("decrby")->once()->with('foo', 2)->andReturnTrue();
|
||||
$redis->shouldReceive("get")->once()->with('foo')->andReturn(6);
|
||||
$redis->shouldReceive("get")->once()->with('foo')->andReturn(4);
|
||||
$redis->shouldReceive("get")->once()->with('foo')->andReturn('6');
|
||||
$redis->shouldReceive("get")->once()->with('foo')->andReturn('4');
|
||||
$redis->shouldReceive("set")->once()->with('bar', serialize(true))->andReturnTrue();
|
||||
$redis->shouldReceive("set")->once()->with('baz', serialize(null))->andReturnTrue();
|
||||
$redis->shouldReceive("del")->once()->with('baz')->andReturnTrue();
|
||||
|
12
vendor/topthink/think-orm/src/db/BaseQuery.php
vendored
12
vendor/topthink/think-orm/src/db/BaseQuery.php
vendored
@ -829,6 +829,18 @@ abstract class BaseQuery
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自增序列名
|
||||
* @access public
|
||||
* @param string $sequence 自增序列名
|
||||
* @return $this
|
||||
*/
|
||||
public function sequence(string $sequence = null)
|
||||
{
|
||||
$this->options['sequence'] = $sequence;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置JSON字段信息
|
||||
* @access public
|
||||
|
12
vendor/topthink/think-orm/src/db/Query.php
vendored
12
vendor/topthink/think-orm/src/db/Query.php
vendored
@ -228,18 +228,6 @@ class Query extends BaseQuery
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自增序列名
|
||||
* @access public
|
||||
* @param string $sequence 自增序列名
|
||||
* @return $this
|
||||
*/
|
||||
public function sequence(string $sequence = null)
|
||||
{
|
||||
$this->options['sequence'] = $sequence;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定强制索引
|
||||
* @access public
|
||||
|
@ -424,7 +424,7 @@ trait Attribute
|
||||
break;
|
||||
case 'datetime':
|
||||
$value = is_numeric($value) ? $value : strtotime($value);
|
||||
$value = $this->formatDateTime('Y-m-d H:i:s.u', $value);
|
||||
$value = $this->formatDateTime('Y-m-d H:i:s.u', $value, true);
|
||||
break;
|
||||
case 'object':
|
||||
if (is_object($value)) {
|
||||
|
@ -99,9 +99,10 @@ class AliossStorage extends Storage
|
||||
* @param string $name 文件名称
|
||||
* @param string $file 文件内容
|
||||
* @param boolean $safe 安全模式
|
||||
* @param string $attachment 下载名称
|
||||
* @return array
|
||||
*/
|
||||
public function set($name, $file, $safe = false)
|
||||
public function set($name, $file, $safe = false, $attachment = null)
|
||||
{
|
||||
$token = $this->buildUploadToken($name);
|
||||
$data = ['key' => $name];
|
||||
@ -109,6 +110,9 @@ class AliossStorage extends Storage
|
||||
$data['Signature'] = $token['signature'];
|
||||
$data['OSSAccessKeyId'] = $this->accessKey;
|
||||
$data['success_action_status'] = '200';
|
||||
if (is_string($attachment) && strlen($attachment) > 0) {
|
||||
$data['Content-Disposition'] = "attachment;filename=" . urlencode($attachment);
|
||||
}
|
||||
$file = ['field' => 'file', 'name' => $name, 'content' => $file];
|
||||
if (is_numeric(stripos(HttpExtend::submit($this->upload(), $data, $file), '200 OK'))) {
|
||||
return ['file' => $this->path($name, $safe), 'url' => $this->url($name, $safe), 'key' => $name];
|
||||
|
Loading…
x
Reference in New Issue
Block a user