mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-22 10:40:25 +08:00
阶段性提交
This commit is contained in:
36
pkg/rpc/dao/log_dao.go
Normal file
36
pkg/rpc/dao/log_dao.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
)
|
||||
|
||||
var SharedLogDAO = NewLogDAO()
|
||||
|
||||
type LogDAO struct {
|
||||
BaseDAO
|
||||
}
|
||||
|
||||
func NewLogDAO() *LogDAO {
|
||||
return &LogDAO{}
|
||||
}
|
||||
|
||||
func (this *LogDAO) CreateUserLog(ctx context.Context, level string, action string, description string, ip string) error {
|
||||
_, err := this.RPC().LogRPC().CreateLog(ctx, &pb.CreateLogRequest{
|
||||
Level: level,
|
||||
Description: description,
|
||||
Action: action,
|
||||
Ip: ip,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (this *LogDAO) CreateAdminLog(ctx context.Context, level string, action string, description string, ip string) error {
|
||||
_, err := this.RPC().LogRPC().CreateLog(ctx, &pb.CreateLogRequest{
|
||||
Level: level,
|
||||
Description: description,
|
||||
Action: action,
|
||||
Ip: ip,
|
||||
})
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user