Browse Source

refactor:运费区域删除方法增加注释

antshop
linyaostalker 5 years ago
parent
commit
3fa28ee2f8
  1. 19
      backend/modules/shop/controllers/ExpressTemplateController.php

19
backend/modules/shop/controllers/ExpressTemplateController.php

@ -4,9 +4,11 @@ namespace backend\modules\shop\controllers;
use backend\modules\shop\logic\ShopManager; use backend\modules\shop\logic\ShopManager;
use backend\modules\shop\models\searchs\ExpressAreaSearch; use backend\modules\shop\models\searchs\ExpressAreaSearch;
use Throwable;
use Yii; use Yii;
use backend\modules\shop\models\ars\ExpressTemplate; use backend\modules\shop\models\ars\ExpressTemplate;
use backend\modules\shop\models\searchs\ExpressTemplateSearch; use backend\modules\shop\models\searchs\ExpressTemplateSearch;
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;
@ -14,7 +16,7 @@ use yii\web\Response;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use backend\modules\shop\models\ars\ExpressArea; use backend\modules\shop\models\ars\ExpressArea;
use backend\modules\goods\models\ars\Goods; use backend\modules\goods\models\ars\Goods;
use backend\modules\shop\logic\CommonManager;
use iron\widget\Excel;
/** /**
@ -110,6 +112,8 @@ class ExpressTemplateController 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)
{ {
@ -152,7 +156,7 @@ class ExpressTemplateController 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,
@ -162,6 +166,7 @@ class ExpressTemplateController extends Controller
} }
/** /**
* @param $id
* @return string * @return string
* 运费区域列表 * 运费区域列表
*/ */
@ -185,8 +190,7 @@ class ExpressTemplateController extends Controller
*/ */
public function actionExpressAreaCreate() public function actionExpressAreaCreate()
{ {
$expressTemplateId = Yii::$app->request->get('expressTemplateId');
$expressTemplateModel = ExpressTemplate::findOne($expressTemplateId);
$expressTemplateModel = ExpressTemplate::findOne(Yii::$app->request->get('expressTemplateId'));
$model = new ExpressArea(); $model = new ExpressArea();
$model->basic_count = 1; $model->basic_count = 1;
$model->basic_price = '0.00'; $model->basic_price = '0.00';
@ -213,7 +217,6 @@ class ExpressTemplateController extends Controller
} }
$data = ShopManager::filterCity($model); //获取筛选的城市数据 $data = ShopManager::filterCity($model); //获取筛选的城市数据
if (empty($data)) { if (empty($data)) {
Yii::$app->session->setFlash('error', '已无地区选择'); Yii::$app->session->setFlash('error', '已无地区选择');
return $this->redirect('express-area-list?id='.$expressTemplateModel->id); return $this->redirect('express-area-list?id='.$expressTemplateModel->id);
@ -277,6 +280,12 @@ class ExpressTemplateController extends Controller
]); ]);
} }
/**
* @param $id
* @return Response
* @throws StaleObjectException
* @throws Throwable
*/
public function actionExpressAreaDelete($id) public function actionExpressAreaDelete($id)
{ {
$expressAreaModel = ExpressArea::findOne($id); $expressAreaModel = ExpressArea::findOne($id);

Loading…
Cancel
Save