17 lines
499 B
JavaScript
17 lines
499 B
JavaScript
const Framework = require("../../framework/node-core-framework.js");
|
|
const ossToolService = require('../services/oss_tool_service.js');
|
|
module.exports = {
|
|
|
|
'POST /file/upload_oss': async (ctx) => {
|
|
const body = ctx.getBody();
|
|
const { fileBase64 } = body;
|
|
|
|
|
|
// base 64 转buffer
|
|
const buffer = Buffer.from(fileBase64, 'base64');
|
|
let result = await ossToolService.uploadStream(buffer, 'image/jpeg', 'jpg')
|
|
|
|
|
|
return ctx.success(result);
|
|
}
|
|
} |