|
|
@@ -2875,11 +2875,11 @@ private function fetchArticles($catId, $website, $limit, $isImageArticle = false
|
|
|
$query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
|
->orWhereNull("ignore_ids");
|
|
|
})
|
|
|
- ->first(['cat_arr_id']);
|
|
|
+ ->first(['catid']);
|
|
|
if (empty($article)) {
|
|
|
return Result::error("该文章不存在", 0);
|
|
|
}
|
|
|
- // return Result::success($article);
|
|
|
+ // return Result::success($article);
|
|
|
break;
|
|
|
case 2:
|
|
|
// 商品
|
|
|
@@ -2953,9 +2953,16 @@ private function fetchArticles($catId, $website, $limit, $isImageArticle = false
|
|
|
return Result::error("该数据不存在", 0);
|
|
|
break;
|
|
|
}
|
|
|
+ // return Result::success($article);
|
|
|
$catid =0 ;
|
|
|
- $catidArray = json_decode($article['cat_arr_id'], true);
|
|
|
- $catid = !empty($catidArray) ? end($catidArray) : null;
|
|
|
+
|
|
|
+ if(!isset($article['cat_arr_id'])){
|
|
|
+ $catid = isset($article['catid']) ? $article['catid'] : (isset($article['category_id']) ? $article['category_id'] : null);
|
|
|
+ }else{
|
|
|
+ $catidArray = json_decode($article['cat_arr_id'], true);
|
|
|
+ $catid = !empty($catidArray) ? end($catidArray) : null;
|
|
|
+ }
|
|
|
+ // return Result::success($catid);
|
|
|
// return Result::success($article['cat_arr_id']);
|
|
|
if (empty($catid)) {
|
|
|
return Result::error("该数据不存在", 0);
|
|
|
@@ -2963,23 +2970,21 @@ private function fetchArticles($catId, $website, $limit, $isImageArticle = false
|
|
|
|
|
|
$pinyin = WebsiteCategory::where('website_id', $data['website_id'])
|
|
|
->where('category_id',$catid)
|
|
|
- ->first('path')
|
|
|
- ->toArray();
|
|
|
+ ->first('path');
|
|
|
}else{
|
|
|
// if ($last_category['pid'] != 0) {
|
|
|
$cat_arr = json_decode($last_category['category_arr_id'], true);
|
|
|
- $catid = !empty($cat_arr) ? end($cat_arr) : null;
|
|
|
+ $catid = !empty($cat_arr) && is_array($cat_arr) ? end($cat_arr) : null;
|
|
|
$pinyin = WebsiteCategory::where('website_id', $data['website_id'])
|
|
|
->where('category_id',$catid)
|
|
|
->where('path',$data['all_route'])
|
|
|
- ->first('path')
|
|
|
- ->toArray();
|
|
|
+ ->first('path');
|
|
|
// } else {
|
|
|
// $pinyin[0] = $last_category['aLIas_pinyin'];
|
|
|
// }
|
|
|
}
|
|
|
- // return Result::success($pinyin[0]);
|
|
|
- if (empty($pinyin) || count($pinyin)>1 || $pinyin['path'] != $data['all_route']) {
|
|
|
+ // return Result::success($pinyin);
|
|
|
+ if (empty($pinyin) || $pinyin['path'] != $data['all_route']) {
|
|
|
return Result::error('非法路径!');
|
|
|
} else {
|
|
|
return Result::success($pinyin);
|