2025-04-24 18:31:27 +08:00

129 lines
4.5 KiB
C#

using MyCode.Project.Domain.Message.Act.Common;
using MyCode.Project.Domain.Message.Act.Report2301;
using MyCode.Project.Domain.Message.Common;
using MyCode.Project.Domain.Message.Request.Goods;
using MyCode.Project.Domain.Message.Request.OnlineGoods;
using MyCode.Project.Domain.Message.Response.Activity;
using MyCode.Project.Domain.Message.Response.Goods;
using MyCode.Project.Domain.Message.Response.OnlineGoods;
using MyCode.Project.Infrastructure.Common;
using MyCode.Project.Infrastructure.Constant;
using MyCode.Project.Services;
using System;
using System.Collections.Generic;
using System.Web.Http;
namespace MyCode.Project.WebApi.Areas.Wechat.Controllers
{
/// <summary>
/// 收银台商品相关的接口
/// </summary>
public class OnlineGoodsController : BaseWechatController
{
private IOnlineGoodsService _OnlineGoodsService;
private IRpShopUseAppletDataService _rpShopUseAppletDataService;
private ISalesSheetService _salesSheetService;
/// <summary>
/// 初始化一个<see cref="GoodsController"/>类型的实例
/// </summary>
public OnlineGoodsController(IOnlineGoodsService onlineGoodsService
, IRpShopUseAppletDataService rpShopUseAppletDataService
,ISalesSheetService salesSheetService)
{
_OnlineGoodsService = onlineGoodsService;
_rpShopUseAppletDataService = rpShopUseAppletDataService;
_salesSheetService = salesSheetService;
}
#region GetSellsPageList()
/// <summary>
/// 销售商品列表
/// </summary>
/// <param name="search">查询条件</param>
/// <returns></returns>
[HttpPost]
public PageResult<OnlineGoodsStockPageListResp> GetSellsPageList(PagedSearch<OnlineGoodsStockPageListQuery> search)
{
return this._OnlineGoodsService.GetSellsPageList(search, this.CurrentLogin.MerchantId);
}
#endregion
#region GetOnlineDeptTreeList()
/// <summary>
/// 获取商品分类列表
/// </summary>
/// <returns></returns>
[HttpGet]
public List<OnlineDeptTreeListResp> GetOnlineDeptTreeList()
{
return this._OnlineGoodsService.GetOnlineDeptTreeList();
}
#endregion
#region GetOnlineGoodsDetail()
/// <summary>
/// 获取商品电商资料详情
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public OnlineGoodsDetailResp GetOnlineGoodsDetail(OnlineGoodsItem req)
{
try
{
_rpShopUseAppletDataService.SetData(30, req.ShopId, this.CurrentLogin);
}
catch
{ }
return this._OnlineGoodsService.GetOnlineGoodsDetail(req);
}
#endregion
#region GetGoodsSharePic()
/// <summary>
/// 门店端获取商品详情拼接海报的多个图片
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public CustomerSharePicResp GetGoodsSharePic(ShopOnlineGoodsItem req)
{
return this._OnlineGoodsService.GetGoodsSharePic(req,this.CurrentLogin,true);
}
#endregion
#region GetOnlineDeptTreeList()
/// <summary>
/// 获取商品分类列表
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public List<OnlineDeptTreeListResp> GetLxmOnlineDeptTreeList(BfyApiKeyAct request)
{
if (request.LxmZHMDReportKey.ToLower() == Const.LxmSysTemReportKey.ToLower())
{
return this._OnlineGoodsService.GetOnlineDeptTreeList();
}
else
return null;
}
#endregion
#region GetDetailListByCode()
/// <summary>
/// 根据抖音码获取对应的商品列表
/// </summary>
/// <param name="act"></param>
/// <returns></returns>
[HttpPost]
public List<TuanGouGoodsPageListResp> GetDetailListByCode(DouYinUrlAct act)
{
return _salesSheetService.GetDetailListByCode(act.Code, act.ShopId);
}
#endregion
}
}