123456789101112131415161718192021222324252627282930313233343536 |
- // 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 CompanyLogAdd(ctx context.Context, req *v1.CompanyLogAddRequest) (reply *v1.CompanyLogAddReply, err error) {
- p := &model.TCompanyLog{}
- 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.CreatedAt = time.Unix(req.Timestamp, 0)
- err = p.Insert(database.DB())
- if err != nil {
- return nil, errors.DataBaseError
- }
- reply = &v1.CompanyLogAddReply{}
- return reply, nil
- }
|