mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-27 05:00:25 +08:00
增加操作日志查看界面
This commit is contained in:
30
internal/web/models/log_dao.go
Normal file
30
internal/web/models/log_dao.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/rpc"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
)
|
||||
|
||||
var SharedLogDAO = NewLogDAO()
|
||||
|
||||
type LogDAO struct {
|
||||
}
|
||||
|
||||
func NewLogDAO() *LogDAO {
|
||||
return &LogDAO{}
|
||||
}
|
||||
|
||||
func (this *LogDAO) CreateAdminLog(ctx context.Context, level string, action string, description string, ip string) error {
|
||||
client, err := rpc.SharedRPC()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = client.LogRPC().CreateLog(ctx, &pb.CreateLogRequest{
|
||||
Level: level,
|
||||
Description: description,
|
||||
Action: action,
|
||||
Ip: ip,
|
||||
})
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user