5 changed files with 134 additions and 82 deletions
@ -0,0 +1,38 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
async function createYingshi (ctx) { |
||||
|
try { |
||||
|
const { models } = ctx.fs.dc |
||||
|
const { userId, token } = ctx.fs.api |
||||
|
|
||||
|
const { id, name, cloudControl, highDefinition, memoryCard, |
||||
|
voice, kindId, abilityId, rtmp, } = ctx.request.body |
||||
|
|
||||
|
let storageData = { |
||||
|
type: 'yingshi', name, cloudControl, highDefinition, memoryCard, |
||||
|
voice, longitude, latitude, kindId, abilityId, rtmp, |
||||
|
} |
||||
|
|
||||
|
if (id) { |
||||
|
storageData.createTime = moment().format() |
||||
|
storageData.createUserId = userId |
||||
|
await models.Camera.update(storageData, { |
||||
|
where: { |
||||
|
id, |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
await models.Camera.create(storageData) |
||||
|
} |
||||
|
|
||||
|
ctx.status = 204; |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = {} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
module.exports = { |
||||
|
|
||||
|
}; |
Loading…
Reference in new issue