|
|
|
using BBWY.Common.Models;
|
|
|
|
using BBWY.Server.Business;
|
|
|
|
using BBWY.Server.Model.Dto;
|
|
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
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
|
|
|
|
{
|
|
|
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
|
|
|
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]
|
|
|
|
[AllowAnonymous]
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 获取店铺客服组
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost]
|
|
|
|
public IList<WaiterResponse> GetServiceGroupList([FromBody]PlatformRequest request)
|
|
|
|
{
|
|
|
|
return venderBusiness.GetServiceGroupList(request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|