204 lines
5.2 KiB
C#
204 lines
5.2 KiB
C#
|
|
using SqlSugar;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.ComponentModel.DataAnnotations;
|
|||
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Web.Security;
|
|||
|
|
|
|||
|
|
namespace Models.ModelItems
|
|||
|
|
{
|
|||
|
|
#region 用户表
|
|||
|
|
[Table("UserInfo")]
|
|||
|
|
public class UserInfo:ICloneable
|
|||
|
|
{
|
|||
|
|
//用户表 ID 密码 用户名 头像(有默认) 性别 年龄 说明 创建时间 到期时间 (默认2个月后) 所属酒店 所属酒店组
|
|||
|
|
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
|
|||
|
|
public int Id { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 用户标识(账号)
|
|||
|
|
/// </summary>
|
|||
|
|
|
|||
|
|
|
|||
|
|
[SugarColumn(ColumnDataType = "varchar(50)", IndexGroupNameList = new[] { "Uid_key" }) ]
|
|||
|
|
public string Uid { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 密码
|
|||
|
|
/// </summary>
|
|||
|
|
|
|||
|
|
|
|||
|
|
[SugarColumn(ColumnDataType = "varchar(50)")]
|
|||
|
|
public string Pwd { get; set; }
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
[SugarColumn(ColumnDataType = "varchar(255)",IsNullable =true)]
|
|||
|
|
|
|||
|
|
public string PwdSee { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 头像url
|
|||
|
|
/// </summary>
|
|||
|
|
///
|
|||
|
|
[SugarColumn(ColumnDataType = "varchar(255)", IsNullable = true, DefaultValue = "default.png")]
|
|||
|
|
|
|||
|
|
public string HeadImg { get; set; } = "defaultboy.png";
|
|||
|
|
/// <summary>
|
|||
|
|
/// 性别 0-3 0 男 1 女 2 未知 3 预留待定 默认0
|
|||
|
|
/// </summary>
|
|||
|
|
[SugarColumn(ColumnDataType = "int")]
|
|||
|
|
|
|||
|
|
public int? Sex { get; set; } = 0;
|
|||
|
|
/// <summary>
|
|||
|
|
/// 年龄 默认18
|
|||
|
|
/// </summary>
|
|||
|
|
[SugarColumn(ColumnDataType = "int", IsNullable = true, DefaultValue = "18")]
|
|||
|
|
public int? Age { get; set; } = 18;
|
|||
|
|
/// <summary>
|
|||
|
|
/// 是否可用 0 可用 1 不可 2管理
|
|||
|
|
/// </summary>
|
|||
|
|
|
|||
|
|
|
|||
|
|
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
|
|||
|
|
public int? IsValid { get; set; } = 0;
|
|||
|
|
/// <summary>
|
|||
|
|
/// 说明
|
|||
|
|
/// </summary>
|
|||
|
|
///
|
|||
|
|
|
|||
|
|
[SugarColumn(ColumnDataType = "varchar(255)", IsNullable = true)]
|
|||
|
|
|
|||
|
|
public string Desc { get; set; } = "";
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 创建时间
|
|||
|
|
/// </summary>
|
|||
|
|
///
|
|||
|
|
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
|
|||
|
|
|
|||
|
|
public DateTime CreateTime { get; set; } = DateTime.Now;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
|
|||
|
|
|
|||
|
|
public DateTime? EndTime { get; set; } = DateTime.Now.AddMonths(2);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
public object Clone()
|
|||
|
|
{
|
|||
|
|
return this.Clone();
|
|||
|
|
}
|
|||
|
|
public UserInfo Clones()
|
|||
|
|
{
|
|||
|
|
return (UserInfo)this.Clone();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 创建人
|
|||
|
|
/// </summary>
|
|||
|
|
[SugarColumn(ColumnDataType = "varchar(255)", IsNullable = true)]
|
|||
|
|
public string CreatedBy { get; set; } = "系统";
|
|||
|
|
/// <summary>
|
|||
|
|
/// 所属酒店
|
|||
|
|
/// </summary>
|
|||
|
|
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
|
|||
|
|
|
|||
|
|
public int? HotelID { get; set; } = 0;
|
|||
|
|
|
|||
|
|
|
|||
|
|
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
|
|||
|
|
|
|||
|
|
public int? HotelGroupID { get; set; } = 0;
|
|||
|
|
/// <summary>
|
|||
|
|
/// 是否导入 1 导入
|
|||
|
|
/// </summary>
|
|||
|
|
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
|
|||
|
|
public int IsImport { get; set; } = 0;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 酒店数量
|
|||
|
|
/// </summary>
|
|||
|
|
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
|
|||
|
|
public int Hotel_Count { get; set; } = 0;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 所有酒店
|
|||
|
|
/// </summary>
|
|||
|
|
[SugarColumn(ColumnDataType = "TEXT(21845)", IsNullable = true)]
|
|||
|
|
public string Hotel_Data { get; set; } = "";
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 公司 0 宝来威 1 住好 2 卓豪
|
|||
|
|
/// </summary>
|
|||
|
|
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
|
|||
|
|
|
|||
|
|
public int? Company { get; set; }
|
|||
|
|
|
|||
|
|
|
|||
|
|
[SugarColumn(ColumnDataType = "int", IsNullable = true)]
|
|||
|
|
|
|||
|
|
public int? OldId { get; set; } = 0;
|
|||
|
|
|
|||
|
|
|
|||
|
|
[SugarColumn(ColumnDataType = "int")]
|
|||
|
|
|
|||
|
|
//是否自动授权
|
|||
|
|
public int Autho { get; set; } = 0;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 创建时间
|
|||
|
|
/// </summary>
|
|||
|
|
///
|
|||
|
|
[SugarColumn(ColumnDataType = "datetime(3)", IsNullable = true)]
|
|||
|
|
|
|||
|
|
public DateTime SyncTime { get; set; } = DateTime.Now;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 计算密码 Hash值
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="password"></param>
|
|||
|
|
/// <param name="entity"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public UserInfo ComputePasswordHash()
|
|||
|
|
{
|
|||
|
|
this.Pwd = HashCode(this.Uid.ToUpper() + this.Pwd + (this.CreateTime).ToString("yyyy-MM-dd HH:mm:ss"));
|
|||
|
|
|
|||
|
|
return this;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取MD5值
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="key">加密的字符串</param>
|
|||
|
|
/// <returns>返回MD5值</returns>
|
|||
|
|
public string HashCode(string key)
|
|||
|
|
{
|
|||
|
|
return FormsAuthentication.HashPasswordForStoringInConfigFile(key, "MD5");
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|