作者 张关杰

Merge remote-tracking branch 'origin/master' into bate

@@ -544,21 +544,15 @@ class ProjectUpdate extends Command @@ -544,21 +544,15 @@ class ProjectUpdate extends Command
544 $url = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => 1, 'pagesize' => 0]); 544 $url = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => 1, 'pagesize' => 0]);
545 $data = curl_c($url); 545 $data = curl_c($url);
546 if (isset($data['code']) && $data['code'] == 200) { 546 if (isset($data['code']) && $data['code'] == 200) {
547 - $category = $data['data']['category'] ?? [];  
548 - if (empty($category)) {  
549 - $route_model = new RouteMap();  
550 - $route_page = $route_model->read(['source' => 'page', 'route' => $custom_info['route']], 'id');  
551 - if (!$route_page) {  
552 $category = [ 547 $category = [
553 [ 548 [
554 'id' => 0, 549 'id' => 0,
555 'name' => $custom_info['route'], 550 'name' => $custom_info['route'],
556 'url' => '/' . $custom_info['route'], 551 'url' => '/' . $custom_info['route'],
557 - 'parent' => 0 552 + 'parent' => 0,
  553 + 'children' => $data['data']['category'] ?? []
558 ] 554 ]
559 ]; 555 ];
560 - }  
561 - }  
562 $this->category_custom_insert($project_id, $custom_info['id'], $category, 0); 556 $this->category_custom_insert($project_id, $custom_info['id'], $category, 0);
563 557
564 $count = $data['data']['count'] ?? 0; 558 $count = $data['data']['count'] ?? 0;
@@ -94,9 +94,8 @@ class UpdateProductCategory extends Command @@ -94,9 +94,8 @@ class UpdateProductCategory extends Command
94 if(!empty($cate_arr) && is_array($cate_arr)){ 94 if(!empty($cate_arr) && is_array($cate_arr)){
95 foreach ($cate_arr as $v){ 95 foreach ($cate_arr as $v){
96 $categoryModel = new Category(); 96 $categoryModel = new Category();
97 - $info = $categoryModel->read(['pid'=>$v],['id']);  
98 - if($info !== false){  
99 - //有下级时,跳过 97 + $info = $categoryModel->read(['id'=>$v],['id']);
  98 + if($info === false){
100 continue; 99 continue;
101 }else{ 100 }else{
102 //更新关联表 101 //更新关联表
@@ -154,18 +154,19 @@ class NewsController extends BaseController @@ -154,18 +154,19 @@ class NewsController extends BaseController
154 154
155 155
156 /** 156 /**
157 - * @name :添加新闻时获取分类列表  
158 - * @author :liyuhang  
159 - * @method 157 + * 添加新闻时获取分类列表
  158 + * @param NewsLogic $newsLogic
  159 + * @throws \App\Exceptions\BsideGlobalException
160 */ 160 */
161 public function get_category_list(NewsLogic $newsLogic){ 161 public function get_category_list(NewsLogic $newsLogic){
162 $list = $newsLogic->news_get_category_list(); 162 $list = $newsLogic->news_get_category_list();
163 $this->response('success',Code::SUCCESS,$list); 163 $this->response('success',Code::SUCCESS,$list);
164 } 164 }
  165 +
165 /** 166 /**
166 - * @name :获取详情  
167 - * @author :liyuhang  
168 - * @method 167 + * 获取新闻详情
  168 + * @param NewsLogic $newsLogic
  169 + * @throws \App\Exceptions\BsideGlobalException
169 */ 170 */
170 public function info(NewsLogic $newsLogic){ 171 public function info(NewsLogic $newsLogic){
171 $this->request->validate([ 172 $this->request->validate([
@@ -174,6 +175,10 @@ class NewsController extends BaseController @@ -174,6 +175,10 @@ class NewsController extends BaseController
174 'id.required' => 'ID不能为空', 175 'id.required' => 'ID不能为空',
175 ]); 176 ]);
176 $info = $newsLogic->newsInfo(); 177 $info = $newsLogic->newsInfo();
  178 +
  179 + $template_id = $this->getTemplateId(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL);//获取模版id
  180 + $info['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL,$template_id, $info['id']);
  181 +
177 $this->response('success',Code::SUCCESS,$info); 182 $this->response('success',Code::SUCCESS,$info);
178 } 183 }
179 184