From 0e895739857973ab5ecb76504ef67965b57e8281 Mon Sep 17 00:00:00 2001
From: houxiao <houxiao@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期二, 14 三月 2017 17:36:28 +0800
Subject: [PATCH] 添加接口描述 sql

---
 VisitFace/document/erdb api接口描述.txt |   71 ++++++++++++++++++++++++++++++++---
 VisitFace/document/erdb.vpp         |    0 
 2 files changed, 65 insertions(+), 6 deletions(-)

diff --git "a/VisitFace/document/erdb api\346\216\245\345\217\243\346\217\217\350\277\260.txt" "b/VisitFace/document/erdb api\346\216\245\345\217\243\346\217\217\350\277\260.txt"
index df5a398..16edc37 100644
--- "a/VisitFace/document/erdb api\346\216\245\345\217\243\346\217\217\350\277\260.txt"
+++ "b/VisitFace/document/erdb api\346\216\245\345\217\243\346\217\217\350\277\260.txt"
@@ -83,7 +83,7 @@
 Request:
 {
 	registerCompanyID : 123, // 鑻ヤ负-1鍒欏彧鎼滅储VisitFaceDB
-	imgs : [ "image base64" ] // 瀵瑰簲澶氫釜浜虹殑浜鸿劯鍥惧儚
+	imgs : [ "image base64" ] // 瀵瑰簲澶氫釜浜虹殑浜鸿劯鍥惧儚 # 浣跨敤http form post
 }
 Response:
 [
@@ -91,16 +91,33 @@
 		registerCompanyID : 123, //鎵句笉鍒拌繑鍥濾isitDBFaceID锛屾椤逛负-1
 		faceID : 1,
 		isVisitDBFaceID : false, // <dbid=-1, faceid!=-1> : true, <dbid!=-1, faceid!=-1> : false
-		srcImgIdx : 1,
-		srcImgPosX : 123,
-		srcImgPosY : 456,
-		srcImgPosW : 123,
-		srcImgPosH : 456
+		imgUrl : "",
+		imgType : ""
 	},
 	{
 		faceID : -1, // 鎼滅储鏃犵粨鏋� <dbid=-1, faceid=-1>
 	}
 ]
+
+a)鎺ユ敹imgs浜岃繘鍒舵暟鎹�
+b)杞彂鍒颁汉鑴歌瘑鍒湇鍔�(registerCompanyID, imgs)
+c)鎺ユ敹璇嗗埆缁撴灉锛�<dbid, faceid>锛屽叾涓�<0,0>琛ㄧず鏈壘鍒扮粨鏋滐紝<0,N>琛ㄧず鍦ㄨ瀹㈡暟鎹簱涓壘鍒颁汉鑴革紝<N,M>琛ㄧず鍦∟鍏徃涓尮閰嶄汉鑴窶
+d) 瀵逛簬鍗曚釜浜鸿劯缁撴灉锛�
+  if <0,0>
+  {
+	// 鎼滅储鏃犵粨鏋�
+  }
+  else if (dbid == 0 && faceid != 0)
+  { // 璁垮
+	// select * from VisitFace where faceid="$faceid";
+	// select * from Person where 
+  }
+  else if (dbid != 0 && faceid != 0)
+  { // 鍛樺伐
+  	// select * from EmployeeFace where RegisterCompanyID="$dbid" and faceid="$faceid";
+	// select * from Person where 
+  }
+  
 
 1.4. 浜鸿劯鎬讳綋淇℃伅鏌ヨ
 閫氳繃faceID鑾峰緱Person绠�瑕佷俊鎭�
@@ -157,6 +174,48 @@
 	}
 ]
 
+
+鍙傝�僡)b)c)d)
+e) 瀵逛簬鍗曚釜浜鸿劯缁撴灉锛�
+   // "$person.id"
+   select CompanyID from Place where placeID="$placeID"
+   isChecking = select * CheckingCompany where CompanyID = "$CompanyID" and PersonID="$PersonID"
+   if (visitStatusID == 绛惧埌) // 鍏ュ彛鎽勫儚澶�
+   {
+	 if (isChecking)
+		checking(PersonID, placeID);
+		return person current status
+	 else
+	    return person status not changed;
+   }
+   else if (visitStatusID == 绛鹃��/绛剧) // 鍑哄彛鎽勫儚澶�
+   {
+	 if (isChecking)
+		unchecking(PersonID, placeID);
+		return person current status
+	 else
+	    unvisit(PersonID, placeID);
+   }
+   
+   checking:
+   noNeedInsertNewRecord = select * from Checking where StatusID = "$NewStatusID" and statusDt + 5second > now() and PersonID = "$PersonID" and PlaceID="$PlaceID"
+   if (!noNeedInsertNewRecord)
+   {
+	insert into Checking(...);
+   }
+   
+   unvisit
+   noNeedInsertNewRecord = ...
+   if (!noNeedInsertNewRecord)
+   {
+    // get last visit event
+    select * from Visit where VisitorPersonID="$PersonID" and CompanyID="$CompanyID" order by startTime desc limit 1
+	
+    insert into Visiting
+	update Visit LastStatusID, lastTime
+   }
+
+
 1.7. 鏌ヨ浜哄憳鏉ヨ/绛惧埌鐘舵��
 闇�瑕佹敮鎸佹壒閲忔煡璇�
 Request:
diff --git a/VisitFace/document/erdb.vpp b/VisitFace/document/erdb.vpp
index 3f423c9..c0adb8f 100644
--- a/VisitFace/document/erdb.vpp
+++ b/VisitFace/document/erdb.vpp
Binary files differ

--
Gitblit v1.8.0