'use strict'; module.exports = app => { const DataTypes = app.Sequelize; const sequelize = app.model; const attributes = { articleId: { type: DataTypes.INTEGER(10).UNSIGNED, allowNull: false, defaultValue: null, primaryKey: true, autoIncrement: true, comment: "文章ID", field: "article_id" }, articleTitle: { type: DataTypes.STRING(200), allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "文章标题", field: "article_title" }, articleDesc: { type: DataTypes.STRING(255), allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "文章描述", field: "article_desc" }, articleContent: { type: DataTypes.TEXT, allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "文章内容", field: "article_content" }, articleImage: { type: DataTypes.STRING(255), allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "封面图片", field: "article_image" }, articleType: { type: DataTypes.INTEGER(1).UNSIGNED, allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "文章类型 0文章 1视频", field: "article_type" }, categoryId: { type: DataTypes.INTEGER(10).UNSIGNED, allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "分类ID", field: "category_id" }, articleTags: { type: DataTypes.STRING(255), allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "文章标签,多个用逗号隔开", field: "article_tags" }, articleStatus: { type: DataTypes.INTEGER(1).UNSIGNED, allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "文章状态", field: "article_status" }, articleAuthor: { type: DataTypes.STRING(100), allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "文章作者", field: "article_author" }, articleViews: { type: DataTypes.INTEGER(10).UNSIGNED, allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "浏览次数", field: "article_views" }, articleTemplateInfo: { type: DataTypes.STRING(255), allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "文章详情模版", field: "article_template_info" }, articleRecommend: { type: DataTypes.INTEGER(1).UNSIGNED, allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "文章推荐 0不推荐 1推荐", field: "article_recommend" }, articleTemplateList: { type: DataTypes.STRING(255), allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "文章列表模版", field: "article_template_list" }, articleSort: { type: DataTypes.INTEGER(10).UNSIGNED, allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "文章排序", field: "article_sort" }, viewAuth: { type: DataTypes.INTEGER(1).UNSIGNED, allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "0 所有人 1超管", field: "view_auth" }, adminId: { type: DataTypes.INTEGER(10).UNSIGNED, allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "管理员ID", field: "admin_id" }, updateTime: { type: DataTypes.DATE, allowNull: false, defaultValue: sequelize.literal('CURRENT_TIMESTAMP'), primaryKey: false, autoIncrement: false, comment: "更新时间", field: "update_time" }, createTime: { type: DataTypes.DATE, allowNull: false, defaultValue: null, primaryKey: false, autoIncrement: false, comment: "创建时间", field: "create_time" } }; const options = { tableName: "szj_articles", comment: "", indexes: [{ name: "category_id", unique: false, type: "BTREE", fields: ["category_id"] }, { name: "article_status", unique: false, type: "BTREE", fields: ["article_status"] }] }; const SzjArticlesModel = sequelize.define("szjArticlesModel", attributes, options); return SzjArticlesModel; };