using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YBDevice.Entity
{
///
/// 科普资讯提交
///
public class SecInfoSubmitModel
{
///
/// 内容
///
[Required(ErrorMessage = "内容不可为空")]
public string content { get; set; }
///
///
///
public Guid Id { get; set; }
///
/// 类型,1-文本,2-链接,3-跳转小程序
///
public AdType Type { get; set; }
///
/// 标题
///
[MaxLength(50, ErrorMessage = "标题长度最多为50个字")]
public string Title { get; set; }
///
/// 所属分组ID
///
public int TagId { get; set; }
///
/// 封面图片地址
///
[Required(ErrorMessage = "请先上传封面图片")]
public string HeadImg { get; set; }
///
/// 点击次数
///
public int ClickCount { get; set; }
///
/// 小程序appid
///
[Required(ErrorMessage = "请先选择小程序")]
public string AppId { get; set; }
}
///
/// 分组类型
///
public class SecInfoTypeModel : YB_SecInfoType
{
///
/// 客户名称
///
public string BusinessName { get; set; }
}
///
/// 科普资讯列表
///
public class SecInfoListModel
{
///
/// 分组名
///
public string tagname { get; set; }
///
///
///
public Guid Id { get; set; }
///
/// 类型,1-文本,2-链接,3-跳转小程序
///
public int Type { get; set; }
///
/// 标题
///
public string Title { get; set; }
///
/// 所属分组ID
///
public int TagId { get; set; }
///
/// 封面图片地址
///
public string HeadImg { get; set; }
///
/// 点击次数
///
public int ClickCount { get; set; }
///
/// 状态,0-未开启,1-正常运行,2-已关闭
///
public AdStatus Status { get; set; }
///
/// 商户ID
///
public int BusienssId { get; set; }
///
/// 创建时间
///
public DateTime CreateTime { get; set; }
}
///
/// 科普资讯列表
///
public class SecInfoApiListModel
{
///
/// 记录ID
///
public Guid Id { get; set; }
///
/// 标题
///
public string Title { get; set; }
///
/// 封面图
///
public string HeadImg { get; set; }
///
/// 发布时间
///
public DateTime time { get; set; }
///
/// 发布时间
///
public string CreateTime { get; set; }
///
/// 点击数
///
public int ClickCount { get; set; }
///
/// 内容,只有为链接、小程序时有效
///
public string Content { get; set; } = "";
///
/// 类型,1-文本,2-链接,3-小程序
///
public AdType Type { get; set; }
}
///
/// 轮播图、开屏广告列表
///
public class BannerListModel : YB_Banner
{
///
/// 客户名称
///
public string BusinessName { get; set; }
}
///
/// 轮播图列表
///
public class BannerApiListModel
{
///
/// 记录ID
///
public int Id { get; set; }
///
/// 封面图
///
public string HeadImg { get; set; }
///
/// 类型,1-文本,2-链接,3-跳转小程序
///
public AdType Type { get; set; }
///
/// 内容,只有小程序,链接有效
///
public string content { get; set; }
}
///
/// 获取用户的轮播图列表
///
public class BannerListC2SDto
{
///
/// 家庭成员ID
///
public int FamilyId { get; set; }
///
/// 小程序appid
///
public string AppId { get; set; }
}
///
/// 轮播图、开屏广告信息提交
///
public class BannerSubmitModel : IValidatableObject
{
///
///
///
public System.Int32 Id { get; set; }
///
/// 封面图
///
[Required(ErrorMessage = "封面图不可为空")]
public System.String HeadImg { get; set; }
///
/// 轮播图名称
///
[Required(ErrorMessage = "名称不可为空"), MaxLength(100, ErrorMessage = "名称最多100个字")]
public System.String Name { get; set; }
///
/// 类型,1-文本,2-链接,3-跳转小程序
///
public AdType Type { get; set; }
///
/// 小程序appid
///
public string AppId { get; set; }
///
/// 内容
///
public string content { get; set; }
///
/// 绑定的设备ID列表
///
public List equids { get; set; }
///
/// 验证
///
///
///
public IEnumerable Validate(ValidationContext validationContext)
{
if (Type == AdType.URL && !content.ToLower().StartsWith("http"))
{
yield return new ValidationResult("链接格式不正确", new[] { nameof(content) });
}
if (Type == AdType.Text && string.IsNullOrEmpty(content))
{
yield return new ValidationResult("文本内容不可为空", new[] { nameof(content) });
}
if (Type == AdType.MINIAPP && string.IsNullOrEmpty(content))
{
yield return new ValidationResult("小程序appid不可为空", new[] { nameof(content) });
}
if (Type == AdType.MINIAPP && !content.ToLower().StartsWith("wx"))
{
yield return new ValidationResult("小程序appid格式不正确", new[] { nameof(content) });
}
}
}
///
/// 轮播图详情
///
public class BannerDetaimS2CDto
{
///
/// 内容
///
public string Content { get; set; }
///
/// 发布时间
///
public string CreateTime { get; set; }
}
///
/// 广告内容详情
///
public class AdDetailModel
{
///
/// 内容
///
public string Content { get; set; }
///
/// 标题
///
public string Title { get; set; }
///
/// 发布时间
///
public string CreateTime { get; set; }
}
}