channel.go 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. package channel
  2. import (
  3. "go-common/app/interface/main/app-card/model/card"
  4. "go-common/app/interface/main/app-channel/model"
  5. "go-common/app/interface/main/app-channel/model/tab"
  6. tag "go-common/app/interface/main/tag/model"
  7. "strconv"
  8. )
  9. // Tab is
  10. type Tab struct {
  11. ID int64 `json:"id"`
  12. Name string `json:"name"`
  13. IsAtten int32 `json:"is_atten,omitempty"`
  14. Atten int64 `json:"atten,omitempty"`
  15. Cover string `json:"cover,omitempty"`
  16. HeadCover string `json:"head_cover,omitempty"`
  17. Content string `json:"content,omitempty"`
  18. URI string `json:"uri,omitempty"`
  19. Activity int32 `json:"activity,omitempty"`
  20. SimilarTag []*Tab `json:"similar_tag,omitempty"`
  21. TabList []*TabList `json:"tab,omitempty"`
  22. }
  23. type TabList struct {
  24. TabID string `json:"tab_id,omitempty"`
  25. Name string `json:"name,omitempty"`
  26. URI string `json:"uri,omitempty,"`
  27. }
  28. // Tag is
  29. type Tag struct {
  30. ID int64 `json:"tag_id,omitempty"`
  31. Name string `json:"tag_name,omitempty"`
  32. IsAtten int8 `json:"is_atten,omitempty"`
  33. Count *struct {
  34. Atten int `json:"atten,omitempty"`
  35. } `json:"count,omitempty"`
  36. }
  37. // Param is
  38. type Param struct {
  39. MobiApp string `form:"mobi_app"`
  40. Device string `form:"device"`
  41. AccessKey string `form:"access_key"`
  42. Build int `form:"build"`
  43. Ver string `form:"ver"`
  44. Lang string `form:"lang"`
  45. ID int64 `form:"id"`
  46. MID int64 `form:"mid"`
  47. }
  48. // List is
  49. type List struct {
  50. RegionTop []*Region `json:"region_top,omitempty"`
  51. RegionBottom []*Region `json:"region_bottom,omitempty"`
  52. AttenChannel []*Channel `json:"atten_channel,omitempty"`
  53. RecChannel []*Channel `json:"rec_channel,omitempty"`
  54. Ver string `json:"ver"`
  55. }
  56. // Region is
  57. type Region struct {
  58. ID int64 `json:"-"`
  59. RID int `json:"tid"`
  60. ReID int `json:"reid"`
  61. Name string `json:"name"`
  62. Logo string `json:"logo"`
  63. GoTo string `json:"goto"`
  64. Param string `json:"param"`
  65. Type int8 `json:"type"`
  66. URI string `json:"uri,omitempty"`
  67. Area string `json:"-"`
  68. Language string `json:"-"`
  69. Plat int8 `json:"-"`
  70. }
  71. // Channel is
  72. type Channel struct {
  73. ID int64 `json:"id"`
  74. Name string `json:"name"`
  75. IsAtten int32 `json:"is_atten,omitempty"`
  76. Cover string `json:"cover,omitempty"`
  77. Atten int64 `json:"atten,omitempty"`
  78. Content string `json:"content,omitempty"`
  79. }
  80. // Category is
  81. type Category struct {
  82. ID int64 `json:"id"`
  83. Name string `json:"name"`
  84. }
  85. // RegionLimit
  86. type RegionLimit struct {
  87. ID int64 `json:"-"`
  88. Rid int64 `json:"-"`
  89. Build int `json:"-"`
  90. Condition string `json:"-"`
  91. }
  92. // RegionConfig
  93. type RegionConfig struct {
  94. ID int64 `json:"-"`
  95. Rid int64 `json:"-"`
  96. ScenesID int `json:"-"`
  97. }
  98. // ParamSquare
  99. type ParamSquare struct {
  100. MobiApp string `form:"mobi_app"`
  101. Device string `form:"device"`
  102. AccessKey string `form:"access_key"`
  103. Build int `form:"build"`
  104. Lang string `form:"lang"`
  105. MID int64 `form:"mid"`
  106. LoginEvent int32 `form:"login_event"`
  107. }
  108. // Square
  109. type Square struct {
  110. Region []*Region `json:"region,omitempty"`
  111. Square []card.Handler `json:"square,omitempty"`
  112. }
  113. // Mysub
  114. type Mysub struct {
  115. List []*Channel `json:"list,omitempty"`
  116. DisplayCount int `json:"display_count,omitempty"`
  117. }
  118. type ChanOids struct {
  119. Oid int64 `json:"-"`
  120. FromType string `json:"-"`
  121. }
  122. func (t *Tab) SimilarTagChange(tc *tag.ChannelDetail) {
  123. t.ID = tc.Tag.ID
  124. t.Name = tc.Tag.Name
  125. t.IsAtten = tc.Tag.Attention
  126. t.Atten = tc.Tag.Sub
  127. t.Content = tc.Tag.Content
  128. t.Cover = tc.Tag.Cover
  129. if t.Cover == "" {
  130. t.Cover = "http://i0.hdslb.com/bfs/archive/33dc521a84fb608e07770b3fdc347104aa6e9911.png"
  131. }
  132. t.HeadCover = tc.Tag.HeadCover
  133. if t.HeadCover == "" {
  134. t.HeadCover = "http://i0.hdslb.com/bfs/archive/de02e2a2293a1da46ea9669679d88514959910ef.png"
  135. }
  136. t.Activity = tc.Tag.Activity
  137. for _, s := range tc.Synonym {
  138. ct := &Tab{
  139. ID: s.Id,
  140. Name: s.Name,
  141. }
  142. ct.URI = model.FillURI(model.GotoTag, strconv.FormatInt(s.Id, 10), 0, 0, 0, nil)
  143. t.SimilarTag = append(t.SimilarTag, ct)
  144. }
  145. }
  146. func (l *TabList) TabListChange(m *tab.Menu) {
  147. l.TabID = strconv.FormatInt(m.TabID, 10)
  148. l.Name = m.Name
  149. l.URI = model.FillURI(model.GotoPegasusTab, strconv.FormatInt(m.TabID, 10), 0, 0, 0, model.PegasusHandler(m))
  150. }