Commit 22dc75e6 authored by hewenhao's avatar hewenhao

feat: update

parent 72fc7bf5
export default {
"正价课后接二维码.jpg": {
"u": "https://cdn.jkwljy.com/pbb/j2YF_vxBB4NKy1QXtNQXjmB7Cr8_/309x309",
"w": 309,
"h": 309
},
"专注力课-鹿帅二维码.jpg": {
"u": "https://cdn.jkwljy.com/pbb/ZBD_M_L2k9IIQQmjNlBv9QSCGH8_/448x453",
"w": 448,
"h": 453
},
"专注力课-橙子老师二维码.jpg": {
"u": "https://cdn.jkwljy.com/pbb/XCLgJQ3S4ki4mcFLX67wyftu5X8_/491x497",
"w": 491,
"h": 497
}
}
\ No newline at end of file
export default {
"体验课海报.jpg": {
"u": "https://cdn.jkwljy.com/pbb/TgZckDx_yjk1durzDLri9YSPmJs_/1080x1920",
"w": 1080,
"h": 1920
},
"体验课banner.jpg": {
"u": "https://cdn.jkwljy.com/pbb/T92r5Co7D05KxSnGjdZF7JuaJtk_/686x340",
"w": 686,
"h": 340
},
"专注力体验课详情页.jpg": {
"u": "https://cdn.jkwljy.com/pbb/0NHttXBA2hZOT3nJNa3KclkTva8_/750x8562",
"w": 750,
"h": 8562
}
}
\ No newline at end of file
export default {
"首图.jpg": {
"u": "https://cdn.jkwljy.com/pbb/0xQSqThfQhd9wyUDIMeU9PrF2KU_/750x750",
"w": 750,
"h": 750
},
"详情页.jpg": {
"u": "https://cdn.jkwljy.com/pbb/GR3HsKu_ztltI69cyASeWitwSYg_/750x7847",
"w": 750,
"h": 7847
},
"海报1.jpg": {
"u": "https://cdn.jkwljy.com/pbb/ndxYAf8KSmrA8aO0jBRJxQvmFhM_/1080x1920",
"w": 1080,
"h": 1920
},
"banner.jpg": {
"u": "https://cdn.jkwljy.com/pbb/QpyBogiZSd9vOa__TTs1xFfQRMg_/686x340",
"w": 686,
"h": 340
}
}
\ No newline at end of file
...@@ -76,7 +76,7 @@ function uploadFile ({ fileName, filePath, relativePath }) { ...@@ -76,7 +76,7 @@ function uploadFile ({ fileName, filePath, relativePath }) {
cos.sliceUploadFile({ cos.sliceUploadFile({
Bucket: config.Bucket,//'test-1257124244', // Bucket 格式:test-1250000000 Bucket: config.Bucket,//'test-1257124244', // Bucket 格式:test-1250000000
Region: 'ap-chengdu', Region: 'ap-chengdu',
Key: getFileName(relativePath, filePath), Key: getFileName(relativePath, filePath, dimensions),
ContentType: getContentType(filePath), ContentType: getContentType(filePath),
CacheControl: 'max-age=5185897', CacheControl: 'max-age=5185897',
FilePath: filePath, FilePath: filePath,
...@@ -99,7 +99,7 @@ function uploadFile ({ fileName, filePath, relativePath }) { ...@@ -99,7 +99,7 @@ function uploadFile ({ fileName, filePath, relativePath }) {
}) })
} }
function getFileName(filePath, absolutPath) { function getFileName(filePath, absolutPath, dimensions) {
const str = require('crypto') const str = require('crypto')
.createHash('sha1') .createHash('sha1')
.update('geek-cos-upload') .update('geek-cos-upload')
...@@ -108,7 +108,7 @@ function getFileName(filePath, absolutPath) { ...@@ -108,7 +108,7 @@ function getFileName(filePath, absolutPath) {
.update(fs.readFileSync(absolutPath, { encoding: 'binary' })) .update(fs.readFileSync(absolutPath, { encoding: 'binary' }))
.digest('base64') .digest('base64')
.replace(/\.|\-|\=|\+|\//g, '_') .replace(/\.|\-|\=|\+|\//g, '_')
return `/${folderName}/${str}`; return `/${folderName}/${str}/${dimensions.width}x${dimensions.height}`;
} }
// // 分片上传 // // 分片上传
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment