using Nirvana.Common;
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 AccountExtend : YB_Account
{
///
/// 客户名称
///
public string BusinessName { get; set; }
///
/// 角色名称
///
public string RoleName { get; set; }
}
///
/// 用户登录
///
public class LoginModel
{
///
/// 用户名
///
public string username { get; set; }
///
/// 密码
///
public string pwd { get; set; }
///
/// 验证码
///
public string code { get; set; } = "";
///
/// 用户openid
///
public string openid { get; set; }
}
///
/// 角色信息提交
///
public class RoleSubmitModel : YB_nRole
{
///
/// 菜单列表
///
public List menuids { get; set; }
///
/// 按钮列表
///
public List actionids { get; set; }
}
///
/// 修改密码
///
public class BusienssPwd : IValidatableObject
{
///
/// 旧密码
///
[Required(ErrorMessage ="请输入旧密码")]
[MinLength(6,ErrorMessage ="密码长度最少为6位")]
public string OldPwd { get; set; }
///
/// 新密码
///
[Required(ErrorMessage = "请输入新密码")]
[MinLength(6, ErrorMessage = "密码长度最少为6位")]
public string NewPwd { get; set; }
///
/// 确认新密码
///
[Required(ErrorMessage = "请再次输入新密码")]
[MinLength(6, ErrorMessage = "密码长度最少为6位")]
public string ReNewPwd { get; set; }
///
/// 验证
///
///
///
public IEnumerable Validate(ValidationContext validationContext)
{
if (NewPwd != ReNewPwd)
{
yield return new ValidationResult(
"两次密码不一致"
, new[] { nameof(NewPwd) }
);
}
}
}
///
/// 客户信息提交
///
public class BusinessSubmitModel : YB_Business
{
///
/// 账户类型
///
public AccountType AccountType { get; set; }
///
/// 密码
///
public string password { get; set; }
///
/// 重复输入密码
///
public string repassword { get; set; }
///
/// 角色ID
///
public Guid RoleId { get; set; }
}
///
/// 用户资料
///
public class UserInfoModel
{
///
/// 头像
///
public string headimg { get; set; }
///
/// 性别,0-未知,1-男,2-女
///
public GenderType sex { get; set; }
///
/// 昵称
///
public string nickname { get; set; }
///
/// 手机号是否已绑定,true-是,false-否
///
public bool isbindphone { get; set; }
///
/// 家庭成员ID
///
public int familyid { get; set; }
///
/// 身高
///
public decimal height { get; set; }
///
/// 目标体重
///
public decimal targetweight { get; set; }
///
/// 目标体重日期
///
public string targettime { get; set; }
///
/// 年龄
///
public int age { get; set; }
///
/// 带几岁几个月的
///
public string MAge { get; set; }
///
/// 最新的体重
///
public decimal weight { get; set; }
///
/// 最新的测量时间
///
public string lasthearttime { get; set; }
///
/// 生日
///
public string Birthday { get; set; }
///
/// 第一次测量体重
///
public decimal FirstWeight { get; set; } = 0;
///
/// 重量变化
///
public decimal TotalWeight { get; set; } = 0;
///
/// 测量次数
///
public int Cnt { get; set; } = 0;
///
/// 较上次的体重变化
///
public decimal LastWeight { get; set; } = 0;
///
/// 标准体重
///
public decimal StandWeight { get; set; } = 0;
///
/// 测量天数
///
public int Day { get; set; } = 0;
///
/// 初始测量时间
///
public DateTime? FirstResultTime { get; set; }
///
/// 成员类型
///
public FamilyType Type { get; set; }
///
/// BMI值
///
public decimal BMI { get; set; }
}
///
/// 家庭成员提交信息
///
public class FamilySubmitModel:IValidatableObject
{
///
/// 如果是修改,则传入此值
///
public int id { get; set; } = 0;
///
/// 家庭成员名称
///
[Required(ErrorMessage ="家庭成员名称不可为空")]
public string name { get; set; }
///
/// 身高,单位为CM
///
[Range(30, 300, ErrorMessage = "身高值只能在30-300厘米之间")]
public decimal height { get; set; }
///
/// 性别,0-未知,1-男,2-女
///
public GenderType sex { get; set; }
///
/// 出生年月
///
public DateTime birthday { get; set; }
///
/// 类型,1-成人,2-儿童,3-婴儿
///
public FamilyType type { get; set; }
///
/// 头像地址
///
public string headimg { get; set; }
///
/// 验证
///
///
///
public IEnumerable Validate(ValidationContext validationContext)
{
if (birthday >= DateTime.Now.Date)
{
yield return new ValidationResult("出生年月不可大于当前日期", new[] { nameof(birthday)});
}
if (birthday.ToAge() >= 100)
{
yield return new ValidationResult("年龄范围需在0-100之间", new[] { nameof(birthday) });
}
}
}
///
/// 家庭成员列表
///
public class FamilyListModel
{
///
/// 成员ID
///
public int Id { get; set; }
///
/// 头像
///
public string HeadImg { get; set; }
///
/// 类型,1-成人,2-儿童
///
public FamilyType Type { get; set; }
///
/// 名字
///
public string Name { get; set; }
///
/// 身高,单位为厘米
///
public decimal Height { get; set; }
///
/// 性别,0-未知,1-男,2-女
///
public GenderType Sex { get; set; }
///
/// 最新的体重
///
public decimal Weight { get; set; }
///
/// 最近的测量时间
///
public string LastHeartTime { get; set; }
///
/// 生日,出生年月日
///
public DateTime Birthday { get; set; }
///
/// 年龄,整数岁,主要用于结果计算
///
public int Age { get; set; }
///
/// 年龄,精确到月份
///
public string mAge { get; set; } = "";
///
/// 是否为自己,0-否,1-是,不能够删除
///
public int IsSelf { get; set; }
}
///
/// 八电极用户测量信息查询
///
public class UserBodyMeasureInfoModel: UserMeasureInfoModel
{
///
/// 用户id
///
public string fansid { get; set; } = "";
}
///
/// 用户测量信息查询
///
public class UserMeasureInfoModel : IValidatableObject
{
///
/// 是否重新计算,0-否,1-是
///
public int IsCalc { get; set; } = 0;
///
/// 家庭成员ID
///
public int familyid { get; set; }
///
/// 性别,1-男,2-女,0-未知
///
public GenderType sex { get; set; }
///
/// 身高,单位为CM
///
[Range(50, 250, ErrorMessage = "身高值只能在50-250厘米之间")]
public decimal height { get; set; }
///
/// 出生年月
///
public DateTime birthday { get; set; }
///
/// 页码,历史记录使用
///
public int pagesize { get; set; } = 1;
///
/// 每页显示的数量,历史记录使用
///
public int pagenum { get; set; } = 10;
///
/// 设备类型,参考类型表
///
public int devtype { get; set; } = 0;
///
/// 验证
///
///
///
public IEnumerable Validate(ValidationContext validationContext)
{
if (familyid <= 0)
{
yield return new ValidationResult("请先选择家庭成员", new[] { nameof(familyid) });
}
}
}
///
/// 短信接口
///
public class SMSMODEL
{
///
/// code=0成功
///
public int code { get; set; }
///
/// 信息描述
///
public string message { get; set; }
///
/// 数据
///
public object data { get; set; }
}
///
/// 注册成功返回的数据
///
public class RegSuccessS2CDto
{
///
/// 用户token
///
public string token { get; set; }
///
/// 用户sessionid
///
public string sessionid { get; set; }
///
/// 注册用户资料
///
public RegUserInfoS2CDto info { get; set; }
}
///
/// 注册用户信息
///
public class RegUserInfoS2CDto
{
///
/// 头像
///
public string headimg { get; set; }
///
/// 昵称
///
public string nickname { get; set; }
}
///
/// 用户注册
///
public class RegModel
{
///
/// 唯一id,作为换取登录信息的凭据
///
public string sessionId { get; set; } = "";
///
/// 手机号
///
public string phone { get; set; }
///
/// 验证码
///
public string code { get; set; } = "";
///
/// 是否校检验证码
///
public bool isvrcode { get; set; } = true;
///
/// 用户wxfansid
///
public Guid? fansid { get; set; } = null;
}
///
/// 小程序升级信息
///
public class WxOpenUpgradeC2SDto
{
///
/// 小程序appid
///
public string AppId { get; set; }
///
/// 线上小程序版本号
///
public string Version { get; set; }
///
/// 小程序版本,develop-开发版,trial-体验版,release-正式版
///
public string EnvVersion { get; set; }
}
///
/// 小程序升级信息
///
public class WxOpenUpgradeS2CDto
{
///
/// 升级版本号
///
public string Version { get; set; }
///
/// 版本描述
///
public string Desc { get; set; }
}
///
/// 用户基础信息
///
public class UserBaseInfoS2SDto
{
///
/// 用户openid
///
public string openid { get; set; }
///
/// 昵称
///
public string nickname { get; set; }
///
/// 头像
///
public string headimgurl { get; set; }
///
/// 用户unionid
///
public string unionid { get; set; }
}
}