作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !346
@@ -542,6 +542,16 @@ class ProjectUpdate extends Command @@ -542,6 +542,16 @@ 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 + $category = [
  547 + [
  548 + 'id' => 0,
  549 + 'name' => $custom_info['route'],
  550 + 'url' => '/' . $custom_info['route'],
  551 + 'parent' => 0
  552 + ]
  553 + ];
  554 + }
545 $this->category_custom_insert($project_id, $custom_info['id'], $category, 0); 555 $this->category_custom_insert($project_id, $custom_info['id'], $category, 0);
546 556
547 $count = $data['data']['count'] ?? 0; 557 $count = $data['data']['count'] ?? 0;
@@ -564,6 +574,11 @@ class ProjectUpdate extends Command @@ -564,6 +574,11 @@ class ProjectUpdate extends Command
564 if ($item['category'] ?? []) { 574 if ($item['category'] ?? []) {
565 $category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]); 575 $category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]);
566 $category_id = implode(',', array_column($category_arr, 'id')); 576 $category_id = implode(',', array_column($category_arr, 'id'));
  577 + } else {
  578 + $category_custom = $category_model->read(['route' => $custom_info['route']], 'id');
  579 + if ($category_custom) {
  580 + $category_id = $category_custom['id'];
  581 + }
567 } 582 }
568 //名称去掉特殊符号 583 //名称去掉特殊符号
569 $item['title'] = $this->special2str($item['title'] ?? ''); 584 $item['title'] = $this->special2str($item['title'] ?? '');