|
|
@@ -418,8 +418,12 @@ class ProductRepository extends BaseRepository
|
|
418
|
418
|
$value['plate_mer_profit'] = $value['gong_mer_profit'];
|
|
419
|
419
|
|
|
420
|
420
|
$sku = '';
|
|
421
|
|
- if (isset($value['detail']) && is_array($value['detail'])) {
|
|
|
421
|
+ if (isset($value['detail']) && is_array($value['detail']) && count($value['detail']) > 0) {
|
|
422
|
422
|
$sku = implode(',', $value['detail']);
|
|
|
423
|
+ } else {
|
|
|
424
|
+ // 单规格情况,detail填充默认内容
|
|
|
425
|
+ $value['detail'] = ['默认'];
|
|
|
426
|
+ $sku = '默认';
|
|
423
|
427
|
}
|
|
424
|
428
|
$product_data = Db::name('store_product')->where('product_id', $id)->value('spu_id');
|
|
425
|
429
|
if ($product_data) {
|
|
|
@@ -1012,6 +1016,11 @@ class ProductRepository extends BaseRepository
|
|
1012
|
1016
|
}
|
|
1013
|
1017
|
|
|
1014
|
1018
|
$res['isRelation'] = $isRelation ?? false;
|
|
|
1019
|
+ foreach ($res['attrValue'] as $k => $value) {//兜底单规格老商品,如果没有那就填充默认
|
|
|
1020
|
+ if (empty($value['sku'])) {
|
|
|
1021
|
+ $res['attrValue'][$k]['sku'] = '默认';
|
|
|
1022
|
+ }
|
|
|
1023
|
+ }
|
|
1015
|
1024
|
$res['sku'] = $this->detailAttrValue($res['attrValue'], $userInfo, $res['product_type']);
|
|
1016
|
1025
|
$res['sales'] = $res['sales'] + $res['ficti'];
|
|
1017
|
1026
|
$res['replayData'] = app()->make(ProductReplyRepository::class)->getReplyRate($res['product_id']);
|