table.go 982 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. #*****************************************************************************
  3. # @file table.go
  4. # @author MakerYang(https://www.makeryang.com)
  5. # @statement 免费课程配套开源项目,任何形式收费均为盗版
  6. #*****************************************************************************
  7. */
  8. package GameServerData
  9. import (
  10. "Game/framework/database"
  11. "Game/framework/utils"
  12. )
  13. var TableName = "game_server_data"
  14. type Data struct {
  15. ServerId int `gorm:"primary_key;AUTO_INCREMENT;unique_index;not null;column:server_id"`
  16. ServerName string `gorm:"column:server_name"`
  17. ServerStatus int `gorm:"column:server_status"`
  18. Database.DefaultField
  19. }
  20. type Return struct {
  21. Token string `json:"token"`
  22. ServerName string `json:"server_name"`
  23. }
  24. func ReturnData(dataStruct *Data) Return {
  25. data := Return{}
  26. if dataStruct.ServerId > 0 {
  27. data.Token = Utils.EncodeId(32, dataStruct.ServerId)
  28. data.ServerName = dataStruct.ServerName
  29. }
  30. return data
  31. }