瀏覽代碼

添加商品-增加icon展示类型

sunxbiao 5 月之前
父節點
當前提交
b2e194f441
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      app/common/repositories/store/product/ProductRepository.php

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

@@ -175,6 +175,12 @@ class ProductRepository extends BaseRepository
175
                 }
175
                 }
176
             }
176
             }
177
 
177
 
178
+            if (!empty($data['icon_type'])) {
179
+                if (is_array($data['icon_type'])) {
180
+                    $data['icon_type'] = json_encode($data['icon_type'], JSON_UNESCAPED_UNICODE);
181
+                }
182
+            }
183
+
178
             $pension = bcsub($data['attrValue'][0]['price'], bcmul($data['attrValue'][0]['price'], $data['commission'], 2), 2);
184
             $pension = bcsub($data['attrValue'][0]['price'], bcmul($data['attrValue'][0]['price'], $data['commission'], 2), 2);
179
             if ($data['pension'] > $pension) {
185
             if ($data['pension'] > $pension) {
180
                 return ['code' => 201, 'msg' => '养老金金额和佣金金额总和不能超过商品单价'];
186
                 return ['code' => 201, 'msg' => '养老金金额和佣金金额总和不能超过商品单价'];
@@ -265,6 +271,11 @@ class ProductRepository extends BaseRepository
265
                     $value['extension_one'] = $base_commission;
271
                     $value['extension_one'] = $base_commission;
266
                 }
272
                 }
267
             }
273
             }
274
+            if (!empty($data['icon_type'])) {
275
+                if (is_array($data['icon_type'])) {
276
+                    $data['icon_type'] = json_encode($data['icon_type'], JSON_UNESCAPED_UNICODE);
277
+                }
278
+            }
268
             $param['attr'] = $data['attr'] ?? '';
279
             $param['attr'] = $data['attr'] ?? '';
269
             $param['attrValue'] = $data['attrValue'] ?? '';
280
             $param['attrValue'] = $data['attrValue'] ?? '';
270
             $param['cate'] = $data['mer_cate_id'] ?? '';
281
             $param['cate'] = $data['mer_cate_id'] ?? '';