/// <summary> /// 删除用户 /// </summary> /// <param name="id"></param> public bool DeleteSubject(int id) { var url = subjectdelete_url + id; var request = new HttpMethod(); request.Delete(url, session); return true; }
public static FaceCompare Compare(string photo) { Dictionary<string, string> param = new Dictionary<string, string>(); param.Add("name", ConfigProfile.Current.Name); param.Add("timeout", ConfigProfile.Current.Timeout.ToString()); var url = string.Concat("http://" + ConfigProfile.Current.NucIp + ":8080", "/video_verify"); var data = photo.FileToByte(); Stopwatch sw = Stopwatch.StartNew(); var responsestr = new HttpMethod().Post(url, data, param); sw.Stop(); LogHelper.Info("比对->" + sw.ElapsedMilliseconds); FaceCompare face = responsestr.Deserialize<FaceCompare>(); return face; }
/// <summary> /// 创建用户 /// </summary> /// <param name="emp"></param> public bool CreateSubject(Employee emp) { var dict = new Dictionary<string, string>(); //0:员工 1:访客 2:VIP dict.Add("subject_type", "0"); dict.Add("name", emp.Name); dict.Add("job_number", emp.CardNo); var request = new HttpMethod(); var responseStr = request.Post(subject_url, session, dict); if (responseStr.IsEmpty()) { return false; } var json = responseStr.Deserialize<Subject>(); emp.ID = json.data.id; UpdatePhoto(emp); return true; }
/// <summary> /// 获取底裤列表 /// </summary> /// <returns></returns> public SubjectList GetSubjectList() { var request = new HttpMethod(); var list = request.Get<SubjectList>(subjectlist_url, session); return list; }
/// <summary> /// 上传识别用户图像 /// </summary> /// <param name="emp"></param> private void UpdatePhoto(Employee emp) { var dict = new Dictionary<string, string>(); dict.Add("subject_id", emp.ID.ToString()); var image = emp.Photo.FileToByte(); var request = new HttpMethod(); var responseStr = request.PostPhoto(subjectphoto_url, image, session, dict); var json = responseStr.Deserialize<UploadPhoto>(); if (json.code == 0) { } }