feedback.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. package model
  2. import "go-common/library/time"
  3. const (
  4. // EnvPro is pro.
  5. EnvPro = "pro"
  6. // EnvTest is env.
  7. EnvTest = "test"
  8. // EnvDev is env.
  9. EnvDev = "dev"
  10. // MaxUploadSize for h5 upload
  11. MaxUploadSize = 20 * 1024 * 1024
  12. )
  13. // feedback model const.
  14. const (
  15. // StateNoReply 未回复
  16. StateNoReply = 0
  17. // StateReplied 已回复
  18. StateReplied = 1
  19. // StateRepeated 二次追问
  20. StateRepeated = 2
  21. // StateOther 其它
  22. StateOther = 4
  23. // TypeCustomer 客户
  24. TypeCustomer = 0
  25. // TypeServer 客服
  26. TypeServer = 1
  27. // player cast screen
  28. AndroidPlayerScreen = int64(464)
  29. AndroidPlayerScreenNothing = int64(465)
  30. AndroidPlayerScreenDlna = int64(466)
  31. AndroidPlayerScreenTV = int64(470)
  32. IOSPlayerScreen = int64(467)
  33. IOSPlayerScreenNothing = int64(468)
  34. IOSPlayerScreenDlna = int64(469)
  35. IOSPlayerScreenTV = int64(471)
  36. )
  37. // Session is feedback session
  38. type Session struct {
  39. ID int64 `json:"id"`
  40. Buvid string `json:"-"`
  41. System string `json:"-"`
  42. Version string `json:"-"`
  43. Mid int64 `json:"-"`
  44. Aid string `json:"-"`
  45. Content string `json:"content"`
  46. ImgURL string `json:"-"`
  47. LogURL string `json:"-"`
  48. Device string `json:"-"`
  49. Channel string `json:"-"`
  50. IP uint32 `json:"-"`
  51. NetState string `json:"-"`
  52. NetOperator string `json:"-"`
  53. AgencyArea string `json:"-"`
  54. Platform string `json:"-"`
  55. Browser string `json:"-"`
  56. Email string `json:"-"`
  57. QQ string `json:"-"`
  58. State int8 `json:"state"`
  59. ReplyID string `json:"-"`
  60. ReplyTime time.Time `json:"-"`
  61. LasterTime time.Time `json:"-"`
  62. CTime time.Time `json:"ctime"`
  63. MTime time.Time `json:"-"`
  64. }
  65. // WebSession web session.
  66. type WebSession struct {
  67. Session *Session `json:"session,omitempty"`
  68. Tag *Tag `json:"tag,omitempty"`
  69. }
  70. // Reply is feedback reply
  71. type Reply struct {
  72. ID int64 `json:"-"`
  73. SessionID int64 `json:"-"`
  74. ReplyID string `json:"reply_id"`
  75. Type int8 `json:"type"`
  76. Content string `json:"content"`
  77. ImgURL string `json:"img_url"`
  78. LogURL string `json:"log_url"`
  79. CTime time.Time `json:"ctime"`
  80. MTime time.Time `json:"-"`
  81. }
  82. // SsnAndTagID ssn and tagid.
  83. type SsnAndTagID struct {
  84. TagID int64 `json:"tag_id"`
  85. SessionID int64 `json:"session_id"`
  86. }
  87. // Replys for sort by ctime asc
  88. type Replys []Reply
  89. func (t Replys) Len() int { return len(t) }
  90. func (t Replys) Less(i, j int) bool {
  91. return t[i].CTime < t[j].CTime
  92. }
  93. func (t Replys) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
  94. // FormPlatForm fro playerCheck.
  95. func FormPlatForm(platStr string) (plat int) {
  96. switch platStr {
  97. case "web":
  98. plat = 1
  99. case "ios":
  100. plat = 2
  101. case "android":
  102. plat = 3
  103. }
  104. return
  105. }