<?php
 namespace Module\CmsJob\Api\Controller; use Illuminate\Routing\Controller; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Response; use Module\CmsJob\Util\CmsJobUtil; class CmsJobController extends Controller { public function paginate() { $input = InputPackage::buildFromInput(); $page = $input->getPage(); $pageSize = $input->getPageSize(); $option = []; $option['where'] = []; $option['order'] = ['id', 'desc']; $paginateData = ModelUtil::paginate('cms_job', $page, $pageSize, $option); $records = CmsJobUtil::buildRecords($paginateData['records']); return Response::generateSuccessData([ 'page' => $page, 'pageSize' => $pageSize, 'total' => $paginateData['total'], 'records' => $records, ]); } public function get() { $id = InputPackage::buildFromInput()->getInteger('id'); $record = CmsJobUtil::get($id); $post = CmsJobUtil::buildRecord($record); $post['content'] = $record['content']; return Response::generateSuccessData($post); } }