You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
3.4 KiB
103 lines
3.4 KiB
using BBWY.Common.Models;
|
|
using BBWY.Server.Business;
|
|
using BBWY.Server.Model.Dto;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Primitives;
|
|
using Newtonsoft.Json;
|
|
using NLog;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Text;
|
|
|
|
namespace BBWY.Server.API.Controllers
|
|
{
|
|
|
|
public class VenderController : BaseApiController
|
|
{
|
|
private VenderBusiness venderBusiness;
|
|
private NLogManager nLogManager;
|
|
|
|
public VenderController(IHttpContextAccessor httpContextAccessor,
|
|
VenderBusiness venderBusiness,
|
|
NLogManager nLogManager) : base(httpContextAccessor)
|
|
{
|
|
this.venderBusiness = venderBusiness;
|
|
this.nLogManager = nLogManager;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取商家信息
|
|
/// </summary>
|
|
/// <param name="platformRequest"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public VenderResponse GetVenderInfo([FromBody] PlatformRequest platformRequest)
|
|
{
|
|
return venderBusiness.GetVenderInfo(platformRequest);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取物流公司
|
|
/// </summary>
|
|
/// <param name="platformRequest"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public IList<LogisticsResponse> GetLogisticsList([FromBody] PlatformRequest platformRequest)
|
|
{
|
|
return venderBusiness.GetLogisticsList(platformRequest);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存店铺设置
|
|
/// </summary>
|
|
/// <param name="shopSettingRequest"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public long SaveShopSetting([FromBody] ShopSettingRequest shopSettingRequest)
|
|
{
|
|
return venderBusiness.SaveShopSetting(shopSettingRequest);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 接收JD店铺Token更新
|
|
/// </summary>
|
|
/// <param name="jDShopToken"></param>
|
|
[HttpPost]
|
|
public string AcceptJDShopToken([FromBody] JDShopToken jDShopToken)
|
|
{
|
|
var httpContext = httpContextAccessor.HttpContext;
|
|
var stringBuilder = new StringBuilder();
|
|
stringBuilder.AppendLine("AcceptJDShopToken");
|
|
stringBuilder.AppendLine($"ContentType:{httpContext.Request.ContentType}");
|
|
stringBuilder.Append($"jDShopToken:{JsonConvert.SerializeObject(jDShopToken)}");
|
|
nLogManager.Default().Info(stringBuilder.ToString());
|
|
return venderBusiness.AcceptJDShopToken(jDShopToken);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取部门和下属店铺
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public IList<DepartmentResponse> GetDeparmentList()
|
|
{
|
|
if (!Request.Headers.TryGetValue("bbwyTempKey", out StringValues sv))
|
|
throw new BusinessException("非法请求");
|
|
if (sv.ToString() != "21jfhayu27q")
|
|
throw new BusinessException("非法请求");
|
|
return venderBusiness.GetDeparmentList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据ShopId获取店铺
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public IList<ShopResponse> GetShopListByShopIds(QueryShopByIdsRequest request)
|
|
{
|
|
return venderBusiness.GetShopListByShopIds(request);
|
|
}
|
|
}
|
|
}
|
|
|