作者 刘锟

update

@@ -542,6 +542,20 @@ class ProjectUpdate extends Command @@ -542,6 +542,20 @@ class ProjectUpdate extends Command
542 $data = curl_c($url); 542 $data = curl_c($url);
543 if (isset($data['code']) && $data['code'] == 200) { 543 if (isset($data['code']) && $data['code'] == 200) {
544 $category = $data['data']['category'] ?? []; 544 $category = $data['data']['category'] ?? [];
  545 + if (empty($category)) {
  546 + $route_model = new RouteMap();
  547 + $route_page = $route_model->read(['source' => 'page', 'route' => $custom_info['route']], 'id');
  548 + if (!$route_page) {
  549 + $category = [
  550 + [
  551 + 'id' => 0,
  552 + 'name' => $custom_info['route'],
  553 + 'url' => '/' . $custom_info['route'],
  554 + 'parent' => 0
  555 + ]
  556 + ];
  557 + }
  558 + }
545 $this->category_custom_insert($project_id, $custom_info['id'], $category, 0); 559 $this->category_custom_insert($project_id, $custom_info['id'], $category, 0);
546 560
547 $count = $data['data']['count'] ?? 0; 561 $count = $data['data']['count'] ?? 0;
@@ -564,6 +578,11 @@ class ProjectUpdate extends Command @@ -564,6 +578,11 @@ class ProjectUpdate extends Command
564 if ($item['category'] ?? []) { 578 if ($item['category'] ?? []) {
565 $category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]); 579 $category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]);
566 $category_id = implode(',', array_column($category_arr, 'id')); 580 $category_id = implode(',', array_column($category_arr, 'id'));
  581 + } else {
  582 + $category_custom = $category_model->read(['route' => $custom_info['route']], 'id');
  583 + if ($category_custom) {
  584 + $category_id = $category_custom['id'];
  585 + }
567 } 586 }
568 //名称去掉特殊符号 587 //名称去掉特殊符号
569 $item['title'] = $this->special2str($item['title'] ?? ''); 588 $item['title'] = $this->special2str($item['title'] ?? '');