base.go 763 B

1234567891011121314151617181920212223242526272829303132333435
  1. package model
  2. import (
  3. "strings"
  4. "time"
  5. )
  6. // 游戏基础表-BaseData exported from Base表.xlsx
  7. type BaseData struct {
  8. Uid int64 `json:"Uid"` // 编号
  9. Key string `json:"Key"` // key
  10. Format string `json:"Format"` // 格式 服务端根据此字段识别格式
  11. Value string `json:"Value"` // 参数值
  12. }
  13. type Timestamp int64
  14. func (t *Timestamp) UnmarshalJSON(b []byte) error {
  15. // Remove quotes
  16. s := strings.Trim(string(b), "\"")
  17. // Parse the date string
  18. parsedTime, err := time.ParseInLocation("2006/01/02", s, time.Local)
  19. if err != nil {
  20. return err
  21. }
  22. // Convert to Unix timestamp
  23. *t = Timestamp(parsedTime.Unix())
  24. return nil
  25. }
  26. type BaseData2 struct {
  27. ChapterStartTime Timestamp `json:"StartTime"` // 章节基准时间
  28. }