init cloud
This commit is contained in:
parent
566c065303
commit
c175187f4f
|
@ -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;
|
||||
|
|
60
models/WaitingReq.php
Normal file
60
models/WaitingReq.php
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user