作者 ZhengBing He

sampleLink

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