|
...
|
...
|
@@ -5,6 +5,7 @@ namespace App\Models\WorkOrder; |
|
|
|
use App\Models\Base;
|
|
|
|
use App\Models\Manage\ManageHr;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
|
|
class Tickets extends Base
|
|
|
|
{
|
|
...
|
...
|
@@ -77,9 +78,48 @@ class Tickets extends Base |
|
|
|
* 3. 技术完成了工单
|
|
|
|
* - 通知第一负责人,通知企微群
|
|
|
|
*/
|
|
|
|
public function pushDing()
|
|
|
|
public function pushDing($action = 'create')
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
$ding = new TicketDing();
|
|
|
|
$ding->msgKey = 'sampleLink';
|
|
|
|
$ding->table_name = 'gl_tickets';
|
|
|
|
$ding->table_id = $this->id;
|
|
|
|
|
|
|
|
if ($action == 'create')
|
|
|
|
{
|
|
|
|
// 客户提交了工单
|
|
|
|
$ding->userIds = [$this->project->engineer_id];
|
|
|
|
$ding->msgParam = json_encode([
|
|
|
|
'text' => "您有新的工单(ID: {$this->id}),请及时处理!",
|
|
|
|
'title' => 'AI协同工单 - ' . $this->project->title,
|
|
|
|
'picUrl' => 'https://hub.globalso.com/logocm.png',
|
|
|
|
'messageUrl' => 'https://oa.quanqiusou.cn/afterorder?project_id=' . $this->project->uuid,
|
|
|
|
], JSON_UNESCAPED_UNICODE);
|
|
|
|
$ding->save();
|
|
|
|
}elseif ($action == 'chat'){
|
|
|
|
// 客户补充了工单
|
|
|
|
$ding = new TicketDing();
|
|
|
|
$lastChat = TicketChat::where('ticket_id', $this->id)
|
|
|
|
->where('submit_side', 1)
|
|
|
|
->orderBy('id', 'desc')
|
|
|
|
->first();
|
|
|
|
|
|
|
|
$ding->userIds = [!empty($lastChat) ? $lastChat->manage_id : $this->project->engineer_id];
|
|
|
|
$ding->msgParam = json_encode([
|
|
|
|
'text' => "客户补充了工单(ID: {$this->id}),请及时处理!",
|
|
|
|
'title' => 'AI协同工单 - ' . $this->project->title,
|
|
|
|
'picUrl' => 'https://hub.globalso.com/logocm.png',
|
|
|
|
'messageUrl' => 'https://oa.quanqiusou.cn/afterorder?project_id=' . $this->project->uuid,
|
|
|
|
], JSON_UNESCAPED_UNICODE);
|
|
|
|
$ding->save();
|
|
|
|
}elseif ($action == 'finish'){
|
|
|
|
// 完成工单
|
|
|
|
|
|
|
|
}
|
|
|
|
}catch (\Exception $exception){
|
|
|
|
Log::error(" | ERRPR | Ticket {$exception->getMessage()} \n {$exception->getTraceAsString()}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|