|
...
|
...
|
@@ -234,70 +234,73 @@ class FetchTicketProjects extends Command |
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($items as $item) {
|
|
|
|
$uuid = md5("AICC{$item['id']}");
|
|
|
|
$project = TicketProject::where('uuid', $uuid)->first();
|
|
|
|
// 判断套餐是超迹还是域途, 如果 $item['plans'][0]['name'] 包含 '超迹' 则为超迹,否则为域途
|
|
|
|
$project_cate = Str::contains($item['plans'][0]['name'], '超迹') ? 3 : 4;
|
|
|
|
if ($project_cate == 3)
|
|
|
|
{
|
|
|
|
// 售后服务经理
|
|
|
|
$assm_id = collect([
|
|
|
|
ManageHr::where('name', $item['cj_assm']['real_name'] ?? '')->first()->manage_id ?? 0,
|
|
|
|
20, //徐莹
|
|
|
|
])->first(fn($v) => $v !== null && $v !== 0, 0);
|
|
|
|
}else
|
|
|
|
foreach ($item['plans'] as $plan)
|
|
|
|
{
|
|
|
|
// 域途
|
|
|
|
$assm_id = collect([
|
|
|
|
ManageHr::where('name', $item['yutu_assm']['real_name'] ?? '')->first()->manage_id ?? 0,
|
|
|
|
85, //黄小玉
|
|
|
|
])->first(fn($v) => $v !== null && $v !== 0, 0);
|
|
|
|
}
|
|
|
|
// 判断套餐是超迹还是域途, 如果 $item['plans'][0]['name'] 包含 '超迹' 则为超迹,否则为域途
|
|
|
|
$project_cate = Str::contains($plan['name'], '超迹') ? 3 : 4;
|
|
|
|
$uuid = md5("AICC{$item['id']}{$project_cate}");
|
|
|
|
$project = TicketProject::where('uuid', $uuid)->first();
|
|
|
|
if ($project_cate == 3)
|
|
|
|
{
|
|
|
|
// 售后服务经理
|
|
|
|
$assm_id = collect([
|
|
|
|
ManageHr::where('name', $item['cj_assm']['real_name'] ?? '')->first()->manage_id ?? 0,
|
|
|
|
20, //徐莹
|
|
|
|
])->first(fn($v) => $v !== null && $v !== 0, 0);
|
|
|
|
}else
|
|
|
|
{
|
|
|
|
// 域途
|
|
|
|
$assm_id = collect([
|
|
|
|
ManageHr::where('name', $item['yutu_assm']['real_name'] ?? '')->first()->manage_id ?? 0,
|
|
|
|
85, //黄小玉
|
|
|
|
])->first(fn($v) => $v !== null && $v !== 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 优化师
|
|
|
|
$seom_id = 0;
|
|
|
|
// 第一负责人
|
|
|
|
$engineer_id = $assm_id;
|
|
|
|
$is_del = 0;
|
|
|
|
// 优化师
|
|
|
|
$seom_id = 0;
|
|
|
|
// 第一负责人
|
|
|
|
$engineer_id = $assm_id;
|
|
|
|
$is_del = 0;
|
|
|
|
|
|
|
|
$fields = [
|
|
|
|
'company_name' => $item['company'],
|
|
|
|
'title' => $item['company'] . " - " . $item['plan'],
|
|
|
|
'assm_id' => $assm_id,
|
|
|
|
'seom_id' => $seom_id,
|
|
|
|
'engineer_id' => $engineer_id,
|
|
|
|
'is_del' => $is_del,
|
|
|
|
'website' => '',
|
|
|
|
'test_website' => '',
|
|
|
|
'version' => 1, // 版本号
|
|
|
|
'plan' => $item['plans'][0]['name'] ?? '',
|
|
|
|
'project_cate' => $project_cate,
|
|
|
|
'wechat_group_id' => $item['chatroom'],
|
|
|
|
];
|
|
|
|
$fields = [
|
|
|
|
'company_name' => $item['company'],
|
|
|
|
'title' => $item['company'] . " - " . $plan['name'],
|
|
|
|
'assm_id' => $assm_id,
|
|
|
|
'seom_id' => $seom_id,
|
|
|
|
'engineer_id' => $engineer_id,
|
|
|
|
'is_del' => $is_del,
|
|
|
|
'website' => '',
|
|
|
|
'test_website' => '',
|
|
|
|
'version' => 1, // 版本号
|
|
|
|
'plan' => $item['plans'][0]['name'] ?? '',
|
|
|
|
'project_cate' => $project_cate,
|
|
|
|
'wechat_group_id' => $item['chatroom'],
|
|
|
|
];
|
|
|
|
|
|
|
|
if (!$project) {
|
|
|
|
$project = new TicketProject();
|
|
|
|
$project->uuid = $uuid;
|
|
|
|
$project->post_id = $item['postid'];
|
|
|
|
$project->table_id = $item['id'];
|
|
|
|
foreach ($fields as $k => $v) {
|
|
|
|
$project->$k = $v;
|
|
|
|
}
|
|
|
|
$project->save();
|
|
|
|
} else {
|
|
|
|
$changed = false;
|
|
|
|
foreach ($fields as $k => $v) {
|
|
|
|
if ($project->$k != $v) {
|
|
|
|
if (!$project) {
|
|
|
|
$project = new TicketProject();
|
|
|
|
$project->uuid = $uuid;
|
|
|
|
$project->post_id = $item['postid'];
|
|
|
|
$project->table_id = $item['id'];
|
|
|
|
foreach ($fields as $k => $v) {
|
|
|
|
$project->$k = $v;
|
|
|
|
$changed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($changed) {
|
|
|
|
$project->save();
|
|
|
|
} else {
|
|
|
|
$changed = false;
|
|
|
|
foreach ($fields as $k => $v) {
|
|
|
|
if ($project->$k != $v) {
|
|
|
|
$project->$k = $v;
|
|
|
|
$changed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($changed) {
|
|
|
|
$project->save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$lastid = $item['id'];
|
|
|
|
echo now() . " | INFO | AICC: {$item['id']} {$item['company']} fetch ok \n";
|
|
|
|
}
|
|
|
|
$lastid = $item['id'];
|
|
|
|
echo now() . " | INFO | AICC: {$item['id']} {$item['company']} fetch ok \n";
|
|
|
|
}
|
|
|
|
}catch (\Exception $exception){
|
|
|
|
echo now() . " | ERROR | " . $exception->getMessage() . "\n" . $exception->getTraceAsString() . "\n";
|
...
|
...
|
|