作者 lyh

gx

... ... @@ -8,7 +8,9 @@ use App\Http\Controllers\Bside\BaseController;
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\Project\Project;
use App\Models\RouteMap;
use App\Rules\Ids;
use Illuminate\Http\Request;
... ... @@ -36,6 +38,13 @@ class KeywordController extends BaseController
$this->map['project_id'] = $this->user['project_id'];
$filed = ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'status', 'created_at'];
$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['tdk'] = boolval($v['seo_title']) * boolval($v['seo_keywords']) * boolval($v['seo_description']);
$v['url'] = $this->getProjectDomain() . RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
}
}
return $this->response('success',Code::SUCCESS,$data);
}
... ...