Explorar o código

商品详情-在返回商品详情检测为空时只修改sku
商家运费模板-调整默认模板放到数组的开头

xupuyuan hai 4 meses
pai
achega
49fe971ca3

+ 1 - 1
app/common/dao/store/shipping/ShippingTemplateDao.php

@@ -89,7 +89,7 @@ class ShippingTemplateDao  extends BaseDao
89 89
 //        return ($this->getModel())::getDB()->where('mer_id',$merId)->field('shipping_template_id,name')->select();
90 90
         $list = ($this->getModel())::getDB()->where('mer_id',$merId)->field('shipping_template_id,name')->select()->toArray();
91 91
         $default = ['shipping_template_id' => 105, 'name' => '默认包邮'];//默认
92
-        $list[] = $default;
92
+        array_unshift($list, $default);
93 93
         return $list;
94 94
     }
95 95
 

+ 2 - 10
app/common/repositories/store/product/ProductRepository.php

@@ -1016,17 +1016,9 @@ class ProductRepository extends BaseRepository
1016 1016
         }
1017 1017
 
1018 1018
         $res['isRelation'] = $isRelation ?? false;
1019
-        foreach ($res['attrValue'] as $k => $value) {
1020
-            $detail = $value['detail'] ?? null;
1021
-            if (is_array($detail) && count($detail) > 0) {
1022
-                $sku = implode(',', $detail);
1023
-            } else {
1024
-                $detail = ['默认'];
1025
-                $sku = '默认';
1026
-            }
1027
-            $res['attrValue'][$k]['detail'] = $detail;
1019
+        foreach ($res['attrValue'] as $k => $value) {//兜底单规格老商品,如果没有那就填充默认
1028 1020
             if (empty($value['sku'])) {
1029
-                $res['attrValue'][$k]['sku'] = $sku;
1021
+                $res['attrValue'][$k]['sku'] = '默认';
1030 1022
             }
1031 1023
         }
1032 1024
         $res['sku'] = $this->detailAttrValue($res['attrValue'], $userInfo, $res['product_type']);