min-radish/php-wechat-api

PHP对微信公众号API的调用

v1.4.3 2019-04-18 12:44 UTC

This package is auto-updated.

Last update: 2024-09-23 15:25:46 UTC


README

需自定义一个类并继承 Radish\WeChat\WeChat 自定义CaChe抽象方法
public function cacheGet($key = 'access_token', $default = false);
public function cacheSet($key, $val, $timeout = 7140);

api示例说明

    $wechat = new WeChat();

获取客服列表

$json = $wechat->getCSList();
正确响应
{   
    "kf_list" : [
         {
            "kf_account" : "test1@test",
            "kf_headimgurl" : "http://mmbiz.qpic.cn/mmbiz/4whpV1VZl2iccsvYbHvnphkyGtnvjfUS8Ym0GSaLic0FD3vN0V8PILcibEGb2fPfEOmw/0",
            "kf_id" : "1001",
            "kf_nick" : "ntest1",
            "kf_wx" : "kfwx1"
         },
         {
            "kf_account" : "test2@test",
            "kf_headimgurl" : "http://mmbiz.qpic.cn/mmbiz/4whpV1VZl2iccsvYbHvnphkyGtnvjfUS8Ym0GSaLic0FD3vN0V8PILcibEGb2fPfEOmw/0",
            "kf_id" : "1002",
            "kf_nick" : "ntest2",
            "kf_wx" : "kfwx2"
         }
    ]
}

获取在线客服列表

$json = $wechat->getOLCSList();
返回数据示例(正确时的JSON返回结果):
 {
     "kf_online_list" : [
         {
             "kf_account" : "test1@test" ,
              "status" : 1,
              "kf_id" : "1001" ,
              "accepted_case" : 1
         },
         {
             "kf_account" : "test2@test" ,
              "status" : 1,
              "kf_id" : "1002" ,
              "accepted_case" : 2
         }
     ]
 }

参数说明

添加客服帐号

$json = $wechat->addCS($param);
$param 示例
{
    "kf_account" : "test1@test",
    "nickname" : "客服1"
}

返回数据示例(正确时的JSON返回结果): { "errcode" : 0, "errmsg" : "ok" }

邀请绑定客服帐号

$json = $wechat->invitBindCS($param);

$param 示例
{
    "kf_account" : "test1@test",
    "invite_wx" : "test_kfwx"
}

参数说明

设置客服信息

$json = $wechat->updateCS($param);

$param示例
{
    "kf_account" : "test1@test",
    "nickname" : "客服1"
}

参数说明

上传客服头像

$json = $wechat->updateCSImg($CSAccount, $param);

$CSAccount完整客服帐号,格式为:帐号前缀@公众号微信号

$file = 文件绝对路径;
$param 
[
  'media' => new \CURLFile($file)
]

删除客服帐号

$json = $wechat->updateCSImg($CSAccount);

$CSAccount完整客服帐号,格式为:帐号前缀@公众号微信号

客服管理接口返回码说明