recommend.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. package recommend
  2. import (
  3. "context"
  4. "encoding/json"
  5. "fmt"
  6. "net/url"
  7. "strconv"
  8. "time"
  9. "go-common/app/interface/main/app-show/conf"
  10. "go-common/app/interface/main/app-show/model/recommend"
  11. "go-common/library/ecode"
  12. "go-common/library/log"
  13. httpx "go-common/library/net/http/blademaster"
  14. xtime "go-common/library/time"
  15. "github.com/pkg/errors"
  16. )
  17. const (
  18. // _hotUrl = "/y3kflg2k/ranking-m.json"
  19. _hotUrl = "/data/rank/reco-tmzb.json"
  20. _regionUrl = "/8669rank/mobile_random/%s/1.json" // %s must be replaced to concrete tid
  21. // _regionHotUrl = "/y3kflg2k/catalogy/%d-recommend-m.json"
  22. _regionListUrl = "/list"
  23. // _regionChildHotUrl = "/y3kflg2k/catalogy/catalogy-%d-3-m.json"
  24. _regionChildHotUrl = "/data/rank/recent_region-%d-3.json"
  25. _regionArcListUrl = "/x/v2/archive/rank"
  26. _rankRegionUrl = "/y3kflg2k/rank/%s-03-%d.json"
  27. _rankOriginalUrl = "/y3kflg2k/rank/%s-03.json"
  28. _rankBangumiUrl = "/y3kflg2k/rank/all-3-33.json"
  29. _feedDynamicUrl = "/feed/tag/top"
  30. _rankAllAppUrl = "/data/rank/recent_all-app.json"
  31. _rankOriginAppUrl = "/data/rank/recent_origin-app.json"
  32. _rankRegionAppUrl = "/data/rank/recent_region-%d-app.json"
  33. _rankBangumiAppUrl = "/data/rank/all_region-33-app.json"
  34. _hottabURL = "/data/rank/reco-app-remen.json"
  35. _hotHeTongtabURL = "/data/rank/reco-app-remen-%d.json"
  36. _hotHeTongtabcardURL = "/data/rank/reco-app-remen-card-%d.json"
  37. )
  38. // Dao is recommend dao.
  39. type Dao struct {
  40. client *httpx.Client
  41. clientAsyn *httpx.Client
  42. clientParam *httpx.Client
  43. hotUrl string
  44. regionUrl string
  45. regionChildHotUrl string
  46. regionListUrl string
  47. regionArcListUrl string
  48. rankRegionUrl string
  49. rankOriginalUrl string
  50. rankBangumilUrl string
  51. feedDynamicUrl string
  52. rankAllAppUrl string
  53. rankOriginAppUrl string
  54. rankRegionAppUrl string
  55. rankBangumiAppUrl string
  56. hottabURL string
  57. hotHetongURL string
  58. hotHeTongtabcardURL string
  59. }
  60. //New recommend dao.
  61. func New(c *conf.Config) (d *Dao) {
  62. d = &Dao{
  63. client: httpx.NewClient(conf.Conf.HTTPClient),
  64. clientAsyn: httpx.NewClient(c.HTTPClientAsyn),
  65. clientParam: httpx.NewClient(conf.Conf.HTTPClient),
  66. // hotUrl: c.Host.Hetongzi + _hotUrl,
  67. hotUrl: c.Host.HetongziRank + _hotUrl,
  68. regionUrl: c.Host.Hetongzi + _regionUrl,
  69. // regionHotUrl: c.Host.Hetongzi + _regionHotUrl,
  70. // regionChildHotUrl: c.Host.Hetongzi + _regionChildHotUrl,
  71. regionChildHotUrl: c.Host.HetongziRank + _regionChildHotUrl,
  72. regionListUrl: c.Host.ApiCo + _regionListUrl,
  73. regionArcListUrl: c.Host.ApiCoX + _regionArcListUrl,
  74. rankRegionUrl: c.Host.Hetongzi + _rankRegionUrl,
  75. rankOriginalUrl: c.Host.Hetongzi + _rankOriginalUrl,
  76. rankBangumilUrl: c.Host.Hetongzi + _rankBangumiUrl,
  77. feedDynamicUrl: c.Host.Data + _feedDynamicUrl,
  78. rankAllAppUrl: c.Host.HetongziRank + _rankAllAppUrl,
  79. rankOriginAppUrl: c.Host.HetongziRank + _rankOriginAppUrl,
  80. rankRegionAppUrl: c.Host.HetongziRank + _rankRegionAppUrl,
  81. rankBangumiAppUrl: c.Host.HetongziRank + _rankBangumiAppUrl,
  82. hottabURL: c.Host.Data + _hottabURL,
  83. hotHetongURL: c.Host.Data + _hotHeTongtabURL,
  84. hotHeTongtabcardURL: c.Host.Data + _hotHeTongtabcardURL,
  85. }
  86. return
  87. }
  88. // Hots get recommends.
  89. func (d *Dao) Hots(c context.Context) (arcids []int64, err error) {
  90. var res struct {
  91. Code int `json:"code"`
  92. List []struct {
  93. Aid int64 `json:"aid"`
  94. } `json:"list"`
  95. }
  96. if err = d.clientAsyn.Get(c, d.hotUrl, "", nil, &res); err != nil {
  97. log.Error("recommend hots url(%s) error(%v)", d.hotUrl, err)
  98. return
  99. }
  100. b, _ := json.Marshal(&res)
  101. log.Info("recommend hots url(%s) json(%s)", d.hotUrl, b)
  102. if res.Code != 0 {
  103. log.Error("recommend hots url(%s) error(%v)", d.hotUrl, res.Code)
  104. err = fmt.Errorf("recommend api response code(%v)", res)
  105. return
  106. }
  107. for _, arcs := range res.List {
  108. arcids = append(arcids, arcs.Aid)
  109. }
  110. return
  111. }
  112. // Region get region recommend.
  113. func (d *Dao) Region(c context.Context, tid string) (arcids []int64, err error) {
  114. var res struct {
  115. Code int `json:"code"`
  116. Data []struct {
  117. Aid string `json:"aid"`
  118. } `json:"list"`
  119. }
  120. api := fmt.Sprintf(d.regionUrl, tid)
  121. if err = d.clientAsyn.Get(c, api, "", nil, &res); err != nil {
  122. log.Error("recommend region url(%s) error(%v)", api, err)
  123. return
  124. }
  125. if res.Code != 0 {
  126. log.Error("recommend region url(%s) error(%v)", api, res.Code)
  127. err = fmt.Errorf("recommend region api response code(%v)", res)
  128. return
  129. }
  130. for _, arcs := range res.Data {
  131. arcids = append(arcids, aidToInt(arcs.Aid))
  132. }
  133. return
  134. }
  135. // RegionHots get hots recommend
  136. func (d *Dao) RegionHots(c context.Context, tid int) (arcids []int64, err error) {
  137. var res struct {
  138. Code int `json:"code"`
  139. List []struct {
  140. Aid int64 `json:"aid"`
  141. } `json:"list"`
  142. }
  143. api := fmt.Sprintf(d.rankRegionAppUrl, tid)
  144. if err = d.clientAsyn.Get(c, api, "", nil, &res); err != nil {
  145. log.Error("recommend region hots url(%s) error(%v)", api, err)
  146. return
  147. }
  148. if res.Code != 0 {
  149. log.Error("recommend region hots url(%s) error(%v)", api, res.Code)
  150. err = fmt.Errorf("recommend region hots api response code(%v)", res)
  151. return
  152. }
  153. for _, arcs := range res.List {
  154. arcids = append(arcids, arcs.Aid)
  155. }
  156. return
  157. }
  158. // RegionList
  159. func (d *Dao) RegionList(c context.Context, rid, tid, audit, pn, ps int, order string) (arcids []int64, err error) {
  160. params := url.Values{}
  161. params.Set("order", order)
  162. params.Set("filtered", strconv.Itoa(audit))
  163. params.Set("page", strconv.Itoa(pn))
  164. params.Set("pagesize", strconv.Itoa(ps))
  165. params.Set("tid", strconv.Itoa(rid))
  166. if tid > 0 {
  167. params.Set("tag_id", strconv.Itoa(tid))
  168. }
  169. params.Set("apiver", "2")
  170. params.Set("ver", "2")
  171. var res struct {
  172. Code int `json:"code"`
  173. List []struct {
  174. Aid interface{} `json:"aid"`
  175. } `json:"list"`
  176. }
  177. if err = d.client.Get(c, d.regionListUrl, "", params, &res); err != nil {
  178. log.Error("recommend region news url(%s) error(%v)", d.regionListUrl+"?"+params.Encode(), err)
  179. return
  180. }
  181. if res.Code != 0 && res.Code != -1 {
  182. log.Error("recommend region news url(%s) error(%v)", d.regionListUrl+"?"+params.Encode(), res.Code)
  183. err = fmt.Errorf("recommend region news api response code(%v)", res)
  184. return
  185. }
  186. for _, arcs := range res.List {
  187. var aidInt int64
  188. switch aid := arcs.Aid.(type) {
  189. case string:
  190. aidInt = aidToInt(aid)
  191. case float64:
  192. aidInt = int64(aid)
  193. }
  194. arcids = append(arcids, aidInt)
  195. }
  196. return
  197. }
  198. // TwoRegionHots
  199. func (d *Dao) RegionChildHots(c context.Context, rid int) (arcids []int64, err error) {
  200. var res struct {
  201. Code int `json:"code"`
  202. List []struct {
  203. Aid int64 `json:"aid"`
  204. } `json:"list"`
  205. }
  206. api := fmt.Sprintf(d.regionChildHotUrl, rid)
  207. if err = d.clientAsyn.Get(c, api, "", nil, &res); err != nil {
  208. log.Error("recommend region child hots url(%s) error(%v)", api, err)
  209. return
  210. }
  211. if res.Code != 0 {
  212. log.Error("recommend region child hots url(%s) error(%v)", api, res.Code)
  213. err = fmt.Errorf("recommend region child hots api response code(%v)", res)
  214. return
  215. }
  216. for _, arcs := range res.List {
  217. arcids = append(arcids, arcs.Aid)
  218. }
  219. return
  220. }
  221. func (d *Dao) RegionArcList(c context.Context, rid, pn, ps int, now time.Time) (arcids []int64, err error) {
  222. params := url.Values{}
  223. params.Set("rid", strconv.Itoa(rid))
  224. params.Set("pn", strconv.Itoa(pn))
  225. params.Set("ps", strconv.Itoa(ps))
  226. var res struct {
  227. Code int `json:"code"`
  228. Data struct {
  229. List []struct {
  230. Aid int64 `json:"aid"`
  231. } `json:"archives"`
  232. } `json:"data"`
  233. }
  234. if err = d.client.Get(c, d.regionArcListUrl, "", params, &res); err != nil {
  235. log.Error("recommend regionArc news url(%s) error(%v)", d.regionArcListUrl+"?"+params.Encode(), err)
  236. return
  237. }
  238. if res.Code != 0 && res.Code != -1 {
  239. log.Error("recommend regionArc news url(%s) error(%v)", d.regionArcListUrl+"?"+params.Encode(), res.Code)
  240. err = fmt.Errorf("recommend regionArc news api response code(%v)", res)
  241. return
  242. }
  243. for _, arcs := range res.Data.List {
  244. arcids = append(arcids, arcs.Aid)
  245. }
  246. return
  247. }
  248. // RegionRank
  249. func (d *Dao) RankRegion(c context.Context, rid int, order string) (data []*recommend.Arc, err error) {
  250. var res struct {
  251. Data struct {
  252. Code int `json:"code"`
  253. List []*recommend.Arc `json:"list"`
  254. } `json:"rank"`
  255. }
  256. api := fmt.Sprintf(d.rankRegionUrl, order, rid)
  257. if err = d.clientAsyn.Get(c, api, "", nil, &res); err != nil {
  258. log.Error("recommend region rank hots url(%s) error(%v)", api, err)
  259. return
  260. }
  261. if res.Data.Code != 0 {
  262. log.Error("recommend region rank hots url(%s) error(%v)", api, res.Data.Code)
  263. err = fmt.Errorf("recommend region rank hots api response code(%v)", res)
  264. return
  265. }
  266. data = res.Data.List
  267. return
  268. }
  269. // RankAll
  270. func (d *Dao) RankAll(c context.Context, order string) (data []*recommend.Arc, err error) {
  271. var res struct {
  272. Data struct {
  273. Code int `json:"code"`
  274. List []*recommend.Arc `json:"list"`
  275. } `json:"rank"`
  276. }
  277. api := fmt.Sprintf(d.rankOriginalUrl, order)
  278. if err = d.clientAsyn.Get(c, api, "", nil, &res); err != nil {
  279. log.Error("recommend region rank hots url(%s) error(%v)", api, err)
  280. return
  281. }
  282. if res.Data.Code != 0 {
  283. log.Error("recommend region rank hots url(%s) error(%v)", api, res.Data.Code)
  284. err = fmt.Errorf("recommend region rank hots api response code(%v)", res)
  285. return
  286. }
  287. data = res.Data.List
  288. return
  289. }
  290. // RankAll
  291. func (d *Dao) RankBangumi(c context.Context) (data []*recommend.Arc, err error) {
  292. var res struct {
  293. Data struct {
  294. Code int `json:"code"`
  295. List []*recommend.Arc `json:"list"`
  296. } `json:"rank"`
  297. }
  298. if err = d.clientAsyn.Get(c, d.rankBangumilUrl, "", nil, &res); err != nil {
  299. log.Error("recommend region rank hots url(%s) error(%v)", d.rankBangumilUrl, err)
  300. return
  301. }
  302. if res.Data.Code != 0 {
  303. log.Error("recommend region rank hots url(%s) error(%v)", d.rankBangumilUrl, res.Data.Code)
  304. err = fmt.Errorf("recommend region rank hots api response code(%v)", res)
  305. return
  306. }
  307. data = res.Data.List
  308. return
  309. }
  310. // FeedDynamic
  311. func (d *Dao) FeedDynamic(c context.Context, pull bool, rid, tid int, ctime, mid int64, now time.Time) (hotAids, newAids []int64, ctop, cbottom xtime.Time, err error) {
  312. var pn string
  313. if pull {
  314. pn = "1"
  315. } else {
  316. pn = "2"
  317. }
  318. params := url.Values{}
  319. params.Set("src", "2")
  320. params.Set("pn", pn)
  321. params.Set("mid", strconv.FormatInt(mid, 10))
  322. if ctime != 0 {
  323. params.Set("ctime", strconv.FormatInt(ctime, 10))
  324. }
  325. if rid != 0 {
  326. params.Set("rid", strconv.Itoa(rid))
  327. }
  328. if tid != 0 {
  329. params.Set("tag", strconv.Itoa(tid))
  330. }
  331. var res struct {
  332. Code int `json:"code"`
  333. Data []int64 `json:"data"`
  334. Hot []int64 `json:"hot"`
  335. CTop xtime.Time `json:"ctop"`
  336. CBottom xtime.Time `json:"cbottom"`
  337. }
  338. if err = d.client.Get(c, d.feedDynamicUrl, "", params, &res); err != nil {
  339. log.Error("region feed dynamic d.client.Get(%s) error(%v)", d.feedDynamicUrl+"?"+params.Encode(), err)
  340. return
  341. }
  342. b, _ := json.Marshal(&res)
  343. log.Info("region feed dynamic url(%s) response(%s)", d.feedDynamicUrl+"?"+params.Encode(), b)
  344. if res.Code != 0 {
  345. log.Error("region feed dynamic d.client.Get(%s) error(%v)", d.regionArcListUrl+"?"+params.Encode(), res.Code)
  346. err = fmt.Errorf("region feed dynamicapi response code(%v)", res)
  347. return
  348. }
  349. hotAids = res.Hot
  350. newAids = res.Data
  351. ctop = res.CTop
  352. cbottom = res.CBottom
  353. return
  354. }
  355. func (d *Dao) RankAppRegion(c context.Context, rid int) (aids []int64, others, scores map[int64]int64, err error) {
  356. var res struct {
  357. Code int `json:"code"`
  358. List []struct {
  359. Aid int64 `json:"aid"`
  360. Score int64 `json:"score"`
  361. Others []struct {
  362. Aid int64 `json:"aid"`
  363. Score int64 `json:"score"`
  364. } `json:"others"`
  365. } `json:"list"`
  366. }
  367. api := fmt.Sprintf(d.rankRegionAppUrl, rid)
  368. if err = d.client.Get(c, api, "", nil, &res); err != nil {
  369. log.Error("recommend region rank hots url(%s) error(%v)", api, err)
  370. return
  371. }
  372. if res.Code != 0 && res.Code != -1 {
  373. log.Error("recommend region rank hots url(%s) error(%v)", api, res.Code)
  374. err = fmt.Errorf("recommend region rank hots api response code(%v)", res)
  375. return
  376. }
  377. scores = map[int64]int64{}
  378. others = map[int64]int64{}
  379. for _, arcs := range res.List {
  380. aids = append(aids, arcs.Aid)
  381. scores[arcs.Aid] = arcs.Score
  382. for _, o := range arcs.Others {
  383. aids = append(aids, o.Aid)
  384. scores[o.Aid] = o.Score
  385. others[o.Aid] = arcs.Aid
  386. }
  387. }
  388. return
  389. }
  390. func (d *Dao) RankAppOrigin(c context.Context) (aids []int64, others, scores map[int64]int64, err error) {
  391. var res struct {
  392. Code int `json:"code"`
  393. List []struct {
  394. Aid int64 `json:"aid"`
  395. Score int64 `json:"score"`
  396. Others []struct {
  397. Aid int64 `json:"aid"`
  398. Score int64 `json:"score"`
  399. } `json:"others"`
  400. } `json:"list"`
  401. }
  402. if err = d.client.Get(c, d.rankOriginAppUrl, "", nil, &res); err != nil {
  403. log.Error("recommend Origin rank hots url(%s) error(%v)", d.rankOriginAppUrl, err)
  404. return
  405. }
  406. if res.Code != 0 && res.Code != -1 {
  407. log.Error("recommend Origin rank hots url(%s) error(%v)", d.rankOriginAppUrl, res.Code)
  408. err = fmt.Errorf("recommend Origin rank hots api response code(%v)", res)
  409. return
  410. }
  411. scores = map[int64]int64{}
  412. others = map[int64]int64{}
  413. for _, arcs := range res.List {
  414. aids = append(aids, arcs.Aid)
  415. scores[arcs.Aid] = arcs.Score
  416. for _, o := range arcs.Others {
  417. aids = append(aids, o.Aid)
  418. scores[o.Aid] = o.Score
  419. others[o.Aid] = arcs.Aid
  420. }
  421. }
  422. return
  423. }
  424. func (d *Dao) RankAppAll(c context.Context) (aids []int64, others, scores map[int64]int64, err error) {
  425. var res struct {
  426. Code int `json:"code"`
  427. List []struct {
  428. Aid int64 `json:"aid"`
  429. Score int64 `json:"score"`
  430. Others []struct {
  431. Aid int64 `json:"aid"`
  432. Score int64 `json:"score"`
  433. } `json:"others"`
  434. } `json:"list"`
  435. }
  436. if err = d.client.Get(c, d.rankAllAppUrl, "", nil, &res); err != nil {
  437. log.Error("recommend All rank hots url(%s) error(%v)", d.rankAllAppUrl, err)
  438. return
  439. }
  440. if res.Code != 0 && res.Code != -1 {
  441. log.Error("recommend All rank hots url(%s) error(%v)", d.rankAllAppUrl, res.Code)
  442. err = fmt.Errorf("recommend All rank hots api response code(%v)", res)
  443. return
  444. }
  445. scores = map[int64]int64{}
  446. others = map[int64]int64{}
  447. for _, arcs := range res.List {
  448. aids = append(aids, arcs.Aid)
  449. scores[arcs.Aid] = arcs.Score
  450. for _, o := range arcs.Others {
  451. aids = append(aids, o.Aid)
  452. scores[o.Aid] = o.Score
  453. others[o.Aid] = arcs.Aid
  454. }
  455. }
  456. return
  457. }
  458. func (d *Dao) RankAppBangumi(c context.Context) (aids []int64, others, scores map[int64]int64, err error) {
  459. var res struct {
  460. Code int `json:"code"`
  461. List []struct {
  462. Aid int64 `json:"aid"`
  463. Score int64 `json:"score"`
  464. Others []struct {
  465. Aid int64 `json:"aid"`
  466. Score int64 `json:"score"`
  467. } `json:"others"`
  468. } `json:"list"`
  469. }
  470. if err = d.client.Get(c, d.rankBangumiAppUrl, "", nil, &res); err != nil {
  471. log.Error("recommend bangumi rank hots url(%s) error(%v)", d.rankBangumiAppUrl, err)
  472. return
  473. }
  474. if res.Code != 0 && res.Code != -1 {
  475. log.Error("recommend bangumi rank hots url(%s) error(%v)", d.rankBangumiAppUrl, res.Code)
  476. err = fmt.Errorf("recommend bangumi rank hots api response code(%v)", res)
  477. return
  478. }
  479. scores = map[int64]int64{}
  480. others = map[int64]int64{}
  481. for _, arcs := range res.List {
  482. aids = append(aids, arcs.Aid)
  483. scores[arcs.Aid] = arcs.Score
  484. for _, o := range arcs.Others {
  485. aids = append(aids, o.Aid)
  486. scores[o.Aid] = o.Score
  487. others[o.Aid] = arcs.Aid
  488. }
  489. }
  490. return
  491. }
  492. func aidToInt(aidstr string) (aid int64) {
  493. aid, _ = strconv.ParseInt(aidstr, 10, 64)
  494. return
  495. }
  496. // HotTab hot tab
  497. func (d *Dao) HotTab(c context.Context) (list []*recommend.List, err error) {
  498. var res struct {
  499. Code int `json:"code"`
  500. List []*recommend.List `json:"list"`
  501. }
  502. if err = d.client.Get(c, d.hottabURL, "", nil, &res); err != nil {
  503. log.Error("hottab hots url(%s) error(%v)", d.hottabURL, err)
  504. return
  505. }
  506. b, _ := json.Marshal(&res)
  507. log.Info("hottab list url(%s) response(%s)", d.hottabURL, b)
  508. if res.Code != 0 {
  509. err = ecode.Int(res.Code)
  510. log.Error("hottab hots url(%s) code(%d)", d.hottabURL, res.Code)
  511. return
  512. }
  513. list = res.List
  514. return
  515. }
  516. // HotTenTab hot tab
  517. func (d *Dao) HotTenTab(c context.Context, i int) (list []*recommend.List, err error) {
  518. var res struct {
  519. Code int `json:"code"`
  520. List []*recommend.List `json:"list"`
  521. }
  522. if err = d.client.Get(c, fmt.Sprintf(d.hotHetongURL, i), "", nil, &res); err != nil {
  523. err = errors.Wrap(err, fmt.Sprintf(d.hotHetongURL, i))
  524. return
  525. }
  526. if res.Code != 0 {
  527. err = errors.Wrap(err, fmt.Sprintf("code(%d)", res.Code))
  528. return
  529. }
  530. list = res.List
  531. return
  532. }
  533. // HotHeTongTabCard hot tab card
  534. func (d *Dao) HotHeTongTabCard(c context.Context, i int) (list []*recommend.CardList, err error) {
  535. var res struct {
  536. Code int `json:"code"`
  537. List []*recommend.CardList `json:"list"`
  538. }
  539. if err = d.client.Get(c, fmt.Sprintf(d.hotHeTongtabcardURL, i), "", nil, &res); err != nil {
  540. err = errors.Wrap(err, fmt.Sprintf(d.hotHeTongtabcardURL, i))
  541. return
  542. }
  543. if res.Code != 0 {
  544. err = errors.Wrap(err, fmt.Sprintf("code(%d)", res.Code))
  545. return
  546. }
  547. list = res.List
  548. return
  549. }