using MyCode.Project.Domain.Message.Request.Activity; using MyCode.Project.Domain.Message.Request.Clerk; using MyCode.Project.Domain.Message.Response.Activity; using MyCode.Project.Domain.Message.Response.CardCover; using MyCode.Project.Domain.Message.Response.Member; using MyCode.Project.Domain.Message.Response.Shop; using MyCode.Project.Domain.Message.Response.User; using MyCode.Project.Infrastructure.Common; using MyCode.Project.Infrastructure.Exceptions; using MyCode.Project.Services; using System; using System.Collections.Generic; using System.Web.Http; namespace MyCode.Project.WebApi.Areas.Wechat.Controllers { /// ///营销中心 相关 /// public class ActivityController : BaseWechatController { private IActivityService _activityService; private IMemberInfoService _memberInfoService; /// /// 初始化一个类型的实例 /// public ActivityController(IActivityService activityService , IMemberInfoService memberInfoService) { _activityService = activityService; _memberInfoService = memberInfoService; } #region 加盟商、店长或店员获取店铺活动列表 /// /// 加盟商、店长或店员获取店铺活动列表 /// /// 店铺ID(店长或店员可不传参) [HttpGet] public ActivityResp GetActivityList(Guid? ShopID) { ShopID = ShopID.HasValue ? ShopID : this.CurrentLogin.ShopId; if (!ShopID.HasValue) { throw new LoginError("登录信息已失效,请重新登录"); } return _activityService.GetActivityList(ShopID.Value, this.CurrentLogin); } #endregion #region (加盟商、店长或店员端)活动详情 /// /// (加盟商、店长或店员端)活动详情 /// /// 店铺ID(加盟商角色且店铺已参加活动时需传) /// 活动主键ID [HttpGet] public ActivityDetail GetDetail(Guid? shopId,Guid ID) { shopId = shopId.HasValue ? shopId.Value : this.CurrentLogin.ShopId; return _activityService.GetDetail(shopId.Value,ID,this.CurrentLogin); } #endregion #region (加盟商、店长或店员端)通用活动/分销活动/报名活动--详情 /// /// (加盟商、店长或店员端)通用活动/分销活动--详情 /// /// [HttpPost] public ActivityCommonDetail GetCommonDetail(CommonActivityReq request) { request.shopId = request.shopId.HasValue ? request.shopId.Value : this.CurrentLogin.ShopId.Value; return _activityService.GetCommonDetail(request, this.CurrentLogin); } #endregion #region 通用活动/报名活动详情--(加盟商已存在奖品池信息) 加盟商修改奖品池 /// /// 通用活动/报名活动 详情--(加盟商已存在奖品池信息) 加盟商修改奖品池 /// /// 奖品明细ID /// 是否选中 0:取消选中 1:选中 [HttpGet] public void SetCommonPrize(Guid itemId,int isChoosed) { _activityService.SetCommonPrize(itemId, isChoosed, this.CurrentLogin); } #endregion #region 马上参加 /// /// 马上参加 /// /// 代金券ID 活动二可不传 /// 活动主键ID /// 是否所有店铺参与该活动 0:否 1:是 /// 选择只有当前店铺参与活动 当前店铺ID public void SetShopJoin(Guid? VoucherID, Guid ActivityID, int IsAll, Guid? ShopID) { _activityService.SetShopJoin(VoucherID, ActivityID, IsAll,ShopID,this.CurrentLogin); } #endregion #region 活动三-马上参加 /// /// 活动三-马上参加 /// [HttpPost] public void SetOnlyShopJoin(ShopJoinReq request) { request.ShopID = request.ShopID.HasValue ? request.ShopID : this.CurrentLogin.ShopId; _activityService.SetOnlyShopJoin(request,this.CurrentLogin); } #endregion #region 通用活动/报名活动-马上参加 /// /// 通用活动/报名活动-马上参加 /// [HttpPost] public void SetAllShopJoin(AllShopJoinReq request) { _activityService.SetAllShopJoin(request, this.CurrentLogin); } #endregion #region 分销活动-马上参加 /// /// 分销活动-马上参加 /// [HttpPost] public void SetIsAllShopJoin(IsAllShopJoinReq request) { _activityService.SetIsAllShopJoin(request, this.CurrentLogin); } #endregion #region 活动数据统计 /// /// 活动数据统计 /// [HttpPost] public DataCenterResp GetDataStatistics(DataCenterReq request) { request.ShopID = request.ShopID.HasValue ? request.ShopID : this.CurrentLogin.ShopId; return _activityService.GetDataStatistics(request, this.CurrentLogin); } #endregion //#region GetShopShareCode(加盟商/店员分享活动小程序海报) ///// ///// 加盟商/店员分享活动小程序海报,返回完整的图片URL ///// ///// ///// //[HttpGet] //public string GetCustomerShareCode(Guid shopActivityId) //{ // return _activityService.GetCustomerShareCode(shopActivityId,CurrentLogin); //} //#endregion #region 修改代金券 /// /// 修改代金券 /// /// 店铺参与活动记录ID /// 代金券ID [HttpGet] public void SetShopVoucher(Guid logId, Guid voucherId) { _activityService.SetShopVoucher(logId, voucherId, this.CurrentLogin); } #endregion #region 修改兑换方案 /// /// 修改兑换方案 /// /// 店铺参与活动记录ID /// 兑换方案主键ID [HttpGet] public void SetShopCase(Guid logId, Guid caseId) { _activityService.SetShopCase(logId, caseId, this.CurrentLogin); } #endregion #region 溯源数据 /// /// 溯源数据 /// /// /// [HttpPost] public PageResult GetOriginPageList(PagedSearch search) { return _activityService.GetOriginPageList(search,this.CurrentLogin); } #endregion #region 报名活动-溯源数据查看报名信息 /// /// 报名活动-溯源数据查看报名信息 /// /// 溯源信息主键Id /// [HttpGet] public ApplyInfo GetApplyInfo(Guid Id) { return _activityService.GetApplyInfo(Id); } #endregion #region 加盟商取消参与活动 /// /// 加盟商取消参与活动 /// /// 活动主键ID /// 店铺主键ID [HttpGet] public void CancelJoinActivity(Guid id,Guid shopId) { _activityService.CancelJoinActivity(id,shopId,this.CurrentLogin); } #endregion #region 调度开启活动 /// /// 调度开启活动 /// [HttpGet] [AllowAnonymous] public void ActivityBegin() { _activityService.JoinProcessToActivity(); } #endregion #region 管理层-进行中活动列表 /// /// 管理层-进行中活动列表 /// /// [HttpGet] public List GetInActivityList() { return _activityService.GetActivityList(); } #endregion #region 管理层-所有非禁用与非进行中的活动列表 /// /// 管理层-所有非禁用与非进行中的活动列表 /// /// [HttpGet] public List GetAllActivityList() { return _activityService.GetAllActivityList(); } #endregion #region 强提醒-每天未核销人数 /// /// 强提醒-每天未核销人数 /// /// 加盟商角色必传 /// public List GetUnusedList(Guid? shopId) { shopId = shopId.HasValue ? shopId : this.CurrentLogin.ShopId; return _activityService.GetUnusedList(shopId,this.CurrentLogin); } #endregion #region 首页轮播图 /// /// 首页轮播图 /// /// 店铺ID /// [HttpGet] public List GetHomePageList(Guid? shopID) { return _activityService.GetHomePageList(shopID, 1); } #endregion #region GetCustomPage 获取自定义页面信息 /// /// 获取自定义页面信息 /// /// [HttpGet] [AllowAnonymous] public CustomPage GetCustomPage(Guid id) { return _memberInfoService.GetCustomPage(id); } #endregion #region GetCustomerSharePic(门店端获取拼接海报的多个图片) /// /// 门店端获取拼接海报的多个图片 /// /// /// [HttpGet] public CustomerSharePicResp GetCustomerSharePic(Guid shopActivityId) { return _activityService.GetCustomerSharePicNew(shopActivityId, CurrentLogin,true); } #endregion #region GetMiniCodeUrl(获取1280小程序码) /// /// 获取1280小程序码 /// /// /// [HttpGet] public string Get1280MiniCodeUrl(Guid shopActivityId) { return _activityService.Get1280MiniCodeUrl(shopActivityId, CurrentLogin, true); } #endregion #region ClearActivityCache(清除已经结束的活动的缓存内容) /// /// 清除已经结束的活动的缓存内容 /// [HttpGet] [AllowAnonymous] public void ClearActivityCache() { _activityService.ClearActivityCache(); } #endregion #region ResetKeyExpire(刷新店员添加客户的小程序码的redis有效期) /// /// 刷新店员添加客户的小程序码的redis有效期 /// [HttpGet] [AllowAnonymous] public void ResetKeyExpire() { _activityService.ResetKeyExpire(); } #endregion } }