diff --git a/controllers/ApiController.php b/controllers/ApiController.php index 5a82da06..e693415f 100644 --- a/controllers/ApiController.php +++ b/controllers/ApiController.php @@ -68,6 +68,7 @@ class ApiController extends Controller { if ($post["id"] == 0) { $model = new CaptureLogs(); $model->create([ + "Staff" => 0, "Time" => $time, "Image" => $fileName ]); diff --git a/controllers/ConfigController.php b/controllers/ConfigController.php index 610aac90..2522dd6f 100644 --- a/controllers/ConfigController.php +++ b/controllers/ConfigController.php @@ -170,7 +170,7 @@ class ConfigController extends Controller { ] ]; $ip = "192.168.0.42"; - $tempConfig = json_decode(file_get_contents("http://192.168.1.241:4004/ReadAPIConfig", false, stream_context_create($options)), true); + $tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadAPIConfig", false, stream_context_create($options)), true); if ($tempConfig['status']) { $t = json_decode($tempConfig['data'], true); $temp = explode("/", $t['url']); diff --git a/controllers/ListManagementController.php b/controllers/ListManagementController.php index bcf77bd1..055d0561 100644 --- a/controllers/ListManagementController.php +++ b/controllers/ListManagementController.php @@ -172,4 +172,15 @@ class ListManagementController extends Controller { } } + public function actionUpload() { + if (Yii::$app->request->post()) { + $model = new common(); + Yii::$app->response->format = "json"; + return [ + "dataPath" => "BiFace/", + "url" => $model->UploadFile("AnhNhanVien", ["PNG", "JPG", "JPEG", "GIF"], "temp") + ]; + } + } + } diff --git a/db/app.db b/db/app.db index fca36137..85c94fd5 100644 Binary files a/db/app.db and b/db/app.db differ diff --git a/models/CaptureLogs.php b/models/CaptureLogs.php index e1478d33..e447f764 100644 --- a/models/CaptureLogs.php +++ b/models/CaptureLogs.php @@ -8,6 +8,7 @@ use Yii; * This is the model class for table "capture_logs". * * @property int $id + * @property int $staff_id * @property int $time * @property string $image * @property int $status @@ -27,7 +28,7 @@ class CaptureLogs extends \yii\db\ActiveRecord { */ public function rules() { return [ - [['time', 'status'], 'integer'], + [['staff_id', 'time', 'status'], 'integer'], [['image', 'remark'], 'string'], ]; } @@ -47,6 +48,7 @@ class CaptureLogs extends \yii\db\ActiveRecord { public function create($data) { $r = $this->load([ + 'staff_id' => $data['Staff'], 'time' => $data['Time'], 'image' => $data["Image"], 'status' => 0, diff --git a/models/common.php b/models/common.php index a96213e8..19f6f055 100644 --- a/models/common.php +++ b/models/common.php @@ -172,7 +172,7 @@ class common extends \yii\db\ActiveRecord { } public static function requestToEngine($path, $data) { - return file_get_contents("http://192.168.2.158:2305" . $path, false, stream_context_create([ + return file_get_contents("http://localhost:2305" . $path, false, stream_context_create([ 'http' => [ 'header' => "Content-Type: application/json", 'method' => "POST", diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties index 86275d35..30719514 100644 --- a/nbproject/private/private.properties +++ b/nbproject/private/private.properties @@ -1,7 +1,7 @@ copy.src.files=false copy.src.on.open=false copy.src.target= -remote.connection=missing-config +remote.connection=BiFace-99bab6 remote.directory=/BiFace_Server_Lite remote.upload=ON_SAVE run.as=LOCAL diff --git a/views/list-management/index.tpl b/views/list-management/index.tpl index f6b9ed40..0576ea35 100644 --- a/views/list-management/index.tpl +++ b/views/list-management/index.tpl @@ -136,6 +136,12 @@ +