clue.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. const { DataTypes } = require('sequelize');
  2. const connect = require('./connect');
  3. /*
  4. type: DataTypes.STRING,
  5. allowNull: false,
  6. defaultValue:'',
  7. comment: '名',
  8. */
  9. const model = connect.define(
  10. __filename.slice(__dirname.length + 1).replace('.js', ''),
  11. {
  12. id: {
  13. type: DataTypes.INTEGER,
  14. autoIncrement: true,
  15. primaryKey: true,
  16. comment: 'id',
  17. },
  18. bid: {
  19. type: DataTypes.INTEGER,
  20. defaultValue: 0,
  21. comment: '商户ID',
  22. },
  23. name: {
  24. type: DataTypes.STRING,
  25. allowNull: false,
  26. defaultValue: '',
  27. comment: '联系人',
  28. },
  29. phone: {
  30. type: DataTypes.STRING,
  31. defaultValue: '',
  32. comment: '手机号',
  33. },
  34. email: {
  35. type: DataTypes.STRING,
  36. defaultValue: '',
  37. comment: '邮箱',
  38. },
  39. content: {
  40. type: DataTypes.STRING,
  41. defaultValue: '',
  42. comment: '内容',
  43. },
  44. adminId: {
  45. type: DataTypes.INTEGER,
  46. defaultValue: 0,
  47. comment: '管理员ID',
  48. },
  49. type: {
  50. type: DataTypes.TINYINT,
  51. defaultValue: 0,
  52. comment: '1联系我们2预约咨询',
  53. },
  54. isContact: {
  55. type: DataTypes.TINYINT,
  56. defaultValue: 0,
  57. comment: '是否联系0未联系1联系',
  58. },
  59. busName: {
  60. type: DataTypes.STRING,
  61. defaultValue: '',
  62. comment: '账号名',
  63. },
  64. busCompany: {
  65. type: DataTypes.STRING,
  66. defaultValue: '',
  67. comment: '账号公司',
  68. },
  69. },
  70. {
  71. comment: '联系和咨询',
  72. hooks: {
  73. beforeFind(option) {
  74. if (!option.order) {
  75. option.order = [['id', 'desc']];
  76. }
  77. },
  78. },
  79. }
  80. );
  81. module.exports = model;