作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !52
... ... @@ -63,7 +63,7 @@ class HtmlCollect extends Command
//设置数据库
$project = ProjectServer::useProject($project_id);
if ($project) {
$collect_info = CollectTask::select(['id', 'domain', 'route'])->where('id', $collect_id)->where('status', CollectTask::STATUS_UN)->first();
$collect_info = CollectTask::select(['id', 'domain', 'route'])->where('id', $collect_id)->where('status', CollectTask::STATUS_UN)->where('language', '')->first();
if (!$collect_info) {
sleep(2);
... ... @@ -84,6 +84,9 @@ class HtmlCollect extends Command
$html = $this->upload_source($html, $source_list, $project_id);
}
} catch (\Exception $e) {
$collect_info->status = CollectTask::STATUS_FAIL;
$collect_info->save();
echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $e->getMessage() . PHP_EOL;
return true;
}
... ... @@ -137,7 +140,7 @@ class HtmlCollect extends Command
//设置数据库
$project = ProjectServer::useProject($update_log->project_id);
if ($project) {
$collect_list = CollectTask::select(['id', 'project_id'])->where('project_id', $update_log['project_id'])->where('source', $source)->where('language', '')->where('status', CollectTask::STATUS_UN)->orderBy('language', 'asc')->limit(50)->get();
$collect_list = CollectTask::select(['id', 'project_id'])->where('project_id', $update_log['project_id'])->where('source', $source)->where('language', '')->where('status', CollectTask::STATUS_UN)->orderBy('id', 'asc')->limit(50)->get();
if ($collect_list->count() == 0) {
$complete = true;
... ...
... ... @@ -63,7 +63,7 @@ class HtmlLanguageCollect extends Command
//设置数据库
$project = ProjectServer::useProject($project_id);
if ($project) {
$collect_info = CollectTask::select(['id', 'domain', 'route'])->where('id', $collect_id)->where('status', CollectTask::STATUS_UN)->first();
$collect_info = CollectTask::select(['id', 'domain', 'route'])->where('id', $collect_id)->where('status', CollectTask::STATUS_UN)->where('language', '!=', '')->first();
if (!$collect_info) {
sleep(2);
... ... @@ -84,6 +84,9 @@ class HtmlLanguageCollect extends Command
$html = $this->upload_source($html, $source_list, $project_id);
}
} catch (\Exception $e) {
$collect_info->status = CollectTask::STATUS_FAIL;
$collect_info->save();
echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $e->getMessage() . PHP_EOL;
return true;
}
... ... @@ -137,7 +140,7 @@ class HtmlLanguageCollect extends Command
//设置数据库
$project = ProjectServer::useProject($update_log->project_id);
if ($project) {
$collect_list = CollectTask::select(['id', 'project_id'])->where('project_id', $update_log['project_id'])->where('source', $source)->where('language', '!=', '')->where('status', CollectTask::STATUS_UN)->orderBy('language', 'asc')->limit(50)->get();
$collect_list = CollectTask::select(['id', 'project_id'])->where('project_id', $update_log['project_id'])->where('source', $source)->where('language', '!=', '')->where('status', CollectTask::STATUS_UN)->orderBy('id', 'asc')->limit(50)->get();
if ($collect_list->count() == 0) {
$complete = true;
... ...
... ... @@ -15,6 +15,7 @@ class CollectTask extends Base
const STATUS_UN = 0;
const STATUS_ING = 1;
const STATUS_COM = 2;
const STATUS_FAIL = 3;
public static function _insert($url, $project_id, $source, $source_id, $link_type = 0, $language_list = [])
{
... ...