From c06ac05c6e52dd5bf818c9add39db5eed557ccac Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期四, 07 十一月 2024 16:57:21 +0800
Subject: [PATCH] 调整实名比对

---
 db/realPersons.go |   73 ++++++++++++++----------------------
 1 files changed, 28 insertions(+), 45 deletions(-)

diff --git a/db/realPersons.go b/db/realPersons.go
index 2f5a803..8b79251 100644
--- a/db/realPersons.go
+++ b/db/realPersons.go
@@ -3,69 +3,52 @@
 import (
 	"encoding/base64"
 	"sdkCompare/util"
+	"time"
 )
 
-type Layouts struct {
-	Id         string `gorm:"column:id"`
-	TableId    string `gorm:"column:tableId"`
-	Name       string `gorm:"column:name"`
-	Phone      string `gorm:"column:phone"`
-	Address    string `gorm:"column:address"`
-	Age        string `gorm:"column:age"`
-	Gender     string `gorm:"column:gender"`
-	IdCard     string `gorm:"column:id_card"`
-	PersonType string `gorm:"column:person_type"` //'1锛氬父椹讳汉鍙o紝2锛氬墠绉戜汉鍛橈紝3锛氭秹姣掍汉鍛橈紝4锛氭秹绋充汉鍛橈紱5锛氬湪閫冧汉鍛橈紝6:娴佸姩浜哄彛锛�7:瀵勪綇浜哄彛锛�',
-	Feature    string `gorm:"column:feature"`
+type RealNamePerson struct {
+	Id                  string    `gorm:"column:id;type:varchar(191);primary_key;"`
+	PersonId            string    `gorm:"column:person_id;type:varchar(191)"`            // 绗笁鏂瑰悕鍗曞簱浜哄憳id
+	Name                string    `gorm:"column:name;type:varchar(32)"`                  // 濮撳悕
+	Gender              string    `gorm:"column:gender; type:varchar(16)"`               // 娉ㄥ唽鎬у埆锛坢ale-鐢�, female-濂�,unknown-鏈煡
+	CertType            int       `gorm:"column:cert_type;"`                             // 璇佷欢绫诲瀷 璇佷欢绫诲瀷锛�111-灞呮皯韬唤璇侊紝113-鎴峰彛绨匡紝114-涓浗浜烘皯瑙f斁鍐涘啗瀹樿瘉锛�131-宸ヤ綔璇侊紝123璀﹀畼璇侊紝133-瀛︾敓璇侊紝335-鏈哄姩杞﹂┚椹惰瘉,锛�337-鏈哄姩杞﹁椹惰瘉锛�414-鎶ょ収锛�782-甯傚悕鍗★紝990-鍏朵粬璇佷欢銆傚彇鍊煎弬鑰冩暟鎹瓧鍏�
+	CertName            string    `gorm:"column:cert_name;type:varchar(32)"`             // 璇佷欢绫诲瀷鍚嶇О
+	CertNumber          string    `gorm:"column:cert_number;type:varchar(32);index"`     // 璇佷欢鍙风爜
+	FacePicUrl          string    `gorm:"column:face_pic_url"`                           // 浜鸿劯鍥�
+	FacePicBase64       string    `gorm:"column:face_pic_base64"`                        // 浜鸿劯鍥�
+	FaceFeature         string    `gorm:"column:face_feature"`                           // 浜鸿劯鐗瑰緛鍊�
+	BornTime            string    `gorm:"column:born_time;type:varchar(32)"`             // 鍑虹敓骞存湀鏃�
+	NativeCountyCode    string    `gorm:"column:native_county_code;type:varchar(32)"`    // 绫嶈疮鍖哄幙缂栧彿
+	ResidenceCountyCode string    `gorm:"column:residence_county_code;type:varchar(32)"` // 灞呬綇鍦板尯鍘跨紪鍙�
+	Vendor              string    `gorm:"column:vendor;type:varchar(32)"`                // 鏁版嵁鏉ユ簮
+	PersonLibId         string    `gorm:"column:person_lib_id;type:varchar(191)"`        // 鍚嶅崟搴搃d
+	PersonLibName       string    `gorm:"column:person_lib_name;type:varchar(191)"`      // 鍚嶅崟搴撳悕绉�
+	CreatedAt           time.Time `gorm:"column:created_at;autoCreateTime"`
+	UpdatedAt           time.Time `gorm:"column:updated_at;autoUpdateTime"`
 }
 
-func (l *Layouts) TableName() string {
-	return "layouts"
+func (l *RealNamePerson) TableName() string {
+	return "real_name_persons"
 }
 
-func (l *Layouts) GetRealNamePersonList() (arr []*FeatureCacheBase, err error) {
-	var persons []Layouts
-	sql := "select id, tableId, person_type, feature from layouts"
+func (l *RealNamePerson) GetRealNamePersonList() (arr []*FeatureCacheBase, err error) {
+	var persons []RealNamePerson
+	sql := "select id, cert_number, face_feature from real_name_persons where face_feature != ''"
 	err = db.Raw(sql).Find(&persons).Error
 	if err != nil {
 		return nil, nil
 	}
 
 	for _, p := range persons {
-		if p.Feature != "" {
-			byteFeat, err := base64.StdEncoding.DecodeString(p.Feature)
+		if p.FaceFeature != "" {
+			byteFeat, err := base64.StdEncoding.DecodeString(p.FaceFeature)
 			if err != nil {
 				continue
 			}
 
 			arr = append(arr, &FeatureCacheBase{
 				Id:          p.Id,
-				TableId:     p.TableId,
-				FaceFeature: util.ByteSlice2float32Slice(byteFeat),
-			})
-		}
-	}
-
-	return
-}
-
-func (l *Layouts) GetKeyPersonList() (arr []*FeatureCacheBase, err error) {
-	var persons []Layouts
-	sql := "select id, id_card, person_type, feature from layouts where person_type != '1'"
-	err = db.Raw(sql).Find(&persons).Error
-	if err != nil {
-		return nil, nil
-	}
-
-	for _, p := range persons {
-		if p.Feature != "" {
-			byteFeat, err := base64.StdEncoding.DecodeString(p.Feature)
-			if err != nil {
-				continue
-			}
-
-			arr = append(arr, &FeatureCacheBase{
-				Id:          p.Id,
-				TableId:     p.IdCard,
+				TableId:     p.CertNumber,
 				FaceFeature: util.ByteSlice2float32Slice(byteFeat),
 			})
 		}

--
Gitblit v1.8.0