实现实时展示访问日志

This commit is contained in:
刘祥超
2020-10-10 19:21:32 +08:00
parent e790aba3e4
commit 6d268d0b73
7 changed files with 348 additions and 15 deletions

View File

@@ -1 +1,17 @@
package models
import (
"encoding/json"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
// 转换成PB对象
func (this *HTTPAccessLog) ToPB() (*pb.HTTPAccessLog, error) {
p := &pb.HTTPAccessLog{}
err := json.Unmarshal([]byte(this.Content), p)
if err != nil {
return nil, err
}
p.RequestId = this.RequestId
return p, nil
}