init cloud

This commit is contained in:
dongpd 2020-09-22 15:56:13 +07:00
parent 566c065303
commit c175187f4f
3 changed files with 70 additions and 0 deletions

View File

@ -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() { public function actionSyncUrl() {
if (Yii::$app->request->post()) { if (Yii::$app->request->post()) {
$post = Yii::$app->request->bodyParams; $post = Yii::$app->request->bodyParams;

BIN
db/app.db

Binary file not shown.

60
models/WaitingReq.php Normal file
View File

@ -0,0 +1,60 @@
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "waiting_req".
*
* @property int $id
* @property string $content
* @property int $time
*/
class WaitingReq extends \yii\db\ActiveRecord {
/**
* {@inheritdoc}
*/
public static function tableName() {
return 'waiting_req';
}
/**
* {@inheritdoc}
*/
public function rules() {
return [
[['content', 'time'], 'required'],
[['content'], 'string'],
[['time'], 'integer'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels() {
return [
'id' => '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;
}
}
}
}