update database

This commit is contained in:
dongpd 2020-12-09 14:45:49 +07:00
parent ee3c869d71
commit 24e3347d43
4 changed files with 17 additions and 7 deletions

View File

@ -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"];

BIN
db/app.db

Binary file not shown.

View File

@ -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 {

View File

@ -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 {