using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YBDevice.NApi.Application.MessageInfo
{
///
/// 消息订阅
///
public class SubscribeC2SDto : IValidatableObject
{
///
/// 小程序appid
///
[Required(ErrorMessage ="小程序appid不可为空")]
public string AppId { get; set; }
///
/// 订阅的消息类型,1-周提醒,2-月提醒,3-半年提醒,4-一年提醒
///
public int Type { get; set; }
///
/// 订阅的模板状态列表
///
public List List { get; set; }
public IEnumerable Validate(ValidationContext validationContext)
{
List types = new List { 1, 2, 3, 4 };
if (!types.Contains(Type))
{
yield return new ValidationResult(
"请选择正确的消息类型"
, new[] { nameof(Type) }
);
}
if (List == null || List.Count == 0)
{
yield return new ValidationResult(
"未找到可用的模板"
, new[] { nameof(List) }
);
}
}
}
///
/// 取消订阅
///
public class UnSubscribeC2SDto
{
///
/// 小程序appid
///
[Required(ErrorMessage = "小程序appid不可为空")]
public string AppId { get; set; }
///
/// 订阅的消息类型,1-周提醒,2-月提醒,3-半年提醒,4-一年提醒
///
public int Type { get; set; }
}
///
/// 订阅模板
///
public class SubscribeTplS2SDto
{
///
/// 模板ID
///
[Required(ErrorMessage = "模板ID不可为空")]
public string TplId { get; set; }
///
/// 订阅状态,accept-同意,reject-拒绝,ban-已被后台封禁,filter-被过滤
///
[Required(ErrorMessage = "订阅状态不可为空")]
public string Status { get; set; }
}
///
/// 用户可订阅的消息模板
///
public class SubscribeTplS2CDto
{
///
/// 模板ID
///
public string Id { get; set; }
}
///
/// 用户已订阅的模板
///
public class UserSubscribeS2CDto
{
///
/// 订阅的类型
///
public int Type { get; set; }
}
///
/// 微信客服信息
///
public class CustomServiceC2SDto
{
///
/// 企业微信appid
///
public string QyAppId { get; set; }
///
/// 客服链接
///
public string Url { get; set; }
}
}