作者 lyh

gx

@@ -8,6 +8,7 @@ use App\Http\Logic\Bside\Product\CategoryLogic; @@ -8,6 +8,7 @@ use App\Http\Logic\Bside\Product\CategoryLogic;
8 use App\Http\Requests\Bside\Product\CategoryRequest; 8 use App\Http\Requests\Bside\Product\CategoryRequest;
9 use App\Models\Product\Category; 9 use App\Models\Product\Category;
10 use App\Models\Product\CategoryRelated; 10 use App\Models\Product\CategoryRelated;
  11 +use App\Models\Product\Product;
11 use App\Models\RouteMap\RouteMap; 12 use App\Models\RouteMap\RouteMap;
12 use App\Rules\Ids; 13 use App\Rules\Ids;
13 use Illuminate\Http\Request; 14 use Illuminate\Http\Request;
@@ -56,8 +57,7 @@ class CategoryController extends BaseController @@ -56,8 +57,7 @@ class CategoryController extends BaseController
56 */ 57 */
57 public function handleParam(&$category,$v){ 58 public function handleParam(&$category,$v){
58 $v['url'] = $this->user['domain'] . RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_CATE, $v['id'], $v['project_id']); 59 $v['url'] = $this->user['domain'] . RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_CATE, $v['id'], $v['project_id']);
59 - $cate_ids = $category->getChildIdsArr($v['id']);  
60 - $v['product_num'] = CategoryRelated::whereIn('cate_id', $cate_ids)->distinct()->count('product_id'); 60 + $v['product_num'] = Product::where('category_id','like' ,'%,'.$v['category_id'].',%')->count();;
61 $v['image_link'] = getImageUrl($v['image']); 61 $v['image_link'] = getImageUrl($v['image']);
62 return $v; 62 return $v;
63 } 63 }
@@ -9,6 +9,7 @@ use App\Http\Logic\Bside\Product\KeywordLogic; @@ -9,6 +9,7 @@ use App\Http\Logic\Bside\Product\KeywordLogic;
9 use App\Http\Requests\Bside\Product\KeywordRequest; 9 use App\Http\Requests\Bside\Product\KeywordRequest;
10 use App\Models\Product\Keyword; 10 use App\Models\Product\Keyword;
11 use App\Models\Product\KeywordRelated; 11 use App\Models\Product\KeywordRelated;
  12 +use App\Models\Product\Product;
12 use App\Models\RouteMap\RouteMap; 13 use App\Models\RouteMap\RouteMap;
13 use App\Rules\Ids; 14 use App\Rules\Ids;
14 use Illuminate\Http\Request; 15 use Illuminate\Http\Request;
@@ -39,7 +40,7 @@ class KeywordController extends BaseController @@ -39,7 +40,7 @@ class KeywordController extends BaseController
39 $data = $keyword->lists($this->map,$this->page,$this->row,$this->order,$filed); 40 $data = $keyword->lists($this->map,$this->page,$this->row,$this->order,$filed);
40 if(!empty($data)){ 41 if(!empty($data)){
41 foreach ($data['list'] as &$v){ 42 foreach ($data['list'] as &$v){
42 - $v['product_num'] = KeywordRelated::where('keyword_id', $v['id'])->distinct()->count('product_id'); 43 + $v['product_num'] = Product::where('keyword_id','like' ,'%,'.$v['keyword_id'].',%')->count();
43 $v['tdk'] = boolval($v['seo_title']) * boolval($v['seo_keywords']) * boolval($v['seo_description']); 44 $v['tdk'] = boolval($v['seo_title']) * boolval($v['seo_keywords']) * boolval($v['seo_description']);
44 $v['url'] = $this->user['domain'] . RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); 45 $v['url'] = $this->user['domain'] . RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
45 } 46 }
@@ -47,6 +48,13 @@ class KeywordController extends BaseController @@ -47,6 +48,13 @@ class KeywordController extends BaseController
47 return $this->response('success',Code::SUCCESS,$data); 48 return $this->response('success',Code::SUCCESS,$data);
48 } 49 }
49 50
  51 + /**
  52 + * @remark :获取数据详情
  53 + * @name :info
  54 + * @author :lyh
  55 + * @method :post
  56 + * @time :2023/8/23 16:57
  57 + */
50 public function info(Request $request, KeywordLogic $logic){ 58 public function info(Request $request, KeywordLogic $logic){
51 $request->validate([ 59 $request->validate([
52 'id'=>'required' 60 'id'=>'required'
@@ -26,17 +26,6 @@ class KeywordLogic extends BaseLogic @@ -26,17 +26,6 @@ class KeywordLogic extends BaseLogic
26 $this->model = new Keyword(); 26 $this->model = new Keyword();
27 } 27 }
28 28
29 - public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20)  
30 - {  
31 - $data = parent::getList($map, $sort, $columns, $limit);  
32 - foreach ($data['list'] as &$v){  
33 - $v['product_num'] = Product::where('keyword_id','like' ,'%,'.$v['keyword_id'].',%')->count();  
34 - $v['tdk'] = boolval($v['seo_title']) * boolval($v['seo_keywords']) * boolval($v['seo_description']);  
35 - $v['url'] = $this->user['domain'] . $v['route'];  
36 - }  
37 - return $this->success($data);  
38 - }  
39 -  
40 /** 29 /**
41 * @remark :获取数据详情 30 * @remark :获取数据详情
42 * @name :getInfo 31 * @name :getInfo