heyuntao
2023-05-05 cc09b6fe6ffac34a4eeeb26d313b187713cae0de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
using CommonUtil.Top;
using DkSdkCore;
using DkSdkCore.Request;
using DkSdkCore.Response;
using Microsoft.AspNetCore.Mvc;
using Microsoft.OpenApi.Writers;
using Operater.DTO.Tk;
using System.Collections.Generic;
 
namespace Api.Operater.Controllers
{
    /// <summary>
    /// 淘宝商品
    /// </summary>
    [Route(TopConstants.API_ROUTE)]
    public class TkProductController : BaseController
    {
 
        /// <summary>
        /// 获取分类
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetSuperCategory()
        {
            DtkApp app = new DtkApp();
            List<GetTkCategoryReponse> getTkCategories = new List<GetTkCategoryReponse>();
            TKGetSuperCategoryRequest tKGetSuperCategoryRequest = new TKGetSuperCategoryRequest();
            TKGetSuperCategoryResponse tKGetSuperCategoryResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TKGetSuperCategoryResponse>(app.Excute(tKGetSuperCategoryRequest));
            if (tKGetSuperCategoryResponse == null && tKGetSuperCategoryResponse.data.Count == 0)
            {
                return Error("没有数据啦!");
            }
            else
            {
                foreach (var item in tKGetSuperCategoryResponse.data)
                {
                    GetTkCategoryReponse tbProductListReponse = new GetTkCategoryReponse
                    {
                        cid = item.cid,
                        cname = item.cname,
                        cpic = item.cpic,
 
                    };
                    List<Subcategoriesdata> subcategoriesdatas = new List<Subcategoriesdata>();
                    foreach (var s in item.subcategories)
                    {
                        Subcategoriesdata gEt = new Subcategoriesdata
                        {
                            subcid = s.subcid,
                            scname = s.subcname,
                            scpic = s.scpic
                        };
                        subcategoriesdatas.Add(gEt);
                    }
                    tbProductListReponse.subcategories = subcategoriesdatas;
                    getTkCategories.Add(tbProductListReponse);
                }
                return Success(getTkCategories);
            }
 
        }
 
        /// <summary>
        /// 商品列表(通过商品类目获取)
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetCategoryProductList([FromBody] GetTkCategoryProductListRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetGoodsListRequest goodsListRequest = new TkGetGoodsListRequest();
            goodsListRequest.pageId = request.PageNo.ToString();
            goodsListRequest.pageSize = request.PageSize.ToString();
            goodsListRequest.cids = request.cid;
            goodsListRequest.sort = request.sort;
            TkGetGoodsListResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetGoodsListResponse>(app.Excute(goodsListRequest));
            List<GetTkTbProductListReponse> getTkTbProductLists = new List<GetTkTbProductListReponse>();
            if (dtkresponse == null || dtkresponse.data.list.Count == 0)
            {
                return Error("没有数据啦!");
            }
            foreach (var item in dtkresponse.data.list)
            {
                GetTkTbProductListReponse tbProductListReponse = new GetTkTbProductListReponse
                {
                    goodsId = item.GoodsId,
                    dtitle = item.Dtitle,
                    shopType = item.ShopType,
                    actualPrice = item.ActualPrice.ToString(),
                    couponPrice = item.CouponPrice.ToString(),
                    monthsale = item.MonthSales,
                    mainPic=item.MainPic
                };
                getTkTbProductLists.Add(tbProductListReponse);
            }
            return Success(getTkTbProductLists);
        }
 
        /// <summary>
        /// 推荐好货
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetRecommendGoodsList([FromBody] GetTkProductListRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetGoodsListRequest goodsListRequest = new TkGetGoodsListRequest();
            goodsListRequest.pageId = request.PageNo.ToString();
            goodsListRequest.pageSize = request.PageSize.ToString();
            TkGetGoodsListResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetGoodsListResponse>(app.Excute(goodsListRequest));
            List<GetTkTbProductListReponse> getTkTbProductLists = new List<GetTkTbProductListReponse>();
            if (dtkresponse == null || dtkresponse.data.list.Count == 0)
            {
                return Error("没有数据啦!");
            }
            foreach (var item in dtkresponse.data.list)
            {
                GetTkTbProductListReponse tbProductListReponse = new GetTkTbProductListReponse
                {
                    goodsId = item.GoodsId,
                    dtitle = item.Dtitle,
                    shopType = item.ShopType,
                    actualPrice = item.ActualPrice.ToString(),
                    couponPrice = item.CouponPrice.ToString(),
                    monthsale = item.MonthSales,
                    mainPic = item.MainPic
                };
                getTkTbProductLists.Add(tbProductListReponse);
            }
            return Success(getTkTbProductLists);
        }
 
        /// <summary>
        /// 热销榜
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetRankingGoodsList([FromBody] GetTkProductListRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetGoodRankingListRequest goodsListRequest = new TkGetGoodRankingListRequest();
            goodsListRequest.rankType = "1";
            goodsListRequest.pageId = request.PageNo.ToString();
            goodsListRequest.pageSize = request.PageSize.ToString();
            TkGetGoodRankingListResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetGoodRankingListResponse>(app.Excute(goodsListRequest));
            List<GetTkTbProductListReponse> getTkTbProductLists = new List<GetTkTbProductListReponse>();
            if (dtkresponse == null || dtkresponse.data.Count == 0)
            {
                return Error("没有数据啦!");
            }
            foreach (var item in dtkresponse.data)
            {
                GetTkTbProductListReponse tbProductListReponse = new GetTkTbProductListReponse
                {
                    goodsId = item.goodsId,
                    dtitle = item.dtitle,
                    shopType = item.shopType,
                    actualPrice = item.actualPrice.ToString(),
                    couponPrice = item.couponPrice.ToString(),
                    monthsale = item.monthSales,
                    mainPic = item.mainPic
                };
                getTkTbProductLists.Add(tbProductListReponse);
            }
            return Success(getTkTbProductLists);
        }
 
        /// <summary>
        /// 主播力荐
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetLiveGoodsList([FromBody] GetTkProductListRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetLiveGoodListRequest goodsListRequest = new TkGetLiveGoodListRequest();
            goodsListRequest.pageId = request.PageNo.ToString();
            goodsListRequest.pageSize = request.PageSize.ToString();
            TkGetLiveGoodListResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetLiveGoodListResponse>(app.Excute(goodsListRequest));
            List<GetTkTbProductListReponse> getTkTbProductLists = new List<GetTkTbProductListReponse>();
            if (dtkresponse == null || dtkresponse.data.list.Count == 0)
            {
                return Error("没有数据啦!");
            }
            foreach (var item in dtkresponse.data.list)
            {
                GetTkTbProductListReponse tbProductListReponse = new GetTkTbProductListReponse
                {
                    goodsId = item.GoodsId,
                    dtitle = item.Dtitle,
                    shopType = item.ShopType,
                    actualPrice = item.ActualPrice.ToString(),
                    couponPrice = item.CouponPrice.ToString(),
                    monthsale = item.MonthSales,
                    mainPic = item.MainPic
                };
                getTkTbProductLists.Add(tbProductListReponse);
            }
            return Success(getTkTbProductLists);
        }
 
        /// <summary>
        /// 捡漏爆款
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetHeightCommissionGoodList([FromBody] GetTkProductListRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetHeightCommissionGoodListRequest goodsListRequest = new TkGetHeightCommissionGoodListRequest();
            goodsListRequest.pageId = request.PageNo.ToString();
            goodsListRequest.pageSize = request.PageSize.ToString();
            goodsListRequest.sort = "3";
            TkGetLiveGoodListResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetLiveGoodListResponse>(app.Excute(goodsListRequest));
            List<GetTkTbProductListReponse> getTkTbProductLists = new List<GetTkTbProductListReponse>();
            if (dtkresponse == null || dtkresponse.data.list.Count == 0)
            {
                return Error("没有数据啦!");
            }
            foreach (var item in dtkresponse.data.list)
            {
                GetTkTbProductListReponse tbProductListReponse = new GetTkTbProductListReponse
                {
                    goodsId = item.GoodsId,
                    dtitle = item.Dtitle,
                    shopType = item.ShopType,
                    actualPrice = item.ActualPrice.ToString(),
                    couponPrice = item.CouponPrice.ToString(),
                    monthsale = item.MonthSales,
                    mainPic = item.MainPic
                };
                getTkTbProductLists.Add(tbProductListReponse);
            }
            return Success(getTkTbProductLists);
        }
 
        /// <summary>
        /// 历史最低
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetHistoryLowGoodList([FromBody] GetTkProductListRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetHistoryLowPriceGoodListRequest goodsListRequest = new TkGetHistoryLowPriceGoodListRequest();
            goodsListRequest.pageId = request.PageNo.ToString();
            goodsListRequest.pageSize = request.PageSize.ToString();
            goodsListRequest.sort = "3";
            TkGetLiveGoodListResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetLiveGoodListResponse>(app.Excute(goodsListRequest));
            List<GetTkTbProductListReponse> getTkTbProductLists = new List<GetTkTbProductListReponse>();
            if (dtkresponse == null || dtkresponse.data.list.Count == 0)
            {
                return Error("没有数据啦!");
            }
            foreach (var item in dtkresponse.data.list)
            {
                GetTkTbProductListReponse tbProductListReponse = new GetTkTbProductListReponse
                {
                    goodsId = item.GoodsId,
                    dtitle = item.Dtitle,
                    shopType = item.ShopType,
                    actualPrice = item.ActualPrice.ToString(),
                    couponPrice = item.CouponPrice.ToString(),
                    monthsale = item.MonthSales,
                    mainPic = item.MainPic
                };
                getTkTbProductLists.Add(tbProductListReponse);
            }
            return Success(getTkTbProductLists);
        }
 
        /// <summary>
        /// 商品搜索
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetSearchGoodsList([FromBody] GetTkSearchProductListRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetSuperGoodListRequest goodsListRequest = new TkGetSuperGoodListRequest();
            goodsListRequest.sort = request.sort == null ? "0" : request.sort;
            goodsListRequest.type = request.type==null?"0" : request.type;
            goodsListRequest.pageId = request.PageNo.ToString();
            goodsListRequest.pageSize = request.PageSize.ToString();
            goodsListRequest.keyWords = request.keyWords ;
            goodsListRequest.hasCoupon = request.hasCoupon == null ? "1" : request.hasCoupon;
            goodsListRequest.tmall = request.tmall;
            TkGetSuperGoodListResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetSuperGoodListResponse>(app.Excute(goodsListRequest));
            List<GetTkSearchProductListReponse> getTkTbProductLists = new List<GetTkSearchProductListReponse>();
            if (dtkresponse == null || dtkresponse.data.list.Count == 0)
            {
                return Error("没有数据啦!");
            }
            foreach (var item in dtkresponse.data.list)
            {
                GetTkSearchProductListReponse tbProductListReponse = new GetTkSearchProductListReponse
                {
                    imgs = item.smallImages,
                    originalPrice = item.originalPrice.ToString(),
                    shopType = item.shopType,
                    dtitle = item.dtitle,
                    monthSales = item.monthSales,
                    couponPrice = item.couponPrice.ToString(),
                    couponEndTime = item.couponEndTime,
                    couponStartTime = item.couponStartTime,
                    desc = item.desc,
                    goodsId = item.goodsId,
                    actualPrice = item.actualPrice.ToString(),
                    monthsale = item.monthSales,
                    mainPic = item.mainPic
                };
                getTkTbProductLists.Add(tbProductListReponse);
            }
            return Success(getTkTbProductLists);
        }
 
        /// <summary>
        /// 搜索联想词
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetSearchSuggestion([FromBody] GetTkSearchSuggestionRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetSearchSuggestionRequest goodsListRequest = new TkGetSearchSuggestionRequest();
            goodsListRequest.keyWords = request.keyWords;
            goodsListRequest.type = "3";
            TkGetSearchSuggestionResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetSearchSuggestionResponse>(app.Excute(goodsListRequest));
            if(dtkresponse.data!=null|| dtkresponse.msg == "成功")
            {
                return Success(dtkresponse);
            }
            else
            {
                return Success("");
            }
 
        }
 
 
        /// <summary>
        /// 热搜词Top100
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetHotTop100()
        {
            DtkApp app = new DtkApp();
            TkGetHotTop100Request goodsListRequest = new TkGetHotTop100Request();
            goodsListRequest.type = "1";
            TkGetHotTop100Response dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetHotTop100Response>(app.Excute(goodsListRequest));
            if (dtkresponse.data != null || dtkresponse.msg == "成功")
            {
                return Success(dtkresponse.data);
            }
            else
            {
                return Success("");
            }
 
        }
 
        /// <summary>
        /// 每日爆款
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetExplosiveGoodsList([FromBody] GetTkProductListRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetExplosiveGoodsListRequest goodsListRequest = new TkGetExplosiveGoodsListRequest();
            goodsListRequest.pageId = request.PageNo.ToString();
            goodsListRequest.pageSize = request.PageSize.ToString();
            TkGetExplosiveGoodsListResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetExplosiveGoodsListResponse>(app.Excute(goodsListRequest));
            List<GetTkTbProductListReponse> getTkTbProductLists = new List<GetTkTbProductListReponse>();
            if (dtkresponse == null || dtkresponse.data.list.Count == 0)
            {
                return Error("没有数据啦!");
            }
            foreach (var item in dtkresponse.data.list)
            {
                GetTkTbProductListReponse tbProductListReponse = new GetTkTbProductListReponse
                {
                    goodsId = item.goodsId,
                    dtitle = item.dtitle,
                    shopType = item.shopType,
                    actualPrice = item.actualPrice.ToString(),
                    couponPrice = item.couponPrice.ToString(),
                    monthsale = item.monthSales,
                    mainPic = item.mainPic
                };
                getTkTbProductLists.Add(tbProductListReponse);
            }
            return Success(getTkTbProductLists);
        }
 
        /// <summary>
        /// 9.9包邮精选
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetOpGoodsList([FromBody] GetTkOpProductListRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetOpGoodListRequest goodsListRequest = new TkGetOpGoodListRequest();
            goodsListRequest.nineCid = request.nineCid;
            goodsListRequest.pageId = request.PageNo.ToString();
            goodsListRequest.pageSize = request.PageSize.ToString();
            TkGetSuperGoodListResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetSuperGoodListResponse>(app.Excute(goodsListRequest));
            List<GetTkTbProductListReponse> getTkTbProductLists = new List<GetTkTbProductListReponse>();
            if (dtkresponse == null || dtkresponse.data.list.Count == 0)
            {
                return Error("没有数据啦!");
            }
            foreach (var item in dtkresponse.data.list)
            {
                GetTkTbProductListReponse tbProductListReponse = new GetTkTbProductListReponse
                {
                    goodsId = item.goodsId,
                    dtitle = item.dtitle,
                    shopType = item.shopType,
                    actualPrice = item.actualPrice.ToString(),
                    couponPrice = item.couponPrice.ToString(),
                    monthsale = item.monthSales,
                    mainPic = item.mainPic
                };
                getTkTbProductLists.Add(tbProductListReponse);
            }
            return Success(getTkTbProductLists);
        }
 
        /// <summary>
        /// 折上折
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetSupperDiscountGoodsList([FromBody] GetTkSupperDiscountGoodsListRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetSupperDiscountGoodListRequest goodsListRequest = new TkGetSupperDiscountGoodListRequest();
            goodsListRequest.cids = request.cids;
            goodsListRequest.sort = request.sort;
            goodsListRequest.pageId = request.PageNo.ToString();
            goodsListRequest.pageSize = request.PageSize.ToString();
            TkGetSuperGoodListResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetSuperGoodListResponse>(app.Excute(goodsListRequest));
            List<GetTkTbProductListReponse> getTkTbProductLists = new List<GetTkTbProductListReponse>();
            if (dtkresponse == null || dtkresponse.data.list.Count == 0)
            {
                return Error("没有数据啦!");
            }
            foreach (var item in dtkresponse.data.list)
            {
                GetTkTbProductListReponse tbProductListReponse = new GetTkTbProductListReponse
                {
                    goodsId = item.goodsId,
                    dtitle = item.dtitle,
                    shopType = item.shopType,
                    actualPrice = item.actualPrice.ToString(),
                    couponPrice = item.couponPrice.ToString(),
                    monthsale = item.monthSales,
                    mainPic = item.mainPic
                };
                getTkTbProductLists.Add(tbProductListReponse);
            }
            return Success(getTkTbProductLists);
        }
 
        /// <summary>
        /// 每日半价
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetHalfPriceDayGoodsList([FromBody] GetTkHalfPriceDayGoodsListRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetHalfPriceDayGoodsListRequest goodsListRequest = new TkGetHalfPriceDayGoodsListRequest();
            goodsListRequest.sessions = request.sessions;
            goodsListRequest.pageId = request.PageNo.ToString();
            goodsListRequest.pageSize = request.PageSize.ToString();
            TkGetSuperGoodListResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetSuperGoodListResponse>(app.Excute(goodsListRequest));
            List<GetTkTbProductListReponse> getTkTbProductLists = new List<GetTkTbProductListReponse>();
            if (dtkresponse == null || dtkresponse.data.list.Count == 0)
            {
                return Error("没有数据啦!");
            }
            foreach (var item in dtkresponse.data.list)
            {
                GetTkTbProductListReponse tbProductListReponse = new GetTkTbProductListReponse
                {
                    goodsId = item.goodsId,
                    dtitle = item.dtitle,
                    shopType = item.shopType,
                    actualPrice = item.actualPrice.ToString(),
                    couponPrice = item.couponPrice.ToString(),
                    monthsale = item.monthSales,
                    mainPic = item.mainPic
                };
                getTkTbProductLists.Add(tbProductListReponse);
            }
            return Success(getTkTbProductLists);
        }
 
        /// <summary>
        /// 每日半价
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetBrandColumList([FromBody] GetTkBrandColumListRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetBrandColumListRequest goodsListRequest = new TkGetBrandColumListRequest();
            goodsListRequest.cid = request.cid;
            goodsListRequest.pageId = request.PageNo.ToString();
            goodsListRequest.pageSize = request.PageSize.ToString();
            TkGetBrandColumListResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetBrandColumListResponse>(app.Excute(goodsListRequest));
            List<GetTkBrandColumListResponse> getTkTbProductLists = new List<GetTkBrandColumListResponse>();
            if (dtkresponse == null||dtkresponse.code!=0 || dtkresponse.data.list.Count == 0)
            {
                return Error("没有数据啦!");
            }
            foreach (var item in dtkresponse.data.list)
            {
                List<GetTkTbProductListReponse> goods = new List<GetTkTbProductListReponse>();
                foreach (var good in item.goodsList)
                {
                    GetTkTbProductListReponse tbProductListReponse = new GetTkTbProductListReponse
                    {
                        goodsId = good.GoodsId,
                        dtitle = good.Dtitle,
                        shopType = good.ShopType,
                        actualPrice = good.ActualPrice.ToString(),
                        couponPrice = good.CouponPrice.ToString(),
                        monthsale = good.MonthSales,
                        mainPic = good.MainPic
                    };
                    goods.Add(tbProductListReponse);
                }
                GetTkBrandColumListResponse brandColumListResponse = new GetTkBrandColumListResponse
                {
                    brandId=item.brandId,
                    brandName=item.brandName,
                    brandLogo=item.brandLogo,
                    brandFeatures=item.brandFeatures,
                    brandDesc=item.brandDesc,
                    sales=item.sales,
                    maxDiscountAmount=item.maxDiscountAmount,
                    maxDiscount=item.maxDiscount,
                    goodlist=goods
                };
               
                 
               
            }
            return Success(getTkTbProductLists);
        }
 
        /// <summary>
        /// 整点秒杀
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetDdqGoodList([FromBody] GetTkddqRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetDdpGoodsListRequest goodsListRequest = new TkGetDdpGoodsListRequest();
            goodsListRequest.roundTime = request.roundTime;
            TkGetDdpGoodsListResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetDdpGoodsListResponse>(app.Excute(goodsListRequest));
            if (dtkresponse.data != null || dtkresponse.msg == "成功")
            {
                return Success(dtkresponse);
            }
            else
            {
                return Success("");
            }
 
        }
 
        /// <summary>
        /// 商品详情
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetGoodDetail([FromBody] GetTkProductDetailRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetGoodDetailRequest goodDetailRequest = new TkGetGoodDetailRequest();
            goodDetailRequest.id = request.id;
            TkGetGoodDetailResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetGoodDetailResponse>(app.Excute(goodDetailRequest));
            if (dtkresponse == null || dtkresponse.data == null)
            {
                return Error("未查到数据");
            }
            else
            {
 
                GetTkProductDetailResponse getTkProductDetail = new GetTkProductDetailResponse
                {
                    imgs = dtkresponse.data.imgs.Split(','),
                    subdivisionName = dtkresponse.data.subdivisionName,
                    subdivisionRank=dtkresponse.data.subdivisionRank,
                    actualPrice=dtkresponse.data.actualPrice,
                    originalPrice = dtkresponse.data.originalPrice,
                    shopType = dtkresponse.data.shopType,
                    dtitle = dtkresponse.data.dtitle,
                    monthSales = dtkresponse.data.monthSales,
                    couponPrice = dtkresponse.data.couponPrice,
                    couponEndTime= dtkresponse.data.couponEndTime,
                    couponStartTime= dtkresponse.data.couponStartTime,
                    desc= dtkresponse.data.desc,
                    detailPics=dtkresponse.data.detailPics
 
                };
                return Success(getTkProductDetail);
            }
 
        }
 
 
        /// <summary>
        /// 生成淘宝口令
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetPrivilegeLink([FromBody] GetTkProductDetailRequest request)
        {
            DtkApp app = new DtkApp();
            TkGetPrivilegeLinkRequest goodDetailRequest = new TkGetPrivilegeLinkRequest();
            goodDetailRequest.goodsId = request.id;
            TkGetPrivilegeLinkResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetPrivilegeLinkResponse>(app.Excute(goodDetailRequest));
            if (dtkresponse == null || dtkresponse.data == null)
            {
                return Error("未查到数据");
            }
            else
            {
 
                GetPrivilegeLinkResponse getTkProductDetail = new GetPrivilegeLinkResponse
                {
                   couponClickUrl= dtkresponse.data.couponClickUrl,
                    couponEndTime = dtkresponse.data.couponEndTime,
                    couponInfo = dtkresponse.data.couponInfo,
                    couponStartTime = dtkresponse.data.couponStartTime,
                    itemId = dtkresponse.data.itemId,
                    couponTotalCount = dtkresponse.data.couponTotalCount,
                    couponRemainCount = dtkresponse.data.couponRemainCount,
                    itemUrl = dtkresponse.data.itemUrl,
                    tpwd = dtkresponse.data.tpwd,
                    longTpwd = dtkresponse.data.longTpwd,
                    TpwdNew=dtkresponse.data.TpwdNew,
                    maxCommissionRate = dtkresponse.data.maxCommissionRate,
                    shortUrl = dtkresponse.data.shortUrl,
                    minCommissionRate = dtkresponse.data.minCommissionRate
 
                };
                return Success(getTkProductDetail);
            }
 
        }
 
    }
}