作者 ZhengBing He

sampleLink

@@ -55,16 +55,18 @@ class WorkOrderDing extends Command @@ -55,16 +55,18 @@ class WorkOrderDing extends Command
55 )->get('https://oa.cmer.com/api/dingding/user/' . $mobile); 55 )->get('https://oa.cmer.com/api/dingding/user/' . $mobile);
56 if ($response->status() == 200) { 56 if ($response->status() == 200) {
57 $userid = $response->json()['data']['userid']; 57 $userid = $response->json()['data']['userid'];
58 - $text = "**您有新的售后工单**<br>";  
59 - $text .= "工单ID:{$log->ticket_id}<br>";  
60 - $text .= "工单类型:<font color='red'>{$log->ticket->title}</font><br>";  
61 - $text .= "项目:{$log->ticket->project->title}<br>";  
62 - $text .= "时间:{$log->created_at}<br>"; 58 +// $text = "**您有新的售后工单**<br>";
  59 +// $text .= "工单ID:{$log->ticket_id}<br>";
  60 +// $text .= "工单类型:<font color='red'>{$log->ticket->title}</font><br>";
  61 +// $text .= "项目:{$log->ticket->project->title}<br>";
  62 +// $text .= "时间:{$log->created_at}<br>";
63 $ding = new DingTalkService(); 63 $ding = new DingTalkService();
64 $resp = $ding->danliao(json_encode([ 64 $resp = $ding->danliao(json_encode([
65 - 'text' => $text,  
66 - 'title' => '售后工单通知',  
67 - ]), [$userid]); 65 + 'text' => "您有新的售后工单,请及时处理!",
  66 + 'title' => 'AI协同工单 - ' . $log->ticket->project->title,
  67 + 'picUrl' => 'https://hub.globalso.com/logocm.png',
  68 + 'messageUrl' => 'https://oa.quanqiusou.cn/afterorder?project_id=' . $log->ticket->project->uuid,
  69 + ]), [$userid], 'sampleLink');
68 $log->ding = 1; 70 $log->ding = 1;
69 }else 71 }else
70 $log->ding = 2; 72 $log->ding = 2;
@@ -45,7 +45,7 @@ class DingTalkService @@ -45,7 +45,7 @@ class DingTalkService
45 } 45 }
46 46
47 /** 批量发送私聊消息 */ 47 /** 批量发送私聊消息 */
48 - public function danliao(string $text, array $user_ids) 48 + public function danliao(string $text, array $user_ids, string $msg_key='sampleMarkdown')
49 { 49 {
50 $endpoint = '/v1/danliao'; 50 $endpoint = '/v1/danliao';
51 $payload = [ 51 $payload = [
@@ -53,7 +53,8 @@ class DingTalkService @@ -53,7 +53,8 @@ class DingTalkService
53 "appSecret" => $this->appSecret, 53 "appSecret" => $this->appSecret,
54 "robotCode" => $this->robotCode, 54 "robotCode" => $this->robotCode,
55 "msg_param" => $text, 55 "msg_param" => $text,
56 - "user_ids" => $user_ids 56 + "user_ids" => $user_ids,
  57 + "msg_key" => $msg_key
57 ]; 58 ];
58 return $this->send_request('POST', $this->bashUrl . $endpoint, $payload); 59 return $this->send_request('POST', $this->bashUrl . $endpoint, $payload);
59 } 60 }