Commit d6b48561 by xiawei

upload oss

parent 27e524dd
const { version } = require('./package.json');
const BASE_URL = '/live/'; const BASE_URL = '/live/';
const globalEnv = require('./config/global.js'); const globalEnv = require('./config/global.js');
const modeEnv = process.env.mode ? require(`./config/${process.env.mode}.js`) : {}; const modeEnv = process.env.mode ? require(`./config/${process.env.mode}.js`) : {};
...@@ -103,7 +104,7 @@ export default { ...@@ -103,7 +104,7 @@ export default {
*/ */
// publicPath: `/${BUILD_DIST.toLowerCase()}/`, // publicPath: `/${BUILD_DIST.toLowerCase()}/`,
publicPath: process.env.run_server publicPath: process.env.run_server
? `//static-${process.env.run_server}.guangdianyun.tv/live/${getTime()}` ? `//static-${process.env.run_server}.guangdianyun.tv/live/${version}`
: `/${BUILD_DIST.toLowerCase()}/`, : `/${BUILD_DIST.toLowerCase()}/`,
extend(config, ctx) { extend(config, ctx) {
// console.log(ctx); // console.log(ctx);
...@@ -113,24 +114,3 @@ export default { ...@@ -113,24 +114,3 @@ export default {
plugins: [] plugins: []
} }
}; };
/**
*日期
*/
function getTime() {
let format = 'yyMMdd';
const date = new Date();
const o = {
'y+': String(date.getFullYear()).substr(2, 2),
'M+': String(date.getMonth() + 1),
'd+': String(date.getDate())
};
for (const k in o) {
if (new RegExp(`(${k})`).test(format)) {
let str = o[k] + '';
str = str.length > 1 ? str : 0 + str;
format = format.replace(RegExp.$1, str);
}
}
return format;
}
const { version } = require('./package.json');
const OSS = require('ali-oss'); const OSS = require('ali-oss');
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
...@@ -79,24 +80,4 @@ async function upload(dirName) { ...@@ -79,24 +80,4 @@ async function upload(dirName) {
console.log(dirName + '上传oss成功失败', err); console.log(dirName + '上传oss成功失败', err);
} }
} }
/** upload(`/live/${version}`);
*日期
*/
function getTime() {
let format = 'yyMMdd';
const date = new Date();
const o = {
'y+': String(date.getFullYear()).substr(2, 2),
'M+': String(date.getMonth() + 1),
'd+': String(date.getDate())
};
for (const k in o) {
if (new RegExp(`(${k})`).test(format)) {
let str = o[k] + '';
str = str.length > 1 ? str : 0 + str;
format = format.replace(RegExp.$1, str);
}
}
return format;
}
upload(`/live/${getTime()}`);
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 sign in to comment