Browse Source

首页推荐

gorden 8 months ago
parent
commit
3e072dd255
1 changed files with 9 additions and 1 deletions
  1. 9 1
      app/admin/service/goods/GoodsService.php

+ 9 - 1
app/admin/service/goods/GoodsService.php

@@ -227,6 +227,9 @@ class GoodsService
             if (!empty($row['goods_attribute_json'])) {
                 $row['goods_attribute_json'] = json_decode($row['goods_attribute_json']);
             }
+            if (!empty($row['goods_category']) && $row['goods_category'] == 'INDEX'){
+                $row['goods_recommend_index'] = 'INDEX';
+            }
         }
 
         return json_success('', compact('rows', 'page', 'pageSize', 'total'));
@@ -595,6 +598,9 @@ class GoodsService
             $data['goods_label'] = !empty($data['goods_label']) ? explode(',', $data['goods_label']) : [];
             $data['goods_json'] = $data['goods_json'] ? json_decode($data['goods_json'], true) : [];
             $data['goods_cover'] = getenv('STORAGE_DOMAIN') . $data['goods_cover'];
+            if(!empty($data['goods_category']) && $data['goods_category'] == 'INDEX'){
+                $data['goods_recommend_index'] = 'INDEX';
+            }
 
             // 创建者
             $data['creator_username'] = '';
@@ -1715,6 +1721,9 @@ class GoodsService
                 $data['goods_category'] = $category->category_classify ?? '';
                 $data['goods_prefix'] = $data['goods_prefix'] ?? ($category->category_name ? '【' . $category->category_name . '】' : '');
             }
+            if (!empty($params['goods_recommend_index'])){
+                $data['goods_category'] = $params['goods_recommend_index'];
+            }
             // 上架时间有变动
             if ($data['goods_status'] == 'PENDING' && $row->goods_on_addtimes != $data['goods_on_addtimes']) {
                 $redis = Redis::connection();
@@ -1854,7 +1863,6 @@ class GoodsService
                 } elseif (empty($data['goods_attribute_json'])) {
                     $data['goods_attribute_json'] = [];
                 }
-                dump($data['goods_attribute_json']);
                 $data['goods_attribute_json']['premisses'] = $params['goods_premisses'];
                 $data['goods_attribute_json'] = json_encode($data['goods_attribute_json']);
             }