合并分支 'workorder' 到 'master'
plan 查看合并请求 !2299
正在显示
1 个修改的文件
包含
58 行增加
和
55 行删除
| @@ -234,70 +234,73 @@ class FetchTicketProjects extends Command | @@ -234,70 +234,73 @@ class FetchTicketProjects extends Command | ||
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | foreach ($items as $item) { | 236 | foreach ($items as $item) { |
| 237 | - $uuid = md5("AICC{$item['id']}"); | ||
| 238 | - $project = TicketProject::where('uuid', $uuid)->first(); | ||
| 239 | - // 判断套餐是超迹还是域途, 如果 $item['plans'][0]['name'] 包含 '超迹' 则为超迹,否则为域途 | ||
| 240 | - $project_cate = Str::contains($item['plans'][0]['name'], '超迹') ? 3 : 4; | ||
| 241 | - if ($project_cate == 3) | ||
| 242 | - { | ||
| 243 | - // 售后服务经理 | ||
| 244 | - $assm_id = collect([ | ||
| 245 | - ManageHr::where('name', $item['cj_assm']['real_name'] ?? '')->first()->manage_id ?? 0, | ||
| 246 | - 20, //徐莹 | ||
| 247 | - ])->first(fn($v) => $v !== null && $v !== 0, 0); | ||
| 248 | - }else | 237 | + foreach ($item['plans'] as $plan) |
| 249 | { | 238 | { |
| 250 | - // 域途 | ||
| 251 | - $assm_id = collect([ | ||
| 252 | - ManageHr::where('name', $item['yutu_assm']['real_name'] ?? '')->first()->manage_id ?? 0, | ||
| 253 | - 85, //黄小玉 | ||
| 254 | - ])->first(fn($v) => $v !== null && $v !== 0, 0); | ||
| 255 | - } | 239 | + // 判断套餐是超迹还是域途, 如果 $item['plans'][0]['name'] 包含 '超迹' 则为超迹,否则为域途 |
| 240 | + $project_cate = Str::contains($plan['name'], '超迹') ? 3 : 4; | ||
| 241 | + $uuid = md5("AICC{$item['id']}{$project_cate}"); | ||
| 242 | + $project = TicketProject::where('uuid', $uuid)->first(); | ||
| 243 | + if ($project_cate == 3) | ||
| 244 | + { | ||
| 245 | + // 售后服务经理 | ||
| 246 | + $assm_id = collect([ | ||
| 247 | + ManageHr::where('name', $item['cj_assm']['real_name'] ?? '')->first()->manage_id ?? 0, | ||
| 248 | + 20, //徐莹 | ||
| 249 | + ])->first(fn($v) => $v !== null && $v !== 0, 0); | ||
| 250 | + }else | ||
| 251 | + { | ||
| 252 | + // 域途 | ||
| 253 | + $assm_id = collect([ | ||
| 254 | + ManageHr::where('name', $item['yutu_assm']['real_name'] ?? '')->first()->manage_id ?? 0, | ||
| 255 | + 85, //黄小玉 | ||
| 256 | + ])->first(fn($v) => $v !== null && $v !== 0, 0); | ||
| 257 | + } | ||
| 256 | 258 | ||
| 257 | - // 优化师 | ||
| 258 | - $seom_id = 0; | ||
| 259 | - // 第一负责人 | ||
| 260 | - $engineer_id = $assm_id; | ||
| 261 | - $is_del = 0; | 259 | + // 优化师 |
| 260 | + $seom_id = 0; | ||
| 261 | + // 第一负责人 | ||
| 262 | + $engineer_id = $assm_id; | ||
| 263 | + $is_del = 0; | ||
| 262 | 264 | ||
| 263 | - $fields = [ | ||
| 264 | - 'company_name' => $item['company'], | ||
| 265 | - 'title' => $item['company'] . " - " . $item['plan'], | ||
| 266 | - 'assm_id' => $assm_id, | ||
| 267 | - 'seom_id' => $seom_id, | ||
| 268 | - 'engineer_id' => $engineer_id, | ||
| 269 | - 'is_del' => $is_del, | ||
| 270 | - 'website' => '', | ||
| 271 | - 'test_website' => '', | ||
| 272 | - 'version' => 1, // 版本号 | ||
| 273 | - 'plan' => $item['plans'][0]['name'] ?? '', | ||
| 274 | - 'project_cate' => $project_cate, | ||
| 275 | - 'wechat_group_id' => $item['chatroom'], | ||
| 276 | - ]; | 265 | + $fields = [ |
| 266 | + 'company_name' => $item['company'], | ||
| 267 | + 'title' => $item['company'] . " - " . $plan['name'], | ||
| 268 | + 'assm_id' => $assm_id, | ||
| 269 | + 'seom_id' => $seom_id, | ||
| 270 | + 'engineer_id' => $engineer_id, | ||
| 271 | + 'is_del' => $is_del, | ||
| 272 | + 'website' => '', | ||
| 273 | + 'test_website' => '', | ||
| 274 | + 'version' => 1, // 版本号 | ||
| 275 | + 'plan' => $item['plans'][0]['name'] ?? '', | ||
| 276 | + 'project_cate' => $project_cate, | ||
| 277 | + 'wechat_group_id' => $item['chatroom'], | ||
| 278 | + ]; | ||
| 277 | 279 | ||
| 278 | - if (!$project) { | ||
| 279 | - $project = new TicketProject(); | ||
| 280 | - $project->uuid = $uuid; | ||
| 281 | - $project->post_id = $item['postid']; | ||
| 282 | - $project->table_id = $item['id']; | ||
| 283 | - foreach ($fields as $k => $v) { | ||
| 284 | - $project->$k = $v; | ||
| 285 | - } | ||
| 286 | - $project->save(); | ||
| 287 | - } else { | ||
| 288 | - $changed = false; | ||
| 289 | - foreach ($fields as $k => $v) { | ||
| 290 | - if ($project->$k != $v) { | 280 | + if (!$project) { |
| 281 | + $project = new TicketProject(); | ||
| 282 | + $project->uuid = $uuid; | ||
| 283 | + $project->post_id = $item['postid']; | ||
| 284 | + $project->table_id = $item['id']; | ||
| 285 | + foreach ($fields as $k => $v) { | ||
| 291 | $project->$k = $v; | 286 | $project->$k = $v; |
| 292 | - $changed = true; | ||
| 293 | } | 287 | } |
| 294 | - } | ||
| 295 | - if ($changed) { | ||
| 296 | $project->save(); | 288 | $project->save(); |
| 289 | + } else { | ||
| 290 | + $changed = false; | ||
| 291 | + foreach ($fields as $k => $v) { | ||
| 292 | + if ($project->$k != $v) { | ||
| 293 | + $project->$k = $v; | ||
| 294 | + $changed = true; | ||
| 295 | + } | ||
| 296 | + } | ||
| 297 | + if ($changed) { | ||
| 298 | + $project->save(); | ||
| 299 | + } | ||
| 297 | } | 300 | } |
| 301 | + $lastid = $item['id']; | ||
| 302 | + echo now() . " | INFO | AICC: {$item['id']} {$item['company']} fetch ok \n"; | ||
| 298 | } | 303 | } |
| 299 | - $lastid = $item['id']; | ||
| 300 | - echo now() . " | INFO | AICC: {$item['id']} {$item['company']} fetch ok \n"; | ||
| 301 | } | 304 | } |
| 302 | }catch (\Exception $exception){ | 305 | }catch (\Exception $exception){ |
| 303 | echo now() . " | ERROR | " . $exception->getMessage() . "\n" . $exception->getTraceAsString() . "\n"; | 306 | echo now() . " | ERROR | " . $exception->getMessage() . "\n" . $exception->getTraceAsString() . "\n"; |
-
请 注册 或 登录 后发表评论