users_money_logs.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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('UsersMoneyLogs', {
  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. money: {
  17. type: DataTypes.FLOAT,
  18. allowNull: true,
  19. },
  20. user_id: {
  21. type: DataTypes.INTEGER(10).UNSIGNED,
  22. allowNull: true,
  23. },
  24. type: {
  25. type: DataTypes.INTEGER(2).UNSIGNED,
  26. allowNull: true,
  27. },
  28. inviter_id: {
  29. type: DataTypes.INTEGER(10).UNSIGNED,
  30. allowNull: true,
  31. },
  32. inviter_name: {
  33. type: DataTypes.STRING(255),
  34. allowNull: true,
  35. },
  36. inviter_img: {
  37. type: DataTypes.STRING(255),
  38. allowNull: true,
  39. },
  40. admin_id: {
  41. type: DataTypes.INTEGER(10).UNSIGNED,
  42. allowNull: true,
  43. },
  44. change_time: {
  45. type: DataTypes.TIME,
  46. allowNull: true,
  47. },
  48. }, {
  49. tableName: 'szj_users_money_logs',
  50. });
  51. Model.associate = function() {
  52. Model.belongsTo(app.model.AdminUser, { foreignKey: 'admin_id', targetKey: 'admin_id', as: 'admin_user' });
  53. };
  54. // 同步:没有就新建,有就不变
  55. Model.sync();
  56. return Model;
  57. };