from语句

@return string
487328
public function getFromString(): string
    {
        $statement = '';
        if (empty($this->builder->getFrom())) {
            return $statement;
        }

        // from语句
        $statement .= $this->getFrom();
        $fromAlias = $this->getFromAlias();

        if (!empty($fromAlias)) {
            $statement .= ' AS ' . $fromAlias;
        }
        // join语句
        $statement .= ' ' . $this->getJoinString();
        $statement = rtrim($statement);

        if (!empty($statement)) {
            $statement = 'FROM ' . $statement;
        }

        return $statement;
    }
319253
protected function prepareFrom(): string
    {
        $fromClauses = [];
        // Loop through all FROM clauses
        foreach ($this->from as $from) {
            $fromClause = Db::quoteIdentifier($from['table']) . ' AS ' . Db::quoteIdentifier($from['alias'])
                . $this->prepareJoins($from['alias']);

            $fromClauses[$from['alias']] = $fromClause;
        }

        return ' FROM ' . implode(', ', $fromClauses);
    }
911857
function callBack($from,$to,$customerSerNum,$fromSerNum,$promptTone)
	  {
        //子帐号鉴权信息验证，对必选参数进行判空。
        $auth=$this->subAuth();
        if($auth!=""){
            return $auth;
        }
        // 拼接请求包体
        if($this->BodyType=="json"){
           $body= "{'from':'$from','to':'$to','customerSerNum':'$customerSerNum','fromSerNum':'$fromSerNum','promptTone':'$promptTone'}";
        }else{
           $body= "<CallBack>
                     <from>$from</from>
                     <to>$to</to>
                     <customerSerNum>$customerSerNum</customerSerNum>
                     <fromSerNum>$fromSerNum</fromSerNum>
                     <promptTone>$promptTone</promptTone>
                   </CallBack>";
        }
        $this->showlog("request body = ".$body);
        // 大写的sig参数
        $sig =  strtoupper(md5($this->SubAccountSid . $this->SubAccountToken . $this->Batch));
        // 生成请求URL
        $url="https://$this->ServerIP:$this->ServerPort/$this->SoftVersion/SubAccounts/$this->SubAccountSid/Calls/Callback?sig=$sig";
        $this->showlog("request url = ".$url);
        // 生成授权：子帐号Id + 英文冒号 + 时间戳
        $authen=base64_encode($this->SubAccountSid . ":" . $this->Batch);
        // 生成包头
        $header = array("Accept:application/$this->BodyType","Content-Type:application/$this->BodyType;charset=utf-8","Authorization:$authen");
        // 发请求
        $result = $this->curl_post($url,$body,$header);
        $this->showlog("response body = ".$result);
        if($this->BodyType=="json"){//JSON格式
           $datas=json_decode($result);
        }else{ //xml格式
           $datas = simplexml_load_string(trim($result," \t\n\r"));
        }
      //  if($datas == FALSE){
//            $datas = new stdClass();
//            $datas->statusCode = '172003';
//            $datas->statusMsg = '返回包体错误'; 
//        }
        return $datas;
	}
758305
protected function buildFrom()
    {
        if (!$this->from) {
            return '';
        }

        $refs = array();
        foreach ($this->from as $from) {
            $refs[] = implode(' ', $from);
        }
        return ' FROM' . $this->indentCsv($refs);
    }
529078
protected function actionList()
    {
        /* 判断类型 */
        switch ($_GET['action']) {
            /* 列出文件 */
            case 'listfile':
                $this->driver->uploadDir .= DIRECTORY_SEPARATOR . 'file';
                $this->driver->accept = $this->reAccept($this->config['fileManagerAllowFiles']);
                break;
            /* 列出图片 */
            default:
                $this->driver->uploadDir .= DIRECTORY_SEPARATOR . 'image';
                $this->driver->accept = $this->reAccept($this->config['imageManagerAllowFiles']);
        }

        /* 获取参数 */
        $size = isset($_GET['size']) ? htmlspecialchars($_GET['size']) : 10;
        $start = isset($_GET['start']) ? htmlspecialchars($_GET['start']) : 0;
        $response = $this->driver->listFiles($start, $size);

        $result = [];
        $result['state'] = 'SUCCESS';
        $result['list'] = array_map(function ($val) {
            return [
                'url' => $this->formatListItemUrl($val)
            ];
        },$response->list);
        return json_encode($result);
    }
874786
public function selected()
    {
        // 请求参数
        $param['__EVENTTARGET'] = '';
        $param['__EVENTARGUMENT'] = '';
        $param['__VIEWSTATE'] = true;
        $param['zymc'] = "";
        $param['xx'] = "";
        $param['Button8'] = iconv('utf-8', 'gb2312', '已选课程');

        $header = [
            'code', 'name', 'property', 'direction', 'credit', 'hour', 'exam_time', '', 'status'
        ];

        return $this->getSelect($param, $param, $header, 10);
    }
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;
	}
370778
public function getData()
    {
        $this->validateData();

        $data = array(
            'version'            => $this->getVersion(),
            'charset'            => $this->getEncoding(), //UTF-8, GBK等
            'merId'              => $this->getMerId(),   //无卡商户填写
            'merAbbr'            => $this->getMerAbbr(), //商户名称
            'transType'          => $this->getTransType(), //交易类型，CONSUME or PRE_AUTH
            'orderAmount'        => $this->getOrderAmount(), //交易金额
            'orderNumber'        => $this->getOrderNumber(), //订单号，必须唯一
            'orderTime'          => $this->getOrderTime(), //交易时间, YYYYmmhhddHHMMSS
            'orderCurrency'      => $this->getOrderCurrency(), //交易币种，CURRENCY_CNY=>156
            'customerIp'         => $this->getCustomerIp(), //用户IP
            'frontEndUrl'        => $this->getReturnUrl(), //前台回调URL
            'backEndUrl'         => $this->getNotifyUrl(), //后台回调URL
            'commodityUrl'       => $this->getShowUrl(),
            'commodityName'      => $this->getTitle(),
            'origQid'            => '',
            'acqCode'            => '',
            'merCode'            => '',
            'commodityUnitPrice' => '',
            'commodityQuantity'  => '',
            'commodityDiscount'  => '',
            'transferFee'        => '',
            'customerName'       => '',
            'defaultPayType'     => '',
            'defaultBankNumber'  => '',
            'transTimeout'       => '',
            'merReserved'        => '',
            'signMethod'         => 'md5',
        );

        $data = $this->filter($data);

        $data['signature'] = $this->sign($data);

        return $data;
    }
495520
public function run()
    {

        $id = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->id;

        $config = Json::encode($this->config);

        //ready部分代码，是为了缩略图管理。UEditor本身就很大，在后台直接加载大文件图片会很卡。
        $script = <<<UEDITOR
    var {$this->name} = UE.getEditor('{$id}',{$config});
    {$this->name}.ready(function(){
        this.addListener( "beforeInsertImage", function ( type, imgObjs ) {
            for(var i=0;i < imgObjs.length;i++){
                imgObjs[i].src = imgObjs[i].src.replace(".thumbnail","");
            }
        });
    });
UEDITOR;

        $this->getView()->registerJs($script);

        if ($this->hasModel()) {
            return Html::activeTextarea($this->model, $this->attribute);
        } else {
            return Html::textarea($this->name, $this->value, ['id' => $id]);
        }
    }
862092
public function toArray()
    {
        $arr = [];
        // 从保存未定义属性的变量中读取字段kv
        foreach ($this->attrs as $field => $value) {
            $arr[$field] = $value;
        }

        // 从指定的属性中读取字段kv
        foreach ($this->columnMap as $field => $attr) {
            if (property_exists($this, $attr)) {
                $arr[$field] = $this->$attr;
            } else {
                unset($arr[$field]);
            }
        }

        return $arr;
    }
1338697
public function getContent() {
        $cmd = Factory::config('php_path', 'php').' -dvld.active=1 '.$this->srcFile;  // 替换为你要执行的shell脚本
        $process = Process::factory($cmd);
        $status = $process->start()->join()->stop();
        extract($process->getOutput());
        return $stderr;
    }
1297027
public function makeSign()
	{
		//签名步骤一：按字典序排序参数
		ksort($this->values);
		$string = $this->toUrlParams();
		//签名步骤二：在string后加入KEY
		$string = $string . '&key=' . Wxpay::getConfig('key');
		//签名步骤三：MD5加密
		$string = md5($string);
		//签名步骤四：所有字符转为大写
		$result = strtoupper($string);
		return $result;
	}
274260
public function getquery()
      {
            $query = \Grace\Req\Environment::getInstance()->all()['query'];
            $_p = array();
            $_query = explode('&', $query);
            foreach($_query as $k=>$value){
                  //存在=号
                  $p = explode('=', $value);
                  if(!empty($p[0])){
                        $_p[$p[0]] = isset($p[1])?$p[1]:'';
                  }
            }
            return $_p;       //获得通过querystring 分析出来的参数
      }
160884
public function from($from)
    {
        $pos = strpos($from, ' ');
        if (false !== $pos) {
            $this->table = substr($from, 0, $pos);
        } else {
            $this->table = $from;
        }
        $this->fullTable = $this->db->getTable($this->table);
        return $this->add('from', $this->db->getTable($from));
    }
1001777
public function create()
    {
        if ($this->bgImage && is_file($this->bgImage)) {
            // 从背景图片建立背景画布
            $this->img = imagecreatefrompng($this->bgImage);
        } else {
            // 手动建立背景画布,图像资源
            $this->img = imagecreatetruecolor($this->width, $this->height);

            //给画布填充矩形的背景色rgb(230, 255, 230);
            $bgColor = $this->bgColor;

            //背景色
            $bgColor = imagecolorallocate(
                $this->img, hexdec(substr($bgColor, 1, 2)),
                hexdec(substr($bgColor, 3, 2)), hexdec(substr($bgColor, 5, 2))
            );

            imagefilledrectangle($this->img, 0, 0, $this->width, $this->height, $bgColor);
        }

        //给资源画上边框-可选 rgb(153, 153, 255)
//        $borderColor = imagecolorallocate($this->img, 153, 153, 255); // 0-255
//        imagerectangle($this->img, 0, 0, $this->width-1, $this->height-1,$borderColor);

        $this->drawLine();
        $this->drawChar();
        $this->drawPixel();
        $this->drawChars();

        return $this;
    }
603938
public function parseURL() {

        $appConfigs = getConfigs(); //获取app配置

        self::$urlMappingRules = $appConfigs['url_mapping_rules'];
        //优先处理短链接映射
        $this->requestUri = self::url2source($this->requestUri);
        $_SERVER['REQUEST_URI'] = $this->requestUri;

        $defaultUrl = $appConfigs['default_url'];
        $urlInfo = parse_url($this->requestUri);

        if ( $urlInfo['path'] && $urlInfo['path'] != '/' ) {
            $filename = str_replace(EXT_URI, '', $urlInfo['path']);
            $filename = rtrim($filename, "/");
            $pathInfo = explode('/', $filename);
            array_shift($pathInfo);
            if ( $pathInfo[0] ) $this->setModule($pathInfo[0]);
            if ( $pathInfo[1] ) $this->setAction($pathInfo[1]);
            if ( $pathInfo[2] ) $this->setMethod($pathInfo[2]);

            //提取pathinfo参数
            if ( count($pathInfo) > 3 ) {
                if ( isset($pathInfo[3]) ) {
                    $params = explode('-', $pathInfo[3]);
                    for ( $i = 0; $i < count($params); $i++ ) {
                        if ( $i % 2 == 0 ) {
                            if ( trim($params[$i]) == '' ) {
                                continue;
                            }
                            $_GET[$params[$i]] = $params[$i+1];
                        }
                    }
                }
            }

            //提取query参数
            if ( isset($urlInfo['query']) ) {
                $params = explode('&', $urlInfo['query']);
                foreach ( $params as $values ) {
                    $__p = explode('=', $values);
                    if ( trim($__p[0]) == '' ) {
                        continue;
                    }
                    $_GET[$__p[0]] = urldecode($__p[1]);
                }
            }

        }

        //如果没有任何参数，则访问默认页面。如http://www.herosphp.my这种格式
        if ( !$this->module ) $this->setModule($defaultUrl['module']);
        if ( !$this->action ) $this->setAction($defaultUrl['action']);
        if ( !$this->method ) $this->setMethod($defaultUrl['method']);

        $this->setParameters($_GET + $_POST);

        //die();
    }
769265
public function run()
    {
        if(Schema::hasTable(strtolower($this->model)))
        {
            $tableName = strtolower($this->model);
        }elseif(Schema::hasTable(strtolower($this->model)."s")) {
            $tableName = strtolower($this->model."s");
        }else{
            $tableName = "";
        }

        $tableColumns = $tableName != "" ? Schema::getColumnListing($tableName) : [];

        $module  = camel_case($this->module);
        $model   = camel_case($this->model);

        $paramColumns = array_diff($tableColumns, ["id", "created_at", "updated_at"]);

        $paramStrings = collect($paramColumns)->map(function($item){
            return "$".lcfirst(camel_case($item));
        })->toArray();

        $data = [
            "group"         => $this->group,
            "module"        => $module,
            "model"         => $model,
            "paramStrings"  => $paramStrings,
            "tableColumns"  => $paramColumns
        ];

        $this->makeDir();

        //列表视图
        $listsFilePath      = "views/".$this->group."/".$this->module."/".$this->model."_lists.blade.php";
        $listsTemplatePath  = $this->customTemplate ?: __DIR__."/template/view/lists.blade.php";

        $this->makeView($listsFilePath, $listsTemplatePath, $data);

        //创建视图
        $addFilePath        = "views/".$this->group."/".$this->module."/add_".$this->model.".blade.php";
        $addTemplatePath    = $this->customTemplate ?: __DIR__."/template/view/add.blade.php";

        $this->makeView($addFilePath, $addTemplatePath, $data);

        //编辑视图
        $editFilePath       = "views/".$this->group."/".$this->module."/edit_".$this->model.".blade.php";
        $editTemplatePath   = $this->customTemplate ?: __DIR__."/template/view/edit.blade.php";

        $this->makeView($editFilePath, $editTemplatePath, $data);

        //查看视图
        $viewFilePath       = "views/".$this->group."/".$this->module."/view_".$this->model.".blade.php";
        $viewTemplatePath   = $this->customTemplate ?: __DIR__."/template/view/view.blade.php";

        $this->makeView($viewFilePath, $viewTemplatePath, $data);
    }