正在显示
1 个修改的文件
包含
41 行增加
和
1 行删除
| @@ -5,6 +5,7 @@ namespace App\Models\WorkOrder; | @@ -5,6 +5,7 @@ namespace App\Models\WorkOrder; | ||
| 5 | use App\Models\Base; | 5 | use App\Models\Base; |
| 6 | use App\Models\Manage\ManageHr; | 6 | use App\Models\Manage\ManageHr; |
| 7 | use Illuminate\Database\Eloquent\Factories\HasFactory; | 7 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 8 | +use Illuminate\Support\Facades\Log; | ||
| 8 | 9 | ||
| 9 | class Tickets extends Base | 10 | class Tickets extends Base |
| 10 | { | 11 | { |
| @@ -77,9 +78,48 @@ class Tickets extends Base | @@ -77,9 +78,48 @@ class Tickets extends Base | ||
| 77 | * 3. 技术完成了工单 | 78 | * 3. 技术完成了工单 |
| 78 | * - 通知第一负责人,通知企微群 | 79 | * - 通知第一负责人,通知企微群 |
| 79 | */ | 80 | */ |
| 80 | - public function pushDing() | 81 | + public function pushDing($action = 'create') |
| 81 | { | 82 | { |
| 83 | + try { | ||
| 84 | + $ding = new TicketDing(); | ||
| 85 | + $ding->msgKey = 'sampleLink'; | ||
| 86 | + $ding->table_name = 'gl_tickets'; | ||
| 87 | + $ding->table_id = $this->id; | ||
| 82 | 88 | ||
| 89 | + if ($action == 'create') | ||
| 90 | + { | ||
| 91 | + // 客户提交了工单 | ||
| 92 | + $ding->userIds = [$this->project->engineer_id]; | ||
| 93 | + $ding->msgParam = json_encode([ | ||
| 94 | + 'text' => "您有新的工单(ID: {$this->id}),请及时处理!", | ||
| 95 | + 'title' => 'AI协同工单 - ' . $this->project->title, | ||
| 96 | + 'picUrl' => 'https://hub.globalso.com/logocm.png', | ||
| 97 | + 'messageUrl' => 'https://oa.quanqiusou.cn/afterorder?project_id=' . $this->project->uuid, | ||
| 98 | + ], JSON_UNESCAPED_UNICODE); | ||
| 99 | + $ding->save(); | ||
| 100 | + }elseif ($action == 'chat'){ | ||
| 101 | + // 客户补充了工单 | ||
| 102 | + $ding = new TicketDing(); | ||
| 103 | + $lastChat = TicketChat::where('ticket_id', $this->id) | ||
| 104 | + ->where('submit_side', 1) | ||
| 105 | + ->orderBy('id', 'desc') | ||
| 106 | + ->first(); | ||
| 107 | + | ||
| 108 | + $ding->userIds = [!empty($lastChat) ? $lastChat->manage_id : $this->project->engineer_id]; | ||
| 109 | + $ding->msgParam = json_encode([ | ||
| 110 | + 'text' => "客户补充了工单(ID: {$this->id}),请及时处理!", | ||
| 111 | + 'title' => 'AI协同工单 - ' . $this->project->title, | ||
| 112 | + 'picUrl' => 'https://hub.globalso.com/logocm.png', | ||
| 113 | + 'messageUrl' => 'https://oa.quanqiusou.cn/afterorder?project_id=' . $this->project->uuid, | ||
| 114 | + ], JSON_UNESCAPED_UNICODE); | ||
| 115 | + $ding->save(); | ||
| 116 | + }elseif ($action == 'finish'){ | ||
| 117 | + // 完成工单 | ||
| 118 | + | ||
| 119 | + } | ||
| 120 | + }catch (\Exception $exception){ | ||
| 121 | + Log::error(" | ERRPR | Ticket {$exception->getMessage()} \n {$exception->getTraceAsString()}"); | ||
| 122 | + } | ||
| 83 | } | 123 | } |
| 84 | 124 | ||
| 85 | } | 125 | } |
-
请 注册 或 登录 后发表评论