背景:const EventUser = sequelize.define('userEvents', { payStatus: Sequelize.STRING
})
User.belongsToMany(Event, { through: EventUser})
Event.belongsToMany(User, { through: EventUser})使用: const event = await EventModel.getEventDetail(eventId); const user = await UserModel.findUserById(userId); //这里event和user都是有值的,确认
try { await event.addUser(user, { through: { payStatus: payStatus }}) //这里报错
} catch (e) {
console.log(e)
}
- 2 回答
- 0 关注
- 1755 浏览
添加回答
举报
0/150
提交
取消