model.go 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. package model
  2. import (
  3. xtime "go-common/library/time"
  4. )
  5. // Report APP report info.
  6. type Report struct {
  7. ID int64 `json:"id"`
  8. APPID int64 `json:"app_id"` // application
  9. PlatformID int `json:"platform_id"`
  10. Mid int64 `json:"mid"`
  11. Buvid string `json:"buvid"`
  12. Build int `json:"build"`
  13. TimeZone int `json:"time_zone"`
  14. NotifySwitch int `json:"notify_switch"` // global notification switch
  15. DeviceToken string `json:"device_token"`
  16. DeviceBrand string `json:"device_brand"`
  17. DeviceModel string `json:"device_model"`
  18. OSVersion string `json:"os_version"`
  19. Extra string `json:"extra"`
  20. Dtime int64 `json:"dtime"`
  21. }
  22. // Task push task info.
  23. type Task struct {
  24. ID string `json:"id"` // task id
  25. Job int64 `json:"job"` // 多个子任务拥有同一个 job name
  26. Type int `json:"type"` // 任务类型 1:后台全量 2:后台批量 3:业务推送
  27. APPID int64 `json:"app_id"`
  28. BusinessID int64 `json:"business_id"`
  29. PlatformID int `json:"platform_id"`
  30. Platform []int `json:"platform"`
  31. Title string `json:"title"`
  32. Summary string `json:"summary"`
  33. LinkType int8 `json:"link_type"`
  34. LinkValue string `json:"link_value"`
  35. Build map[int]*Build `json:"build"`
  36. Sound int `json:"sound"`
  37. Vibration int `json:"vibration"`
  38. PassThrough int `json:"pass_through"`
  39. MidFile string `json:"mid_file"`
  40. Progress *Progress `json:"progress"`
  41. PushTime xtime.Time `json:"push_time"`
  42. ExpireTime xtime.Time `json:"expire_time"`
  43. Status int8 `json:"status"`
  44. Group string `json:"group"`
  45. ImageURL string `json:"image_url"`
  46. Extra *TaskExtra `json:"extra"`
  47. }
  48. // TaskExtra task extra.
  49. type TaskExtra struct {
  50. Group string `json:"group"`
  51. Filename string `json:"filename,omitempty"` // 任务文件的名称(前端展示用)
  52. }
  53. // Build version limit.
  54. type Build struct {
  55. Build int `json:"build"`
  56. Condition string `json:"condition"`
  57. }
  58. // Progress task push progress.
  59. type Progress struct {
  60. // total indicators
  61. Status int8 `json:"st"` // 任务状态
  62. MidTotal int64 `json:"mid_total"` // 任务接收到的mid总数
  63. MidValid int64 `json:"mid_valid"` // 能查到token的mid数
  64. MidMissed int64 `json:"mm"` // mid_missed 查不到token的mid数
  65. MidMissedSuccess int64 `json:"mms"` // mid_missed_success 无效mid补偿推送成功的
  66. MidMissedFailed int64 `json:"mmf"` // mid_missed_failed 无效mid补偿推送失败的
  67. TokenTotal int64 `json:"token_total"` // 一共要推送的token数
  68. TokenValid int64 `json:"token_valid"` // 有效token
  69. TokenDelay int64 `json:"token_delay"` // 延迟推送的token
  70. TokenSuccess int64 `json:"token_success"` // 推送成功的
  71. TokenFailed int64 `json:"token_failed"` // 推送失败的
  72. // brand indicators
  73. Brands map[int]int64 `json:"brands"` // 各品牌统计数据
  74. // server indicators
  75. RetryTimes int64 `json:"retry"` // 重试次数
  76. BeginTime xtime.Time `json:"btime"` // 开始时间
  77. PushTime xtime.Time `json:"ptime"` // 开始推送时间
  78. EndTime xtime.Time `json:"etime"` // 结束时间
  79. }
  80. // APP appication
  81. type APP struct {
  82. ID int64
  83. Name string
  84. PushLimitUser int
  85. }
  86. // Business business
  87. type Business struct {
  88. ID int64 `json:"id"`
  89. APPID int64 `json:"app_id"`
  90. Name string `json:"name"`
  91. Desc string `json:"desc"`
  92. Token string `json:"token"`
  93. Sound int `json:"sound"`
  94. Vibration int `json:"vibration"`
  95. ReceiveSwitch int `json:"receive_switch"`
  96. PushSwitch int `json:"push_switch"`
  97. SilentTime BusinessSilentTime `json:"silent_time"`
  98. PushLimitUser int `json:"push_limit_user"`
  99. Whitelist int `json:"whitelist"`
  100. }
  101. // BusinessSilentTime .
  102. type BusinessSilentTime struct {
  103. BeginHour, EndHour int
  104. BeginMinute, EndMinute int
  105. }
  106. // PushInfo push message.
  107. type PushInfo struct {
  108. Job int64
  109. TaskID string
  110. APPID int64
  111. Title string
  112. Summary string
  113. LinkType int8
  114. LinkValue string
  115. PushTime xtime.Time
  116. ExpireTime xtime.Time
  117. PassThrough int
  118. Sound int
  119. Vibration int
  120. ImageURL string
  121. }
  122. // PushItem push item.
  123. type PushItem struct {
  124. Platform int
  125. Token string
  126. Mid int64
  127. Sound int
  128. Vibration int
  129. Build int
  130. }
  131. // PushChanItem push channel item.
  132. type PushChanItem struct {
  133. Info *PushInfo
  134. Item *PushItem
  135. }
  136. // PushChanItems push channel item.
  137. type PushChanItems struct {
  138. Info *PushInfo
  139. Items []*PushItem
  140. }
  141. // Auth cert or auth info.
  142. type Auth struct {
  143. APPID int64
  144. PlatformID int
  145. Name string // 第三方名称 for android,例如 小米
  146. Key string // android的包名 或 iOS的 cert key
  147. Value string // android的 auth 或 iOS的 cert value
  148. BundleID string // just for iOS
  149. }
  150. // HTTPResponse http response.
  151. type HTTPResponse struct {
  152. Code int
  153. Msg string
  154. }
  155. // Callback push callback.
  156. type Callback struct {
  157. Task string
  158. APP int64
  159. Platform int
  160. Mid int64
  161. Pid int // mobi_app ID
  162. Token string
  163. Buvid string
  164. Click uint8 // 是否被点击
  165. Brand int
  166. Extra *CallbackExtra
  167. }
  168. // CallbackExtra .
  169. type CallbackExtra struct {
  170. Status int `json:"st"`
  171. Channel int `json:"chan"`
  172. }