添加项目文件。

This commit is contained in:
JianWeie
2021-12-20 21:27:32 +08:00
parent 747486f5cb
commit 82d825b7a5
3514 changed files with 887941 additions and 0 deletions

View File

@@ -0,0 +1,110 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/1/31 21:45:10
* Description: 暂无
***********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 微信小程序消息订阅接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class WeChatAppletsMessageController : ControllerBase
{
private readonly IHttpContextUser _user;
private readonly ICoreCmsUserWeChatMsgTemplateServices _userWeChatMsgTemplateServices;
private readonly ICoreCmsUserWeChatMsgSubscriptionSwitchServices _userWeChatMsgSubscriptionSwitchServices;
private readonly ICoreCmsUserWeChatMsgSubscriptionServices _userWeChatMsgSubscriptionServices;
/// <summary>
/// 构造函数
/// </summary>
public WeChatAppletsMessageController(IHttpContextUser user, ICoreCmsUserWeChatMsgTemplateServices userWeChatMsgTemplateServices, ICoreCmsUserWeChatMsgSubscriptionSwitchServices userWeChatMsgSubscriptionSwitchServices, ICoreCmsUserWeChatMsgSubscriptionServices userWeChatMsgSubscriptionServices)
{
_user = user;
_userWeChatMsgTemplateServices = userWeChatMsgTemplateServices;
_userWeChatMsgSubscriptionSwitchServices = userWeChatMsgSubscriptionSwitchServices;
_userWeChatMsgSubscriptionServices = userWeChatMsgSubscriptionServices;
}
#region
/// <summary>
/// 获取用户是否订阅
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> IsTip()
{
var jm = await _userWeChatMsgSubscriptionSwitchServices.IsTip(_user.ID);
return jm;
}
#endregion
#region
/// <summary>
/// 用户取消订阅
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> CloseTip()
{
var jm = await _userWeChatMsgSubscriptionSwitchServices.CloseTip(_user.ID);
return jm;
}
#endregion
#region
/// <summary>
/// 获取订阅模板
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> Tmpl()
{
var jm = await _userWeChatMsgSubscriptionServices.tmpl(_user.ID);
return jm;
}
#endregion
#region
/// <summary>
/// 设置订阅信息
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> SetTip([FromBody] SetWeChatAppletsMessageTip entity)
{
var jm = await _userWeChatMsgSubscriptionServices.SetTip(_user.ID, entity.templateId, entity.status);
return jm;
}
#endregion
}
}