57 lines
1.4 KiB
PHP
57 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace app\modules\api\controllers;
|
|
|
|
use app\models\Report;
|
|
use app\modules\api\models\ReportForm;
|
|
|
|
class ReportStartController extends \app\controllers\Controller
|
|
{
|
|
public $enableCsrfValidation = false;
|
|
/**
|
|
* @return array|mixed|null
|
|
*/
|
|
public function actionStart()
|
|
{
|
|
if(!\Yii::$app->request->isPost){
|
|
$data = [
|
|
'code' => 1,
|
|
'msg' => "Invalid Request"
|
|
];
|
|
return $this->responseHandler($data);
|
|
}
|
|
|
|
$storeId = \Yii::$app->request->post('store_id', 3);
|
|
|
|
$reportForm = new ReportForm();
|
|
|
|
$data = $reportForm->getStartByStoreId($storeId);
|
|
|
|
return $this->responseHandler(['code' => 0, 'msg' => '请求成功', 'data' => $data]);
|
|
}
|
|
|
|
/**
|
|
* @return array|mixed|null
|
|
*/
|
|
public function actionUpload()
|
|
{
|
|
if(!\Yii::$app->request->isPost){
|
|
$data = [
|
|
'code' => 1,
|
|
'msg' => "Invalid Request"
|
|
];
|
|
return $this->responseHandler($data);
|
|
}
|
|
|
|
$leftImg = \Yii::$app->request->post('left');
|
|
$rightImg = \Yii::$app->request->post('right');
|
|
$id = \Yii::$app->request->post('id');
|
|
|
|
$reportForm = new ReportForm();
|
|
|
|
$data = $reportForm->uploadModule($id, $leftImg, $rightImg);
|
|
|
|
return $this->responseHandler($data);
|
|
}
|
|
|
|
} |