This commit is contained in:
2020-03-27 16:42:19 +07:00
parent a4510fce21
commit 85ff8b0e5a
5 changed files with 84 additions and 37 deletions

View File

@@ -38,8 +38,14 @@ class ApiController extends Controller {
public function actionSyncUrl() {
if (Yii::$app->request->post()) {
$post = Yii::$app->request->bodyParams;
$model = new \app\models\FaceLogs();
$model->create($post);
$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];
}