1 Star 0 Fork 435

xflash/go-admin

forked from go-admin/go-admin 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
operation.go 627 Bytes
一键复制 编辑 原始数据 按行查看 历史
package controller
import (
"github.com/gin-gonic/gin/json"
"github.com/chenhg5/go-admin/context"
"github.com/chenhg5/go-admin/modules/auth"
"github.com/chenhg5/go-admin/modules/connections"
)
func RecordOperationLog(ctx *context.Context) {
if user, ok := ctx.UserValue["user"].(auth.User); ok {
var input []byte
form := ctx.Request.MultipartForm
if form != nil {
input, _ = json.Marshal((*form).Value)
}
connections.GetConnection().Exec("insert into goadmin_operation_log (user_id, path, method, ip, input) values (?, ?, ?, ?, ?)", user.ID, ctx.Path(),
ctx.Method(), ctx.LocalIP(), string(input))
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/xflash/go-admin.git
git@gitee.com:xflash/go-admin.git
xflash
go-admin
go-admin
v0.0.2

搜索帮助