import OSS from 'ali-oss'

//上传文件至oss
export async function uploadFileToOss(file) {
	let oss = new OSS({
		region: 'oss-cn-beijing',
		endpoint: "oss-cn-beijing.aliyuncs.com",
		bucket: "junying-odd-job",
		accessKeyId: "LTAI5t9CEXn9sFzGuyi8TYuG",
		accessKeySecret: 'RZFAommAxaeD07ROjVuQZcBwkp1beQ',
		timeout: 87600,
	})
	return new Promise((resolve) => {
		oss.put('upload/files/' + new Date().getTime() + file.name, file).then(({ url }) => {
			resolve(url)
		})
	});
}
