作者 刘锟

update

... ... @@ -527,18 +527,20 @@ class ProjectUpdate extends Command
{
$model = new NewsCategory();
foreach ($items as $item) {
$item['name'] = $this->special2str($item['name'] ?? '');
if ($item['name']) {
$parent = $model->read(['pid' => $pid, 'name' => $item['name']], 'id');
$route = $this->get_url_route($item['url'] ?? '');
if ($route) {
$parent = $model->read(['pid' => $pid, 'alias' => $route], 'id');
if (!$parent) {
try {
$item['name'] = $this->special2str($item['name'] ?? '');
$parent_id = $model->addReturnId([
'project_id' => $project_id,
'name' => $item['name'],
'pid' => $pid,
'original_id' => $item['id']
'original_id' => $item['id'],
'alias' => $route
]);
$this->set_map($this->get_url_route($item['url'] ?? ''), RouteMap::SOURCE_NEWS_CATE, $parent_id, $project_id);
$this->set_map($route, RouteMap::SOURCE_NEWS_CATE, $parent_id, $project_id);
} catch (\Exception $e) {
echo 'date:' . date('Y-m-d H:i:s') . ', category_news_insert error: ' . $e->getMessage() . PHP_EOL;
continue;
... ...