...
|
...
|
@@ -115,6 +115,8 @@ class Goods extends Backend |
|
|
if (!preg_match('/^[0-9]+(.[0-9]{1,8})?$/', $params['price'])) {
|
|
|
$this->error("请填写正确的价格");
|
|
|
}
|
|
|
}else{
|
|
|
$params['price'] = 0;
|
|
|
}
|
|
|
|
|
|
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
|
...
|
...
|
@@ -129,6 +131,12 @@ class Goods extends Backend |
|
|
}
|
|
|
$this->editSku($this->model, $sku, 'add');
|
|
|
|
|
|
// 多规格-把规格最小值作为商品价格
|
|
|
if($params['is_sku']){
|
|
|
// 把规格最小值作为商品价格
|
|
|
$skuPrice = \app\admin\model\shopro\goods\SkuPrice::all(['goods_id' => $this->model->id]);
|
|
|
$this->model->save(['price'=>min(array_column($skuPrice,'price'))]);
|
|
|
}
|
|
|
|
|
|
Db::commit();
|
|
|
|
...
|
...
|
@@ -231,6 +239,14 @@ class Goods extends Backend |
|
|
$this->error($row->getError());
|
|
|
} else {
|
|
|
$this->editSku($row, $sku, 'edit');
|
|
|
|
|
|
// 多规格-把规格最小值作为商品价格
|
|
|
if($row['is_sku']){
|
|
|
// 把规格最小值作为商品价格
|
|
|
$skuPrice = \app\admin\model\shopro\goods\SkuPrice::all(['goods_id' => $row->id]);
|
|
|
$row->save(['price'=>min(array_column($skuPrice,'price'))]);
|
|
|
}
|
|
|
|
|
|
Db::commit();
|
|
|
}
|
|
|
} catch (ValidateException $e) {
|
...
|
...
|
|