正在显示
1 个修改的文件
包含
9 行增加
和
0 行删除
| @@ -8,7 +8,9 @@ use App\Http\Controllers\Bside\BaseController; | @@ -8,7 +8,9 @@ use App\Http\Controllers\Bside\BaseController; | ||
| 8 | use App\Http\Logic\Bside\Product\KeywordLogic; | 8 | 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\Project\Project; | 12 | use App\Models\Project\Project; |
| 13 | +use App\Models\RouteMap; | ||
| 12 | use App\Rules\Ids; | 14 | use App\Rules\Ids; |
| 13 | use Illuminate\Http\Request; | 15 | use Illuminate\Http\Request; |
| 14 | 16 | ||
| @@ -36,6 +38,13 @@ class KeywordController extends BaseController | @@ -36,6 +38,13 @@ class KeywordController extends BaseController | ||
| 36 | $this->map['project_id'] = $this->user['project_id']; | 38 | $this->map['project_id'] = $this->user['project_id']; |
| 37 | $filed = ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'status', 'created_at']; | 39 | $filed = ['id', 'project_id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'status', 'created_at']; |
| 38 | $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); |
| 41 | + if(!empty($data)){ | ||
| 42 | + foreach ($data['list'] as &$v){ | ||
| 43 | + $v['product_num'] = KeywordRelated::where('keyword_id', $v['id'])->distinct()->count('product_id'); | ||
| 44 | + $v['tdk'] = boolval($v['seo_title']) * boolval($v['seo_keywords']) * boolval($v['seo_description']); | ||
| 45 | + $v['url'] = $this->getProjectDomain() . RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); | ||
| 46 | + } | ||
| 47 | + } | ||
| 39 | return $this->response('success',Code::SUCCESS,$data); | 48 | return $this->response('success',Code::SUCCESS,$data); |
| 40 | } | 49 | } |
| 41 | 50 |
-
请 注册 或 登录 后发表评论