fix bug confidence

This commit is contained in:
dongpd 2021-06-17 17:43:44 +07:00
parent 5598e1f3ad
commit 7057e5b35c

View File

@ -97,7 +97,7 @@ class CaptureLogsGrid {
public static function rows() { public static function rows() {
return function($model, $index, $widget, $grid) { return function($model, $index, $widget, $grid) {
$confidence = json_decode($model->confidence, true); $confidence = json_decode($model->confidence, true);
$person = \app\models\ListManagement::findOne($confidence['id1']); $person = isset($confidence['id1']) ? \app\models\ListManagement::findOne($confidence['id1']) : false;
$images = false; $images = false;
if ($person) { if ($person) {
$images = json_decode($person->image, true); $images = json_decode($person->image, true);
@ -110,7 +110,7 @@ class CaptureLogsGrid {
"img" => "/data/uploads/face/" . $model->image, "img" => "/data/uploads/face/" . $model->image,
"confidence" => json_encode([ "confidence" => json_encode([
"name" => $person ? $person->name : "", "name" => $person ? $person->name : "",
"score" => $confidence['percent1'], "score" => isset($confidence['percent1']) ? $confidence['percent1'] : "",
"img" => isset($images[0]) ? "/data/uploads/face/" . $images[0]['url'] : "" "img" => isset($images[0]) ? "/data/uploads/face/" . $images[0]['url'] : ""
]) ])
] ]