users_commission_logs.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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('UsersCommissionLogs', {
  6. log_id: {
  7. type: DataTypes.INTEGER(10).UNSIGNED,
  8. allowNull: false,
  9. primaryKey: true,
  10. autoIncrement: true,
  11. },
  12. log_desc: {
  13. type: DataTypes.STRING(255),
  14. allowNull: true,
  15. },
  16. action_user: {
  17. type: DataTypes.STRING(255),
  18. allowNull: true,
  19. },
  20. commission: {
  21. type: DataTypes.FLOAT,
  22. allowNull: true,
  23. },
  24. user_id: {
  25. type: DataTypes.INTEGER(10).UNSIGNED,
  26. allowNull: true,
  27. },
  28. order_id: {
  29. type: DataTypes.INTEGER(10).UNSIGNED,
  30. allowNull: true,
  31. defaultValue: -1,
  32. },
  33. out_batch_no: {
  34. type: DataTypes.STRING(128),
  35. allowNull: true,
  36. },
  37. out_detail_no: {
  38. type: DataTypes.STRING(128),
  39. allowNull: true,
  40. },
  41. type: {
  42. type: DataTypes.INTEGER(2).UNSIGNED,
  43. allowNull: true,
  44. },
  45. inviter_id: {
  46. type: DataTypes.INTEGER(10).UNSIGNED,
  47. allowNull: true,
  48. },
  49. inviter_name: {
  50. type: DataTypes.STRING(255),
  51. allowNull: true,
  52. },
  53. inviter_img: {
  54. type: DataTypes.STRING(255),
  55. allowNull: true,
  56. },
  57. create_time: {
  58. type: DataTypes.TIME,
  59. allowNull: true,
  60. },
  61. }, {
  62. tableName: 'szj_users_commission_logs',
  63. });
  64. Model.associate = function() {
  65. // 关联订单表
  66. Model.belongsTo(app.model.Orders, { foreignKey: 'order_id', targetKey: 'order_id', as: 'order' });
  67. };
  68. // 同步:没有就新建,有就不变
  69. Model.sync();
  70. return Model;
  71. };