|
|
@ -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, |
|
|
|