| | |
| | | logger.Error(err) |
| | | return |
| | | } |
| | | if info.Tableid != "" { |
| | | if info.AreaId != "" { |
| | | CacheMap.Lock() |
| | | defer CacheMap.Unlock() |
| | | if _, ok := CacheMap.Area[info.Tableid]; !ok { |
| | | CacheMap.Area[info.Tableid] = shardmap.New(uint8(*threadnum)) |
| | | if _, ok := CacheMap.Area[info.AreaId]; !ok { |
| | | CacheMap.Area[info.AreaId] = shardmap.New(uint8(*threadnum)) |
| | | } |
| | | CacheMap.Area[info.Tableid].Set(info.Id, info) |
| | | CacheMap.Area[info.Tableid].Settime() |
| | | CacheMap.Area[info.AreaId].Set(info.Id, info) |
| | | CacheMap.Area[info.AreaId].Settime() |
| | | } |
| | | } |
| | | |
| | |
| | | targets := val.Walk(DoSdkCompare, args.FaceFeature, baseScore) |
| | | if len(targets) > 0 { |
| | | scResult.CompareResult = append(scResult.CompareResult, targets...) |
| | | // todo 添加小区外的关联关系, 下次优先比对 |
| | | } |
| | | } |
| | | |
| | |
| | | package db |
| | | |
| | | import ( |
| | | "basic.com/pubsub/protomsg.git" |
| | | "strconv" |
| | | ) |
| | | |
| | |
| | | return |
| | | } |
| | | |
| | | func (dbp *DbPersons) GetPersonsCompareCacheById(id string) (info *protomsg.Esinfo, err error) { |
| | | func (dbp *DbPersons) GetPersonsCompareCacheById(id string) (info *FeatureCacheBase, err error) { |
| | | sql := "select id,faceFeature,tableId,enable from dbtablepersons where id = \"" + id + "\"" |
| | | var p DbPersons |
| | | err = db.Raw(sql).First(&p).Error |
| | |
| | | return nil, err |
| | | } |
| | | if p.FaceFeature != "" { |
| | | info = &protomsg.Esinfo{ |
| | | info = &FeatureCacheBase{ |
| | | Id: p.Id, |
| | | Tableid: p.TableId, |
| | | TableId: p.TableId, |
| | | AreaId: p.AreaID, |
| | | FaceFeature: p.FaceFeature, |
| | | Enable: int32(p.Enable), |
| | | } |