|
...
|
...
|
@@ -51,7 +51,7 @@ class FetchTicketProjects extends Command |
|
|
|
* @return void
|
|
|
|
* 请求:https://www.quanqiusou.cn/extend_api/webs/globalso_all.php
|
|
|
|
*/
|
|
|
|
public function fetch_v5()
|
|
|
|
public function fetchV5()
|
|
|
|
{
|
|
|
|
# pm 项目经理 assm 售后服务经理
|
|
|
|
$response = Http::get('https://www.quanqiusou.cn/extend_api/webs/globalso_all.php');
|
|
...
|
...
|
@@ -72,13 +72,14 @@ class FetchTicketProjects extends Command |
|
|
|
$engineer_id = (strpos($item['cate'], '推广') !== false) ? $assm_id : Manage::where('name', '杨长远')->value('id') ?? 0;
|
|
|
|
|
|
|
|
$fields = [
|
|
|
|
'post_id' => $item['postid'],
|
|
|
|
'company_name' => $item['company'],
|
|
|
|
'title' => $item['title'],
|
|
|
|
'engineer_id' => $engineer_id, // 第一负责人
|
|
|
|
'assm_id' => $assm_id,
|
|
|
|
'seom_id' => $seom_id,
|
|
|
|
'website' => $item['main_url'] ?? '',
|
|
|
|
'post_id' => $item['postid'],
|
|
|
|
'company_name' => $item['company'],
|
|
|
|
'title' => $item['title'],
|
|
|
|
'engineer_id' => $engineer_id, // 第一负责人
|
|
|
|
'assm_id' => $assm_id,
|
|
|
|
'seom_id' => $seom_id,
|
|
|
|
'website' => $item['main_url'] ?? '',
|
|
|
|
'is_del' => 0,
|
|
|
|
];
|
|
|
|
if (!$project) {
|
|
|
|
$new = new TicketProject();
|
|
...
|
...
|
@@ -103,6 +104,12 @@ class FetchTicketProjects extends Command |
|
|
|
}
|
|
|
|
echo "V5: {$item['postid']} - {$item['title']} - {$item['company']} - {$item['main_url']}\n";
|
|
|
|
}
|
|
|
|
$postids = collect($items)->pluck('postid')->toArray();
|
|
|
|
// 软删除 gl_ticket_projects 中不存在的项目
|
|
|
|
TicketProject::where('version', 5)
|
|
|
|
->whereNotIn('post_id', $postids)
|
|
|
|
->update(['is_del' => 1]);
|
|
|
|
echo "V5: fetch completed, total " . count($items) . " items\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -111,12 +118,15 @@ class FetchTicketProjects extends Command |
|
|
|
* 1. 按照ID升序查询 gl_project 表 limit 10
|
|
|
|
* 2。同步到 TicketProject 后,redis 缓存 ID
|
|
|
|
*/
|
|
|
|
public function fetch_v6()
|
|
|
|
public function fetchV6()
|
|
|
|
{
|
|
|
|
$lastid = 0;
|
|
|
|
while (true) {
|
|
|
|
try {
|
|
|
|
$items = Project::where('id', '>', intval($lastid))
|
|
|
|
// ->where('delete_status', 0)
|
|
|
|
// ->where('extend_type', '!=', 5) // 排除归档项目
|
|
|
|
// ->where('type', '!=', 8) // 排除归档项目
|
|
|
|
->orderBy('id', 'asc')
|
|
|
|
->limit(10)
|
|
|
|
->get();
|
|
...
|
...
|
@@ -143,22 +153,29 @@ class FetchTicketProjects extends Command |
|
|
|
if (in_array($item->type, [Project::TYPE_TWO, Project::TYPE_FOUR, Project::TYPE_SIX])) {
|
|
|
|
// 优化推广项目
|
|
|
|
$engineer_id = $assm_id;
|
|
|
|
}elseif ($item->type == Project::TYPE_THREE) {
|
|
|
|
} elseif ($item->type == Project::TYPE_THREE) {
|
|
|
|
$engineer_id = Manage::where('name', '杨长远')->value('id') ?? 0; // 建站类项目找杨长远
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
$engineer_id = collect([
|
|
|
|
$item->deploy_build->manager_mid ?? 0,
|
|
|
|
$item->deploy_build->leader_mid ?? 0,
|
|
|
|
0
|
|
|
|
])->first(fn($v) => $v !== null && $v !== 0, 0);
|
|
|
|
}
|
|
|
|
$is_del = (
|
|
|
|
$item->extend_type == 5
|
|
|
|
|| $item->type == 8
|
|
|
|
|| $item->delete_status == 1
|
|
|
|
|| $item->site_status == 1
|
|
|
|
) ? 1 : 0;
|
|
|
|
|
|
|
|
$fields = [
|
|
|
|
'company_name' => $item->company,
|
|
|
|
'title' => $item->title,
|
|
|
|
'company_name' => $item->company,
|
|
|
|
'title' => $item->title,
|
|
|
|
'assm_id' => $assm_id,
|
|
|
|
'seom_id' => $seom_id,
|
|
|
|
'engineer_id' => $engineer_id
|
|
|
|
'engineer_id' => $engineer_id,
|
|
|
|
'is_del' => $is_del
|
|
|
|
];
|
|
|
|
if (!$project) {
|
|
|
|
$project = new TicketProject();
|
|
...
|
...
|
@@ -170,7 +187,7 @@ class FetchTicketProjects extends Command |
|
|
|
$project->$k = $v;
|
|
|
|
}
|
|
|
|
$project->save();
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
$changed = false;
|
|
|
|
foreach ($fields as $k => $v) {
|
|
|
|
if ($project->$k != $v) {
|
|
...
|
...
|
@@ -185,7 +202,7 @@ class FetchTicketProjects extends Command |
|
|
|
$lastid = $item->id;
|
|
|
|
echo date('Y-m-d H:i:s') . " V6: $item->id {$item->company} fetch ok \n";
|
|
|
|
}
|
|
|
|
}catch (\Exception $exception) {
|
|
|
|
} catch (\Exception $exception) {
|
|
|
|
echo $exception;
|
|
|
|
break;
|
|
|
|
}
|
|
...
|
...
|
@@ -213,7 +230,7 @@ class FetchTicketProjects extends Command |
|
|
|
$lastid = $item->id;
|
|
|
|
echo date('Y-m-d H:i:s') . " V6: $item->id fetch ok \n";
|
|
|
|
}
|
|
|
|
}catch (\Exception $exception) {
|
|
|
|
} catch (\Exception $exception) {
|
|
|
|
echo $exception;
|
|
|
|
break;
|
|
|
|
}
|
...
|
...
|
|