Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
package model
import (
"fmt"
)
// LoginLog login log.
type LoginLog struct {
Mid int64 `json:"mid"`
Timestamp int64 `json:"timestamp"`
LoginIP int64 `json:"loginip"`
Type int64 `json:"type"`
Server string `json:"server"`
}
// LoginLogResp login log.
type LoginLogResp struct {
Mid int64 `json:"mid"`
Timestamp int64 `json:"timestamp"`
LoginIP string `json:"loginip"`
Type int64 `json:"type"`
Server string `json:"server"`
}
// Format format login log to login log resp.
func Format(l *LoginLog) *LoginLogResp {
if l == nil {
return nil
}
return &LoginLogResp{
Mid: l.Mid,
Timestamp: l.Timestamp,
LoginIP: InetNtoA(l.LoginIP),
Type: l.Type,
Server: l.Server,
}
}
// InetNtoA .
func InetNtoA(ip int64) string {
return fmt.Sprintf("%d.%d.%d.%d",
byte(ip>>24), byte(ip>>16), byte(ip>>8), byte(ip))
}