|
@ -96,7 +96,11 @@ class GoodsController extends Controller |
|
|
$model = new Goods(); |
|
|
$model = new Goods(); |
|
|
$model->is_sale = Goods::IS_SALE_YES; |
|
|
$model->is_sale = Goods::IS_SALE_YES; |
|
|
$model->stock = -1; |
|
|
$model->stock = -1; |
|
|
|
|
|
$model->is_taking = Goods::IS_TAKING_NO; |
|
|
|
|
|
$model->is_express = Goods::IS_EXPRESS_YES; |
|
|
|
|
|
$model->express_type = Goods::EXPRESS_TYPE_EXPRESS_TEMPLAGE; |
|
|
if ($model->load(Yii::$app->request->post()) && $model->validate()) { |
|
|
if ($model->load(Yii::$app->request->post()) && $model->validate()) { |
|
|
|
|
|
$model->uniform_postage *= 100; |
|
|
//商品封面图和商品详情图上传保存处理
|
|
|
//商品封面图和商品详情图上传保存处理
|
|
|
$res = GoodsManager::updateGoods(Yii::$app->request->post(), $model); |
|
|
$res = GoodsManager::updateGoods(Yii::$app->request->post(), $model); |
|
|
if ($res['status']) { |
|
|
if ($res['status']) { |
|
@ -126,12 +130,14 @@ class GoodsController extends Controller |
|
|
$cover_image_old_id_str = $model->image; |
|
|
$cover_image_old_id_str = $model->image; |
|
|
$detail_image_old_id_str = $model->detailImageId; |
|
|
$detail_image_old_id_str = $model->detailImageId; |
|
|
if ($model->load(Yii::$app->request->post()) && $model->validate()) { |
|
|
if ($model->load(Yii::$app->request->post()) && $model->validate()) { |
|
|
|
|
|
$model->uniform_postage *= 100; |
|
|
//商品封面图和商品详情图上传保存处理
|
|
|
//商品封面图和商品详情图上传保存处理
|
|
|
$res = GoodsManager::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']) { |
|
|
if ($res['status']) { |
|
|
return $this->redirect('index'); |
|
|
return $this->redirect('index'); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
$model->uniform_postage /= 100; |
|
|
$attributeModel = GoodsManager::getAttribute($id); |
|
|
$attributeModel = GoodsManager::getAttribute($id); |
|
|
$checkAttr = GoodsManager::getSkuInfo($id); |
|
|
$checkAttr = GoodsManager::getSkuInfo($id); |
|
|
$filterAttributeModel = GoodsManager::getFilterAttribute($id); |
|
|
$filterAttributeModel = GoodsManager::getFilterAttribute($id); |
|
@ -211,10 +217,7 @@ class GoodsController extends Controller |
|
|
$model->user_id = Yii::$app->user->identity->id; |
|
|
$model->user_id = Yii::$app->user->identity->id; |
|
|
$model->name = $file_name; |
|
|
$model->name = $file_name; |
|
|
$file_manager = new \backend\modules\file\logic\file\FileManager(); |
|
|
$file_manager = new \backend\modules\file\logic\file\FileManager(); |
|
|
$type_res = $file_manager->searchType(\backend\modules\file\logic\file\FileManager::$extension, pathinfo($data['path'])['extension']); |
|
|
|
|
|
if ($type_res['status']) { |
|
|
|
|
|
$model->type = $type_res['type']; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$model->type = $file_manager->searchType(pathinfo($data['path'])['extension']); |
|
|
$model->alias = $data['alias']; |
|
|
$model->alias = $data['alias']; |
|
|
$model->path = $data['path']; |
|
|
$model->path = $data['path']; |
|
|
$model->save(); |
|
|
$model->save(); |
|
|