chore(addon/aikefu): update 创建会话ID
This commit is contained in:
@@ -37,45 +37,4 @@ class KefuCreateConversation
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理智能客服获取历史消息事件
|
|
||||||
* @param array $data 事件数据
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function handleKefuGetHistory($data)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
// 创建addon的KefuApi实例
|
|
||||||
$kefu_api = new KefuApi();
|
|
||||||
|
|
||||||
// 调用初始化方法设置属性
|
|
||||||
$kefu_api->initializeForEvent($data);
|
|
||||||
|
|
||||||
// 调用addon的getHistory方法
|
|
||||||
$response = $kefu_api->getHistory();
|
|
||||||
|
|
||||||
// 返回响应数据
|
|
||||||
return json_decode($response->getContent(), true);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
return [
|
|
||||||
'code' => -1,
|
|
||||||
'message' => '获取历史消息失败:' . $e->getMessage(),
|
|
||||||
'data' => []
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 事件监听映射
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function subscribe()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'KefuChat' => 'handleKefuChat',
|
|
||||||
'KefuCreateConversation' => 'handleKefuCreateConversation',
|
|
||||||
'KefuGetHistory' => 'handleKefuGetHistory',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user