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

347 lines
12 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using MyCode.Project.Domain.Message.Response.User;
using MyCode.Project.Infrastructure.Constant;
using MyCode.Project.WebApi.Controllers;
using MyCode.Project.Domain.Config;
using MyCode.Project.Services;
using MyCode.Project.Infrastructure.Common;
using MyCode.Project.Domain.Message.Request.User;
using MyCode.Project.Infrastructure.Enumeration;
using MyCode.Project.Domain.Message.Act.User;
using MyCode.Project.Domain.Message.Response.Goods;
using MyCode.Project.Domain.Model;
using MyCode.Project.Domain.Message.Response.Common;
using MyCode.Project.Domain.Businesses.BillKeeping;
using MyCode.Project.Domain.Message.Response.Member;
using MyCode.Project.Domain.Message.Response.WebSocket;
using MyCode.Project.Domain.Message.Response.Chat;
using MyCode.Project.Domain.Message.Request.WebSocket;
namespace MyCode.Project.WebApi.Areas.Wechat.Controllers
{
/// <summary>
/// WebSocket消息相关,仅供对接返回参数,接口都是无效的
/// </summary>
public class WebSocketController : BaseWechatController
{
private IWebSocketService _webSocketService;
private IChatService _chatService;
/// <summary>
///
/// </summary>
/// <param name=""></param>
public WebSocketController(IWebSocketService webSocketService
, IChatService chatService)
{
_webSocketService = webSocketService;
_chatService = chatService;
}
#region GetHomeMessgeList
/// <summary>
/// 获取首页的消息(不要对接)
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public WebSocketMessgeResp<List<HomeMessgeResp>> GetHomeMessgeList(MessgeRequst requst)
{
WebSocketMessgeResp<List<HomeMessgeResp>> result = new WebSocketMessgeResp<List<HomeMessgeResp>>();
result.ContentTxt = new List<HomeMessgeResp>();
HomeMessgeResp homeMessgeResp = new HomeMessgeResp();
result.ContentTxt.Add(homeMessgeResp);
return result;
}
#endregion
#region GetChatMemberJoin--
/// <summary>
/// 会话页面--会员进店(不要对接)
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public ChatMemberJoin GetChatMemberJoin()
{
ChatMemberJoin result = new ChatMemberJoin();
return result;
}
#endregion
#region GetSampleRemind--//
/// <summary>
/// 会话页面--灰色提醒/邀约/生日提醒(不要对接)
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public ChatSampleRemind GetSampleRemind()
{
ChatSampleRemind result = new ChatSampleRemind();
return result;
}
#endregion
#region ChatSheetRemind--
/// <summary>
/// 会话页面--消费单(不要对接)
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public ChatSheetRemind GetSheetRemind()
{
ChatSheetRemind result = new ChatSheetRemind();
return result;
}
#endregion
#region ChatServiceRemind--
/// <summary>
/// 会话页面--服务单(不要对接)
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public ChatServiceRemind ChatServiceRemind()
{
ChatServiceRemind result = new ChatServiceRemind();
return result;
}
#endregion
#region ChatRechargeRemind--
/// <summary>
/// 会话页面--充值单(不要对接)
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public ChatRechargeRemind ChatRechargeRemind()
{
ChatRechargeRemind result = new ChatRechargeRemind();
return result;
}
#endregion
#region ChatServiceRemind
/// <summary>
/// 素材库(不要对接)
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public MaterialsStore MaterialsStore()
{
MaterialsStore result = new MaterialsStore();
return result;
}
#endregion
#region ConsumptionReminder()
/// <summary>
/// 消费提醒消息(不要对接)
/// </summary>
/// <param name="id"></param>
[HttpGet]
[AllowAnonymous]
public void ConsumptionReminder(string id)
{
_webSocketService.ConsumptionReminder(id);
}
#endregion
#region GetHomeMessgeAmountList()
/// <summary>
/// 获取首页会员与统计列表
/// </summary>
/// <param name="shopId">店铺主键</param>
[HttpGet]
public List<HomeMessgeResp> GetHomeMessgeAmountList(Guid shopId)
{
return _webSocketService.GetHomeMessgeList(shopId,this.CurrentLogin);
}
#endregion
#region GetChatMessagePageList()
/// <summary>
/// 获取历史消息分页列表
/// </summary>
/// <param name="search">分页参数</param>
[HttpPost]
public PageResult<WebSocketMessgeResp<string>> GetMessagePageList(PagedSearch<MessgeRequst> search)
{
return _webSocketService.GetMessagePageList(search, this.CurrentLogin);
}
#endregion
#region SendChatMemberJoin--
/// <summary>
/// 会话页面--获取会员画像
/// </summary>
/// <returns></returns>
[HttpGet]
public WebSocketMessgeResp<string> SendChatMemberJoin(Guid id,Guid shopId)
{
return _chatService.SendMemberJoinRemind(id, shopId, 0, this.CurrentLogin.UserId);//仅发送给当前操作人查看
}
#endregion
#region SendMaterialsStore
/// <summary>
/// 素材库(不要对接,一期代码所用接口)
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public void SendMaterialsStore(string id)
{
_chatService.SendMaterialsStore(id);
}
#endregion
#region WebSocketKpiMessage(--)
/// <summary>
/// 业绩通知接口--不要对接
/// </summary>
/// <param name="requst"></param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public WebSocketMessgeResp<TodayKPI> WebSocketKpiMessage(MessgeRequst requst)
{
WebSocketMessgeResp<TodayKPI> webSocketMessgeResp = new WebSocketMessgeResp<TodayKPI>();
return webSocketMessgeResp;
}
#endregion
#region SendMemberJoinStore--
/// <summary>
/// 脸部识别--会员进店
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public ChatMemberInShopMesg SendMemberJoinStore()
{
ChatMemberInShopMesg result = new ChatMemberInShopMesg();
return result;
}
#endregion
#region SendMessageByFace
/// <summary>
/// 后端测试用,请勿对接
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public void SendMessageByFace(DateTime time)
{
_webSocketService.SendMessageByFace(time);
}
#endregion
#region SendMessageByFace
///// <summary>
///// 后端测试用,请勿对接--新注册会员发送已成为会员通知
///// </summary>
//[HttpGet]
//[AllowAnonymous]
//public void SendMessageByNewRegistered()
//{
// string faceId = "f-vtn1608025655884";
// string faceImgUrl = "https://ylcloud.oss-cn-shenzhen.aliyuncs.com/upload/faceImg/2020/12/15/jfU1PXAO4H1G0000110.jpg";
// Guid memberId = Guid.Parse("43CEB536-CED3-48E8-A244-21D699E282E2");
// Guid shopId= Guid.Parse("B00922B3-A492-9C7C-E88D-39F0DA1FA384");
// _webSocketService.SendMessageByNewRegistered(shopId, memberId,faceId, faceImgUrl);
//}
#endregion
#region GetFaceInfoAmount
/// <summary>
/// 后端测试用,请勿对接
/// </summary>
/// <param name="shopId">店铺主键 加盟商需传</param>
[HttpGet]
public int GetFaceInfoAmount(Guid? shopId)
{
if (!shopId.HasValue)
shopId = this.CurrentLogin.ShopId;
return _webSocketService.GetFaceInfoAmount(shopId);
}
#endregion
#region SetWorker
/// <summary>
/// 标记为工作人员
/// </summary>
/// <param name="shopId">店铺主键</param>
/// <param name="faceId">人脸识别id</param>
[HttpGet]
public void SetWorker(Guid shopId,string faceId)
{
_webSocketService.SetWorker(shopId, faceId);
}
#endregion
#region GetFaceInfoList
/// <summary>
/// 店铺人脸识别图片集合
/// </summary>
/// <param name="shopId">店铺主键 加盟商需传</param>
[HttpGet]
public List<FaceInfoResp> GetFaceInfoList(Guid? shopId)
{
if (!shopId.HasValue)
shopId = this.CurrentLogin.ShopId;
return _webSocketService.GetFaceInfoList(shopId);
}
#endregion
#region SetMemberBindFaceId id
/// <summary>
/// 会员绑定脸部识别id
/// </summary>
/// <param name="memberId">会员主键</param>
/// <param name="faceId">人脸识别id</param>
/// <param name="faceImgUrl">人脸识别图片url</param>
[HttpGet]
public void SetMemberBindFaceId(Guid memberId, string faceId,string faceImgUrl)
{
_webSocketService.SetMemberBindFaceId(memberId, faceId,faceImgUrl);
}
#endregion
#region SetMemberUnBindFaceId id
/// <summary>
/// 会员解绑人脸识别id
/// </summary>
/// <param name="memberId">会员主键</param>
[HttpGet]
public void SetMemberUnBindFaceId(Guid memberId)
{
_webSocketService.SetMemberUnBindFaceId(memberId);
}
#endregion
#region GetMemberBindInfo
/// <summary>
/// 获取会员的人脸识别信息
/// </summary>
/// <param name="memberId">会员主键</param>
[HttpGet]
public FaceInfoResp GetMemberBindInfo(Guid memberId)
{
return _webSocketService.GetMemberBindInfo(memberId);
}
#endregion
}
}