Skip to content

Commit c742841

Browse files
committed
Merge pull request #211 from binsee/patch
修复bug(感谢 @piccscy)
2 parents ccf3fbf + 75e8482 commit c742841

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

errCode.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ class ErrCode
107107
'61455'=>'客服账号名包含非法字符(英文+数字)',
108108
'61456'=>'客服账号个数超过限制(10个客服账号)',
109109
'61457'=>'无效头像文件类型',
110+
'61458'=>'客户正在被其他客服接待',
111+
'61459'=>'客服不在线',
110112
'61500'=>'日期格式错误',
111113
'61501'=>'日期范围错误',
112114
'7000000'=>'请求正常,无语义结果',

qywechat.class.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,12 +1352,14 @@ public function moveDepartment($data){
13521352
* {
13531353
* "id": 1,
13541354
* "name": "广州研发中心",
1355-
* "parentid": 0
1355+
* "parentid": 0,
1356+
* "order": 40
13561357
* },
13571358
* {
13581359
* "id": 2
13591360
* "name": "邮箱产品部",
1360-
* "parentid": 1
1361+
* "parentid": 1,
1362+
* "order": 40
13611363
* }
13621364
* ]
13631365
* }

wechat.class.php

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,21 +110,22 @@ class Wechat
110110
const MEDIA_VIDEO_UPLOAD = '/media/uploadvideo?';
111111
const OAUTH_PREFIX = 'https://open.weixin.qq.com/connect/oauth2';
112112
const OAUTH_AUTHORIZE_URL = '/authorize?';
113+
///多客服相关地址
114+
const CUSTOM_SERVICE_GET_RECORD = '/customservice/getrecord?';
115+
const CUSTOM_SERVICE_GET_KFLIST = '/customservice/getkflist?';
116+
const CUSTOM_SERVICE_GET_ONLINEKFLIST = '/customservice/getonlinekflist?';
113117
const API_BASE_URL_PREFIX = 'https://api.weixin.qq.com'; //以下API接口URL需要使用此前缀
114118
const OAUTH_TOKEN_URL = '/sns/oauth2/access_token?';
115119
const OAUTH_REFRESH_URL = '/sns/oauth2/refresh_token?';
116120
const OAUTH_USERINFO_URL = '/sns/userinfo?';
117121
const OAUTH_AUTH_URL = '/sns/auth?';
118122
///多客服相关地址
119-
const CUSTOM_SERVICE_GET_RECORD = '/customservice/getrecord?';
120-
const CUSTOM_SERVICE_GET_KFLIST = '/customservice/getkflist?';
121-
const CUSTOM_SERVICE_GET_ONLINEKFLIST = '/customservice/getonlinekflist?';
122-
const CUSTOM_SEESSION_CREATE = '/customservice/kfsession/create?';
123-
const CUSTOM_SEESSION_CLOSE = '/customservice/kfsession/close?';
124-
const CUSTOM_SEESSION_SWITCH = '/customservice/kfsession/switch?';
125-
const CUSTOM_SEESSION_GET = '/customservice/kfsession/getsession?';
126-
const CUSTOM_SEESSION_GET_LIST = '/customservice/kfsession/getsessionlist?';
127-
const CUSTOM_SEESSION_GET_WAIT = '/customservice/kfsession/getwaitcase?';
123+
const CUSTOM_SESSION_CREATE = '/customservice/kfsession/create?';
124+
const CUSTOM_SESSION_CLOSE = '/customservice/kfsession/close?';
125+
const CUSTOM_SESSION_SWITCH = '/customservice/kfsession/switch?';
126+
const CUSTOM_SESSION_GET = '/customservice/kfsession/getsession?';
127+
const CUSTOM_SESSION_GET_LIST = '/customservice/kfsession/getsessionlist?';
128+
const CUSTOM_SESSION_GET_WAIT = '/customservice/kfsession/getwaitcase?';
128129
const CS_KF_ACCOUNT_ADD_URL = '/customservice/kfaccount/add?';
129130
const CS_KF_ACCOUNT_UPDATE_URL = '/customservice/kfaccount/update?';
130131
const CS_KF_ACCOUNT_DEL_URL = '/customservice/kfaccount/del?';
@@ -1758,7 +1759,7 @@ public function getQRCode($scene_id,$type=0,$expire=1800){
17581759
* @return string url 返回http地址
17591760
*/
17601761
public function getQRUrl($ticket) {
1761-
return self::QRCODE_IMG_URL.$ticket;
1762+
return self::QRCODE_IMG_URL.urlencode($ticket);
17621763
}
17631764

17641765
/**
@@ -2342,11 +2343,11 @@ public function getCustomServiceOnlineKFlist(){
23422343
public function createKFSession($openid,$kf_account,$text=''){
23432344
$data=array(
23442345
"openid" =>$openid,
2345-
"nickname" => $kf_account
2346+
"kf_account" => $kf_account
23462347
);
23472348
if ($text) $data["text"] = $text;
23482349
if (!$this->access_token && !$this->checkAuth()) return false;
2349-
$result = $this->http_post(self::API_URL_PREFIX.self::CUSTOM_SEESSION_CREATE.'access_token='.$this->access_token,self::json_encode($data));
2350+
$result = $this->http_post(self::API_BASE_URL_PREFIX.self::CUSTOM_SESSION_CREATE.'access_token='.$this->access_token,self::json_encode($data));
23502351
if ($result)
23512352
{
23522353
$json = json_decode($result,true);
@@ -2379,7 +2380,7 @@ public function closeKFSession($openid,$kf_account,$text=''){
23792380
);
23802381
if ($text) $data["text"] = $text;
23812382
if (!$this->access_token && !$this->checkAuth()) return false;
2382-
$result = $this->http_post(self::API_URL_PREFIX.self::CUSTOM_SEESSION_CLOSE .'access_token='.$this->access_token,self::json_encode($data));
2383+
$result = $this->http_post(self::API_BASE_URL_PREFIX.self::CUSTOM_SESSION_CLOSE .'access_token='.$this->access_token,self::json_encode($data));
23832384
if ($result)
23842385
{
23852386
$json = json_decode($result,true);
@@ -2406,7 +2407,7 @@ public function closeKFSession($openid,$kf_account,$text=''){
24062407
*/
24072408
public function getKFSession($openid){
24082409
if (!$this->access_token && !$this->checkAuth()) return false;
2409-
$result = $this->http_get(self::API_URL_PREFIX.self::CUSTOM_SEESSION_GET .'access_token='.$this->access_token.'&openid='.$openid);
2410+
$result = $this->http_get(self::API_BASE_URL_PREFIX.self::CUSTOM_SESSION_GET .'access_token='.$this->access_token.'&openid='.$openid);
24102411
if ($result)
24112412
{
24122413
$json = json_decode($result,true);
@@ -2439,7 +2440,7 @@ public function getKFSession($openid){
24392440
*/
24402441
public function getKFSessionlist($kf_account){
24412442
if (!$this->access_token && !$this->checkAuth()) return false;
2442-
$result = $this->http_get(self::API_URL_PREFIX.self::CUSTOM_SEESSION_GET_LIST .'access_token='.$this->access_token.'&kf_account='.$kf_account);
2443+
$result = $this->http_get(self::API_BASE_URL_PREFIX.self::CUSTOM_SESSION_GET_LIST .'access_token='.$this->access_token.'&kf_account='.$kf_account);
24432444
if ($result)
24442445
{
24452446
$json = json_decode($result,true);
@@ -2475,7 +2476,7 @@ public function getKFSessionlist($kf_account){
24752476
*/
24762477
public function getKFSessionWait(){
24772478
if (!$this->access_token && !$this->checkAuth()) return false;
2478-
$result = $this->http_get(self::API_URL_PREFIX.self::CUSTOM_SEESSION_GET_WAIT .'access_token='.$this->access_token);
2479+
$result = $this->http_get(self::API_BASE_URL_PREFIX.self::CUSTOM_SESSION_GET_WAIT .'access_token='.$this->access_token);
24792480
if ($result)
24802481
{
24812482
$json = json_decode($result,true);

0 commit comments

Comments
 (0)