infoc.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. package model
  2. const (
  3. // PlatAndroid is int8 for android.
  4. PlatAndroid = int8(0)
  5. // PlatIPhone is int8 for iphone.
  6. PlatIPhone = int8(1)
  7. // PlatIPad is int8 for ipad.
  8. PlatIPad = int8(2)
  9. // PlatWPhone is int8 for wphone.
  10. PlatWPhone = int8(3)
  11. // PlatAndroidG is int8 for Android Global.
  12. PlatAndroidG = int8(4)
  13. // PlatIPhoneI is int8 for Iphone Global.
  14. PlatIPhoneI = int8(5)
  15. // PlatIPadI is int8 for IPAD Global.
  16. PlatIPadI = int8(6)
  17. // PlatAndroidTV is int8 for AndroidTV Global.
  18. PlatAndroidTV = int8(7)
  19. // PlatAndroidI is int8 for Android Global.
  20. PlatAndroidI = int8(8)
  21. // PlatH5 is int8 for H5
  22. PlatH5 = int8(9)
  23. // PlatPC is int8 for PC
  24. PlatPC = int8(10)
  25. //PlatOther is int8 for unknow plat
  26. PlatOther = int8(11)
  27. )
  28. // Plat return plat by platStr or mobiApp
  29. func Plat(mobiApp, device string) int8 {
  30. switch mobiApp {
  31. case "iphone", "iphone_b":
  32. if device == "pad" {
  33. return PlatIPad
  34. }
  35. return PlatIPhone
  36. case "white":
  37. return PlatIPhone
  38. case "ipad":
  39. return PlatIPad
  40. case "android":
  41. return PlatAndroid
  42. case "win":
  43. return PlatWPhone
  44. case "android_G":
  45. return PlatAndroidG
  46. case "android_i":
  47. return PlatAndroidI
  48. case "iphone_i":
  49. if device == "pad" {
  50. return PlatIPadI
  51. }
  52. return PlatIPhoneI
  53. case "ipad_i":
  54. return PlatIPadI
  55. case "android_tv":
  56. return PlatAndroidTV
  57. case "h5":
  58. return PlatH5
  59. case "pc":
  60. return PlatPC
  61. }
  62. return PlatOther
  63. }
  64. // Client 成转换AI部门的client
  65. func Client(plat int8) string {
  66. switch plat {
  67. case PlatIPad, PlatIPadI:
  68. return "ipad"
  69. case PlatIPhone, PlatIPhoneI:
  70. return "iphone"
  71. case PlatAndroid, PlatAndroidG, PlatAndroidI, PlatAndroidTV:
  72. return "android"
  73. default:
  74. return "web"
  75. }
  76. }
  77. // HistoryClient .
  78. func HistoryClient(plat int8) (client int8) {
  79. switch plat {
  80. case PlatAndroid, PlatAndroidG, PlatAndroidI:
  81. client = 3
  82. case PlatIPhone, PlatIPhoneI:
  83. client = 1
  84. case PlatPC, PlatH5:
  85. client = 2
  86. case PlatAndroidTV:
  87. client = 33
  88. case PlatIPad, PlatIPadI:
  89. client = 4
  90. case PlatWPhone:
  91. client = 6
  92. }
  93. return
  94. }