|
@@ -78,7 +78,9 @@ class Wechat
|
|
|
const OAUTH_USERINFO_URL = 'https://api.weixin.qq.com/sns/userinfo?';
|
|
|
const PAY_DELIVERNOTIFY = 'https://api.weixin.qq.com/pay/delivernotify?';
|
|
|
const PAY_ORDERQUERY = 'https://api.weixin.qq.com/pay/orderquery?';
|
|
|
- const CUSTOM_SERVICE = '/customservice/getrecord?';
|
|
|
+ const CUSTOM_SERVICE_GET_RECORD = '/customservice/getrecord?';
|
|
|
+ const CUSTOM_SERVICE_GET_KFLIST = '/customservice/getkflist?';
|
|
|
+ const CUSTOM_SERVICE_GET_ONLINEKFLIST = '/customservice/getkflist?';
|
|
|
|
|
|
private $token;
|
|
|
private $appid;
|
|
@@ -1263,13 +1265,85 @@ class Wechat
|
|
|
}
|
|
|
|
|
|
|
|
|
- * 获取多客服获取会话记录
|
|
|
+ * 获取多客服会话记录
|
|
|
* @param array $data 数据结构{"starttime":123456789,"endtime":987654321,"openid":"OPENID","pagesize":10,"pageindex":1,}
|
|
|
* @return boolean|array
|
|
|
*/
|
|
|
public function getCustomServiceMessage($data){
|
|
|
if (!$this->access_token && !$this->checkAuth()) return false;
|
|
|
- $result = $this->http_post(self::API_URL_PREFIX.self::CUSTOM_SERVICE.'access_token='.$this->access_token,self::json_encode($data));
|
|
|
+ $result = $this->http_post(self::API_URL_PREFIX.self::CUSTOM_SERVICE_GET_RECORD.'access_token='.$this->access_token,self::json_encode($data));
|
|
|
+ if ($result)
|
|
|
+ {
|
|
|
+ $json = json_decode($result,true);
|
|
|
+ if (!$json || !empty($json['errcode'])) {
|
|
|
+ $this->errCode = $json['errcode'];
|
|
|
+ $this->errMsg = $json['errmsg'];
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return $json;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 转发多客服消息
|
|
|
+ * Examle: $obj->transfer_customer_service($customer_account)->reply();
|
|
|
+ * @param string $customer_account 转发到指定客服帐号:test1@test
|
|
|
+ */
|
|
|
+ public function transfer_customer_service($customer_account = '')
|
|
|
+ {
|
|
|
+ $msg = array(
|
|
|
+ 'ToUserName' => $this->getRevFrom(),
|
|
|
+ 'FromUserName'=>$this->getRevTo(),
|
|
|
+ 'CreateTime'=>time(),
|
|
|
+ 'MsgType'=>'transfer_customer_service',
|
|
|
+ );
|
|
|
+ if (!$customer_account) {
|
|
|
+ $msg['TransInfo'] = array('KfAccount'=>$customer_account);
|
|
|
+ }
|
|
|
+ $this->Message($msg);
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 获取多客服客服基本信息
|
|
|
+ * @param
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getCustomServiceKFlist(){
|
|
|
+ if (!$this->access_token && !$this->checkAuth()) return false;
|
|
|
+ $result = $this->http_get(self::API_URL_PREFIX.self::CUSTOM_SERVICE_GET_KFLIST.'access_token='.$this->access_token);
|
|
|
+ if ($result)
|
|
|
+ {
|
|
|
+ $json = json_decode($result,true);
|
|
|
+ if (!$json || !empty($json['errcode'])) {
|
|
|
+ $this->errCode = $json['errcode'];
|
|
|
+ $this->errMsg = $json['errmsg'];
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return $json;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 获取多客服在线客服接待信息
|
|
|
+ * @param
|
|
|
+ * @return array {
|
|
|
+ "kf_online_list": [
|
|
|
+ {
|
|
|
+ "kf_account": "test1@test",
|
|
|
+ "status": 1,
|
|
|
+ "kf_id": "1001",
|
|
|
+ "auto_accept": 0,
|
|
|
+ "accepted_case": 1
|
|
|
+ }
|
|
|
+ ]
|
|
|
+}
|
|
|
+ */
|
|
|
+ public function getCustomServiceOnlineKFlist(){
|
|
|
+ if (!$this->access_token && !$this->checkAuth()) return false;
|
|
|
+ $result = $this->http_get(self::API_URL_PREFIX.self::CUSTOM_SERVICE_GET_ONLINEKFLIST.'access_token='.$this->access_token);
|
|
|
if ($result)
|
|
|
{
|
|
|
$json = json_decode($result,true);
|