Преглед изворни кода

修复添加商品默认分润比不生效问题

sunxbiao пре 1 година
родитељ
комит
c1524dcd66
1 измењених фајлова са 9 додато и 0 уклоњено
  1. 9 0
      app/common/repositories/store/product/ProductRepository.php

+ 9 - 0
app/common/repositories/store/product/ProductRepository.php

@@ -253,6 +253,15 @@ class ProductRepository extends BaseRepository
253
     public function update(int $id, array $data, $merId)
253
     public function update(int $id, array $data, $merId)
254
     {
254
     {
255
         Db::transaction(function () use ($id, $data, $merId) {
255
         Db::transaction(function () use ($id, $data, $merId) {
256
+            if ($data['extension_type'] != 1) {
257
+                $base_commission = Db::name('system_config_value')->where('config_key', 'base_commission')->where('mer_id', $merId)->value('value');
258
+                if ($base_commission < 5) {
259
+                    $base_commission = 5;
260
+                }
261
+                foreach ($data['attrValue'] as &$value) {
262
+                    $value['extension_one'] = $base_commission;
263
+                }
264
+            }
256
             $param['attr'] = $data['attr'] ?? '';
265
             $param['attr'] = $data['attr'] ?? '';
257
             $param['attrValue'] = $data['attrValue'] ?? '';
266
             $param['attrValue'] = $data['attrValue'] ?? '';
258
             $param['cate'] = $data['mer_cate_id'] ?? '';
267
             $param['cate'] = $data['mer_cate_id'] ?? '';