Files
wechatWeb/_docs/sql/biz_api_call_log.sql
张成 30a909762e 1
2026-04-01 10:58:28 +08:00

18 lines
915 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 模型api/model/biz_api_call_log.js → tableName: biz_api_call_log
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `biz_api_call_log` (
`id` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
`user_id` BIGINT UNSIGNED NOT NULL COMMENT '业务用户ID',
`token_id` BIGINT UNSIGNED NOT NULL COMMENT '使用的Token ID',
`api_path` VARCHAR(200) NOT NULL COMMENT '接口路径',
`http_method` VARCHAR(10) NOT NULL DEFAULT 'POST',
`status_code` INT NOT NULL DEFAULT 0 COMMENT '上游返回的HTTP状态码',
`response_time` INT NOT NULL DEFAULT 0 COMMENT '上游响应耗时ms',
`call_date` DATE NOT NULL COMMENT '调用日期',
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX `idx_user_date` (`user_id`, `call_date`),
INDEX `idx_api_date` (`api_path`, `call_date`),
INDEX `idx_user_api` (`user_id`, `api_path`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='API调用日志';