如何将多个查询同一个表的接口合并在一起 用2个参数就可以调用

<?php
class Model_Renqi extends PhalApi_Model_NotORM{
public function renqilist($bade,$type) {
if($bade==1){
return $this->getORM()
->select('id','name','title')
->where('type',$type)
->where('bade == 1')
->order('beizhu DESC')
->fetchAll();
}
}

/**
* 数据库表名称
*/....Model层

<?php
//Domain层
class Domain_Renqi
{

public function renqilist($bade,$type)
{
$Model_Renqi = new Model_Renqi();
$renqi = $Model_Renqi->renqilist($bade,$type);
return $renqi;
}
}

//Api层
<?php
class Api_Renqi extends PhalApi_Api{
public function getRules(){
return array(
'renqilist' => array(
'type' => array('name' => 'type', 'type' => 'string','require' => true, 'desc' => '信息所属'),
'bade' => array('name' => 'bade', 'bade' => 'string','require' => true, 'desc' => '信息所属'),
),
);
}
public function renqilist(){
$rs = array('code' => 0,'info' => array());
$Domain_Renqi = new Domain_Renqi();
$rs['info'] = $Domain_Renqi -> renqilist($this->type,$this->bade);
if (empty($rs['info'])){
$rs['code'] = 1;
$rs['msg'] = T('Error Renqi',110);
}
return $rs;
}
}

这些代码哪里有问题?
已邀请:

dogstar - PhalApi创始人

赞同来自:

不是很明白,是否可用数据库的IN查询?

要回复问题请先登录注册