122 lines
4.1 KiB
C#
122 lines
4.1 KiB
C#
using MyCode.Project.Domain.Businesses.Sms.Templates;
|
|
using MyCode.Project.Domain.Businesses.WorkProcess;
|
|
using MyCode.Project.Domain.Message.Request.Clerk;
|
|
using MyCode.Project.Domain.Message.Request.Message;
|
|
using MyCode.Project.Domain.Message.Response.Message;
|
|
using MyCode.Project.Domain.Message.Response.Shop;
|
|
using MyCode.Project.Domain.Message.Response.User;
|
|
using MyCode.Project.Infrastructure.Common;
|
|
using MyCode.Project.Infrastructure.Enumeration;
|
|
using MyCode.Project.Infrastructure.Extensions;
|
|
using MyCode.Project.Services;
|
|
using Senparc.CO2NET.Extensions;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web.Http;
|
|
|
|
namespace MyCode.Project.WebApi.Areas.Wechat.Controllers
|
|
{
|
|
/// <summary>
|
|
///消息中心 相关
|
|
/// </summary>
|
|
public class SysMessageController : BaseWechatController
|
|
{
|
|
private ISysMessageService _sysMessageService;
|
|
private IChatService _chatService;
|
|
private IShopActionLogService _shopActionLogService;
|
|
private INotificationTaskService _notificationTaskService;
|
|
|
|
/// <summary>
|
|
/// 初始化一个<see cref="SysMessageController"/>类型的实例
|
|
/// </summary>
|
|
public SysMessageController(ISysMessageService sysMessageService
|
|
, IChatService chatService
|
|
, IShopActionLogService shopActionLogService
|
|
, INotificationTaskService notificationTaskService
|
|
)
|
|
{
|
|
_sysMessageService = sysMessageService;
|
|
_chatService = chatService;
|
|
_shopActionLogService = shopActionLogService;
|
|
_notificationTaskService = notificationTaskService;
|
|
}
|
|
|
|
#region 消息中心分页列表
|
|
/// <summary>
|
|
/// 消息中心分页列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public PageResult<MessageResp> GetMessages(PagedSearch<ProcessMessageReq> search)
|
|
{
|
|
if (!search.Condition.ShopID.HasValue)
|
|
{
|
|
PagedSearch newSearch = new PagedSearch();
|
|
newSearch = search;
|
|
return _sysMessageService.GetMessages(this.CurrentLogin, newSearch);
|
|
}
|
|
if (search.PageSize > 1 && search.Condition.ShopID.HasValue)
|
|
{
|
|
//记录小程序操作
|
|
if (this.CurrentLogin.RoleType == LoginRoleType.CustomerID)
|
|
_shopActionLogService.SetShopActionLog(search.Condition.ShopID.SafeValue(), this.CurrentLogin.CustomerId.SafeValue(), 1, 12);
|
|
else
|
|
_shopActionLogService.SetShopActionLog(search.Condition.ShopID.SafeValue(), this.CurrentLogin.ClerkId.SafeValue(), 2, 12);
|
|
}
|
|
return _sysMessageService.GetMessages(this.CurrentLogin, search);
|
|
}
|
|
#endregion
|
|
|
|
|
|
//#region 公告栏的消息
|
|
///// <summary>
|
|
///// 公告栏的消息
|
|
///// </summary>
|
|
///// <returns></returns>
|
|
//[HttpPost]
|
|
//public PageResult<MessageResp> GetMessages(PagedSearch search)
|
|
//{
|
|
// return _sysMessageService.GetMessages(this.CurrentLogin, search);
|
|
//}
|
|
//#endregion
|
|
|
|
|
|
#region 消息详情
|
|
/// <summary>
|
|
/// 消息详情
|
|
/// </summary>
|
|
/// <param name="ID">消息主键</param>
|
|
[HttpGet]
|
|
public void ddddd(Guid memberId, Guid shopId, Guid sheetId)
|
|
{
|
|
_chatService.SendMemberChatService(memberId, shopId, sheetId);
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 发送短信
|
|
/// </summary>
|
|
/// <param name="ddd"></param>
|
|
[HttpPost]
|
|
[AllowAnonymous]
|
|
public void SendSmsMsg(SmsNotificationData<SmsServiceFinishTemplate> ddd)
|
|
{
|
|
_notificationTaskService.SendSmsMsg(ddd.ToJson());
|
|
}
|
|
|
|
|
|
#region 消息详情
|
|
/// <summary>
|
|
/// 消息详情
|
|
/// </summary>
|
|
/// <param name="ID">消息主键</param>
|
|
[HttpGet]
|
|
[AllowAnonymous]
|
|
public MessageDetailResp GetMessageDetail(Guid ID)
|
|
{
|
|
return _sysMessageService.GetMessageDetail(ID);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|