|
|
@@ -78,19 +78,13 @@ export class MiniAd {
|
|
|
throw new Error('not found params')
|
|
|
}
|
|
|
const form = new FormData()
|
|
|
- let filename = await Encrypt.md5(Random.number(0, 999999).toString())
|
|
|
- let fileMime = 'image/png'
|
|
|
+ // let filename = await Encrypt.md5(Random.number(0, 999999).toString())
|
|
|
+ // let fileMime = 'image/png'
|
|
|
form.append('token', 1242207897)
|
|
|
Object.entries(params).forEach(item => {
|
|
|
const k = item[0]
|
|
|
const v = item[1]
|
|
|
- if (k === 'name') {
|
|
|
- filename = v.toString()
|
|
|
- } else if (k === 'type') {
|
|
|
- fileMime = v.toString()
|
|
|
- } else {
|
|
|
- form.append(k, v)
|
|
|
- }
|
|
|
+ form.append(k, v)
|
|
|
})
|
|
|
const image = ctx.request.files.image_file
|
|
|
|
|
|
@@ -98,11 +92,12 @@ export class MiniAd {
|
|
|
|
|
|
form.append('image_file', fs.readFileSync(path, { encoding: 'binary' }), { contentType: params.type, filename: params.name })
|
|
|
|
|
|
+ console.log(form)
|
|
|
const data = await this.service.snsImage(form)
|
|
|
if (data) {
|
|
|
- console.log(data.body, data.headers)
|
|
|
- // ret.code = 200
|
|
|
- // ret.msg = 'ok'
|
|
|
+ console.log(data.headers, data.body)
|
|
|
+ ret.code = 200
|
|
|
+ ret.msg = 'ok'
|
|
|
// ret.data = data
|
|
|
}
|
|
|
} catch (e) {
|