配置设备与页面的关联关系
@param array $data
@return array
@throws Exceptions\InvalidResponseException
@throws Exceptions\LocalCacheException
424194
public function bindPage(array $data)
    {
        $url = "https://api.weixin.qq.com/shakearound/device/bindpage?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
93014
public function getOAuth2AccessToken(array $data)
    {
        $http = $this->http([
            'url' => $this->baseUrl . 'sns/oauth2/access_token',
            'dataType' => 'json',
            'throwException' => false,
            'data' => $data + [
                    'code' => '', // 需传入参数
                    'appid' => $this->appId,
                    'secret' => $this->appSecret,
                    'grant_type' => 'authorization_code',
                ],
        ]);
        if ($this->isError($http)) {
            $this->logError($http);
        }

        return $http;
    }
69029
public function set_httpHeader($data = [])
    {
        //将二维数组转为一维数组
        $result = [];
        foreach ($data as $key => $row) {
            if (is_array($row)) {
                if (isset($row[0])) {
                    $result[] = $row[0];
                }
            } else {
                $result[] = $row;
            }
        }

        $this->config['CURLOPT_HTTPHEADER'] = $data;

        return $this;
    }
1256075
public function createUser(array $data)
    {
        $result = $this->httpRaw(self::WECHAT_USER_CREATE_PREFIX, $data, [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['errcode']) && ($result['errcode'] ? $this->dump([$data,$result,$this->getAccessToken()]) : !$result['errcode']);
    }
533241
public function updatePoi(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_POI_UPDATE_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] === 'ok';
    }
974879
public function searchPage(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_PAGE_SEARCH_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errcode']) && !$result['errcode'] ? $result['data'] : false;
    }
602029
public function getUpStreamMessage(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_UP_STREAM_MESSAGE_GET_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['list']) ? $result['list'] : false;
    }
267385
public function sendAll(array $data)
    {
        $result = $this->httpRaw(self::WECHAT_SEND_ALL_PREFIX, $data, [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['errcode']) && !$result['errcode'];
    }
817378
private function parse(array $data)
    {
        $result = array();

        foreach ($data as $index => $array) {
            if ($this->serializer->isSerialized($array[ConstProviderInterface::CACHE_PARAM_VALUE])) {
                $array[ConstProviderInterface::CACHE_PARAM_VALUE] = $this->serializer->unserialize($array[ConstProviderInterface::CACHE_PARAM_VALUE]);
            }

            $result[$array[ConstProviderInterface::CACHE_PARAM_KEY]] = array(
                ConstProviderInterface::CACHE_PARAM_VALUE => $array[ConstProviderInterface::CACHE_PARAM_VALUE], 
                ConstProviderInterface::CACHE_PARAM_TTL => $array[ConstProviderInterface::CACHE_PARAM_TTL], 
                ConstProviderInterface::CACHE_PARAM_CREATED_ON => $array[ConstProviderInterface::CACHE_PARAM_CREATED_ON]
            );
        }

        return $result;
    }
391619
public function getMaterialList($data)
    {
        $result = $this->httpRaw(self::WECHAT_MATERIAL_LIST_GET_PREFIX, $data, [
            'access_token' => $this->getAccessToken()
        ]);
        return !isset($result['errodcode']) ? $result : false;
    }
855379
public function update(array $data = [])
    {
        $options = $this->parseExpress();
        $data    = array_merge($options['data'], $data);
        $pk      = $this->getPk($options);
        $where   = [];
        if (isset($options['cache']) && is_string($options['cache']['key'])) {
            $key = $options['cache']['key'];
        }

        if (empty($options['where'])) {
            // 如果存在主键数据 则自动作为更新条件
            if (is_string($pk) && isset($data[$pk])) {
                $where[$pk] = $data[$pk];
                if (!isset($key)) {
                    $key = 'think:' . $options['table'] . '|' . $data[$pk];
                }
                unset($data[$pk]);
            } elseif (is_array($pk)) {
                // 增加复合主键支持
                foreach ($pk as $field) {
                    if (isset($data[$field])) {
                        $where[$field] = $data[$field];
                    } else {
                        // 如果缺少复合主键数据则不执行
                        throw new Exception('miss complex primary data');
                    }
                    unset($data[$field]);
                }
            }
            if (!isset($where)) {
                // 如果没有任何更新条件则不执行
                throw new Exception('miss update condition');
            } else {
                $options['where']['AND'] = $where;
            }
        } elseif (!isset($key) && is_string($pk) && isset($options['where']['AND'][$pk])) {
            $key = $this->getCacheKey($options['where']['AND'][$pk], $options, $this->bind);
        }

        //过滤无效字段
        $this->filter($data);

        // 生成UPDATE SQL语句
        $sql = $this->builder->update($data, $options);
        // 获取参数绑定
        $bind = $this->getBind();
        if ($options['fetch_sql']) {
            // 获取实际执行的SQL语句
            return $this->connection->getRealSql($sql, $bind);
        } else {
            // 执行操作
            $result = '' == $sql ? 0 : $this->execute($sql, $bind);
            if ($result) {
                if (is_string($pk) && isset($where[$pk])) {
                    $data[$pk] = $where[$pk];
                } elseif (is_string($pk) && isset($key) && strpos($key, '|')) {
                    list($a, $val) = explode('|', $key);
                    unset($a);
                    $data[$pk]     = $val;
                }
                $options['data'] = $data;
                $this->trigger('after_update', $options);
            }
            return $result;
        }
    }
425425
private function realUnserialize($data)
    {
        //get
        if (is_string($data) && $this->redisSerialize) {
            switch ($this->redisSerialize) {
                case Macro::SERIALIZE_PHP:
                    if ($this->canUnserialize($data)) {
                        $data = unserialize($data);
                    }
                    break;
                case Macro::SERIALIZE_IGBINARY:
                    $data = @igbinary_unserialize($data);
                    break;
            }
        }

        if (is_string($data) && $this->phpSerialize) {
            switch ($this->phpSerialize) {
                case Macro::SERIALIZE_PHP:
                    if ($this->canUnserialize($data)) {
                        $data = unserialize($data);
                    }
                    break;
                case Macro::SERIALIZE_IGBINARY:
                    $data = @igbinary_unserialize($data);
                    break;
            }

            //兼容yii逻辑
            if (is_array($data) && count($data) === 2 && array_key_exists(1, $data) && $data[1] === null) {
                $data = $data[0];
            }
        }
        return $data;
    }
1066548
public function parse($data)
    {
        $ctrlName = Config::getField('project', 'default_ctrl_name', 'main\\main');
        $apn = Config::getField('project', 'ctrl_name', 'a');
        if (isset($data[$apn])) {
            $ctrlName = \str_replace('/', '\\', $data[$apn]);
        }

        $pathInfo = Request::getPathInfo();
        if (!empty($pathInfo) && '/' !== $pathInfo) {
            $routeMap = ZRoute::match(Config::get('route', false), $pathInfo);
            if (is_array($routeMap)) {
                $ctrlName = \str_replace('/', '\\', $routeMap[0]);
                if (!empty($routeMap[2]) && is_array($routeMap[2])) {
                    //参数优先
                    $data = $data + $routeMap[2];
                }
            }
        }

        $method = Request::getHttpMethod();
        Request::init($ctrlName, $method, $data, Config::getField('project', 'view_mode', 'Php'));
        return true;
    }
860873
public function createPage(array $data)
    {
        $url = "https://api.weixin.qq.com/shakearound/page/add?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
953640
public function searchSemantic(array $data)
    {
        $result = $this->httpRaw(self::WECHAT_SEMANTIC_SEMPROXY_PREFIX, $data, [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['errcode']) && !$result['errcode'] ? $result : false;
    }
65018
public function createQrCode(array $data)
    {
        $result = $this->httpRaw(self::WECHAT_QR_CODE_CREATE_PREFIX, $data, [
            'access_token' => $this->getAccessToken()
        ]);
        return !array_key_exists('errcode', $result) ? $result : false;
    }
1053159
public function toHtml($data)
    {
        if (!is_object($data) && !is_array($data)) {
            throw new \InvalidArgumentException('The $data parameter takes only an object or an array.');
        }

        $data = (array) $data;
        $type = (string) $data['type'];

        switch ($type) {
            case 'photo':
                if (empty($data['width']) || empty($data['height'])) {
                    return false;
                }
                // no break

            case 'link':
                if (empty($data['url']) || !$this->isSafeUrl($data['url'])) {
                    return false;
                }
                break;

            case 'video':
            case 'rich':
                if (empty($data['html']) || !$this->isSafeHtml($data['html'])) {
                    return false;
                }
                break;

            default:
                return false;
        }

        return $this->render($type, $data);
    }