/// <summary> /// 会员登录 /// </summary> /// <param name="account">账号</param> /// <param name="password">密码</param> /// <param name="deviceName">手机设备名称</param> /// <param name="deviceCode">设备编码</param> /// <returns>登录检查</returns> public object CheckUserLogin(string account, string password, string deviceName, string deviceCode) { Result result = new Result(); var syUser = SyUserBo.Instance.GetSyUser(account); if (syUser != null) { if (syUser.Status == (int)SystemStatus.系统用户状态.禁用) { result.Status = false; result.Message = "该账户已被禁用,请联系管理员!"; return(result); } if (!Hyt.Util.EncryptionUtil.VerifyCiphetrextWithMd5AndSalt(password, syUser.Password)) { result.Status = false; result.Message = "账户名或密码错误!"; return(result); } CrCustomerMobileLogin login = CrCustomerMobileLoginBo.Instance.GetModByCustomerSysNo(syUser.SysNo); if (login == null) { login = new CrCustomerMobileLogin(); login.CustomerSysNo = syUser.SysNo; login.CustomerToken = Hyt.Util.EncryptionUtil.MD5Encrypt(account); login.SysNo = CrCustomerMobileLoginBo.Instance.InsertMod(login); } login.LastLoginTime = DateTime.Now; login.CustomerLoginKey = Hyt.Util.EncryptionUtil.MD5Encrypt(account + deviceCode + login.LastLoginTime.ToString("yyyyMMddHHmmss")); login.CustomerLoginDevice = deviceName; login.CustomerLoginDeviceCode = deviceCode; CrCustomerMobileLoginBo.Instance.UpdateMod(login); ///手机登录记录 CrCustomerMobileLoginHistory historyMod = new CrCustomerMobileLoginHistory() { CustomerMobileSysNo = login.SysNo, CustomerLoginDevice = login.CustomerLoginDevice, CustomerLoginDeviceCode = login.CustomerLoginDeviceCode, CustomerLoginKey = login.CustomerLoginKey, CustomerLoginTime = login.LastLoginTime }; CrCustomerMobileLoginBo.Instance.InserHistoryMod(historyMod); return(new { Status = true, Message = "登录成功", Token = login.CustomerToken, LoginKey = login.CustomerLoginKey }); } else { result.Status = false; result.Message = "账户名或密码错误!"; return(result); } }
public override int InserHistoryMod(CrCustomerMobileLoginHistory mod) { return(Context.Insert("CrCustomerMobileLoginHistory", mod).AutoMap(p => p.SysNo).ExecuteReturnLastId <int>("SysNo")); }
public abstract int InserHistoryMod(CrCustomerMobileLoginHistory mod);