1
This commit is contained in:
@@ -8,17 +8,14 @@ module.exports = (db) => {
|
||||
user_id: {
|
||||
type: Sequelize.BIGINT.UNSIGNED,
|
||||
allowNull: false,
|
||||
comment: "业务用户ID",
|
||||
},
|
||||
token_id: {
|
||||
type: Sequelize.BIGINT.UNSIGNED,
|
||||
allowNull: false,
|
||||
comment: "使用的Token ID",
|
||||
},
|
||||
api_path: {
|
||||
type: Sequelize.STRING(200),
|
||||
allowNull: false,
|
||||
comment: "接口路径,如 /user/GetProfile",
|
||||
},
|
||||
http_method: {
|
||||
type: Sequelize.STRING(10),
|
||||
@@ -29,18 +26,15 @@ module.exports = (db) => {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: "上游返回的HTTP状态码",
|
||||
},
|
||||
response_time: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: "上游响应耗时ms",
|
||||
},
|
||||
call_date: {
|
||||
type: Sequelize.DATEONLY,
|
||||
allowNull: false,
|
||||
comment: "调用日期,方便按天统计",
|
||||
},
|
||||
created_at: {
|
||||
type: Sequelize.DATE,
|
||||
@@ -48,17 +42,7 @@ module.exports = (db) => {
|
||||
defaultValue: Sequelize.NOW,
|
||||
},
|
||||
},
|
||||
{
|
||||
tableName: "biz_api_call_log",
|
||||
timestamps: false,
|
||||
underscored: true,
|
||||
comment: "API调用日志",
|
||||
indexes: [
|
||||
{ fields: ["user_id", "call_date"], name: "idx_user_date" },
|
||||
{ fields: ["api_path", "call_date"], name: "idx_api_date" },
|
||||
{ fields: ["user_id", "api_path"], name: "idx_user_api" },
|
||||
],
|
||||
}
|
||||
|
||||
);
|
||||
return biz_api_call_log;
|
||||
};
|
||||
|
||||
@@ -12,7 +12,6 @@ module.exports = (db) => {
|
||||
plan_id: {
|
||||
type: Sequelize.BIGINT.UNSIGNED,
|
||||
allowNull: true,
|
||||
comment: "冗余:鉴权时少联表",
|
||||
},
|
||||
token_name: {
|
||||
type: Sequelize.STRING(100),
|
||||
@@ -32,12 +31,6 @@ module.exports = (db) => {
|
||||
expire_at: { type: Sequelize.DATE, allowNull: false },
|
||||
last_used_at: { type: Sequelize.DATE, allowNull: true },
|
||||
},
|
||||
{
|
||||
tableName: "biz_api_tokens",
|
||||
timestamps: false,
|
||||
underscored: true,
|
||||
comment: "API Token",
|
||||
}
|
||||
);
|
||||
// biz_api_token.sync({ force: true });
|
||||
return biz_api_token;
|
||||
|
||||
@@ -35,7 +35,6 @@ module.exports = (db) => {
|
||||
tableName: "biz_audit_log",
|
||||
timestamps: false,
|
||||
underscored: true,
|
||||
comment: "审计日志",
|
||||
}
|
||||
);
|
||||
// biz_audit_log.sync({ alter: true });
|
||||
|
||||
@@ -34,18 +34,15 @@ module.exports = (db) => {
|
||||
enabled_features: {
|
||||
type: Sequelize.JSON,
|
||||
allowNull: true,
|
||||
comment: "JSON 功能点白名单",
|
||||
},
|
||||
allowed_apis: {
|
||||
type: Sequelize.JSON,
|
||||
allowNull: true,
|
||||
comment: "可访问的接口路径列表,如 [\"/user/GetProfile\",\"/message/SendText\"],null 表示不限制",
|
||||
},
|
||||
api_call_quota: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: "每月 API 总调用次数上限,0=不限制",
|
||||
},
|
||||
status: {
|
||||
type: Sequelize.ENUM("active", "inactive"),
|
||||
@@ -57,7 +54,6 @@ module.exports = (db) => {
|
||||
tableName: "biz_plans",
|
||||
timestamps: false,
|
||||
underscored: true,
|
||||
comment: "套餐",
|
||||
}
|
||||
);
|
||||
// biz_plan.sync({ alter: true });
|
||||
|
||||
@@ -38,7 +38,6 @@ module.exports = (db) => {
|
||||
tableName: "biz_subscriptions",
|
||||
timestamps: false,
|
||||
underscored: true,
|
||||
comment: "订阅",
|
||||
}
|
||||
);
|
||||
// biz_subscription.sync({ alter: true });
|
||||
|
||||
@@ -16,7 +16,6 @@ module.exports = (db) => {
|
||||
stat_month: {
|
||||
type: Sequelize.STRING(7),
|
||||
allowNull: false,
|
||||
comment: "YYYY-MM",
|
||||
},
|
||||
msg_count: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 },
|
||||
mass_count: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 },
|
||||
@@ -27,14 +26,11 @@ module.exports = (db) => {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: "当月 API 转发总调用次数",
|
||||
},
|
||||
},
|
||||
{
|
||||
tableName: "biz_usage_monthly",
|
||||
timestamps: false,
|
||||
underscored: true,
|
||||
comment: "月用量",
|
||||
}
|
||||
);
|
||||
// biz_usage_monthly.sync({ alter: true });
|
||||
|
||||
@@ -9,12 +9,10 @@ module.exports = (db) => {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "姓名/称呼",
|
||||
},
|
||||
mobile: {
|
||||
type: Sequelize.STRING(20),
|
||||
allowNull: true,
|
||||
comment: "手机号",
|
||||
},
|
||||
email: {
|
||||
type: Sequelize.STRING(120),
|
||||
@@ -23,7 +21,6 @@ module.exports = (db) => {
|
||||
company_name: {
|
||||
type: Sequelize.STRING(200),
|
||||
allowNull: true,
|
||||
comment: "公司名",
|
||||
},
|
||||
status: {
|
||||
type: Sequelize.ENUM("active", "disabled"),
|
||||
@@ -32,12 +29,10 @@ module.exports = (db) => {
|
||||
},
|
||||
},
|
||||
{
|
||||
// 与库表名一致:单数 biz_user(与模型名一致,避免部分环境下 tableName 未生效时落到默认表名 biz_user)
|
||||
tableName: "biz_user",
|
||||
freezeTableName: true,
|
||||
timestamps: false,
|
||||
underscored: true,
|
||||
comment: "业务用户",
|
||||
}
|
||||
);
|
||||
// biz_user.sync({ alter: true });
|
||||
|
||||
@@ -6,19 +6,16 @@ module.exports = (db) => {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "控件名称",
|
||||
},
|
||||
module_key: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "组件key",
|
||||
},
|
||||
data_lenght: {
|
||||
type: Sequelize.INTEGER(11),
|
||||
allowNull: false,
|
||||
defaultValue: "50",
|
||||
comment: "数据长度",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -7,19 +7,16 @@ module.exports = (db) => {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "表名",
|
||||
},
|
||||
operate: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "操作",
|
||||
},
|
||||
content: {
|
||||
type: Sequelize.JSON,
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "内容",
|
||||
set(value) {
|
||||
this.setDataValue("content", { value });
|
||||
},
|
||||
|
||||
@@ -8,27 +8,23 @@ module.exports = (db) => {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "菜单名称",
|
||||
},
|
||||
// 父id
|
||||
parent_id: {
|
||||
type: Sequelize.INTEGER(11).UNSIGNED,
|
||||
allowNull: true,
|
||||
defaultValue: 0,
|
||||
comment: "父id",
|
||||
},
|
||||
// 图标
|
||||
icon: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "图标",
|
||||
},
|
||||
path: {
|
||||
type: Sequelize.STRING(255),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "路径",
|
||||
},
|
||||
|
||||
// 菜单类型 "菜单", "页面", "外链", "功能"
|
||||
@@ -36,14 +32,12 @@ module.exports = (db) => {
|
||||
type: Sequelize.STRING(255),
|
||||
allowNull: false,
|
||||
defaultValue: "页面",
|
||||
comment: "菜单类型",
|
||||
},
|
||||
//模型id
|
||||
model_id: {
|
||||
type: Sequelize.INTEGER(11).UNSIGNED,
|
||||
allowNull: true,
|
||||
defaultValue: 0,
|
||||
comment: "模型id",
|
||||
},
|
||||
|
||||
//表单id
|
||||
@@ -51,7 +45,6 @@ module.exports = (db) => {
|
||||
type: Sequelize.INTEGER(11).UNSIGNED,
|
||||
allowNull: true,
|
||||
defaultValue: 0,
|
||||
comment: "表单id",
|
||||
},
|
||||
|
||||
// 组件地址
|
||||
@@ -59,7 +52,6 @@ module.exports = (db) => {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "组件地址",
|
||||
},
|
||||
|
||||
// api地址
|
||||
@@ -67,20 +59,17 @@ module.exports = (db) => {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "api地址",
|
||||
},
|
||||
// 是否显示在菜单中
|
||||
is_show_menu: {
|
||||
type: Sequelize.INTEGER(1),
|
||||
allowNull: false,
|
||||
defaultValue: true,
|
||||
comment: "是否显示在菜单中",
|
||||
},
|
||||
is_show: {
|
||||
type: Sequelize.INTEGER(1),
|
||||
allowNull: false,
|
||||
defaultValue: true,
|
||||
comment: "是否展示",
|
||||
},
|
||||
|
||||
// 菜单类型
|
||||
@@ -88,7 +77,6 @@ module.exports = (db) => {
|
||||
type: Sequelize.INTEGER(11),
|
||||
allowNull: false,
|
||||
defaultValue: "0",
|
||||
comment: "菜单类型",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -7,21 +7,18 @@ module.exports = (db) => {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "字典key",
|
||||
},
|
||||
|
||||
value: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "值",
|
||||
},
|
||||
|
||||
remark: {
|
||||
type: Sequelize.STRING(500),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "备注",
|
||||
},
|
||||
|
||||
// 是否允许修改 0 允许,1 不允许
|
||||
@@ -29,7 +26,6 @@ module.exports = (db) => {
|
||||
type: Sequelize.INTEGER(2),
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: "是否允许修改",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -7,20 +7,17 @@ module.exports = (db) => {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "角色名称",
|
||||
},
|
||||
// 0 普通角色 1 系统角色
|
||||
type: {
|
||||
type: Sequelize.INTEGER(1),
|
||||
allowNull: false,
|
||||
defaultValue: "0",
|
||||
comment: "角色类型",
|
||||
},
|
||||
menus: {
|
||||
type: Sequelize.JSON,
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "权限菜单",
|
||||
set(value) {
|
||||
this.setDataValue('menus', { value });
|
||||
},
|
||||
|
||||
@@ -7,18 +7,15 @@ module.exports = (db) => {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "名称",
|
||||
},
|
||||
password: {
|
||||
type: Sequelize.STRING(100),
|
||||
allowNull: false,
|
||||
defaultValue: "",
|
||||
comment: "密码",
|
||||
},
|
||||
roleId: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
comment: "角色id",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user