您要通过 配置 config/whisper.php ``` // api接口 'api_url' => 'http://www.wsv2.com/index/test/receive' ``` 配置客服端推送的消息,在哪里接收。目前客服会推送如下的消息 1. 客服回复消息 2. 访客被转接消息 3. 访客被关闭消息 ``` // 接受客服发来的消息 public function receive() { $param = input('post.'); file_put_contents('./log.log', var_export($param, true)); /** * 消息体如下 -- 聊天消息 * [ * 'cmd' => 's2cChat', * 'data' => [ * 'from_name' => "客服小白", * 'from_avatar' => "//tva2.sinaimg.cn/crop.0.0.512.512.180/005LMAegjw8f2bp9qg4mrj30e80e8dg5.jpg", * 'from_id' => KF_WERWERSDF, * 'content' => '客服返回消息', * 'to_id' => 20190321, * 'to_name' => '访客20190321', * 'seller_code' => '5c6cbcb7d55ca' * ] * ] */ /** * 消息体如下 -- 转接消息 * [ * 'cmd' => 'relink', * 'data' => [ * 'kefu_code' => 'KF_qeqw', * 'kefu_name' => '客服小白', * 'msg' => '您已被转接' * ] * ] */ /** * 消息体如下 -- 被关闭消息 * [ * 'cmd' => 'isClose', * 'data' => [ * 'msg' => '客服下班了,稍后再来吧。' * ] * ] */ } ```