diff --git a/controllers/ApiController.php b/controllers/ApiController.php index 99b0f9ca..4e6d21e1 100644 --- a/controllers/ApiController.php +++ b/controllers/ApiController.php @@ -35,6 +35,16 @@ class ApiController extends Controller { } } + 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; diff --git a/db/app.db b/db/app.db index aaf93d41..22242a14 100644 Binary files a/db/app.db and b/db/app.db differ diff --git a/models/WaitingReq.php b/models/WaitingReq.php new file mode 100644 index 00000000..11637464 --- /dev/null +++ b/models/WaitingReq.php @@ -0,0 +1,60 @@ + 'ID', + 'content' => 'Content', + 'time' => 'Time', + ]; + } + + public function create($data) { + $r = $this->load([ + 'content' => $data, + 'time' => time() + ], ''); + if ($r) { + try { + $this->save(); + return $this->id; + } catch (\Exception $ex) { + return false; + } + } + } + +}