diff --git a/controllers/ApiController.php b/controllers/ApiController.php index 585d7fdd..52597a97 100644 --- a/controllers/ApiController.php +++ b/controllers/ApiController.php @@ -70,7 +70,8 @@ class ApiController extends Controller { $model->create([ "Staff" => $post["id"], "Time" => $time, - "Image" => $fileName + "Image" => $fileName, + "Confidence" => $post["confidence"] ]); Yii::$app->response->format = "json"; return ["status" => "success"]; diff --git a/db/app.db b/db/app.db index 9e8b11d2..5292374b 100644 Binary files a/db/app.db and b/db/app.db differ diff --git a/models/CaptureLogs.php b/models/CaptureLogs.php index 49ab8842..1c6ab98f 100644 --- a/models/CaptureLogs.php +++ b/models/CaptureLogs.php @@ -13,6 +13,7 @@ use Yii; * @property string $image * @property int $status * @property string $remark + * @property string $confidence */ class CaptureLogs extends \yii\db\ActiveRecord { @@ -29,7 +30,7 @@ class CaptureLogs extends \yii\db\ActiveRecord { public function rules() { return [ [['staff_id', 'time', 'status'], 'integer'], - [['image', 'remark'], 'string'], + [['image', 'remark', 'confidence'], 'string'], ]; } @@ -44,7 +45,8 @@ class CaptureLogs extends \yii\db\ActiveRecord { 'status' => 'Status', 'remark' => 'Remark', 'staff_name' => "Name", - 'staff_image' => "Registration Image" + 'staff_image' => "Registration Image", + 'confidence' => 'Confidence' ]; } @@ -54,7 +56,8 @@ class CaptureLogs extends \yii\db\ActiveRecord { 'time' => $data['Time'], 'image' => $data["Image"], 'status' => 0, - 'remark' => '' + 'remark' => '', + 'confidence' => $data["Confidence"] ], ''); if ($r) { try { diff --git a/models/ListManagement.php b/models/ListManagement.php index 2d1df56c..77b2f7cd 100644 --- a/models/ListManagement.php +++ b/models/ListManagement.php @@ -8,6 +8,7 @@ use Yii; * This is the model class for table "list_management". * * @property int $id + * @property int $code * @property string $type * @property string $name * @property string $image @@ -16,6 +17,7 @@ use Yii; * @property string $telephone * @property string $address * @property int $time + * @property int $last_modified */ class ListManagement extends \yii\db\ActiveRecord { @@ -32,7 +34,7 @@ class ListManagement extends \yii\db\ActiveRecord { public function rules() { return [ [['type', 'name', 'gender', 'telephone', 'address', 'image'], 'string'], - [['birthday', 'time'], 'integer'], + [['birthday', 'time', 'code', 'last_modified'], 'integer'], ]; } @@ -42,6 +44,7 @@ class ListManagement extends \yii\db\ActiveRecord { public function attributeLabels() { return [ 'id' => 'ID', + 'code' => 'Code', 'type' => 'Type', 'name' => 'Name', 'image' => 'Registration Image', @@ -49,12 +52,14 @@ class ListManagement extends \yii\db\ActiveRecord { 'birthday' => 'Birthday', 'telephone' => 'Telephone', 'address' => 'Address', - 'time' => 'Registration time' + 'time' => 'Registration time', + 'last_modified' => 'Last Modified' ]; } public function create($data) { $r = $this->load([ + 'code' => $data['Code'], 'type' => $data['type'], 'name' => $data['name'], 'image' => $data['image'], @@ -62,7 +67,8 @@ class ListManagement extends \yii\db\ActiveRecord { 'birthday' => $data['birthday'] === "" ? 0 : date_format(date_create_from_format('d/m/Y', $data['birthday']), 'U'), 'telephone' => $data['telephone'], 'address' => $data['address'], - 'time' => time() + 'time' => time(), + 'last_modified' => time() ], ''); if ($r) { try {