table.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. #*****************************************************************************
  3. # @file table.go
  4. # @author MakerYang(https://www.makeryang.com)
  5. # @statement 免费课程配套开源项目,任何形式收费均为盗版
  6. #*****************************************************************************
  7. */
  8. package GameLevelData
  9. import (
  10. "Game/framework/database"
  11. )
  12. var TableName = "game_level_data"
  13. type Data struct {
  14. LevelId int `gorm:"primary_key;AUTO_INCREMENT;unique_index;not null;column:level_id"`
  15. LevelServerId int `gorm:"column:level_server_id"`
  16. LevelCareer string `gorm:"column:level_career"`
  17. LevelName string `gorm:"column:level_name"`
  18. LevelMin int `gorm:"column:level_min"`
  19. LevelMax int `gorm:"column:level_max"`
  20. LevelLifeValue int `gorm:"column:level_life_value"`
  21. LevelMagicValue int `gorm:"column:level_magic_value"`
  22. LevelStatus int `gorm:"column:level_status"`
  23. Database.DefaultField
  24. }
  25. type Return struct {
  26. LevelCareer string `json:"level_career"`
  27. LevelName string `json:"level_name"`
  28. LevelMin int `json:"level_min"`
  29. LevelMax int `json:"level_max"`
  30. LevelLifeValue int `json:"level_life_value"`
  31. LevelMagicValue int `json:"level_magic_value"`
  32. }
  33. func ReturnData(dataStruct *Data) Return {
  34. data := Return{}
  35. if dataStruct.LevelId > 0 {
  36. data.LevelCareer = dataStruct.LevelCareer
  37. data.LevelName = dataStruct.LevelName
  38. data.LevelMin = dataStruct.LevelMin
  39. data.LevelMax = dataStruct.LevelMax
  40. data.LevelLifeValue = dataStruct.LevelLifeValue
  41. data.LevelMagicValue = dataStruct.LevelMagicValue
  42. }
  43. return data
  44. }