获取区间
@return [type] [description]
188590
public function limit() {
        $args = func_get_args();
        $this->build()->bindExpression('limit', $args[0] . " " . (empty($args[1]) ? '' : ",{$args[1]}"));

        return $this->connection;
    }
605154
public function actionCreate()
    {
        $model = new WechatForm();
        if ($model->load(Yii::$app->request->post())) {
            if (Request::isAjax()) {
                Yii::$app->getResponse()->format = Response::FORMAT_JSON;
                return ActiveForm::validate($model);
            } elseif ($model->save()) {
                return $this->flash('公众号创建成功! 请补充余下公众号设置以激活公众号', 'info', ['update', 'id' => $model->id]);
            }
        }
        return $this->render('create', [
            'model' => $model
        ]);
    }
622859
public function index()
    {
        return Admin::content(function (Content $content) {
            $content->header(trans('admin.lang.menu'));
            $content->description(trans('admin.:lang.list'));

            $content->row(function (Row $row) {
                $row->column(6, $this->treeView()->render());

                $row->column(6, function (Column $column) {
                    $form = new \Jblv\Admin\Widgets\Form();
                    $form->action(admin_url('auth/menu'));

                    $form->select('parent_id', trans('admin.parent_id'))->options(Menu::selectOptions());
                    $form->text('title', trans('admin.title'))->rules('required');
                    $form->icon('icon', trans('admin.icon'))->default('fa-bars')->rules('required')->help($this->iconHelp());
                    $form->text('uri', trans('admin.uri'));
                    $form->multipleSelect('roles', trans('admin.roles'))->options(Role::all()->pluck('name', 'id'));

                    $column->append((new Box(trans('admin.new'), $form))->style('success'));
                });
            });
        });
    }
758627
public function getTable()
    {
        if ($this->_sql['from']) {
            $table = $this->_sql['from'];
        } else {
            $table = $this->table;
        }
        /**
         * 处理子查询问题
         * 子查询使用()包裹
         */
        if (strpos($table, ')') !== false && strpos($table, '(') !== false) {
            return $table;
        }
        $table = $this->prefix . $table;
        return $this->formatTable($table);
    }
616755
function createFormContentRows() {
    var oThis = this,
        htmlStr = "";
    // 遍历生成所有行
    if (this.dataSourceObj.rows) {
        htmlStr += '<tbody role="rowgroup" id="' + this.options.id + '_form_content_tbody">';
        $.each(this.dataSourceObj.rows, function () {
            htmlStr += '<tr role="row"><td role="rowcell">';
            var value = this.value;
            $.each(oThis.gridCompColumnArr, function () {
                var f = this.options.field,
                    t = this.options.title,
                    v = $(value).attr(f);
                htmlStr += '<div>' + t + ':</div>';
                htmlStr += '<div>' + v + '</div>';
            });
            htmlStr += '</td></tr>';
        });
        htmlStr += '</tbody>';
    }
    return htmlStr;
}
974140
public function getDepartments()
	{

		$me = Member::find($this->selfId)->department;

		$myDepartmentCode = Department::find($me)->code;

		$likeCode = $myDepartmentCode.'%';

		$recs = Department::where('code','LIKE', $likeCode)->get();

		if(count($recs)){
			$arr = [];
			foreach ($recs as $rec) {
				$arr = array_add($arr, $rec->id, $rec->name);
			}
			return $arr;
		}else{
			die('FooWeChat\Authorize\Auth\getDepartments: 记录异常');
			//return view('40x',['color'=>'danger', 'type'=>'1', 'code'=>'1.2']);
		}

	}
196525
public function createImage()
    {
        $this->initImage(); //创建基本图片
        $this->createText(); //输出验证码字符
        if ($this->distortion) {
            $this->distortionText();
        } //扭曲文字
        $this->createNoisePoint(); //产生干扰点
        $this->createNoiseLine(); //产生干扰线
        if ($this->showBorder) {
            imagerectangle($this->image, 0, 0, $this->width - 1, $this->height - 1, $this->randFontColor);
        } //添加边框
        imagepng($this->image);
        imagedestroy($this->image);
        if ($this->distortion) {
            imagedestroy($this->distortionImage);
        }

        return $this->textContent;
    }
1007077
protected function getActionsColumn()
    {
        return function ($row) {
            $btns    = [];
            $html    = app('html');
            $btns[]  = $html->create('li', $html->link(handles("antares::customfields/{$row->id}/edit"), trans('antares/brands::label.brand.edit'), ['data-icon' => 'edit']));
            $btns[]  = $html->create('li', $html->link(handles("antares::customfields/{$row->id}/delete", ['csrf' => true]), trans('antares/brands::label.brand.delete'), ['class' => "triggerable confirm", 'data-icon' => 'delete', 'data-title' => trans("Are you sure?"), 'data-description' => trans('Deleteing customfield') . ' ' . $row->name]));
            $section = $html->create('div', $html->create('section', $html->create('ul', $html->raw(implode('', $btns)))), ['class' => 'mass-actions-menu'])->get();
            return '<i class="zmdi zmdi-more"></i>' . app('html')->raw($section)->get();
        };
    }
206559
protected function buildQuery()
    {
        $foreignKey = $this->foreignKey;
        $localKey   = $this->localKey;

        // 关联查询
        $pk = $this->parent->getPk();

        $condition[] = ['pivot.' . $localKey, '=', $this->parent->$pk];

        return $this->belongsToManyQuery($foreignKey, $localKey, $condition);
    }
606337
public function actionIndex()
    {
        $where = ['type' => Article::ARTICLE];
        $query = Article::find()->select([])->where($where);
        $keyword = htmlspecialchars(yii::$app->getRequest()->get('q'));
        $query->andFilterWhere(['like', 'title', $keyword]);
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort' => [
                'defaultOrder' => [
                    'sort' => SORT_ASC,
                    'id' => SORT_DESC,
                ]
            ]
        ]);
        return $this->render('/article/index', [
            'dataProvider' => $dataProvider,
            'type' => yii::t('cms', 'Search keyword {keyword} results', ['keyword'=>$keyword]),
        ]);
    }
1114108
public function compile()
    {
        $condition_fragments = array();
        $arguments = array();

        $conditions = $this->conditions;
        //没有条件直接返回null
        if ($this->count() < 1) {
            $this->conditionString = '';
            $this->arguments = [];
            return $this;
        }

        //条件操作
        $conditionOperator = $conditions['#conditionOperator'];
        unset($conditions['#conditionOperator']);
        foreach ($conditions as $condition) {

            switch (true) {
                case $condition['field'] instanceof Condition:
                    $condition['field']->compile();
                    if((string) $condition['field']){
                        $condition_fragments[] = '(' . (string) $condition['field'] . ')';
                        $arguments = ArrayLib::array_add($arguments, $condition['field']->arguments());
                    }

                    break;
                case empty($condition['operator']):
                    $condition_fragments[] = '(' . $condition['field'] . ')';
                    $arguments = ArrayLib::array_add($arguments, $condition['value']);
                    break;
                default:
                    $operator_defaults = array(
                        'prefix' => '',
                        'postfix' => '',
                        'delimiter' => '',
                        'operator' => $condition['operator'],
                        'use_value' => TRUE,
                    );
                    $operator = $this->mapConditionOperator($condition['operator']);
                    if (!isset($operator)) {
                        $operator = $this->mapConditionOperator($condition['operator']);
                    }
                    $isSingleValue = false;
                    $operator += $operator_defaults;
                    if (!$operator['delimiter']) {
                        $condition['value'] = array($condition['value']);
                        $isSingleValue = true;
                    }
                    if ($operator['use_value']) {
                        foreach ($condition['value'] as $value) {
                            $arguments[] = $value;
                        }
                    }
                    $condition_fragments[] = $isSingleValue ? sprintf(
                        "%s %s %s",
                        $condition['field'],
                        $operator['operator'],
                        implode(',', array_pad([], count($condition['value']), '?'))
                    ) : sprintf(
                        "%s %s %s %s %s",
                        $condition['field'],
                        $operator['operator'],
                        $operator['prefix'],
                        implode(',', array_pad([], count($condition['value']), '?')),
                        $operator['postfix']
                    );
                    break;
            }

        }
        $this->conditionString = implode(" $conditionOperator ", $condition_fragments);
        $this->arguments = $arguments;

        return $this;
    }
1076382
public function curApp()
    {
        $appId = wei()->app->getId();
        // 设置默认数据,初始化时就会带上
        $this->data[$this->appIdColumn] = $appId;

        return $this->andWhere([$this->appIdColumn => $appId]);
    }
1297930
public function getModuleModel()
    {
        if ($this->_moduleModel === null) {
            // 默认根据缓存的模块数据生成模块model
            $class = $this->module->moduleModelClass;
            $model = new $class;
            $class::populateRecord($model, ModuleModel::models()[$this->id]);
            $this->setModuleModel($model);
        }
        return $this->_moduleModel;
    }
386218
public function getDefinitions()
    {

        // 获取扫描的PHP文件
        $classNames     = $this->registerLoaderAndScanBean();
        $fileClassNames = $this->scanFilePhpClass();
        $classNames     = array_merge($classNames, $fileClassNames);

        foreach ($classNames as $className) {
            $this->parseBeanAnnotations($className);
        }
        $this->parseAnnotationsData();

        return $this->definitions;
    }
1345968
protected function __cells():string{
		$abbr    = $this->getAttribute('abbr');
		$colspan = $this->getAttribute('colspan');
		$rowspan = $this->getAttribute('rowspan');

		if($colspan){
			$colspan = ' colspan="'.intval($colspan).'"';
		}

		if($rowspan){
			$rowspan = ' rowspan="'.intval($rowspan).'"';
		}

		if($this->tag === 'th' && $abbr){
			$abbr = ' abbr="'.$abbr.'"';
		}

		return '<'.$this->tag.$colspan.$rowspan.$abbr.$this->__getCellStyle().'>'.$this->eol($this->content, '<br/>').'</'.$this->tag.'>';
	}
1366785
public function actionList() 
	{
		if(Yii::app()->request->isPostRequest) {
			$paging = trim($_POST['paging']);
			$pagesize = trim($_POST['pagesize']);
			
			$criteria=new CDbCriteria;
			$criteria->compare('publish', 1);
			$criteria->order = 'page_id DESC';
			
			if($paging && $paging == 'true') {
				$dataProvider = new CActiveDataProvider('OmmuPages', array(
					'criteria' => $criteria,
					'pagination' => array(
						'pageSize' => $pagesize ? $pagesize : 20,
					),
				));
				$model = $dataProvider->getData();
			} else {
				$criteria->limit = $pagesize ? $pagesize : 5;
				$model = OmmuPages::model()->findAll($criteria);
			}
			
			if(!empty($model)) {
				foreach($model as $key => $item) {
					$page_url = Utility::getProtocol().'://'.Yii::app()->request->serverName.Yii::app()->request->baseUrl;
					$page_path = 'public/page';
					
					if($item->media && file_exists($page_path.'/'.$item->media))
						$image_url_path = $page_url.'/'.$page_path.'/'.$item->media;
					
					$data[] = array(
						'id' => $item->page_id,
						'title' => $item->title->message,
						'description' => $item->desc ? Utility::shortText(Utility::hardDecode($item->description->message),200) : '-',
						'quote' => $item->quote ? $item->quote_r->message : '-',
						'media_image' => $image_url_path ? $image_url_path : '-',
						'media_show' => $item->media_show == 0 ? 'hide' : 'show',
						'media_type' => $item->media_show != 0 ? (($item->media_type == 0 || $item->media_type == 1) ? 'large' : 'medium') : '-',
						'creation_date' => strtotime($item->creation_date),
					);					
				}
			} else
				$data = array();
			
			if($paging && $paging == 'true') {
				$pager = OFunction::getDataProviderPager($dataProvider);
				$get = array_merge($_GET, array($pager['pageVar'] => $pager['nextPage']));
				$nextPager = $pager['nextPage'] != 0 ? OFunction::validHostURL(Yii::app()->controller->createUrl('list', $get)) : '-';
				$return = array(
					'data' => $data,
					'pager' => $pager,
					'nextPager' => $nextPager,
				);
				$this->_sendResponse(200, CJSON::encode($this->renderJson($return)));	
				
			} else
				$this->_sendResponse(200, CJSON::encode($this->renderJson($data)));
			
		} else 
			$this->redirect(Yii::app()->createUrl('site/index'));
	}
1367331
protected function categoryMenus()
    {
        $menus = [];
        $categories = $this->getCategories();
        foreach ($categories as $key => $label) {
            $menus[$key] = [
                'label' => $label,
                'items' => array_key_exists($key, $this->defaultCateMenus) ? $this->defaultCateMenus[$key] : []
            ];
        }

        $class = $this->moduleModelClass;
        foreach ($class::models() as $model) { // 安装的扩展模块(开启后台功能)
            if (!$model['admin'] || !array_key_exists($model['category'], $categories)) {
                continue;
            }
            $menus[$model['category']]['items'][] = [
                'label' => $model['name'],
                'url' => ModuleHelper::getAdminHomeUrl($model['id'])
            ];
        }

        return $menus;
    }