service.xpcool.com/internal/table/admin_operation_log.go
夏犀麟 ea50261cb8
Some checks failed
Build and Deploy (service.xpcool.com) / build-and-deploy (push) Failing after 35s
feat(house): 扩充看房数据并增强服务器日志功能
- 新增新房预售证表 house_presale 存储预售许可信息
- 为 house_community 表添加 avg_price 字段存储小区参考均价
- 增强服务器操作审计日志功能,新增管理员账号、IP归属地、错误信息、UA等字段
- 实现纯Go版IP归属地离线解析器,无外部依赖,支持二分查找
- 优化看房列表查询逻辑,修复Fields设置位置导致的SQL语法错误
- 集成招聘模块,添加独立数据库配置和Bark推送服务支持
- 重构日志查询接口,支持多维度筛选和综合分页列表展示
- 更新DAO实体结构同步数据库表结构调整
2026-08-27 01:47:32 +08:00

184 lines
3.6 KiB
Go
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.

// =================================================================================
// 本文件由 GoFrame CLI 工具自动生成,可按需修改。
// =================================================================================
package table
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
)
// AdminOperationLog 定义表 "admin_operation_log" 的字段及其属性。
// 该映射由 GoFrame ORM 内部使用,用于理解表结构。
var AdminOperationLog = map[string]*gdb.TableField{
"id": {
Index: 0,
Name: "id",
Type: "bigint unsigned",
Null: false,
Key: "PRI",
Default: nil,
Extra: "auto_increment",
Comment: "",
},
"admin_user_id": {
Index: 1,
Name: "admin_user_id",
Type: "bigint unsigned",
Null: false,
Key: "MUL",
Default: nil,
Extra: "",
Comment: "",
},
"admin_username": {
Index: 2,
Name: "admin_username",
Type: "varchar(64)",
Null: false,
Key: "MUL",
Default: "",
Extra: "",
Comment: "管理员账号(冗余)",
},
"permission": {
Index: 2,
Name: "permission",
Type: "varchar(128)",
Null: false,
Key: "MUL",
Default: "",
Extra: "",
Comment: "",
},
"method": {
Index: 3,
Name: "method",
Type: "varchar(12)",
Null: false,
Key: "",
Default: nil,
Extra: "",
Comment: "",
},
"path": {
Index: 4,
Name: "path",
Type: "varchar(255)",
Null: false,
Key: "",
Default: nil,
Extra: "",
Comment: "",
},
"ip": {
Index: 5,
Name: "ip",
Type: "varchar(64)",
Null: false,
Key: "",
Default: "",
Extra: "",
Comment: "",
},
"ip_location": {
Index: 6,
Name: "ip_location",
Type: "varchar(255)",
Null: false,
Key: "MUL",
Default: "",
Extra: "",
Comment: "IP 归属地(省/市/运营商)",
},
"request_param": {
Index: 6,
Name: "request_param",
Type: "json",
Null: true,
Key: "",
Default: nil,
Extra: "",
Comment: "",
},
"duration_ms": {
Index: 7,
Name: "duration_ms",
Type: "int unsigned",
Null: false,
Key: "",
Default: "0",
Extra: "",
Comment: "",
},
"status_code": {
Index: 8,
Name: "status_code",
Type: "int",
Null: false,
Key: "",
Default: "0",
Extra: "",
Comment: "",
},
"error_message": {
Index: 9,
Name: "error_message",
Type: "varchar(512)",
Null: true,
Key: "",
Default: nil,
Extra: "",
Comment: "失败原因摘要",
},
"user_agent": {
Index: 10,
Name: "user_agent",
Type: "varchar(512)",
Null: false,
Key: "",
Default: "",
Extra: "",
Comment: "浏览器 UA",
},
"created_at": {
Index: 9,
Name: "created_at",
Type: "datetime",
Null: false,
Key: "",
Default: nil,
Extra: "",
Comment: "",
},
"updated_at": {
Index: 10,
Name: "updated_at",
Type: "datetime",
Null: false,
Key: "",
Default: nil,
Extra: "",
Comment: "",
},
"deleted_at": {
Index: 11,
Name: "deleted_at",
Type: "datetime",
Null: true,
Key: "MUL",
Default: nil,
Extra: "",
Comment: "",
},
}
// AdminOperationLogTableFields 将表字段定义注册到数据库实例。
// db实现 gdb.DB 接口的数据库实例。
// schema可选的 schema/命名空间名,尤其适用于支持 schema 的数据库。
func SetAdminOperationLogTableFields(ctx context.Context, db gdb.DB, schema ...string) error {
return db.GetCore().SetTableFields(ctx, "admin_operation_log", AdminOperationLog, schema...)
}