1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- /* indent size: 2 */
- // eslint-disable-next-line strict
- module.exports = app => {
- const DataTypes = app.Sequelize;
- const Model = app.model.define('UsersCommissionLogs', {
- log_id: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: false,
- primaryKey: true,
- autoIncrement: true,
- },
- log_desc: {
- type: DataTypes.STRING(255),
- allowNull: true,
- },
- action_user: {
- type: DataTypes.STRING(255),
- allowNull: true,
- },
- commission: {
- type: DataTypes.FLOAT,
- allowNull: true,
- },
- user_id: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: true,
- },
- order_id: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: true,
- defaultValue: -1,
- },
- out_batch_no: {
- type: DataTypes.STRING(128),
- allowNull: true,
- },
- out_detail_no: {
- type: DataTypes.STRING(128),
- allowNull: true,
- },
- type: {
- type: DataTypes.INTEGER(2).UNSIGNED,
- allowNull: true,
- },
- inviter_id: {
- type: DataTypes.INTEGER(10).UNSIGNED,
- allowNull: true,
- },
- inviter_name: {
- type: DataTypes.STRING(255),
- allowNull: true,
- },
- inviter_img: {
- type: DataTypes.STRING(255),
- allowNull: true,
- },
- create_time: {
- type: DataTypes.TIME,
- allowNull: true,
- },
- }, {
- tableName: 'szj_users_commission_logs',
- });
- Model.associate = function() {
- // 关联订单表
- Model.belongsTo(app.model.Orders, { foreignKey: 'order_id', targetKey: 'order_id', as: 'order' });
- };
- // 同步:没有就新建,有就不变
- Model.sync();
- return Model;
- };
|