与我们合作

我们专注:网站策划设计、网络多媒体传播、网站优化及网站营销
主营业务:网站建设、微信小程序开发、网络运营、云产品·运维解决方案

有一个品牌项目想和我们谈谈吗?

您可以填写右边的表格,让我们了解您的项目需求,这是一个良好的开始,我们将会尽快与您取得联系。当然也欢迎您给我们写信或是打电话,让我们听到您的声音。

您也可通过下列途径与我们取得联系:

地 址: 西安市高新区科技2路65号清华科技园D座1201

座 机: 029-88811692

手 机: 189 9136 7891

邮 箱: yunlangkeji@126.com

网 址: https://www.yunlang.cc

快速提交您的需求 ↓

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. {

GO 欣赏案例
查看经典案例

TOP

在线客服

电话咨询

在线客服 获取报价 免费电话
获取报价
您的称呼:

*

公司名称:

电话:

项目主题:

项目描述:

重要的事情,电话里聊

接通客服

不方便的时候线上咨询,在线等哦