//一对N验证 public string CheckFacesMore(byte[] bytes, string keyCode) { try { Stream jpgStream = BytesToStream(bytes); string result = BaiDuAuthent.search(jpgStream, "usergroup"); return(result); } catch (Exception ex) { return("error"); } }
public string AuthenPliceFace(string IdCard, string RealName, string Phone, string Nation, string Address, byte[] bytes) { string result = ""; try { Stream jpgStream = BytesToStream(bytes); result = BaiDuAuthent.AuthenPliceFaceTwo(IdCard, RealName, Phone, Nation, Address, jpgStream); } catch { return("0"); } return(result); }
public int UserRegister(byte[] bytes, string Phone, string IDno, string RealName, string LoginPass, int VerifyFlag, int CardType, string MedicareNo, string Address, string Healthcard) { UserInfoBLL usbll = new UserInfoBLL(); Models.UserInfoModel.UserInfo user = new Models.UserInfoModel.UserInfo(); user.Phone = Phone; user.IDno = IDno; user.RealName = RealName; user.CardType = CardType; user.MedicareNo = MedicareNo; user.LoginPass = LoginPass; user.VerifyFlag = VerifyFlag; user.Address = Address; user.Healthcard = Healthcard; int Number = 0; try { //密码加密 Random random = new Random(); int random_value = random.Next(10000000, 99999999); //随机一个数字 string SecretKey = PASSWORD_MODIFY.APP_Encode(random_value.ToString()); //生成秘钥 string Pass = PASSWORD_MODIFY.DES_Encode(LoginPass, random_value.ToString()); //根据秘钥生成密码 //说明符合注册条件(验证码和电话号码存在) user.SecretKey = SecretKey; user.LoginPass = Pass; //string birthNumber = user.IDno.Substring(6, 8); //获取出生日期 string birthDate = ""; string strSex = ""; if (user.IDno.Length == 18)//处理18位的身份证号码从号码中得到生日和性别代码 { birthDate = user.IDno.Substring(6, 4) + "-" + user.IDno.Substring(10, 2) + "-" + user.IDno.Substring(12, 2); strSex = user.IDno.Substring(14, 3); } if (user.IDno.Length == 15) { birthDate = "19" + user.IDno.Substring(6, 2) + "-" + user.IDno.Substring(8, 2) + "-" + user.IDno.Substring(10, 2); strSex = user.IDno.Substring(12, 3); } if (int.Parse(strSex) % 2 == 0) //性别代码为偶数是女性奇数为男性 { user.Sex = "F"; //"女"; } else { user.Sex = "M"; //"男"; } user.BirthDate = birthDate; DataTable dt = usbll.GetUserInfo(user.Phone, user.IDno);//检查数据库是否已经存在 电话号码和身份证 if (dt.Rows.Count == 0) { Number = usbll.AddUser(user); } //byte[] bmpData = System.IO.File.ReadAllBytes(System.IO.Path.GetFullPath(".\\") + "temp.jpg"); string group = "usergroup"; //湘潭中心医院 //string group = "xtdygroup"; //湘潭第一医院 string userInfoStr = "{\"UserId\":\"" + user.IDno + "\",\"RealName\":\"" + user.RealName + "\",\"Img\":\"" + user.Img + "\",\"MedicareNo\":\"" + user.MedicareNo + "\",\"BirthDate\":\"" + user.BirthDate + "\",\"Phone\":\"" + user.Phone + "\",\"VerifyFlag\":\"" + user.VerifyFlag + "\",\"FaceImg\":\"" + user.FaceImg + "\",\"Sex\":\"" + user.Sex + "\"}"; string faceReg = BaiDuAuthent.RegUserFace(user.IDno, userInfoStr, group, bytes); } catch (Exception ex) { //PUBLIC_FUNCTION.LogFile("用户注册出现异常[UserRegister],原因:" + ex.Message); } return(Number); }