Browse Source

refactor:处理自提控制器代码问题

antshop
linyaostalker 5 years ago
parent
commit
f95563ca36
  1. 7
      backend/modules/shop/controllers/OrderController.php
  2. 7
      backend/modules/shop/controllers/TakingSiteController.php

7
backend/modules/shop/controllers/OrderController.php

@ -2,12 +2,15 @@
namespace backend\modules\shop\controllers; namespace backend\modules\shop\controllers;
use Throwable;
use Yii; use Yii;
use backend\modules\shop\models\ars\Order; use backend\modules\shop\models\ars\Order;
use backend\modules\shop\models\searchs\OrderSearch; use backend\modules\shop\models\searchs\OrderSearch;
use yii\db\StaleObjectException;
use yii\web\Controller; use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;
use iron\widget\Excel;
/** /**
* OrderController implements the CRUD actions for Order model. * OrderController implements the CRUD actions for Order model.
@ -102,6 +105,8 @@ class OrderController extends Controller
* @param integer $id * @param integer $id
* @return mixed * @return mixed
* @throws NotFoundHttpException if the model cannot be found * @throws NotFoundHttpException if the model cannot be found
* @throws Throwable
* @throws StaleObjectException
*/ */
public function actionDelete($id) public function actionDelete($id)
{ {
@ -138,7 +143,7 @@ class OrderController extends Controller
} else { } else {
$dataProvider = $searchModel->search($params); $dataProvider = $searchModel->search($params);
} }
\iron\widget\Excel::export([
Excel::export([
'models' => $dataProvider->getModels(), 'models' => $dataProvider->getModels(),
'format' => 'Xlsx', 'format' => 'Xlsx',
'asAttachment' => true, 'asAttachment' => true,

7
backend/modules/shop/controllers/TakingSiteController.php

@ -4,12 +4,15 @@ namespace backend\modules\shop\controllers;
use backend\modules\shop\models\ars\Area; use backend\modules\shop\models\ars\Area;
use backend\modules\shop\models\ars\City; use backend\modules\shop\models\ars\City;
use Throwable;
use Yii; use Yii;
use backend\modules\shop\models\ars\TakingSite; use backend\modules\shop\models\ars\TakingSite;
use backend\modules\shop\models\searchs\TakingSiteSearch; use backend\modules\shop\models\searchs\TakingSiteSearch;
use yii\db\StaleObjectException;
use yii\web\Controller; use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;
use iron\widget\Excel;
/** /**
* TakingSiteController implements the CRUD actions for TakingSite model. * TakingSiteController implements the CRUD actions for TakingSite model.
@ -104,6 +107,8 @@ class TakingSiteController extends Controller
* @param integer $id * @param integer $id
* @return mixed * @return mixed
* @throws NotFoundHttpException if the model cannot be found * @throws NotFoundHttpException if the model cannot be found
* @throws Throwable
* @throws StaleObjectException
*/ */
public function actionDelete($id) public function actionDelete($id)
{ {
@ -140,7 +145,7 @@ class TakingSiteController extends Controller
} else { } else {
$dataProvider = $searchModel->search($params); $dataProvider = $searchModel->search($params);
} }
\iron\widget\Excel::export([
Excel::export([
'models' => $dataProvider->getModels(), 'models' => $dataProvider->getModels(),
'format' => 'Xlsx', 'format' => 'Xlsx',
'asAttachment' => true, 'asAttachment' => true,

Loading…
Cancel
Save