Exemplo n.º 1
0
 /**
  * 图片素材总数.
  *
  * @param string $type
  *
  * @return array|int
  */
 public function stats($type = null)
 {
     $response = $this->http->get(self::API_FOREVER_COUNT);
     $response['voice'] = $response['voice_count'];
     $response['image'] = $response['image_count'];
     $response['video'] = $response['video_count'];
     $response['news'] = $response['news_count'];
     $response = new Bag($response);
     return $type ? $response->get($type) : $response;
 }
Exemplo n.º 2
0
 /**
  * 获取jsticket.
  *
  * @return string
  */
 public function getTicket()
 {
     $key = 'overtrue.wechat.jsapi_ticket.' . $this->appId;
     // for php 5.3
     $appId = $this->appId;
     $appSecret = $this->appSecret;
     $cache = $this->cache;
     $apiTicket = self::API_TICKET;
     return $this->cache->get($key, function ($key) use($appId, $appSecret, $cache, $apiTicket) {
         $http = new Http(new AccessToken($appId, $appSecret));
         $result = $http->get($apiTicket);
         $cache->set($key, $result['ticket'], $result['expires_in']);
         return $result['ticket'];
     });
 }
Exemplo n.º 3
0
 /**
  * 获取菜单【查询接口,能获取到任意方式设置的菜单】.
  *
  * @return array
  */
 public function current()
 {
     $menus = $this->http->get(self::API_QUERY);
     return empty($menus) ? array() : $menus;
 }
Exemplo n.º 4
0
 /**
  * 获取所有在线的.
  *
  * @return array
  */
 public function onlines()
 {
     $response = $this->http->get(self::API_ONLINE);
     return $response['kf_online_list'];
 }
Exemplo n.º 5
0
 /**
  * 获取用户列表.
  *
  * @param string $nextOpenId
  *
  * @return Bag
  */
 public function lists($nextOpenId = null)
 {
     $params = array('next_openid' => $nextOpenId);
     return new Bag($this->http->get(self::API_LIST, $params));
 }
Exemplo n.º 6
0
 /**
  * 获取access token.
  *
  * @param string $code
  *
  * @return string
  */
 public function getAccessPermission($code)
 {
     $params = array('appid' => $this->appId, 'secret' => $this->appSecret, 'code' => $code, 'grant_type' => 'authorization_code');
     return $this->lastPermission = $this->http->get(self::API_TOKEN_GET, $params);
 }