|
...
|
...
|
@@ -77,18 +77,22 @@ class ProjectImport extends Command |
|
|
|
foreach ($line_of_text as $k => $v) {
|
|
|
|
if ($k > 0 && isset($v[0]) && $v[0]) {
|
|
|
|
$total_count += 1;
|
|
|
|
if ($task->type == ImportTask::TYPE_NEWS) {
|
|
|
|
if ((new NewsLogic())->importNews($task->project_id, $task->user_id, $v)) {
|
|
|
|
$success_count += 1;
|
|
|
|
}
|
|
|
|
} elseif ($task->type == ImportTask::TYPE_BLOG) {
|
|
|
|
if ((new BlogLogic())->importBlog($task->project_id, $task->user_id, $v)) {
|
|
|
|
$success_count += 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ((new ProductLogic())->importProduct($task->project_id, $task->user_id, $v)) {
|
|
|
|
$success_count += 1;
|
|
|
|
try {
|
|
|
|
if ($task->type == ImportTask::TYPE_NEWS) {
|
|
|
|
if ((new NewsLogic())->importNews($task->project_id, $task->user_id, $v)) {
|
|
|
|
$success_count += 1;
|
|
|
|
}
|
|
|
|
} elseif ($task->type == ImportTask::TYPE_BLOG) {
|
|
|
|
if ((new BlogLogic())->importBlog($task->project_id, $task->user_id, $v)) {
|
|
|
|
$success_count += 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ((new ProductLogic())->importProduct($task->project_id, $task->user_id, $v)) {
|
|
|
|
$success_count += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', title: ' . $v[0] . ', import fail, error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
...
|
...
|
|