// +---------------------------------------------------------------------- namespace app\controller\api; use app\model\system\Attach as AttachModel; /** * @title 附件管理 */ class Attach extends Base { /** * @title 附件列表 */ public function index(){ $param = $this->request->param(); $map = []; $order = "id desc"; if(isset($param['type']) && $param['type']){ $map[] = ['type', '=', $param['type']]; } $list = AttachModel::where($map)->order($order)->paginate($this->request->pageConfig); $this->data['data'] = $list; $this->data['code'] = 1; return $this->data; } }