74 lines
1.9 KiB
PHP
74 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace app\controllers;
|
|
|
|
use Yii;
|
|
use yii\web\Controller;
|
|
use yii\filters\VerbFilter;
|
|
|
|
/**
|
|
* CardController implements the CRUD actions for Card model.
|
|
*/
|
|
class ApiController extends Controller {
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function behaviors() {
|
|
return [
|
|
'verbs' => [
|
|
'class' => VerbFilter::className(),
|
|
'actions' => [
|
|
'delete' => ['POST'],
|
|
],
|
|
],
|
|
];
|
|
}
|
|
|
|
public function actionSaveLogs() {
|
|
if (Yii::$app->request->post()) {
|
|
$post = Yii::$app->request->bodyParams;
|
|
$model = new \app\models\FaceLogs();
|
|
$model->create($post);
|
|
Yii::$app->response->format = "json";
|
|
return ["stt" => true];
|
|
}
|
|
}
|
|
|
|
public function actionWaitingRecognize() {
|
|
if (Yii::$app->request->post()) {
|
|
$post = Yii::$app->request->bodyParams;
|
|
$model = new \app\models\WaitingReq();
|
|
$model->create($post);
|
|
Yii::$app->response->format = "json";
|
|
return ["stt" => true];
|
|
}
|
|
}
|
|
|
|
public function actionSyncUrl() {
|
|
if (Yii::$app->request->post()) {
|
|
$post = Yii::$app->request->bodyParams;
|
|
$sync = \app\models\SyncUrl::find()->one();
|
|
if ($sync) {
|
|
$sync->data = $post['url'];
|
|
$sync->save();
|
|
} else {
|
|
$model = new \app\models\SyncUrl();
|
|
$model->create($post);
|
|
}
|
|
Yii::$app->response->format = "json";
|
|
return ["stt" => true];
|
|
}
|
|
}
|
|
|
|
public function actionTest() {
|
|
$ls = \app\models\WaitingReq::find()->limit(10)->all();
|
|
$c = \app\models\WaitingReq::find()->count();
|
|
echo "<pre>";
|
|
var_dump($c, $ls);
|
|
echo "</pre>";
|
|
return;
|
|
}
|
|
|
|
}
|