From e28296daf53207a1a13e6a246d3c50b02cb586db Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Thu, 28 Nov 2019 16:53:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E9=80=BB=E8=BE=91=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9D=99=E6=80=81=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/src/controllers/GoodsController.php | 11 +++++------ .../goods/src/controllers/ShopCategoryController.php | 6 ++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php index 7e1dad7..6ee5924 100644 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -2,6 +2,7 @@ namespace antgoods\goods\controllers; +use antgoods\goods\models\ars\GoodsSku; use common\models\ars\TemFile; use MongoDB\Driver\Manager; use Yii; @@ -83,8 +84,7 @@ class GoodsController extends Controller $model = new Goods(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { //商品封面图和商品详情图上传保存处理 - $goods_manager = new GoodsManager(); - $res = $goods_manager->updateGoods(Yii::$app->request->post(), $model); + $res = GoodsManager::updateGoods(Yii::$app->request->post(), $model); if ($res['status']) { return $this->redirect('index'); } @@ -108,19 +108,18 @@ class GoodsController extends Controller $model = $this->findModel($id); $model->coverImageId = $model->image; $model->detailImageId = implode(',', File::find()->select('id')->where(['is_delete' => File::IS_DELETE_NO, 'own_id' => $model->id, 'own_type' => File::OWN_TYPE_GOODS_DETAILS])->column()); - $goods_manager = new GoodsManager(); //记录已保存的商品图片id,用于修改 $cover_image_old_id_str = $model->image; $detail_image_old_id_str = $model->detailImageId; if ($model->load(Yii::$app->request->post()) && $model->validate()) { //商品封面图和商品详情图上传保存处理 - $res = $goods_manager->updateGoods(Yii::$app->request->post(), $model, $cover_image_old_id_str, $detail_image_old_id_str); + $res = GoodsManager::updateGoods(Yii::$app->request->post(), $model, $cover_image_old_id_str, $detail_image_old_id_str); if ($res['status']) { return $this->redirect('index'); } } - $attributeModel = $goods_manager->getAttribute($id); - $checkAttr = $goods_manager->getSkuInfo($id); + $attributeModel = GoodsManager::getAttribute($id); + $checkAttr = GoodsManager::getSkuInfo($id); return $this->render('update', [ 'model' => $model, 'attributeModel' => $attributeModel, diff --git a/vendor/antgoods/goods/src/controllers/ShopCategoryController.php b/vendor/antgoods/goods/src/controllers/ShopCategoryController.php index 20a71c1..2699cf9 100644 --- a/vendor/antgoods/goods/src/controllers/ShopCategoryController.php +++ b/vendor/antgoods/goods/src/controllers/ShopCategoryController.php @@ -90,8 +90,7 @@ class ShopCategoryController extends Controller //类目图片上传保存处理 $icon_image_id_str = $model->iconImageId; $model->save(); - $goods_manager = new GoodsManager(); - $save_icon_image_res = $goods_manager->saveFile(explode(',', $icon_image_id_str), $model, [], File::OWN_TYPE_CATEGORY_ICON); + $save_icon_image_res = GoodsManager::saveFile(explode(',', $icon_image_id_str), $model, [], File::OWN_TYPE_CATEGORY_ICON); if($save_icon_image_res['status']){ $model->icon = $save_icon_image_res['first_file_id']; $model->save(); @@ -131,8 +130,7 @@ class ShopCategoryController extends Controller //类目图片上传保存处理 $icon_image_id_str = $model->iconImageId; $model->save(); - $goods_manager = new GoodsManager(); - $save_icon_image_res = $goods_manager->saveFile(explode(',', $icon_image_id_str), $model, explode(',', $icon_image_old_id_arr), File::OWN_TYPE_CATEGORY_ICON); + $save_icon_image_res = GoodsManager::saveFile(explode(',', $icon_image_id_str), $model, explode(',', $icon_image_old_id_arr), File::OWN_TYPE_CATEGORY_ICON); if($save_icon_image_res['status'] && $save_icon_image_res['first_file_id'] !== 0){ $model->icon = $save_icon_image_res['first_file_id']; $model->save();