thinkphp6模型继承问题

发布来源:云浪科技 | 发布时间:2020-12-30

首先看这部分代码,这部分代码是能够正常返回数据的:

  1. use think\Model;


  2. /**

  3.  * @mixin \think\Model

  4.  */

  5. class Menu extends  Model

  6. {

  7.     public function getMenuList($condition = [],$order='',$json = true)

  8.     {


  9.         $where = array();

  10.         if (!empty($condition['title']))

  11.         {

  12.             $condition['title'] =  trim($condition['title']);

  13.             $where[] = ['title','like', '%'.(string)$condition['title'].'%'];

  14.         }

  15.         if (isset($condition['pid']))

  16.         {

  17.             $where[] = ['pid','=',intval($condition['pid']) ];

  18.         }

  19.         if (isset($condition['hide']))

  20.         {

  21.             $where[] = ['hide','=',$condition['hide']];

  22.         }

  23.         if (isset($condition['status']))

  24.         {

  25.             $where[] = ['status','=',$condition['status']];

  26.         }


  27.         $list = $this->where($where)->order($order)->page($condition['page'],$condition['limit'])->select()->toArray();

  28.         return $list;

  29.     }

但是,如果我集成了另外一个非Model的公用模型的话,就会返回数据是空的了,如:

  1. namespace app\base\model;




  2. use think\Model;


  3. /**

  4.  * @mixin \think\Model

  5.  */

  6. class Menu extends  Base

  7. {

立即联系我们

云浪科技企业服务热线 029-88811692
微信二维码 微信扫一扫 专业项目经理为您免费解答

搜索