123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- '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;
- };
|