search.go 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. package search
  2. import "go-common/library/time"
  3. var (
  4. //NotDelete not delete
  5. NotDelete uint8
  6. //Delete delete
  7. Delete uint8 = 1
  8. //Business log business ID
  9. Business = 202
  10. //ActionAddBlack log action
  11. ActionAddBlack = "ActionAddBlack"
  12. //ActionDelBlack log action
  13. ActionDelBlack = "ActionDelBlack"
  14. //ActionAddInter log action
  15. ActionAddInter = "ActionAddInter"
  16. //ActionUpdateInter log action
  17. ActionUpdateInter = "ActionUpdateInter"
  18. //ActionUpdateSearch log action
  19. ActionUpdateSearch = "ActionUpdateSearch"
  20. //ActionPublishHot log action
  21. ActionPublishHot = "ActionPublishHot"
  22. //ActionPublishDark log action
  23. ActionPublishDark = "ActionPublishDark"
  24. //ActionOpenAddHot log action
  25. ActionOpenAddHot = "ActionOpenAddHot"
  26. //ActionDeleteHot delete hot word
  27. ActionDeleteHot = "ActionDeleteHot"
  28. //ActionOpenAddDark log action
  29. ActionOpenAddDark = "ActionOpenAddDark"
  30. //ActionDeleteDark action delete darkword
  31. ActionDeleteDark = "ActionDeleteDark"
  32. //HotAI hot word from AI
  33. HotAI uint8 = 1
  34. //HotOpe hot word from operate
  35. HotOpe uint8 = 2
  36. )
  37. //Hot search history from ai and search words
  38. type Hot struct {
  39. ID uint `json:"-"`
  40. Searchword string `json:"searchword"`
  41. PV int64 `json:"pv"`
  42. Atime string
  43. }
  44. //OpenHot open api for searhc add hot every day
  45. type OpenHot struct {
  46. Date string `json:"date"`
  47. Values []Hot `json:"values"`
  48. }
  49. //Dark search dark list
  50. type Dark struct {
  51. ID uint `json:"id"`
  52. Searchword string `json:"searchword" form:"searchword"`
  53. PV int64 `json:"pv" form:"pv"`
  54. Atime string `json:"atime"`
  55. Deleted uint8 `json:"deleted"`
  56. }
  57. //OpenDark open api for search add dark word every day
  58. type OpenDark struct {
  59. Date string `json:"date"`
  60. Values []Dark `json:"values"`
  61. }
  62. //Black search Black
  63. type Black struct {
  64. Searchword string `json:"searchword" form:"searchword" validate:"required"`
  65. ID int `json:"id"`
  66. Deleted uint8 `json:"deleted"`
  67. }
  68. //AddBlack add search Black
  69. type AddBlack struct {
  70. Searchword string `json:"searchword" form:"searchword" validate:"required"`
  71. }
  72. //Intervene search intervene word
  73. type Intervene struct {
  74. ID int `json:"id" form:"id"`
  75. Searchword string `json:"searchword" form:"searchword"`
  76. Rank int `json:"position" form:"position"`
  77. Pv int `json:"pv"`
  78. Tag string `json:"tag" form:"tag"`
  79. Stime time.Time `json:"stime" form:"stime"`
  80. Etime time.Time `json:"etime" form:"etime"`
  81. Deleted uint8 `json:"deleted"`
  82. }
  83. //InterveneAdd add search intervene word
  84. type InterveneAdd struct {
  85. ID int `json:"id" form:"id"`
  86. Searchword string `json:"searchword" form:"searchword"`
  87. Rank int `json:"position" form:"position"`
  88. Tag string `json:"tag" form:"tag"`
  89. Stime time.Time `json:"stime" form:"stime"`
  90. Etime time.Time `json:"etime" form:"etime"`
  91. }
  92. //HotwordOut hotword out put with publish state
  93. type HotwordOut struct {
  94. Hotword []Intervene `json:"hotword"`
  95. State uint8 `json:"state"`
  96. }
  97. //DarkwordOut hotword out put with publish state
  98. type DarkwordOut struct {
  99. Darkword []Dark `json:"darkword"`
  100. State uint8 `json:"state"`
  101. }
  102. //History search History
  103. type History struct {
  104. ID int `json:"id" form:"id"`
  105. Searchword string `json:"searchword"`
  106. Pv int `json:"pv"`
  107. Position int `json:"position"`
  108. Atime string `json:"atime"`
  109. Tag string `json:"tag"`
  110. Deleted uint8 `json:"deleted"`
  111. }
  112. //PublishState hot word publish state
  113. type PublishState struct {
  114. Date string
  115. State bool
  116. }
  117. //HotPubLog hotword publish log
  118. type HotPubLog struct {
  119. ID int `json:"id" form:"id"`
  120. Searchword string `json:"searchword" form:"searchword"`
  121. Position int `json:"position" form:"position"`
  122. Pv int `json:"pv"`
  123. Tag string `json:"tag" form:"tag"`
  124. Stime time.Time `json:"stime" form:"stime"`
  125. Etime time.Time `json:"etime" form:"etime"`
  126. Atime string `json:"atime"`
  127. Groupid int64 `json:"groupid"`
  128. }
  129. //DarkPubLog dark publish log
  130. type DarkPubLog struct {
  131. ID uint `json:"id"`
  132. Searchword string `json:"searchword" form:"searchword"`
  133. Pv int64 `json:"pv" form:"pv"`
  134. Atime string `json:"atime"`
  135. Groupid int64 `json:"groupid"`
  136. }
  137. // TableName search box history
  138. func (a Hot) TableName() string {
  139. return "search_histories"
  140. }
  141. // TableName search_blacklist
  142. func (a Black) TableName() string {
  143. return "search_blacklist"
  144. }
  145. // TableName search_darkword
  146. func (a Dark) TableName() string {
  147. return "search_darkword"
  148. }
  149. // TableName search_histories
  150. func (a History) TableName() string {
  151. return "search_histories"
  152. }
  153. // TableName search_blacklist
  154. func (a AddBlack) TableName() string {
  155. return "search_blacklist"
  156. }
  157. // TableName search_intervene
  158. func (a Intervene) TableName() string {
  159. return "search_intervene"
  160. }
  161. // TableName InterveneAdd search_intervene
  162. func (a InterveneAdd) TableName() string {
  163. return "search_intervene"
  164. }
  165. // TableName DarkPubLog dark word publish log
  166. func (a DarkPubLog) TableName() string {
  167. return "search_darkword_log"
  168. }
  169. // TableName DarkPubLog dark word publish log
  170. func (a HotPubLog) TableName() string {
  171. return "search_hotword_log"
  172. }