|
...
|
...
|
@@ -58,7 +58,7 @@ class ProjectImport extends Command |
|
|
|
$task->status = ImportTask::STATUS_COM;//导入完成
|
|
|
|
$task->save();
|
|
|
|
|
|
|
|
$this->send_mail($task->user_id, $task->created_at, 0, 0, '文件编码格式错误,仅支持UTF-8和GBK编码格式');
|
|
|
|
$this->send_mail($task->user_id, $task->created_at, $task->type, 0, 0, '文件编码格式错误,仅支持UTF-8和GBK编码格式');
|
|
|
|
return true;
|
|
|
|
} elseif ($file_code_type === 'GBK') {
|
|
|
|
$is_gbk = 1;
|
|
...
|
...
|
@@ -78,7 +78,7 @@ class ProjectImport extends Command |
|
|
|
$task->status = ImportTask::STATUS_COM;//导入完成
|
|
|
|
$task->save();
|
|
|
|
|
|
|
|
$this->send_mail($task->user_id, $task->created_at, 0, 0, '读取文件数据失败');
|
|
|
|
$this->send_mail($task->user_id, $task->created_at, $task->type, 0, 0, '读取文件数据失败');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -137,7 +137,7 @@ class ProjectImport extends Command |
|
|
|
$task->success_count += $success_count;
|
|
|
|
$task->save();
|
|
|
|
|
|
|
|
$this->send_mail($task->user_id, $task->created_at, $success_count, $repeat_count, '');
|
|
|
|
$this->send_mail($task->user_id, $task->created_at, $task->type, $success_count, $repeat_count, '');
|
|
|
|
|
|
|
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', import end, total count: ' . $total_count . ', success count: ' . $success_count . PHP_EOL;
|
|
|
|
|
|
...
|
...
|
@@ -159,10 +159,17 @@ class ProjectImport extends Command |
|
|
|
}
|
|
|
|
|
|
|
|
//发生站内通知
|
|
|
|
protected function send_mail($user_list, $time, $success_count, $repeat_count, $reason)
|
|
|
|
protected function send_mail($user_list, $time, $type, $success_count, $repeat_count, $reason)
|
|
|
|
{
|
|
|
|
if ($type == ImportTask::TYPE_NEWS) {
|
|
|
|
$type_content = '新闻';
|
|
|
|
} elseif ($type == ImportTask::TYPE_BLOG) {
|
|
|
|
$type_content = '博客';
|
|
|
|
} else {
|
|
|
|
$type_content = '产品';
|
|
|
|
}
|
|
|
|
$title = '导入结果通知';
|
|
|
|
$content = '您于 ' . $time . ' 添加的导入任务已执行完成, 成功导入数据:' . $success_count . ' 条';
|
|
|
|
$content = '您于 ' . $time . ' 添加的 ' . $type_content . ' 导入任务已执行完成, 成功导入数据:' . $success_count . ' 条';
|
|
|
|
$repeat_count && $content .= ',过滤已存在数据:' . $repeat_count . ' 条';
|
|
|
|
$reason && $content .= ',原因:' . $reason;
|
|
|
|
|
...
|
...
|
|