12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- const { DataTypes } = require('sequelize');
- const connect = require('./connect');
- /*
- type: DataTypes.STRING,
- allowNull: false,
- defaultValue:'',
- comment: '名',
- */
- const model = connect.define(
- __filename.slice(__dirname.length + 1).replace('.js', ''),
- {
- id: {
- type: DataTypes.INTEGER,
- autoIncrement: true,
- primaryKey: true,
- comment: 'id',
- },
- bid: {
- type: DataTypes.INTEGER,
- defaultValue: 0,
- comment: '商户ID',
- },
- name: {
- type: DataTypes.STRING,
- allowNull: false,
- defaultValue: '',
- comment: '联系人',
- },
- phone: {
- type: DataTypes.STRING,
- defaultValue: '',
- comment: '手机号',
- },
- email: {
- type: DataTypes.STRING,
- defaultValue: '',
- comment: '邮箱',
- },
- content: {
- type: DataTypes.STRING,
- defaultValue: '',
- comment: '内容',
- },
- adminId: {
- type: DataTypes.INTEGER,
- defaultValue: 0,
- comment: '管理员ID',
- },
- type: {
- type: DataTypes.TINYINT,
- defaultValue: 0,
- comment: '1联系我们2预约咨询',
- },
- isContact: {
- type: DataTypes.TINYINT,
- defaultValue: 0,
- comment: '是否联系0未联系1联系',
- },
- busName: {
- type: DataTypes.STRING,
- defaultValue: '',
- comment: '账号名',
- },
- busCompany: {
- type: DataTypes.STRING,
- defaultValue: '',
- comment: '账号公司',
- },
- },
- {
- comment: '联系和咨询',
- hooks: {
- beforeFind(option) {
- if (!option.order) {
- option.order = [['id', 'desc']];
- }
- },
- },
- }
- );
- module.exports = model;
|