获取全部请求输入

@return mixed
344349
public function input()
    {
        return array_replace_recursive($this->query->all(), $this->attributes->all(), $this->request->all());
    }
549904
private function parseNetwork()
    {
        // 用户名密码认证处理
        $username = $this->request->getAttribute('username');
        if(null != $username)
        {
            $auth = base64_encode($username . ':' . $this->request->getAttribute('password', ''));
            $this->request = $this->request->withAddedHeader('Authorization', 'Basic ' . $auth);
        }
        // 超时
        $this->settings['timeout'] = $this->request->getAttribute('timeout', 30000) / 1000;
    }
890255
private static function getRouteArray() {
        //获取请求URL
        $requestUrl = ltrim(rtrim($_SERVER['REQUEST_URI'], '/'), '/');

        //处理特殊情况，去掉index.php/
        if (substr($requestUrl, 0, 9) == 'index.php') {
            $requestUrl = substr($requestUrl, 10);
        }

        //去除?以后的所有参数
        $requestUrl = String::urlSafetyFilter($requestUrl);
        $requestUrlArr = explode('?', $requestUrl);

        //处理请求URL
        $requestUrlArr = explode('/', $requestUrlArr[0]);

        if (count($requestUrlArr) == 0) {
            error_404();
        }

        $requestUrlArr = self::secondDomainFilter($requestUrlArr);

        return $requestUrlArr;
    }
779927
public function getDepartment(){
	    if (!$this->access_token && !$this->checkAuth()) return false;
	    $result = $this->http_get(self::API_URL_PREFIX.self::DEPARTMENT_LIST_URL.'access_token='.$this->access_token);
	    if ($result)
	    {
	        $json = json_decode($result,true);
	        if (!$json || !empty($json['errcode'])) {
	            $this->errCode = $json['errcode'];
	            $this->errMsg = $json['errmsg'];
	            return false;
	        }
	        return $json;
	    }
	    return false;
	}
205817
public function getPrev()
    {
        return self::find()->where(['<', 'id', $this->id])->orderBy(['id' => SORT_DESC])->limit(1)->one();
    }
334311
public function MakeSign()
	{
		//签名步骤一：按字典序排序参数
		ksort($this->values);
		$string = $this->ToUrlParams();
		//签名步骤二：在string后加入KEY
		$string = $string . "&key=".WxPayConfig::$KEY;
		//签名步骤三：MD5加密
		$string = md5($string);
		//签名步骤四：所有字符转为大写
		$result = strtoupper($string);
		return $result;
	}
1220409
public function getUriAsIs() {
        $query = $this->server->get('QUERY_STRING');

        if (!empty($query)) {
            $query = '?' . $query;
        }

        return $this->getSchemeAndHttpHost() . $this->getBaseUrl() . $this->getPathInfo() . $query;
    }
744503
public function check()
    {
        $required = Valid::class . '::required';

        foreach ($this->rules as $rule) {
            list($field, $rule, $params, $message) = $rule;

            // 如果已经存在一条错误了，则后面的错误不再验证
            if (isset($this->errors[$field])) {
                continue;
            }

            $value = Arr::get($this->data, $field);

            // 当规则为非空校验时，如果值为空，则不进行判断
            if ($rule !== $required && !Valid::required($value)) {
                continue;
            }

            $params = $this->normalizeParams($params, $rule, $value);

            if (!call_user_func_array($rule, $params)) {
                $this->errors[$field] = $message;
            }
        }

        return count($this->errors) === 0;
    }
320904
public function get()
    {
        //获取保存值
        $raw = parent::getRaw();
        if (is_null($raw)) {
            return null;
        }

        //JSON解码
        $decoded = json_decode($raw);

        //如果解码失败,返回原始内容
        if (is_null($decoded)) {
            return $raw;
        }

        return $decoded;
    }
1136621
public function getUri()
    {
        if (PHP_SAPI == 'cli') {
            return '/'. trim(Arr::get($_SERVER['argv'], 1, '/'), '/');
        }

        $requestUri = parse_url('http://example.com' . Arr::get($_SERVER, 'REQUEST_URI', ''), PHP_URL_PATH);

        $requestUri = empty($requestUri) ? '/' : $this->filterPath($requestUri);

        return '/' . trim($requestUri, '/');

        // nginx 这种配置不可能走下边逻辑 try_files $uri $uri/ /index.php?$query_string;

        // Path
        // $requestScriptName = parse_url(Arr::get($_SERVER, 'SCRIPT_NAME', ''), PHP_URL_PATH);
        // $requestScriptDir = dirname($requestScriptName);

        // parse_url() requires a full URL. As we don't extract the domain name or scheme,
        // we use a stand-in.
        // $requestUri = parse_url('http://example.com' . Arr::get($_SERVER, 'REQUEST_URI', ''), PHP_URL_PATH);
        //
        // $basePath = '';
        // $virtualPath = $requestUri;
        // if (stripos($requestUri, $requestScriptName) === 0) {
        //     $basePath = $requestScriptName;
        // } elseif ($requestScriptDir !== '/' && stripos($requestUri, $requestScriptDir) === 0) {
        //     $basePath = $requestScriptDir;
        // }
        //
        // if ($basePath) {
        //     $virtualPath = ltrim(substr($requestUri, strlen($basePath)), '/');
        // }
        //
        // $requestUri = empty($virtualPath) ? '/' : $this->filterPath($virtualPath);
        //
        // return '/' . ltrim($requestUri, '/');
    }
398614
public function getCategory()
    {
        if (!$this->access_token && !$this->getAccessToken()) {
            return false;
        }
        $result = Tools::httpGet(self::API_URL_PREFIX . self::POI_CATEGORY . "access_token={$this->access_token}");
        if ($result) {
            $json = json_decode($result, true);
            if (empty($json) || !empty($json['errcode'])) {
                $this->errCode = isset($json['errcode']) ? $json['errcode'] : '505';
                $this->errMsg = isset($json['errmsg']) ? $json['errmsg'] : '无法解析接口返回内容！';
                return $this->checkRetry(__FUNCTION__, func_get_args());
            }
            return $json;
        }
        return false;
    }
1243347
protected function preprocessSelect()
    {
        // handle fields
        if (!isset($this->query['fields']) && !isset($this->query['distinct'])) {
            if (isset($this->query['count'])) {
                $this->query['fields'] = 'count(*)';
            } else {
                $this->query['fields'] = '*';
            }
        }
        
        if (isset($this->query['count']) || (is_string($this->query['fields'][0]) && strpos('count(', $this->query['fields'][0]) !== false)) {
            return ;
        }
        
        /**
         * 检查分页
         * start 作为初始偏移量
         * 
         * -- 解析出 pagesize
         * 1 如果设置了 limit, 从中解析出 offset|pagesize, offset 可能没有值
         * 2 如果未设置 limit 则检查 pagesize 或 num 选项, 得出 pagesize
         * 
         * -- 解析出 offset, 并得出最终 limit
         * 1 如果设置了 limit 且已包含offset, 则优先使用
         * 2 否则检查 page, 解析出 offset, 结合 pagesize 生成最终 limit
         * 3 否则使用已 解析的 start pagesize, 生成最终 limit
         */
        $start = isset($this->query['start']) && intval($this->query['start'][0])>0 ? intval($this->query['start'][0]) : 0;
        if (isset($this->query['limit'])) {     // 优先使用 limit
            if (is_numeric($this->query['limit'][0])) {
                $pagesize = $this->query['limit'][0];
            } else {
                if (!is_array($this->query['limit'][0])) $limitArr = explode(',', $this->query['limit'][0]);
                if (is_numeric($limitArr[0]) && is_numeric($limitArr[1])) {
                    $offset = $limitArr[0];
                    $pagesize = $limitArr[1];
                }
            }
        }
        if (!isset($pagesize) || ! $pagesize) {                  // limit 不存在则依次判断 pagesize, num
            if (isset($this->query['pagesize']) && intval($this->query['pagesize'][0])>0 ) {
                $pagesize   = intval($this->query['pagesize'][0]);
            } elseif (isset($this->query['num']) && intval($this->query['num'][0])>0 ) {
                $pagesize   = intval($this->query['num'][0]);
            }
        }
        
        if (isset($offset)) {
            $offset += $start;
            $limit      =  $offset . ',' . $pagesize;
        } elseif (isset($this->query['page'])) {
            $page       = intval($this->query['page'][0]) > 0 ? intval($this->query['page'][0]) : 1;
            // notice: $pagesize may be still null. 此时 pagesize 仍然可能为空，因为未设置或解析不正确
            $pagesize   = !empty($pagesize) ? $pagesize : 10;
            $offset     =  $start + $pagesize * ($page - 1);
            $limit      =  $offset . ',' . $pagesize;
        } elseif (isset($pagesize)) {
            $limit = $start . ',' . $pagesize;
        }
        if (isset($limit)) {
            $this->query->remove('limit')->set('limit', $limit);     // 强制重设
        }
    }
438181
private function parseReq()
    {
        $this->ip = $this->getIp();
        $this->hostname = $this->env->get('HTTP_HOST');
        $this->referrer = $this->env->get('HTTP_REFERER');
        $this->referer = $this->referrer;
        //请求协议
        $protocol = $this->env->get('SERVER_PROTOCOL');
        //设置变量
        if ($protocol) {
            list($this->protocol, $this->version) = explode('/', $protocol);
            if ($this->protocol == 'https') {
                $this->secure = true;
            } else {
                $this->secure = false;
            }
        } else {
            $this->secure = false;
        }

        return $this;
    }
469721
protected function parseExpress()
    {
        $options = $this->options;

        // 获取数据表
        if (empty($options['table'])) {
            $options['table'] = $this->getTable();
        }

        if (!isset($options['where'])) {
            $options['where'] = [];
        } elseif (isset($options['view'])) {
            // 视图查询条件处理
            foreach (['AND', 'OR'] as $logic) {
                if (isset($options['where'][$logic])) {
                    foreach ($options['where'][$logic] as $key => $val) {
                        if (array_key_exists($key, $options['map'])) {
                            $options['where'][$logic][$options['map'][$key]] = $val;
                            unset($options['where'][$logic][$key]);
                        }
                    }
                }
            }

            if (isset($options['order'])) {
                // 视图查询排序处理
                if (is_string($options['order'])) {
                    $options['order'] = explode(',', $options['order']);
                }
                foreach ($options['order'] as $key => $val) {
                    if (is_numeric($key)) {
                        if (strpos($val, ' ')) {
                            list($field, $sort) = explode(' ', $val);
                            if (array_key_exists($field, $options['map'])) {
                                $options['order'][$options['map'][$field]] = $sort;
                                unset($options['order'][$key]);
                            }
                        } elseif (array_key_exists($val, $options['map'])) {
                            $options['order'][$options['map'][$val]] = 'asc';
                            unset($options['order'][$key]);
                        }
                    } elseif (array_key_exists($key, $options['map'])) {
                        $options['order'][$options['map'][$key]] = $val;
                        unset($options['order'][$key]);
                    }
                }
            }
        }

        if (!isset($options['field'])) {
            $options['field'] = '*';
        }

        if (!isset($options['data'])) {
            $options['data'] = [];
        }

        if (!isset($options['strict'])) {
            $options['strict'] = $this->getConfig('fields_strict');
        }

        foreach (['master', 'lock', 'fetch_pdo', 'fetch_sql', 'distinct'] as $name) {
            if (!isset($options[$name])) {
                $options[$name] = false;
            }
        }

        foreach (['join', 'union', 'group', 'having', 'limit', 'order', 'force', 'comment'] as $name) {
            if (!isset($options[$name])) {
                $options[$name] = '';
            }
        }

        if (isset($options['page'])) {
            // 根据页数计算limit
            list($page, $listRows) = $options['page'];
            $page                  = $page > 0 ? $page : 1;
            $listRows              = $listRows > 0 ? $listRows : (is_numeric($options['limit']) ? $options['limit'] : 20);
            $offset                = $listRows * ($page - 1);
            $options['limit']      = $offset . ',' . $listRows;
        }

        $this->options = [];
        return $options;
    }
169486
public function create(): string
    {
        switch ($this->operation) {
            case 'exist':
                // 判断是否存在满足条件的记录
                return $this->createExist();
            case 'query':
            case 'repair':
            case 'optimize':
            case 'call':
                // 直接SQL查询
                return $this->createQuery();
            case 'execute':
                // 直接SQL操作
                return $this->createExecute();
            case 'insert':
                // 插入
            case 'replace':
                // 存在则替换,否则插入
            case 'insertIgnore':
                // 存在则忽略,否则插入
                return $this->createAdd();
            case 'inserts':
                //多行插入
                return $this->createInserts();
            case 'update':
                // 修改
                return $this->createUpdate();
            case 'delete':
                // 删除
                return $this->createDelete();
            case 'deleteAll':
                // 删除全部
                return $this->createDeleteAll();
            case 'select':
                // 查询
            case 'selectHandle':
                // 查询并返回句柄
                return $this->createSelect();
            case 'crease':
                // 增减
                return $this->createCrease();
        }
        trigger_error('无法识别或不支持的SQL命令:' . $this->operation, E_USER_ERROR);
        return '';
    }
1002327
public function render(){
        //获取组件的class
        $class = self::getClass(self::$set['component_name']);
        //获取组件的属性
        $component_attr = $class::attr();
        //外部调用设定代替默认值
        //赋值一个id的属性
        self::$set['id'] = self::$uniqid_id;

        $class::$attr = array_merge($component_attr ,self::$set);


        if(isset($component_attr['layFilter'])){ //如果组件有这个属性 ，但却没有设置，则默认 是 uniqid_id
            $class::$attr['layFilter'] = ( !isset(self::$set['layFilter']) )  ? self::$uniqid_id  : self::$set['layFilter'];
        }

        //记录当前页面使用了哪些组件
        array_push(self::$components ,[
            'component_name' => self::$set['component_name'] ,
            'uniqid_id' => self::$uniqid_id,
            'set' => $class::$attr
        ]);

        $dom = $class::dom();

        //销毁静态变量 保留了 self::$components 用于 调用组件的js
        self::$set = $class::$attr = $class::$id = null;

        return $dom;
    }
1281400
protected function getDeleteStatement(): string
    {
        $statement = '';
        if (!$this->isDelete()) {
            return $statement;
        }

        // delete语句
        $statement .= $this->getDeleteString();

        // from语句
        if ($this->builder->getFrom()) {
            $statement .= ' ' . $this->getFromString();
        }

        // where语句
        if ($this->builder->getWhere()) {
            $statement .= ' ' . $this->getWhereString();
        }

        // orderBy语句
        if ($this->builder->getOrderBy()) {
            $statement .= ' ' . $this->getOrderByString();
        }

        // limit语句
        if ($this->builder->getLimit()) {
            $statement .= ' ' . $this->getLimitString();
        }

        return $statement;
    }