Browse Source

开发商品模块价格保存机制

antshop
linyaostalker 5 years ago
parent
commit
686b7c1979
  1. 8
      backend/modules/goods/controllers/GoodsController.php
  2. 3
      backend/modules/goods/logic/goods/GoodsManager.php

8
backend/modules/goods/controllers/GoodsController.php

@ -101,9 +101,6 @@ class GoodsController extends Controller
$model->is_express = Goods::IS_EXPRESS_YES;
$model->express_type = Goods::EXPRESS_TYPE_EXPRESS_TEMPLATE;
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
if ($model->uniform_postage) {
$model->uniform_postage *= 100;
}
//商品封面图和商品详情图上传保存处理
$res = GoodsManager::updateGoods(Yii::$app->request->post(), $model);
if ($res['status']) {
@ -133,9 +130,6 @@ class GoodsController extends Controller
$cover_image_old_id_str = $model->image;
$detail_image_old_id_str = $model->detailImageId;
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
if ($model->uniform_postage) {
$model->uniform_postage *= 100;
}
//商品封面图和商品详情图上传保存处理
$res = GoodsManager::updateGoods(Yii::$app->request->post(), $model, $cover_image_old_id_str, $detail_image_old_id_str);
if ($res['status']) {
@ -143,6 +137,8 @@ class GoodsController extends Controller
}
}
$model->uniform_postage /= 100;
$model->market_price /= 100;
$model->price /= 100;
$attributeModel = GoodsManager::getAttribute($id);
$checkAttr = GoodsManager::getSkuInfo($id);
$filterAttributeModel = GoodsManager::getFilterAttribute($id);

3
backend/modules/goods/logic/goods/GoodsManager.php

@ -73,6 +73,9 @@ class GoodsManager
{
$attribute = $data['attribute'];
$filterAttribute = $data['filterattribute'];
$model->uniform_postage *= 100;
$model->market_price *= 100;
$model->price *= 100;
$tra = Yii::$app->db->beginTransaction();
try {
if (!$model->save()) {

Loading…
Cancel
Save