|
@@ -989,8 +989,9 @@ class NewsService implements NewsServiceInterface
|
|
|
public function getWebsiteAllArticle(array $data): array
|
|
|
{
|
|
|
$time1 = microtime(true);
|
|
|
- $data = json_decode($data['id'], true);
|
|
|
$wetbsite_id = $data['website_id'] ?? 2;
|
|
|
+ $data = json_decode($data['id'], true);
|
|
|
+
|
|
|
$categorys = $this->processArticlePro($wetbsite_id);
|
|
|
$cat_1st_arr = $categorys['cat_1st_arr'];
|
|
|
$catiall = $categorys['catiall'];
|
|
@@ -1006,7 +1007,8 @@ class NewsService implements NewsServiceInterface
|
|
|
$article_imgnum = $arr[1] ?? 0;
|
|
|
$article_textnum = $arr[2] ?? 0;
|
|
|
if($parent_category != 0){
|
|
|
- $category_arr = array_merge([$parent_category], $cat_1st_arr[$parent_category]);
|
|
|
+ $category_arr = array_merge([$parent_category], $cat_1st_arr[$parent_category] ?? [0]);
|
|
|
+ // return Result::success($category_arr);
|
|
|
if($article_imgnum != 0){
|
|
|
$img_article = Article::whereIn('catid', $category_arr)
|
|
|
->where('status',1)
|
|
@@ -1666,20 +1668,12 @@ private function fetchArticles($catId, $website, $limit, $isImageArticle = false
|
|
|
//一级所有子级的记录
|
|
|
$cat_1st_arr = [];
|
|
|
foreach ($categorys as $key => $value) {
|
|
|
- if($value->pid != 0 && !in_array($value->category_id,$categoryPIds)){
|
|
|
- $cat_1st_arr[$value->pid][] = $value->category_id;
|
|
|
- }
|
|
|
- // unset($cat_1st_arr[0]);
|
|
|
- // //算出路由拼音
|
|
|
$category_arr_id = json_decode($value->category_arr_id);
|
|
|
$pinyin_str = '';
|
|
|
// 算出一级 并且算出子级
|
|
|
- if ($value->pid == 0) {
|
|
|
+ if ($value->pid != 0) {
|
|
|
$cat_1st_arr[$value->pid][] = $value->category_id;
|
|
|
- } else {
|
|
|
- $cat_1st_arr[$value->category_id][] = [];
|
|
|
- // $cat_1st_arr[$value->pid][] = $value->category_id;
|
|
|
- }
|
|
|
+ }
|
|
|
foreach ($category_arr_id as $k => $v) {
|
|
|
$pinyin_str .= $cat_arr[$v] . '/';
|
|
|
}
|
|
@@ -1688,7 +1682,6 @@ private function fetchArticles($catId, $website, $limit, $isImageArticle = false
|
|
|
$catiall[$value->category_id]['category_id'] = $value->category_id;
|
|
|
$catiall[$value->category_id]['type'] = $value->type;
|
|
|
$catiall[$value->category_id]['pinyin'] = $pinyin_str;
|
|
|
- // $cat_id = $value->category_id;
|
|
|
$websiteInfoIndexed[$value->category_id]->pinyin = $pinyin_str;
|
|
|
}
|
|
|
return [
|