dinner_coins.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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('DinnerCoins', {
  6. id: {
  7. type: DataTypes.INTEGER(10).UNSIGNED,
  8. allowNull: false,
  9. primaryKey: true,
  10. autoIncrement: true,
  11. },
  12. user_id: {
  13. type: DataTypes.INTEGER(16),
  14. allowNull: true,
  15. },
  16. account: {
  17. type: DataTypes.FLOAT(10, 2),
  18. allowNull: true,
  19. },
  20. ori_partner: {
  21. type: DataTypes.INTEGER(1),
  22. allowNull: true,
  23. },
  24. expired: {
  25. type: DataTypes.INTEGER(1),
  26. allowNull: true,
  27. },
  28. partner_id: {
  29. type: DataTypes.INTEGER(16),
  30. allowNull: true,
  31. },
  32. partner_name: {
  33. type: DataTypes.STRING(64),
  34. allowNull: true,
  35. },
  36. partner_address: {
  37. type: DataTypes.STRING(128),
  38. allowNull: true,
  39. },
  40. partner_tel: {
  41. type: DataTypes.STRING(16),
  42. allowNull: true,
  43. },
  44. partner_opening_time: {
  45. type: DataTypes.STRING(64),
  46. allowNull: true,
  47. },
  48. expired_time: {
  49. type: DataTypes.TIME,
  50. allowNull: true,
  51. },
  52. create_time: {
  53. type: DataTypes.TIME,
  54. allowNull: true,
  55. },
  56. update_time: {
  57. type: DataTypes.TIME,
  58. allowNull: true,
  59. },
  60. }, {
  61. tableName: 'szj_dinner_coins',
  62. });
  63. Model.associate = function() {
  64. // 关联商户表
  65. Model.belongsTo(app.model.PartnerInfo, { foreignKey: 'partner_id', targetKey: 'id', as: 'partnerInfo' });
  66. };
  67. // 同步:没有就新建,有就不变
  68. Model.sync();
  69. return Model;
  70. };