using CommonUtil.Top;
|
using DkSdkCore;
|
using DkSdkCore.Request;
|
using DkSdkCore.Response;
|
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Mvc;
|
using Operater.DTO.Tk;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Threading.Tasks;
|
|
namespace Api.Operater.Controllers
|
{
|
/// <summary>
|
/// pdd商品
|
/// </summary>
|
[Route(TopConstants.API_ROUTE)]
|
public class TkPddProductController : BaseController
|
{
|
/// <summary>
|
/// pdd商品搜索
|
/// </summary>
|
/// <param name="request"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetPddSearchGoodsList([FromBody] GetTkPddSearchProductListRequest request)
|
{
|
DtkApp app = new DtkApp();
|
TkGetPddGoodsListResquest goodsListRequest = new TkGetPddGoodsListResquest();
|
goodsListRequest.sortType = request.sort;
|
goodsListRequest.page = request.PageNo.ToString();
|
goodsListRequest.pageSize = request.PageSize.ToString();
|
goodsListRequest.keyword = request.keyWords;
|
goodsListRequest.withCoupon = request.hasCoupon;
|
TkGetPddGoodsListResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetPddGoodsListResponse>(app.Excute(goodsListRequest));
|
List<GetTkPddSearchProductListReponse> getTkTbProductLists = new List<GetTkPddSearchProductListReponse>();
|
if (dtkresponse == null || dtkresponse.data.goodsList.Count == 0)
|
{
|
return Error("没有数据啦!");
|
}
|
foreach (var item in dtkresponse.data.goodsList)
|
{
|
GetTkPddSearchProductListReponse tbProductListReponse = new GetTkPddSearchProductListReponse
|
{
|
dtitle = item.goodsName,
|
shopname = item.mallName,
|
couponPrice = item.couponDiscount.ToString(),
|
couponEndTime = item.couponEndTime,
|
couponStartTime = item.couponStartTime,
|
desc = item.goodsDesc,
|
goodsId = item.goodsId,
|
actualPrice = item.minNormalPrice.ToString(),
|
allsale = item.salesTip,
|
mainPic = item.goodsThumbnailUrl,
|
goodsSign=item.goodsSign
|
};
|
getTkTbProductLists.Add(tbProductListReponse);
|
}
|
return Success(getTkTbProductLists);
|
}
|
|
/// <summary>
|
/// 获取拼多多推广连接
|
/// </summary>
|
/// <param name="request"></param>
|
/// <returns></returns>
|
[HttpPost]
|
public IActionResult GetPddProductShare([FromBody] GetTkPddProductUrlListRequest request)
|
{
|
DtkApp app = new DtkApp();
|
TkGetPddGoodUrlRequest goodDetailRequest = new TkGetPddGoodUrlRequest();
|
goodDetailRequest.pid = "36944097_265137240";
|
goodDetailRequest.goodsSign = request.id;
|
TkGetPddGoodUrlResponse dtkresponse = Newtonsoft.Json.JsonConvert.DeserializeObject<TkGetPddGoodUrlResponse>(app.Excute(goodDetailRequest));
|
if (dtkresponse == null || dtkresponse.Data == null)
|
{
|
return Error("未查到数据");
|
}
|
else
|
{
|
|
|
return Success(dtkresponse.Data.weAppPagePath);
|
}
|
}
|
}
|
}
|