|
@@ -1156,11 +1156,11 @@ class PostRepository
|
|
|
/**
|
|
|
* 添加网站内容
|
|
|
*/
|
|
|
- public function createStore($startPage, $endPage, $size)
|
|
|
+ public function createStore($startPage, $endPage, $size, $categoryId)
|
|
|
{
|
|
|
set_time_limit(1800);
|
|
|
for($i=$startPage;$i<=$endPage;$i++){
|
|
|
- $this->addContent($i, $size);
|
|
|
+ $this->addContent($i, $size, $categoryId);
|
|
|
usleep(100000);
|
|
|
}
|
|
|
|
|
@@ -1169,9 +1169,9 @@ class PostRepository
|
|
|
/**
|
|
|
* 获取网站内容
|
|
|
*/
|
|
|
- public function addContent($page, $size)
|
|
|
+ public function addContent($page, $size, $categoryId)
|
|
|
{
|
|
|
- $lists = $this->getAcFunList($page, $size);
|
|
|
+ $lists = $this->getAcFunList($page, $size, $categoryId);
|
|
|
if(empty($lists)){
|
|
|
return Response::create([
|
|
|
'message' => '获取数据失败',
|
|
@@ -1204,6 +1204,7 @@ class PostRepository
|
|
|
$storeData = [
|
|
|
'source' => 'Acfun',
|
|
|
'source_id' => $item['source_id'],
|
|
|
+ 'category_id' => $categoryId,
|
|
|
'title' => $item['title'],
|
|
|
'content' => $item['content'],
|
|
|
'img' => $item['images'][0],
|
|
@@ -1292,6 +1293,10 @@ class PostRepository
|
|
|
$where[] = ['type', $request['type']];
|
|
|
}
|
|
|
|
|
|
+ if (isset($request['category_id'])) {
|
|
|
+ $where[] = ['category_id', $request['category_id']];
|
|
|
+ }
|
|
|
+
|
|
|
if (isset($request['title'])) {
|
|
|
$where[] = ['title', 'like', "%{$request['title']}%"];
|
|
|
}
|