|
@ -8,13 +8,14 @@ use backend\modules\shop\models\searchs\ExpressAreaSearch; |
|
|
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\caching\Cache; |
|
|
|
|
|
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 yii\web\Response; |
|
|
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; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* ExpressTemplateController implements the CRUD actions for ExpressTemplate model. |
|
|
* ExpressTemplateController implements the CRUD actions for ExpressTemplate model. |
|
@ -112,7 +113,13 @@ class ExpressTemplateController extends Controller |
|
|
*/ |
|
|
*/ |
|
|
public function actionDelete($id) |
|
|
public function actionDelete($id) |
|
|
{ |
|
|
{ |
|
|
$this->findModel($id)->delete(); |
|
|
|
|
|
|
|
|
if (Goods::find()->where(['express_template' => $id])->count() == 0) { |
|
|
|
|
|
$expressTemplateModel = $this->findModel($id); |
|
|
|
|
|
ExpressArea::deleteAll(['express_template' => $expressTemplateModel->id]); |
|
|
|
|
|
$expressTemplateModel->delete(); |
|
|
|
|
|
} else { |
|
|
|
|
|
Yii::$app->session->setFlash('error', '该模板已被使用'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return $this->redirect(['index']); |
|
|
return $this->redirect(['index']); |
|
|
} |
|
|
} |
|
|