21,886
社区成员
发帖
与我相关
我的任务
分享
$where = array_filter($_GET['where'], function($value){return !empty(trim($value));});
$model->where(array_filter($where));
//名称
if($name = I('request.name','')){
$where['name'] = $name;
}
//金额大于等于
if($amountStart = I('request.amountStart',0)){
$where['amount'] = array('EGT',$amountStart);
}
//金额小于等于
if($amountEnd = I('request.amountEnd',0)){
$where['amount'] = array('ELT',$amountEnd);
}
//其他条件...
$res = M('tableName')->where($where)->select();