作者 lyh

gx

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