1、已知bug修复
2、微信接口更新
This commit is contained in:
@@ -1,11 +1,24 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | wechat-php-sdk
|
||||
// +----------------------------------------------------------------------
|
||||
// | 版权所有 2014~2017 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | 官方文档: https://www.kancloud.cn/zoujingli/wechat-php-sdk
|
||||
// +----------------------------------------------------------------------
|
||||
// | 开源协议 ( https://mit-license.org )
|
||||
// +----------------------------------------------------------------------
|
||||
// | github开源项目:https://github.com/zoujingli/wechat-php-sdk
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace Wechat;
|
||||
|
||||
use Wechat\Lib\Common;
|
||||
use Wechat\Lib\Tools;
|
||||
|
||||
class WechatCustom extends Common {
|
||||
class WechatCustom extends Common
|
||||
{
|
||||
|
||||
/** 多客服相关地址 */
|
||||
const CUSTOM_SERVICE_GET_RECORD = '/customservice/getrecord?';
|
||||
@@ -27,7 +40,8 @@ class WechatCustom extends Common {
|
||||
* @param array $data 数据结构 {"starttime":123456789,"endtime":987654321,"openid":"OPENID","pagesize":10,"pageindex":1,}
|
||||
* @return bool|array
|
||||
*/
|
||||
public function getCustomServiceMessage($data) {
|
||||
public function getCustomServiceMessage($data)
|
||||
{
|
||||
if (!$this->access_token && !$this->getAccessToken()) {
|
||||
return false;
|
||||
}
|
||||
@@ -49,7 +63,8 @@ class WechatCustom extends Common {
|
||||
*
|
||||
* @return bool|array
|
||||
*/
|
||||
public function getCustomServiceKFlist() {
|
||||
public function getCustomServiceKFlist()
|
||||
{
|
||||
if (!$this->access_token && !$this->getAccessToken()) {
|
||||
return false;
|
||||
}
|
||||
@@ -71,7 +86,8 @@ class WechatCustom extends Common {
|
||||
*
|
||||
* @return bool|array
|
||||
*/
|
||||
public function getCustomServiceOnlineKFlist() {
|
||||
public function getCustomServiceOnlineKFlist()
|
||||
{
|
||||
if (!$this->access_token && !$this->getAccessToken()) {
|
||||
return false;
|
||||
}
|
||||
@@ -96,14 +112,13 @@ class WechatCustom extends Common {
|
||||
* @param string $text //附加信息,文本会展示在客服人员的多客服客户端,可为空
|
||||
* @return bool|array
|
||||
*/
|
||||
public function createKFSession($openid, $kf_account, $text = '') {
|
||||
$data = array("openid" => $openid, "kf_account" => $kf_account);
|
||||
if ($text) {
|
||||
$data["text"] = $text;
|
||||
}
|
||||
public function createKFSession($openid, $kf_account, $text = '')
|
||||
{
|
||||
if (!$this->access_token && !$this->getAccessToken()) {
|
||||
return false;
|
||||
}
|
||||
$data = array("openid" => $openid, "kf_account" => $kf_account);
|
||||
$text !== '' && $data["text"] = $text;
|
||||
$result = Tools::httpPost(self::API_BASE_URL_PREFIX . self::CUSTOM_SESSION_CREATE . "access_token={$this->access_token}", Tools::json_encode($data));
|
||||
if ($result) {
|
||||
$json = json_decode($result, true);
|
||||
@@ -129,7 +144,8 @@ class WechatCustom extends Common {
|
||||
* "errmsg": "ok",
|
||||
* }
|
||||
*/
|
||||
public function closeKFSession($openid, $kf_account, $text = '') {
|
||||
public function closeKFSession($openid, $kf_account, $text = '')
|
||||
{
|
||||
$data = array("openid" => $openid, "kf_account" => $kf_account);
|
||||
if ($text) {
|
||||
$data["text"] = $text;
|
||||
@@ -161,7 +177,8 @@ class WechatCustom extends Common {
|
||||
* "createtime": 123456789, //会话接入时间
|
||||
* }
|
||||
*/
|
||||
public function getKFSession($openid) {
|
||||
public function getKFSession($openid)
|
||||
{
|
||||
if (!$this->access_token && !$this->getAccessToken()) {
|
||||
return false;
|
||||
}
|
||||
@@ -195,7 +212,8 @@ class WechatCustom extends Common {
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function getKFSessionlist($kf_account) {
|
||||
public function getKFSessionlist($kf_account)
|
||||
{
|
||||
if (!$this->access_token && !$this->getAccessToken()) {
|
||||
return false;
|
||||
}
|
||||
@@ -216,7 +234,8 @@ class WechatCustom extends Common {
|
||||
* 获取未接入会话列表
|
||||
* @return bool|array
|
||||
*/
|
||||
public function getKFSessionWait() {
|
||||
public function getKFSessionWait()
|
||||
{
|
||||
if (!$this->access_token && !$this->getAccessToken()) {
|
||||
return false;
|
||||
}
|
||||
@@ -241,7 +260,8 @@ class WechatCustom extends Common {
|
||||
* @param string $password 客服账号明文登录密码,会自动加密
|
||||
* @return bool|array
|
||||
*/
|
||||
public function addKFAccount($account, $nickname, $password) {
|
||||
public function addKFAccount($account, $nickname, $password)
|
||||
{
|
||||
$data = array("kf_account" => $account, "nickname" => $nickname, "password" => md5($password));
|
||||
if (!$this->access_token && !$this->getAccessToken()) {
|
||||
return false;
|
||||
@@ -272,7 +292,8 @@ class WechatCustom extends Common {
|
||||
* "errmsg": "ok",
|
||||
* }
|
||||
*/
|
||||
public function updateKFAccount($account, $nickname, $password) {
|
||||
public function updateKFAccount($account, $nickname, $password)
|
||||
{
|
||||
$data = array("kf_account" => $account, "nickname" => $nickname, "password" => md5($password));
|
||||
if (!$this->access_token && !$this->getAccessToken()) {
|
||||
return false;
|
||||
@@ -295,7 +316,8 @@ class WechatCustom extends Common {
|
||||
* @param string $account 完整客服账号(账号前缀@公众号微信号,账号前缀最多10个字符)
|
||||
* @return bool|array
|
||||
*/
|
||||
public function deleteKFAccount($account) {
|
||||
public function deleteKFAccount($account)
|
||||
{
|
||||
if (!$this->access_token && !$this->getAccessToken()) {
|
||||
return false;
|
||||
}
|
||||
@@ -318,11 +340,12 @@ class WechatCustom extends Common {
|
||||
* @param string $imgfile 头像文件完整路径,如:'D:\user.jpg'。头像文件必须JPG格式,像素建议640*640
|
||||
* @return bool|array
|
||||
*/
|
||||
public function setKFHeadImg($account, $imgfile) {
|
||||
public function setKFHeadImg($account, $imgfile)
|
||||
{
|
||||
if (!$this->access_token && !$this->getAccessToken()) {
|
||||
return false;
|
||||
}
|
||||
$result = Tools::httpPost(self::API_BASE_URL_PREFIX . self::CS_KF_ACCOUNT_UPLOAD_HEADIMG_URL . "access_token={$this->access_token}" . '&kf_account=' . $account, array('media' => '@' . $imgfile), true);
|
||||
$result = Tools::httpPost(self::API_BASE_URL_PREFIX . self::CS_KF_ACCOUNT_UPLOAD_HEADIMG_URL . "access_token={$this->access_token}&kf_account={$account}", array('media' => '@' . $imgfile));
|
||||
if ($result) {
|
||||
$json = json_decode($result, true);
|
||||
if (!$json || !empty($json['errcode'])) {
|
||||
|
||||
Reference in New Issue
Block a user