正在显示
1 个修改的文件
包含
7 行增加
和
5 行删除
| @@ -527,18 +527,20 @@ class ProjectUpdate extends Command | @@ -527,18 +527,20 @@ class ProjectUpdate extends Command | ||
| 527 | { | 527 | { |
| 528 | $model = new NewsCategory(); | 528 | $model = new NewsCategory(); |
| 529 | foreach ($items as $item) { | 529 | foreach ($items as $item) { |
| 530 | - $item['name'] = $this->special2str($item['name'] ?? ''); | ||
| 531 | - if ($item['name']) { | ||
| 532 | - $parent = $model->read(['pid' => $pid, 'name' => $item['name']], 'id'); | 530 | + $route = $this->get_url_route($item['url'] ?? ''); |
| 531 | + if ($route) { | ||
| 532 | + $parent = $model->read(['pid' => $pid, 'alias' => $route], 'id'); | ||
| 533 | if (!$parent) { | 533 | if (!$parent) { |
| 534 | try { | 534 | try { |
| 535 | + $item['name'] = $this->special2str($item['name'] ?? ''); | ||
| 535 | $parent_id = $model->addReturnId([ | 536 | $parent_id = $model->addReturnId([ |
| 536 | 'project_id' => $project_id, | 537 | 'project_id' => $project_id, |
| 537 | 'name' => $item['name'], | 538 | 'name' => $item['name'], |
| 538 | 'pid' => $pid, | 539 | 'pid' => $pid, |
| 539 | - 'original_id' => $item['id'] | 540 | + 'original_id' => $item['id'], |
| 541 | + 'alias' => $route | ||
| 540 | ]); | 542 | ]); |
| 541 | - $this->set_map($this->get_url_route($item['url'] ?? ''), RouteMap::SOURCE_NEWS_CATE, $parent_id, $project_id); | 543 | + $this->set_map($route, RouteMap::SOURCE_NEWS_CATE, $parent_id, $project_id); |
| 542 | } catch (\Exception $e) { | 544 | } catch (\Exception $e) { |
| 543 | echo 'date:' . date('Y-m-d H:i:s') . ', category_news_insert error: ' . $e->getMessage() . PHP_EOL; | 545 | echo 'date:' . date('Y-m-d H:i:s') . ', category_news_insert error: ' . $e->getMessage() . PHP_EOL; |
| 544 | continue; | 546 | continue; |
-
请 注册 或 登录 后发表评论