belongsTo('Cate', 'cate_id'); } // 获取列表 public static function getList($where = array(), $pageSize, $order = ['sort', 'id' => 'desc']) { $list = self::where($where) ->order($order) ->paginate([ 'query' => Request::get(), 'list_rows' => $pageSize, ]); foreach ($list as $k => $v) { if ($list[$k]['cate_id']) { $v['cate_id'] = $v->cate->getData('cate_name'); } } return MakeBuilder::changeTableData($list, 'Article'); } // 导出列表 public static function getExport($where = array(), $order = ['sort', 'id' => 'desc']) { $list = self::where($where) ->order($order) ->select(); foreach ($list as $k => $v) { if ($list[$k]['cate_id']) { $v['cate_id'] = $v->cate->getData('cate_name'); } } return MakeBuilder::changeTableData($list, 'Article'); } }