// Copyright 2019 github.com. All rights reserved. // Use of this source code is governed by github.com. package log import ( "context" "git.getensh.com/common/gopkgs/database" "property-log/model" "property-log/pb/v1" "time" "property-log/errors" ) func SystemLogAdd(ctx context.Context, req *v1.SystemLogAddRequest) (reply *v1.SystemLogAddReply, err error) { p := &model.TSystemLog{} p.Uid = req.Uid p.Module = req.Module p.Action = req.Action p.Origin = req.Origin p.Target = req.Target p.Username = req.Username p.Cid = req.Cid p.GardenId = req.GardenId p.CreatedAt = time.Unix(req.Timestamp, 0) err = p.Insert(database.DB()) if err != nil { return nil, errors.DataBaseError } reply = &v1.SystemLogAddReply{} return reply, nil }