use think\Model;
/**
* @mixin \think\Model
*/
class Menu extends Model
{
public function getMenuList($condition = [],$order='',$json = true)
{
$where = array();
if (!empty($condition['title']))
{
$condition['title'] = trim($condition['title']);
$where[] = ['title','like', '%'.(string)$condition['title'].'%'];
}
if (isset($condition['pid']))
{
$where[] = ['pid','=',intval($condition['pid']) ];
}
if (isset($condition['hide']))
{
$where[] = ['hide','=',$condition['hide']];
}
if (isset($condition['status']))
{
$where[] = ['status','=',$condition['status']];
}
$list = $this->where($where)->order($order)->page($condition['page'],$condition['limit'])->select()->toArray();
return $list;
}但是,如果我集成了另外一个非Model的公用模型的话,就会返回数据是空的了,如:namespace app\base\model;
use think\Model;
/**
* @mixin \think\Model
*/
class Menu extends Base
{bause think\facade\Cache;
use think\Model;
/**
* @mixin \think\Model
*/
class Base extends Model
{
public function __construct()
{
parent::__construct();
}
}返回空的数据:
请问是我哪里的代码没写正确吗?
最佳答案