0
我只是想通过sailsjs在我的数据库创建一个新的输入,但没有错误,没有主菜出来。帆创建问题
这里是我的模型
module.exports = {
attributes: {
id: { type: 'integer'},
entreprise_id: { type: 'integer'},
employees_id: { type: 'string'},
name : { type: 'string'},
description_short: { type: 'string'},
description_long: { type: 'string'},
price: { type: 'string'},
duration: { type: 'string'},
at_home: {type: 'integer'},
break_time: {type: 'integer'},
many_customer: {type: 'integer'},
last_minute_max: {type: 'integer'},
precision_label: {type: 'string'},
createdAt : { type: 'date' },
updatedAt : { type: 'date' }
}
}
和脚本来创建主菜
Service.create({
entreprise_id: entrepriseId,
employees_id:infos['employees_id'],
name :infos['name'],
description_short:infos['description_short'],
description_long:infos['description_long'],
price:infos['price'],
duration:infos['duration'],
at_home:infos['at_home'],
break_time:infos['break_time'],
many_customer:infos['many_customer'],
last_minute_max:infos['last_minute_max'],
precision_label:infos['precision_label']
}).exec(function(err, newService){
if(err){ com.push({error:err})}
else{
com.push(newService)
}
});
我已经验证了信息数组中的所有信息都是空或包含的值,但没有的错误。 这个问题的关键在于我在我的阵列中没有错误,并且没有新的服务作为墙。
1.什么是你的模型文件的名字吗?你如何运行脚本? 3. com数组初始化和检查在哪里? 4.你尝试把日志? – Sangharsh
1. Service.js; 2.我在控制台sailsjs上用grunt运行脚本; 3.数组com在脚本的顶部初始化,我将它用作日志 – Nastyo