修改文件存储规则

This commit is contained in:
Anyon 2020-01-08 15:50:36 +08:00
parent 51385f1c2a
commit 58feddd930
7 changed files with 16 additions and 15 deletions

View File

@ -103,7 +103,7 @@ define(['md5'], function (SparkMD5, allowExtsMimes) {
function setFileXdata(file, xmd5) { function setFileXdata(file, xmd5) {
file.xmd5 = xmd5; file.xmd5 = xmd5;
file.xkey = file.xmd5.substr(0, 16) + '/' + file.xmd5.substr(16, 16) + '.' + file.xext; file.xkey = file.xmd5.substr(0, 2) + '/' + file.xmd5.substr(2, 30) + '.' + file.xext;
delete file.chunk_idx; delete file.chunk_idx;
delete file.chunk_size; delete file.chunk_size;
delete file.chunk_total; delete file.chunk_total;

8
composer.lock generated
View File

@ -909,12 +909,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "8c49f31c04ed4bf34710e43d4115aeba37bbcfaa" "reference": "cd754db0e9921b7aa6cf617887cdc8b122fe8c46"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/8c49f31c04ed4bf34710e43d4115aeba37bbcfaa", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/cd754db0e9921b7aa6cf617887cdc8b122fe8c46",
"reference": "8c49f31c04ed4bf34710e43d4115aeba37bbcfaa", "reference": "cd754db0e9921b7aa6cf617887cdc8b122fe8c46",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -958,7 +958,7 @@
], ],
"description": "ThinkPHP v6.0 Development Library", "description": "ThinkPHP v6.0 Development Library",
"homepage": "http://framework.thinkadmin.top", "homepage": "http://framework.thinkadmin.top",
"time": "2020-01-08T02:36:41+00:00" "time": "2020-01-08T07:48:20+00:00"
}, },
{ {
"name": "zoujingli/wechat-developer", "name": "zoujingli/wechat-developer",

View File

@ -203,6 +203,7 @@ return array(
'app\\wechat\\controller\\Menu' => $baseDir . '/app/wechat/controller/Menu.php', 'app\\wechat\\controller\\Menu' => $baseDir . '/app/wechat/controller/Menu.php',
'app\\wechat\\controller\\News' => $baseDir . '/app/wechat/controller/News.php', 'app\\wechat\\controller\\News' => $baseDir . '/app/wechat/controller/News.php',
'app\\wechat\\controller\\api\\Js' => $baseDir . '/app/wechat/controller/api/Js.php', 'app\\wechat\\controller\\api\\Js' => $baseDir . '/app/wechat/controller/api/Js.php',
'app\\wechat\\controller\\api\\Login' => $baseDir . '/app/wechat/controller/api/Login.php',
'app\\wechat\\controller\\api\\Push' => $baseDir . '/app/wechat/controller/api/Push.php', 'app\\wechat\\controller\\api\\Push' => $baseDir . '/app/wechat/controller/api/Push.php',
'app\\wechat\\controller\\api\\Review' => $baseDir . '/app/wechat/controller/api/Review.php', 'app\\wechat\\controller\\api\\Review' => $baseDir . '/app/wechat/controller/api/Review.php',
'app\\wechat\\controller\\api\\Test' => $baseDir . '/app/wechat/controller/api/Test.php', 'app\\wechat\\controller\\api\\Test' => $baseDir . '/app/wechat/controller/api/Test.php',

View File

@ -336,6 +336,7 @@ class ComposerStaticInit2b1316f37dd8fe5c4c25969e0b842e8e
'app\\wechat\\controller\\Menu' => __DIR__ . '/../..' . '/app/wechat/controller/Menu.php', 'app\\wechat\\controller\\Menu' => __DIR__ . '/../..' . '/app/wechat/controller/Menu.php',
'app\\wechat\\controller\\News' => __DIR__ . '/../..' . '/app/wechat/controller/News.php', 'app\\wechat\\controller\\News' => __DIR__ . '/../..' . '/app/wechat/controller/News.php',
'app\\wechat\\controller\\api\\Js' => __DIR__ . '/../..' . '/app/wechat/controller/api/Js.php', 'app\\wechat\\controller\\api\\Js' => __DIR__ . '/../..' . '/app/wechat/controller/api/Js.php',
'app\\wechat\\controller\\api\\Login' => __DIR__ . '/../..' . '/app/wechat/controller/api/Login.php',
'app\\wechat\\controller\\api\\Push' => __DIR__ . '/../..' . '/app/wechat/controller/api/Push.php', 'app\\wechat\\controller\\api\\Push' => __DIR__ . '/../..' . '/app/wechat/controller/api/Push.php',
'app\\wechat\\controller\\api\\Review' => __DIR__ . '/../..' . '/app/wechat/controller/api/Review.php', 'app\\wechat\\controller\\api\\Review' => __DIR__ . '/../..' . '/app/wechat/controller/api/Review.php',
'app\\wechat\\controller\\api\\Test' => __DIR__ . '/../..' . '/app/wechat/controller/api/Test.php', 'app\\wechat\\controller\\api\\Test' => __DIR__ . '/../..' . '/app/wechat/controller/api/Test.php',

View File

@ -935,12 +935,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "8c49f31c04ed4bf34710e43d4115aeba37bbcfaa" "reference": "cd754db0e9921b7aa6cf617887cdc8b122fe8c46"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/8c49f31c04ed4bf34710e43d4115aeba37bbcfaa", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/cd754db0e9921b7aa6cf617887cdc8b122fe8c46",
"reference": "8c49f31c04ed4bf34710e43d4115aeba37bbcfaa", "reference": "cd754db0e9921b7aa6cf617887cdc8b122fe8c46",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -956,7 +956,7 @@
"ext-json": "*", "ext-json": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2020-01-08T02:36:41+00:00", "time": "2020-01-08T07:48:20+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2020-01-08 14:08:41 // This file is automatically generated at:2020-01-08 15:50:23
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\app\\Service', 0 => 'think\\app\\Service',

View File

@ -112,11 +112,10 @@ abstract class Storage
*/ */
public static function name($url, $ext = '', $pre = '', $fun = 'md5'): string public static function name($url, $ext = '', $pre = '', $fun = 'md5'): string
{ {
empty($ext) && $ext = pathinfo($url, 4); if (empty($ext)) $ext = pathinfo($url, 4);
empty($ext) || $ext = trim($ext, '.\\/'); list($xmd, $ext) = [$fun($url), trim($ext, '.\\/')];
empty($pre) || $pre = trim($pre, '.\\/'); $attr = [trim($pre, '.\\/'), substr($xmd, 0, 2), substr($xmd, 2, 30)];
$splits = array_merge([$pre], str_split($fun($url), 16)); return trim(join('/', $attr), '/') . '.' . strtolower($ext ? $ext : 'tmp');
return trim(join('/', $splits), '/') . '.' . strtolower($ext ? $ext : 'tmp');
} }
/** /**