| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package api
- import (
- "Gwen/model"
- "strconv"
- )
- type AuditConnForm struct {
- Action string `json:"action"`
- ConnId int64 `json:"conn_id"`
- Id string `json:"id"`
- Peer []string `json:"peer"`
- Ip string `json:"ip"`
- SessionId float64 `json:"session_id"`
- Type int `json:"type"`
- Uuid string `json:"uuid"`
- }
- func (a *AuditConnForm) ToAuditConn() *model.AuditConn {
- fp := ""
- fn := ""
- if len(a.Peer) >= 1 {
- fp = a.Peer[0]
- if len(a.Peer) == 2 {
- fn = a.Peer[1]
- }
- }
- ssid := strconv.FormatFloat(a.SessionId, 'f', -1, 64)
- return &model.AuditConn{
- Action: a.Action,
- ConnId: a.ConnId,
- PeerId: a.Id,
- FromPeer: fp,
- FromName: fn,
- Ip: a.Ip,
- SessionId: ssid,
- Type: a.Type,
- Uuid: a.Uuid,
- }
- }
|