|
@@ -140,7 +140,7 @@ class ProjectUpdate extends Command |
|
@@ -140,7 +140,7 @@ class ProjectUpdate extends Command |
|
140
|
'seo_keywords' => $item['seo_keywords'] ?? '',
|
140
|
'seo_keywords' => $item['seo_keywords'] ?? '',
|
|
141
|
'seo_description' => $item['seo_description'] ?? '',
|
141
|
'seo_description' => $item['seo_description'] ?? '',
|
|
142
|
]);
|
142
|
]);
|
|
143
|
- $route = RouteMap::setRoute($this->get_url_route($item['url']) ?: $item['name'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $project_id);
|
143
|
+ $route = $this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $project_id);
|
|
144
|
$model->edit(['route' => $route], ['id' => $id]);
|
144
|
$model->edit(['route' => $route], ['id' => $id]);
|
|
145
|
} catch (\Exception $e) {
|
145
|
} catch (\Exception $e) {
|
|
146
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
146
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
|
@@ -273,7 +273,7 @@ class ProjectUpdate extends Command |
|
@@ -273,7 +273,7 @@ class ProjectUpdate extends Command |
|
273
|
]),
|
273
|
]),
|
|
274
|
'status' => Product::STATUS_ON
|
274
|
'status' => Product::STATUS_ON
|
|
275
|
]);
|
275
|
]);
|
|
276
|
- $route = RouteMap::setRoute($this->get_url_route($item['url']) ?: $item['ttile'], RouteMap::SOURCE_PRODUCT, $id, $project_id);
|
276
|
+ $route = $this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT, $id, $project_id);
|
|
277
|
$model->edit(['route' => $route], ['id' => $id]);
|
277
|
$model->edit(['route' => $route], ['id' => $id]);
|
|
278
|
} catch (\Exception $e) {
|
278
|
} catch (\Exception $e) {
|
|
279
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
279
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
|
@@ -328,7 +328,7 @@ class ProjectUpdate extends Command |
|
@@ -328,7 +328,7 @@ class ProjectUpdate extends Command |
|
328
|
'image' => $item['images'][0] ?? '',
|
328
|
'image' => $item['images'][0] ?? '',
|
|
329
|
'status' => $api_type == 'news' ? News::STATUS_ONE : Blog::STATUS_ONE
|
329
|
'status' => $api_type == 'news' ? News::STATUS_ONE : Blog::STATUS_ONE
|
|
330
|
]);
|
330
|
]);
|
|
331
|
- $route = RouteMap::setRoute($this->get_url_route($item['url']) ?: $item['ttile'], $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $project_id);
|
331
|
+ $route = $this->set_map($this->get_url_route($item['url']), $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $project_id);
|
|
332
|
$model->edit(['url' => $route], ['id' => $id]);
|
332
|
$model->edit(['url' => $route], ['id' => $id]);
|
|
333
|
} catch (\Exception $e) {
|
333
|
} catch (\Exception $e) {
|
|
334
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
334
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
|
@@ -377,7 +377,7 @@ class ProjectUpdate extends Command |
|
@@ -377,7 +377,7 @@ class ProjectUpdate extends Command |
|
377
|
'html' => $item['content'] ?? '',
|
377
|
'html' => $item['content'] ?? '',
|
|
378
|
'status' => 1
|
378
|
'status' => 1
|
|
379
|
]);
|
379
|
]);
|
|
380
|
- $route = RouteMap::setRoute($this->get_url_route($item['url']) ?: $item['ttile'], RouteMap::SOURCE_PAGE, $id, $project_id);
|
380
|
+ $route = $this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PAGE, $id, $project_id);
|
|
381
|
$model->edit(['url' => $route], ['id' => $id]);
|
381
|
$model->edit(['url' => $route], ['id' => $id]);
|
|
382
|
} catch (\Exception $e) {
|
382
|
} catch (\Exception $e) {
|
|
383
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
383
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
|
@@ -465,7 +465,7 @@ class ProjectUpdate extends Command |
|
@@ -465,7 +465,7 @@ class ProjectUpdate extends Command |
|
465
|
'keywords' => $item['keywords'] ?? '',
|
465
|
'keywords' => $item['keywords'] ?? '',
|
|
466
|
'describe' => $item['description'] ?? ''
|
466
|
'describe' => $item['description'] ?? ''
|
|
467
|
]);
|
467
|
]);
|
|
468
|
- $route = RouteMap::setRoute($this->get_url_route($item['url']) ?: $item['name'], RouteMap::SOURCE_PRODUCT_CATE, $parent_id, $project_id);
|
468
|
+ $route = $this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT_CATE, $parent_id, $project_id);
|
|
469
|
$model->edit(['route' => $route], ['id' => $parent_id]);
|
469
|
$model->edit(['route' => $route], ['id' => $parent_id]);
|
|
470
|
} catch (\Exception $e) {
|
470
|
} catch (\Exception $e) {
|
|
471
|
echo 'date:' . date('Y-m-d H:i:s') . ', category_insert error: ' . $e->getMessage() . PHP_EOL;
|
471
|
echo 'date:' . date('Y-m-d H:i:s') . ', category_insert error: ' . $e->getMessage() . PHP_EOL;
|
|
@@ -516,4 +516,28 @@ class ProjectUpdate extends Command |
|
@@ -516,4 +516,28 @@ class ProjectUpdate extends Command |
|
516
|
|
516
|
|
|
517
|
return $str;
|
517
|
return $str;
|
|
518
|
}
|
518
|
}
|
|
|
|
519
|
+
|
|
|
|
520
|
+ //路由入库
|
|
|
|
521
|
+ protected function set_map($route, $source, $source_id, $project_id)
|
|
|
|
522
|
+ {
|
|
|
|
523
|
+ if (empty($route)) {
|
|
|
|
524
|
+ return '';
|
|
|
|
525
|
+ }
|
|
|
|
526
|
+
|
|
|
|
527
|
+ $route_map = new RouteMap();
|
|
|
|
528
|
+ $route_map->project_id = $project_id;
|
|
|
|
529
|
+ $route_map->source = $source;
|
|
|
|
530
|
+ $route_map->source_id = $source_id;
|
|
|
|
531
|
+ $route_map->route = $route;
|
|
|
|
532
|
+
|
|
|
|
533
|
+ if ($source == RouteMap::SOURCE_NEWS) {
|
|
|
|
534
|
+ $route_map->path = RouteMap::SOURCE_NEWS;
|
|
|
|
535
|
+ } elseif ($source == RouteMap::SOURCE_BLOG) {
|
|
|
|
536
|
+ $route_map->path = RouteMap::SOURCE_BLOG;
|
|
|
|
537
|
+ }
|
|
|
|
538
|
+
|
|
|
|
539
|
+ $route_map->save();
|
|
|
|
540
|
+
|
|
|
|
541
|
+ return $route;
|
|
|
|
542
|
+ }
|
|
519
|
} |
543
|
} |