Beispiel #1
0
 /**
  * 通过授权获取用户.
  *
  * @param string $to
  * @param string $state
  * @param string $scope
  *
  * @return array | null
  */
 public function authorize($to = null, $scope = 'snsapi_base', $state = 'STATE')
 {
     if (!$this->input->get('state') && !$this->input->get('code')) {
         $this->redirect($to, $scope, $state);
     }
     return $this->user();
 }
Beispiel #2
0
 /**
  * 处理微信的请求
  *
  * @return mixed
  */
 protected function handleRequest()
 {
     $this->call('received', array($this->input));
     if ($this->input->get('MsgType') && $this->input->get('MsgType') === 'event') {
         return $this->handleEvent($this->input);
     } elseif ($this->input->get('MsgId')) {
         return $this->handleMessage($this->input);
     }
     return false;
 }
Beispiel #3
0
 /**
  * 图片素材总数.
  *
  * @param string $type
  * @param int 应用id
  *
  * @return array|int
  */
 public function stats($type = null, $agentId)
 {
     $response = $this->http->get(self::API_FOREVER_COUNT . '?agentid=' . $agentId);
     $response = new Bag($response);
     return $type ? $response->get($type) : $response;
 }