ip_lib.go 815 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package log
  2. import (
  3. "go.uber.org/zap"
  4. "log-server/global"
  5. "time"
  6. )
  7. /*
  8. ip库
  9. */
  10. type IpLib struct {
  11. Id uint `json:"id"`
  12. Ip string `json:"ip"` //模拟器ip
  13. GameId int `json:"game_id"` //游戏id
  14. Status uint8 `json:"status"` //1表示可用,2表示不可用
  15. CreateTime time.Time `json:"create_time"` // 创建时间
  16. UpdateTime time.Time `json:"update_time"` // 更新时间
  17. }
  18. func (IpLib) TableName() string {
  19. return "ip_lib"
  20. }
  21. func (s *IpLib) AddIpLog(gameId int, ip string, status uint8) {
  22. if gameId != 5001 {
  23. return
  24. }
  25. s.GameId = gameId
  26. s.Ip = ip
  27. s.Status = status
  28. err := global.GVA_DB.Omit("create_time", "update_time").Create(&s).Error
  29. if err != nil {
  30. global.GVA_LOG.Error("create LogScanningCode fail", zap.Error(err))
  31. }
  32. }