thinkphp6模型继承问题

浏览:517 发布日期:2020/09/22 分类:ThinkPHP6专区 关键字: thinkphp6 模型继承
首先看这部分代码,这部分代码是能够正常返回数据的: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
{
base Model 代码:use think\facade\Cache;
use think\Model;

/**
 * @mixin \think\Model
 */
class Base extends Model
{
    public function __construct()
    {

        parent::__construct();

    }

}
返回空的数据:


请问是我哪里的代码没写正确吗?


最佳答案
评论( 相关
后面还有条评论,点击查看>>