res.go 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. package resource
  2. import (
  3. "go-common/app/service/main/archive/api"
  4. xtime "go-common/library/time"
  5. )
  6. // OverSeasCountry OverSeas Country
  7. var OverSeasCountry = map[string]int64{
  8. "澳大利亚": 2,
  9. "泰国": 4,
  10. "印度": 5,
  11. "英国": 6,
  12. "马来西亚": 8,
  13. "安哥拉": 9,
  14. "韩国": 10,
  15. "俄罗斯": 11,
  16. "新加坡": 12,
  17. "菲律宾": 13,
  18. "越南": 14,
  19. "法国": 15,
  20. "波兰": 16,
  21. "荷兰": 17,
  22. "德国": 18,
  23. "西班牙": 19,
  24. "瑞士": 20,
  25. "欧盟": 21,
  26. "丹麦": 22,
  27. "瑞典": 23,
  28. "意大利": 24,
  29. "比利时": 25,
  30. "爱尔兰": 26,
  31. "芬兰": 27,
  32. "匈牙利": 28,
  33. "希腊": 29,
  34. "保加利亚": 30,
  35. "奥地利": 31,
  36. "阿联酋": 32,
  37. "捷克": 33,
  38. "南非": 34,
  39. "以色列": 35,
  40. "卡塔尔": 36,
  41. "乌克兰": 37,
  42. "哈萨克斯坦": 38,
  43. "葡萄牙": 39,
  44. "沙特阿拉伯": 40,
  45. "伊朗": 41,
  46. "挪威": 42,
  47. "加拿大": 43,
  48. "北美地区": 44,
  49. "叙利亚": 45,
  50. "科威特": 46,
  51. "巴林": 47,
  52. "黎巴嫩": 48,
  53. "阿曼": 49,
  54. "约旦": 50,
  55. "伊拉克": 51,
  56. "土耳其": 52,
  57. "罗马尼亚": 53,
  58. "印度尼西亚": 54,
  59. "格鲁吉亚": 55,
  60. "阿塞拜疆": 56,
  61. "布隆迪": 57,
  62. "津巴布韦": 58,
  63. "赞比亚": 59,
  64. "刚果(金)": 60,
  65. "巴勒斯坦": 61,
  66. "立陶宛": 62,
  67. "斯洛伐克": 63,
  68. "塞尔维亚": 64,
  69. "冰岛": 65,
  70. "斯洛文尼亚": 66,
  71. "摩尔多瓦": 67,
  72. "马其顿": 68,
  73. "列支敦士登": 69,
  74. "泽西岛": 70,
  75. "克罗地亚": 71,
  76. "根西岛": 72,
  77. "波斯尼亚和黑塞哥维那": 73,
  78. "爱沙尼亚": 74,
  79. "拉脱维亚": 75,
  80. "智利": 76,
  81. "秘鲁": 77,
  82. "巴西": 78,
  83. "吉尔吉斯斯坦": 79,
  84. "留尼汪岛": 80,
  85. "马恩岛": 81,
  86. "直布罗陀": 82,
  87. "利比亚": 83,
  88. "亚美尼亚": 84,
  89. "也门": 85,
  90. "白俄罗斯": 86,
  91. "瓜德罗普": 87,
  92. "卢森堡": 88,
  93. "马提尼克岛": 89,
  94. "圭亚那": 90,
  95. "科索沃": 91,
  96. "关岛": 92,
  97. "多米尼加": 93,
  98. "墨西哥": 94,
  99. "委内瑞拉": 95,
  100. "波多黎各": 97,
  101. "格林纳达": 98,
  102. "蒙古": 99,
  103. "新西兰": 100,
  104. "孟加拉": 101,
  105. "巴基斯坦": 102,
  106. "亚太地区": 103,
  107. "尼泊尔": 104,
  108. "巴布亚新几内亚": 105,
  109. "特立尼达和多巴哥": 106,
  110. "哥伦比亚": 107,
  111. "阿根廷": 108,
  112. "斯里兰卡": 109,
  113. "埃及": 110,
  114. "厄瓜多尔": 111,
  115. "哥斯达黎加": 112,
  116. "乌拉圭": 113,
  117. "巴巴多斯": 114,
  118. "巴哈马": 115,
  119. "圣卢西亚": 116,
  120. "拉美地区": 117,
  121. "托克劳群岛": 118,
  122. "柬埔寨": 119,
  123. "马尔代夫": 120,
  124. "阿富汗": 121,
  125. "新喀里多尼亚": 122,
  126. "斐济": 123,
  127. "瓦利斯和富图纳群岛": 124,
  128. "尼日利亚": 125,
  129. "阿尔巴尼亚": 126,
  130. "乌兹别克斯坦": 127,
  131. "塞浦路斯": 128,
  132. "圣马力诺": 129,
  133. "黑山": 130,
  134. "塔吉克斯坦": 131,
  135. "马耳他": 132,
  136. "百慕大": 133,
  137. "圣文森特和格林纳丁斯": 134,
  138. "牙买加": 135,
  139. "多哥": 136,
  140. "危地马拉": 137,
  141. "玻利维亚": 138,
  142. "几内亚": 139,
  143. "苏里南": 140,
  144. "利比里亚": 141,
  145. "肯尼亚": 142,
  146. "加纳": 143,
  147. "坦桑尼亚": 144,
  148. "塞内加尔": 145,
  149. "马达加斯加": 146,
  150. "纳米比亚": 147,
  151. "科特迪瓦": 148,
  152. "苏丹": 149,
  153. "喀麦隆": 150,
  154. "马拉维": 151,
  155. "加蓬": 152,
  156. "马里": 153,
  157. "贝宁": 154,
  158. "乍得": 155,
  159. "博茨瓦纳": 156,
  160. "佛得角": 157,
  161. "卢旺达": 158,
  162. "刚果(布)": 159,
  163. "乌干达": 160,
  164. "莫桑比克": 161,
  165. "冈比亚": 162,
  166. "莱索托": 163,
  167. "毛里求斯": 164,
  168. "非洲地区": 165,
  169. "阿尔及利亚": 166,
  170. "斯威士兰": 167,
  171. "布基纳法索": 168,
  172. "塞拉利昂": 169,
  173. "索马里": 170,
  174. "尼日尔": 171,
  175. "中非": 172,
  176. "南苏丹": 173,
  177. "赤道几内亚": 174,
  178. "塞舌尔": 175,
  179. "吉布提": 176,
  180. "摩洛哥": 177,
  181. "毛里塔尼亚": 178,
  182. "科摩罗": 179,
  183. "英属印度洋领地": 180,
  184. "开曼群岛": 181,
  185. "突尼斯": 182,
  186. "马约特": 183,
  187. "老挝": 184,
  188. "缅甸": 185,
  189. "文莱": 186,
  190. "瑙鲁": 187,
  191. "瓦努阿图": 188,
  192. "不丹": 189,
  193. "密克罗尼西亚联邦": 190,
  194. "法属波利尼西亚": 191,
  195. "东帝汶": 192,
  196. "汤加": 193,
  197. "北马里亚纳群岛": 194,
  198. "格陵兰": 195,
  199. "英属维尔京群岛": 196,
  200. "法罗群岛": 197,
  201. "纽埃岛": 198,
  202. "福克兰群岛": 199,
  203. "特克斯和凯科斯群岛": 200,
  204. "洪都拉斯": 201,
  205. "库拉索": 202,
  206. "荷兰加勒比": 203,
  207. "马绍尔群岛": 204,
  208. "库克群岛": 205,
  209. "巴拿马": 206,
  210. "法属圣马丁": 207,
  211. "美属维尔京群岛": 208,
  212. "美属萨摩亚": 209,
  213. "萨尔瓦多": 210,
  214. "荷属圣马丁": 211,
  215. "阿鲁巴": 212,
  216. "巴拉圭": 213,
  217. "多米尼克": 214,
  218. "安提瓜和巴布达": 215,
  219. "安圭拉": 216,
  220. "圣基茨和尼维斯": 217,
  221. "圣皮埃尔和密克隆群岛": 218,
  222. "土库曼斯坦": 219,
  223. "奥兰群岛": 220,
  224. "摩纳哥": 221,
  225. "法属圭亚那": 222,
  226. "安道尔": 223,
  227. "梵蒂冈": 224,
  228. "海地": 225,
  229. "共享地址": 226,
  230. "所罗门群岛": 227,
  231. "基里巴斯": 228,
  232. "帕劳": 229,
  233. "诺福克岛": 230,
  234. "萨摩亚": 231,
  235. "阿里云骨干网": 232,
  236. "本机地址": 233,
  237. "伯利兹": 234,
  238. "尼加拉瓜": 235,
  239. "古巴": 236,
  240. "圣多美和普林西比": 237,
  241. "几内亚比绍": 238,
  242. "本地链路": 239,
  243. "朝鲜": 240,
  244. "埃塞俄比亚": 241,
  245. "厄立特里亚": 242,
  246. "蒙塞拉特岛": 243,
  247. "图瓦卢": 244,
  248. "圣诞岛": 245,
  249. "圣巴泰勒米岛": 246,
  250. }
  251. // AsgTypePic AsgTypeVideo
  252. const (
  253. AsgTypePic = int8(0)
  254. AsgTypeVideo = int8(1)
  255. // pgc mobile
  256. AsgTypeURL = int8(2)
  257. AsgTypeBangumi = int8(3)
  258. AsgTypeLive = int8(4)
  259. AsgTypeGame = int8(5)
  260. AsgTypeAv = int8(6)
  261. AsgTypeTopic = int8(7)
  262. // content type
  263. FromManager = int8(0)
  264. FromCpm = int8(1)
  265. )
  266. // Assignment struct
  267. type Assignment struct {
  268. ID int `json:"id"`
  269. ContractID string `json:"contract_id"`
  270. ResID int `json:"-"`
  271. PosNum int `json:"pos_num"`
  272. Name string `json:"name"`
  273. Pic string `json:"pic"`
  274. LitPic string `json:"litpic"`
  275. URL string `json:"url"`
  276. Rule string `json:"-"`
  277. Style int32 `json:"style"`
  278. IsAd bool `json:"is_ad,omitempty"`
  279. Archive *api.Arc `json:"archive,omitempty"`
  280. Aid int64 `json:"-"`
  281. Weight int `json:"-"`
  282. Atype int8 `json:"-"`
  283. MTime xtime.Time `json:"-"`
  284. Agency string `json:"agency"`
  285. Label string `json:"label"`
  286. Intro string `json:"intro"`
  287. // cpm
  288. CreativeType int8 `json:"creative_type"`
  289. RequestID string `json:"request_id,omitempty"`
  290. CreativeID int64 `json:"creative_id,omitempty"`
  291. SrcID int64 `json:"src_id,omitempty"`
  292. ShowURL string `json:"show_url,omitempty"`
  293. ClickURL string `json:"click_url,omitempty"`
  294. Area int8 `json:"area"`
  295. IsAdLoc bool `json:"is_ad_loc"`
  296. AdCb string `json:"ad_cb"`
  297. Title string `json:"title"`
  298. ServerType int8 `json:"server_type"`
  299. CmMark int8 `json:"cm_mark"`
  300. IsCpm bool `json:"-"`
  301. STime xtime.Time `json:"stime"`
  302. Mid string `json:"mid"`
  303. }
  304. // Relation struct
  305. type Relation struct {
  306. *api.Arc
  307. // cpm
  308. RequestID string `json:"request_id,omitempty"`
  309. CreativeID int64 `json:"creative_id,omitempty"`
  310. SrcID int64 `json:"src_id,omitempty"`
  311. ShowURL string `json:"show_url,omitempty"`
  312. ClickURL string `json:"click_url,omitempty"`
  313. Area int8 `json:"area"`
  314. IsAdLoc bool `json:"is_ad_loc"`
  315. AdCb string `json:"ad_cb"`
  316. ResID int `json:"resource_id"`
  317. IsAd bool `json:"is_ad"`
  318. }
  319. // Position struct
  320. type Position struct {
  321. Pos []*Loc
  322. Counter int `json:"-"`
  323. }
  324. // Res struct
  325. type Res struct {
  326. ID int `json:"-"`
  327. Platform int `json:"-"`
  328. Name string `json:"-"`
  329. Parent int `json:"-"`
  330. Counter int `json:"-"`
  331. Position int `json:"-"`
  332. // ass
  333. Assignments []*Assignment `json:"-"`
  334. }
  335. // Loc struct
  336. type Loc struct {
  337. ID int `json:"-"`
  338. PosNum int `json:"-"`
  339. }
  340. // ArgRess ArgRess
  341. type ArgRess struct {
  342. Pf int `form:"pf" validate:"min=0"`
  343. Ids []int64 `form:"ids,split" validate:"min=1,dive,gte=1"`
  344. Mid int64
  345. Sid string
  346. IP string
  347. Buvid string
  348. }
  349. // ArgRes ArgRes
  350. type ArgRes struct {
  351. Pf int `form:"pf" validate:"min=0"`
  352. ID int64 `form:"id" validate:"min=1"`
  353. Mid int64
  354. Sid string
  355. IP string
  356. Buvid string
  357. }
  358. // ArgAid ArgAid
  359. type ArgAid struct {
  360. Aid int64 `form:"aid" validate:"min=1"`
  361. Mid int64
  362. Sid string
  363. IP string
  364. Buvid string
  365. }