This commit is contained in:
张成
2026-04-01 10:42:33 +08:00
parent 7199c6b5cf
commit 433077f08a
14 changed files with 10 additions and 76 deletions

View File

@@ -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;
};