3
回答
Phalcon框架数据查询问题
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   

我的代码如下:

$builder = $this->getModelsManager()->createBuilder()->from(self::getClassName());
if (!empty($name))
    $builder->where("order_id like :id: or order_name like :id:", array('id' => "%$name%"), array(Column::BIND_PARAM_STR, Column::BIND_PARAM_STR));
if (!empty($code))
    $builder->andWhere("order_sn like :order:", array('order' => "%$code%"),
        array(Column::BIND_PARAM_STR, Column::BIND_PARAM_STR));

我要在后面加上查询当天记录的条件,因为我不会Phalcon,不知道代码该怎么写。或者使用原生SQL查询,怎么返回$builder。因为我要在Controller这样处理它:

$builder = $exceptionModel->getQueryListBuilder($name, $code, $str);
$paginator = new QueryBuilder(array(
    "builder" => $builder,
    "limit" => $pageSize,
    "page" => $pageIndex
));
$param = array(
    'limit' => $pageSize
);

$this->view->setVars(array(
    'title' => '活跃客户',
    'name' => $name,
    'order' => $code,
    'param' => $param,
    'param_uri' => http_build_query($param),
    'page' => $paginator->getPaginate()
));
举报
酸奶瓶盖儿
发帖于9个月前 3回/293阅
顶部