>[info] 接口:http://127.0.0.1:2945 gatewayworker 启动后,会启动一个 http服务,并监厅 2945端口,您只需要往这个端口,推送聊天数据就可了。 ``` // api 访客接入demo public function apiCustomerLink() { // apiService 得到的客服信息 $kefuInfo = [ 'data' => [ 'kefu_code' => 'KF_5c6ce9f6d753b', 'kefu_name' => '客服小白', 'seller_code' => '5c6cbcb7d55ca' ] ]; $content = [ 'uid' => 20190321, "name" => "访客20190321", "avatar" => "//tva2.sinaimg.cn/crop.0.0.512.512.180/005LMAegjw8f2bp9qg4mrj30e80e8dg5.jpg", "ip" => "58.240.254.162" ]; $push_api_url = "http://127.0.0.1:2945"; $post_data = [ "cmd" => "link", "data" => $content, "kefu_code" => $kefuInfo['data']['kefu_code'], "kefu_name" => $kefuInfo['data']['kefu_name'], "seller_code" => $kefuInfo['data']['seller_code'] ]; $ch = curl_init (); curl_setopt ( $ch, CURLOPT_URL, $push_api_url ); curl_setopt ( $ch, CURLOPT_POST, 1 ); curl_setopt ( $ch, CURLOPT_HEADER, 0 ); curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt ( $ch, CURLOPT_POSTFIELDS, http_build_query($post_data)); $return = curl_exec ( $ch ); curl_close ( $ch ); echo $return; } ``` 返回信息是一段 json ``` {code: 200, data: '', msg: 'ok'} ```