partner_info.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* indent size: 2 */
  2. // eslint-disable-next-line strict
  3. module.exports = app => {
  4. const DataTypes = app.Sequelize;
  5. const Model = app.model.define('PartnerInfo', {
  6. id: {
  7. type: DataTypes.INTEGER(10).UNSIGNED,
  8. allowNull: false,
  9. primaryKey: true,
  10. autoIncrement: true,
  11. },
  12. name: {
  13. type: DataTypes.STRING(16),
  14. allowNull: true,
  15. },
  16. address: {
  17. type: DataTypes.STRING(128),
  18. allowNull: true,
  19. },
  20. tel_num: {
  21. type: DataTypes.STRING(16),
  22. allowNull: true,
  23. },
  24. opening_time: {
  25. type: DataTypes.STRING(64),
  26. allowNull: true,
  27. },
  28. rate_from_partner: {
  29. type: DataTypes.FLOAT(10, 2),
  30. allowNull: true,
  31. },
  32. rate_default: {
  33. type: DataTypes.FLOAT(10, 2),
  34. allowNull: true,
  35. },
  36. user_id: {
  37. type: DataTypes.INTEGER(16).UNSIGNED,
  38. allowNull: true,
  39. },
  40. create_time: {
  41. type: DataTypes.TIME,
  42. allowNull: true,
  43. },
  44. update_time: {
  45. type: DataTypes.TIME,
  46. allowNull: true,
  47. },
  48. partner_img: {
  49. type: DataTypes.STRING(128),
  50. allowNull: true,
  51. },
  52. county_name: {
  53. type: DataTypes.STRING(16),
  54. allowNull: true,
  55. },
  56. router_name: {
  57. type: DataTypes.STRING(32),
  58. allowNull: true,
  59. },
  60. top: {
  61. type: DataTypes.INTEGER(1).UNSIGNED,
  62. allowNull: true,
  63. },
  64. online: {
  65. type: DataTypes.INTEGER(1).UNSIGNED,
  66. allowNull: true,
  67. },
  68. order_amount: {
  69. type: DataTypes.INTEGER(8).UNSIGNED,
  70. allowNull: true,
  71. },
  72. latitude: {
  73. type: DataTypes.FLOAT(10, 6),
  74. allowNull: true,
  75. },
  76. longitude: {
  77. type: DataTypes.FLOAT(11, 6),
  78. allowNull: true,
  79. },
  80. category_id: {
  81. type: DataTypes.INTEGER(10),
  82. allowNull: true,
  83. },
  84. partner_fees: {
  85. type: DataTypes.INTEGER(10),
  86. allowNull: true,
  87. },
  88. }, {
  89. tableName: 'szj_partner_info',
  90. });
  91. Model.associate = function() {
  92. // 关联用户表
  93. Model.belongsTo(app.model.Users, { foreignKey: 'user_id', targetKey: 'user_id', as: 'user' });
  94. };
  95. // 同步:没有就新建,有就不变
  96. Model.sync();
  97. return Model;
  98. };