You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
925 B
38 lines
925 B
3 years ago
|
'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 = {
|
||
|
|
||
|
};
|