cms first commit

This commit is contained in:
JaguarJack
2021-05-22 11:02:45 +08:00
parent 0f24c9c580
commit f81eaf40af
77 changed files with 4990 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | Catch-CMS Design On 2020
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\cms\controller;
use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\cms\model\Articles as articlesModel;
class Articles extends CatchController
{
protected $articlesModel;
public function __construct(ArticlesModel $articlesModel)
{
$this->articlesModel = $articlesModel;
}
/**
* 列表
* @time 2020年12月27日 19:40
* @param Request $request
*/
public function index(Request $request) : \think\Response
{
return CatchResponse::paginate($this->articlesModel->getList());
}
/**
* 保存信息
* @time 2020年12月27日 19:40
* @param Request $request
*/
public function save(Request $request) : \think\Response
{
return CatchResponse::success($this->articlesModel->storeBy($request->post()));
}
/**
* 读取
* @time 2020年12月27日 19:40
* @param $id
*/
public function read($id) : \think\Response
{
return CatchResponse::success($this->articlesModel->findBy($id));
}
/**
* 更新
* @time 2020年12月27日 19:40
* @param Request $request
* @param $id
*/
public function update(Request $request, $id) : \think\Response
{
return CatchResponse::success($this->articlesModel->updateBy($id, $request->post()));
}
/**
* 删除
* @time 2020年12月27日 19:40
* @param $id
*/
public function delete($id) : \think\Response
{
return CatchResponse::success($this->articlesModel->deleteBy($id));
}
}

View File

@@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | Catch-CMS Design On 2020
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\cms\controller;
use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\cms\model\Banners as bannersModel;
class Banners extends CatchController
{
protected $bannersModel;
public function __construct(BannersModel $bannersModel)
{
$this->bannersModel = $bannersModel;
}
/**
* 列表
* @time 2020年12月27日 19:58
* @param Request $request
*/
public function index(Request $request) : \think\Response
{
return CatchResponse::paginate($this->bannersModel->getList());
}
/**
* 保存信息
* @time 2020年12月27日 19:58
* @param Request $request
*/
public function save(Request $request) : \think\Response
{
return CatchResponse::success($this->bannersModel->storeBy($request->post()));
}
/**
* 读取
* @time 2020年12月27日 19:58
* @param $id
*/
public function read($id) : \think\Response
{
return CatchResponse::success($this->bannersModel->findBy($id));
}
/**
* 更新
* @time 2020年12月27日 19:58
* @param Request $request
* @param $id
*/
public function update(Request $request, $id) : \think\Response
{
return CatchResponse::success($this->bannersModel->updateBy($id, $request->post()));
}
/**
* 删除
* @time 2020年12月27日 19:58
* @param $id
*/
public function delete($id) : \think\Response
{
return CatchResponse::success($this->bannersModel->deleteBy($id));
}
}

View File

@@ -0,0 +1,91 @@
<?php
// +----------------------------------------------------------------------
// | Catch-CMS Design On 2020
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\cms\controller;
use catcher\base\CatchRequest as Request;
use catcher\CatchAdmin;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\cms\model\Category as categoryModel;
use catcher\CatchUpload;
use catcher\library\excel\reader\Reader;
use think\Exception;
use think\facade\Db;
class Category extends CatchController
{
protected $categoryModel;
public function __construct(CategoryModel $categoryModel)
{
$this->categoryModel = $categoryModel;
}
/**
* 列表
* @time 2020年12月27日 19:15
* @param Request $request
* @return \think\response\Json
*/
public function index(Request $request)
{
return CatchResponse::success($this->categoryModel->getList());
}
/**
* 保存信息
* @time 2020年12月27日 19:15
* @param Request $request
* @return \think\response\Json
*/
public function save(Request $request)
{
return CatchResponse::success($this->categoryModel->storeBy($request->post()));
}
/**
* 读取
* @time 2020年12月27日 19:15
* @param $id
* @return \think\response\Json
*/
public function read($id)
{
return CatchResponse::success($this->categoryModel->findBy($id));
}
/**
* 更新
* @time 2020年12月27日 19:15
* @param Request $request
* @param $id
* @return \think\response\Json
*/
public function update(Request $request, $id)
{
return CatchResponse::success($this->categoryModel->updateBy($id, $request->post()));
}
/**
* 删除
* @time 2020年12月27日 19:15
* @param $id
* @return \think\response\Json
*/
public function delete($id)
{
return CatchResponse::success($this->categoryModel->deleteBy($id));
}
}

View File

@@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | Catch-CMS Design On 2020
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\cms\controller;
use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\cms\model\Comments as commentsModel;
class Comments extends CatchController
{
protected $commentsModel;
public function __construct(CommentsModel $commentsModel)
{
$this->commentsModel = $commentsModel;
}
/**
* 列表
* @time 2020年12月27日 19:53
* @param Request $request
*/
public function index(Request $request) : \think\Response
{
return CatchResponse::paginate($this->commentsModel->getList());
}
/**
* 保存信息
* @time 2020年12月27日 19:53
* @param Request $request
*/
public function save(Request $request) : \think\Response
{
return CatchResponse::success($this->commentsModel->storeBy($request->post()));
}
/**
* 读取
* @time 2020年12月27日 19:53
* @param $id
*/
public function read($id) : \think\Response
{
return CatchResponse::success($this->commentsModel->findBy($id));
}
/**
* 更新
* @time 2020年12月27日 19:53
* @param Request $request
* @param $id
*/
public function update(Request $request, $id) : \think\Response
{
return CatchResponse::success($this->commentsModel->updateBy($id, $request->post()));
}
/**
* 删除
* @time 2020年12月27日 19:53
* @param $id
*/
public function delete($id) : \think\Response
{
return CatchResponse::success($this->commentsModel->deleteBy($id));
}
}

View File

@@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | Catch-CMS Design On 2020
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\cms\controller;
use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\cms\model\FormData as formDataModel;
class FormData extends CatchController
{
protected $formDataModel;
public function __construct(FormDataModel $formDataModel)
{
$this->formDataModel = $formDataModel;
}
/**
* 列表
* @time 2020年12月27日 20:35
* @param Request $request
*/
public function index(Request $request) : \think\Response
{
return CatchResponse::paginate($this->formDataModel->getList());
}
/**
* 保存信息
* @time 2020年12月27日 20:35
* @param Request $request
*/
public function save(Request $request) : \think\Response
{
return CatchResponse::success($this->formDataModel->storeBy($request->post()));
}
/**
* 读取
* @time 2020年12月27日 20:35
* @param $id
*/
public function read($id) : \think\Response
{
return CatchResponse::success($this->formDataModel->findBy($id));
}
/**
* 更新
* @time 2020年12月27日 20:35
* @param Request $request
* @param $id
*/
public function update(Request $request, $id) : \think\Response
{
return CatchResponse::success($this->formDataModel->updateBy($id, $request->post()));
}
/**
* 删除
* @time 2020年12月27日 20:35
* @param $id
*/
public function delete($id) : \think\Response
{
return CatchResponse::success($this->formDataModel->deleteBy($id));
}
}

View File

@@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | Catch-CMS Design On 2020
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\cms\controller;
use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\cms\model\FormFields as formFieldsModel;
class FormFields extends CatchController
{
protected $formFieldsModel;
public function __construct(FormFieldsModel $formFieldsModel)
{
$this->formFieldsModel = $formFieldsModel;
}
/**
* 列表
* @time 2020年12月27日 20:28
* @param Request $request
*/
public function index(Request $request) : \think\Response
{
return CatchResponse::paginate($this->formFieldsModel->getList());
}
/**
* 保存信息
* @time 2020年12月27日 20:28
* @param Request $request
*/
public function save(Request $request) : \think\Response
{
return CatchResponse::success($this->formFieldsModel->storeBy($request->post()));
}
/**
* 读取
* @time 2020年12月27日 20:28
* @param $id
*/
public function read($id) : \think\Response
{
return CatchResponse::success($this->formFieldsModel->findBy($id));
}
/**
* 更新
* @time 2020年12月27日 20:28
* @param Request $request
* @param $id
*/
public function update(Request $request, $id) : \think\Response
{
return CatchResponse::success($this->formFieldsModel->updateBy($id, $request->post()));
}
/**
* 删除
* @time 2020年12月27日 20:28
* @param $id
*/
public function delete($id) : \think\Response
{
return CatchResponse::success($this->formFieldsModel->deleteBy($id));
}
}

View File

@@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | Catch-CMS Design On 2020
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\cms\controller;
use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\cms\model\Forms as formsModel;
class Forms extends CatchController
{
protected $formsModel;
public function __construct(FormsModel $formsModel)
{
$this->formsModel = $formsModel;
}
/**
* 列表
* @time 2020年12月27日 20:19
* @param Request $request
*/
public function index(Request $request) : \think\Response
{
return CatchResponse::paginate($this->formsModel->getList());
}
/**
* 保存信息
* @time 2020年12月27日 20:19
* @param Request $request
*/
public function save(Request $request) : \think\Response
{
return CatchResponse::success($this->formsModel->storeBy($request->post()));
}
/**
* 读取
* @time 2020年12月27日 20:19
* @param $id
*/
public function read($id) : \think\Response
{
return CatchResponse::success($this->formsModel->findBy($id));
}
/**
* 更新
* @time 2020年12月27日 20:19
* @param Request $request
* @param $id
*/
public function update(Request $request, $id) : \think\Response
{
return CatchResponse::success($this->formsModel->updateBy($id, $request->post()));
}
/**
* 删除
* @time 2020年12月27日 20:19
* @param $id
*/
public function delete($id) : \think\Response
{
return CatchResponse::success($this->formsModel->deleteBy($id));
}
}

View File

@@ -0,0 +1,95 @@
<?php
// +----------------------------------------------------------------------
// | Catch-CMS Design On 2020
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\cms\controller;
use catchAdmin\cms\support\Table;
use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\cms\model\ModelFields as ModelFieldsModel;
use catchAdmin\cms\model\Models;
use catcher\exceptions\FailedException;
class ModelFields extends CatchController
{
protected $modelFields;
public function __construct(ModelFieldsModel $modelFields)
{
$this->modelFields = $modelFields;
}
/**
* 列表
* @time 2020年12月29日 21:00
* @param Request $request
* @param Models $models
* @return \think\response\Json
*/
public function index(Request $request): \think\response\Json
{
// $columns = Table::columns($models::where('id',$request->param('model_id'))->value('table_name'));
//foreach ($columns as &$column) {
// $column['title'] = $column['comment'];
// }
return CatchResponse::success($this->modelFields->getFieldsByModelId($request->param('model_id')));
}
/**
* 保存信息
* @time 2020年12月29日 21:00
* @param Request $request
* @return \think\response\Json
*/
public function save(Request $request): \think\response\Json
{
return CatchResponse::success($this->modelFields->storeBy($request->post()));
}
/**
* 读取
* @time 2020年12月29日 21:00
* @param $id
* @return \think\response\Json
*/
public function read($id): \think\response\Json
{
return CatchResponse::success($this->modelFields->findBy($id));
}
/**
* 更新
* @time 2020年12月29日 21:00
* @param Request $request
* @param $id
* @return \think\response\Json
*/
public function update(Request $request, $id): \think\response\Json
{
return CatchResponse::success($this->modelFields->updateBy($id, $request->post()));
}
/**
* 删除
* @time 2020年12月29日 21:00
* @param $id
* @return \think\response\Json
*/
public function delete($id): \think\response\Json
{
return CatchResponse::success($this->modelFields->deleteBy($id));
}
}

View File

@@ -0,0 +1,85 @@
<?php
// +----------------------------------------------------------------------
// | Catch-CMS Design On 2020
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\cms\controller;
use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\cms\model\Models as CmsModel;
class Models extends CatchController
{
protected $cmsModel;
public function __construct(CmsModel $cmsModel)
{
$this->cmsModel = $cmsModel;
}
/**
* 列表
* @time 2020年12月29日 20:02
* @param Request $request
* @return \think\response\Json
*/
public function index(Request $request): \think\response\Json
{
return CatchResponse::paginate($this->cmsModel->getList());
}
/**
* 保存信息
* @time 2020年12月29日 20:02
* @param Request $request
* @return \think\response\Json
*/
public function save(Request $request): \think\response\Json
{
return CatchResponse::success($this->cmsModel->storeBy($request->post()));
}
/**
* 读取
* @time 2020年12月29日 20:02
* @param $id
* @return \think\response\Json
*/
public function read($id): \think\response\Json
{
return CatchResponse::success($this->cmsModel->findBy($id));
}
/**
* 更新
* @time 2020年12月29日 20:02
* @param Request $request
* @param $id
* @return \think\response\Json
*/
public function update(Request $request, $id): \think\response\Json
{
return CatchResponse::success($this->cmsModel->updateBy($id, $request->post()));
}
/**
* 删除
* @time 2020年12月29日 20:02
* @param $id
* @return \think\response\Json
*/
public function delete($id): \think\response\Json
{
return CatchResponse::success($this->cmsModel->deleteBy($id));
}
}

View File

@@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | Catch-CMS Design On 2020
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\cms\controller;
use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\cms\model\SiteLinks as siteLinksModel;
class SiteLinks extends CatchController
{
protected $siteLinksModel;
public function __construct(SiteLinksModel $siteLinksModel)
{
$this->siteLinksModel = $siteLinksModel;
}
/**
* 列表
* @time 2020年12月27日 20:02
* @param Request $request
*/
public function index(Request $request) : \think\Response
{
return CatchResponse::paginate($this->siteLinksModel->getList());
}
/**
* 保存信息
* @time 2020年12月27日 20:02
* @param Request $request
*/
public function save(Request $request) : \think\Response
{
return CatchResponse::success($this->siteLinksModel->storeBy($request->post()));
}
/**
* 读取
* @time 2020年12月27日 20:02
* @param $id
*/
public function read($id) : \think\Response
{
return CatchResponse::success($this->siteLinksModel->findBy($id));
}
/**
* 更新
* @time 2020年12月27日 20:02
* @param Request $request
* @param $id
*/
public function update(Request $request, $id) : \think\Response
{
return CatchResponse::success($this->siteLinksModel->updateBy($id, $request->post()));
}
/**
* 删除
* @time 2020年12月27日 20:02
* @param $id
*/
public function delete($id) : \think\Response
{
return CatchResponse::success($this->siteLinksModel->deleteBy($id));
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace catchAdmin\cms\controller;
use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\cms\model\Tags as tagsModel;
class Tags extends CatchController
{
protected $tagsModel;
public function __construct(TagsModel $tagsModel)
{
$this->tagsModel = $tagsModel;
}
/**
* 列表
* @time 2020年12月27日 19:44
* @param Request $request
*/
public function index(Request $request) : \think\Response
{
return CatchResponse::paginate($this->tagsModel->getList());
}
/**
* 保存信息
* @time 2020年12月27日 19:44
* @param Request $request
*/
public function save(Request $request) : \think\Response
{
return CatchResponse::success($this->tagsModel->storeBy($request->post()));
}
/**
* 读取
* @time 2020年12月27日 19:44
* @param $id
*/
public function read($id) : \think\Response
{
return CatchResponse::success($this->tagsModel->findBy($id));
}
/**
* 更新
* @time 2020年12月27日 19:44
* @param Request $request
* @param $id
*/
public function update(Request $request, $id) : \think\Response
{
return CatchResponse::success($this->tagsModel->updateBy($id, $request->post()));
}
/**
* 删除
* @time 2020年12月27日 19:44
* @param $id
*/
public function delete($id) : \think\Response
{
return CatchResponse::success($this->tagsModel->deleteBy($id));
}
}

View File

@@ -0,0 +1,69 @@
<?php
// +----------------------------------------------------------------------
// | Catch-CMS Design On 2020
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\cms\controller;
use catchAdmin\system\model\Attachments;
use catcher\base\CatchController;
use catcher\base\CatchRequest;
use catcher\CatchResponse;
use catcher\CatchUpload;
use catcher\exceptions\FailedException;
class Upload extends CatchController
{
protected $attachment;
public function __construct(Attachments $attachment)
{
$this->attachment = $attachment;
}
/**
* image upload
*
* @time 2020年01月25日
* @param CatchRequest $request
* @param CatchUpload $upload
* @return \think\response\Json
*/
public function image(CatchRequest $request, CatchUpload $upload): \think\response\Json
{
$images = $request->file();
if (!$images) {
throw new FailedException('请选择图片上传');
}
return CatchResponse::success([
'filePath' => $upload->checkImages($images)->multiUpload($images['image'])
]);
}
/**
* file upload
*
* @time 2020年01月25日
* @param CatchRequest $request
* @param CatchUpload $upload
* @return \think\response\Json
*/
public function file(CatchRequest $request, CatchUpload $upload): \think\response\Json
{
$files = $request->file();
return CatchResponse::success([
'src' => $upload->checkFiles($files)->multiUpload($files['file'])
]);
}
}

View File

@@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | Catch-CMS Design On 2020
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\cms\controller;
use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\cms\model\Users as usersModel;
class Users extends CatchController
{
protected $usersModel;
public function __construct(UsersModel $usersModel)
{
$this->usersModel = $usersModel;
}
/**
* 列表
* @time 2020年12月27日 19:04
* @param Request $request
*/
public function index(Request $request) : \think\Response
{
return CatchResponse::paginate($this->usersModel->getList());
}
/**
* 保存信息
* @time 2020年12月27日 19:04
* @param Request $request
*/
public function save(Request $request) : \think\Response
{
return CatchResponse::success($this->usersModel->storeBy($request->post()));
}
/**
* 读取
* @time 2020年12月27日 19:04
* @param $id
*/
public function read($id) : \think\Response
{
return CatchResponse::success($this->usersModel->findBy($id));
}
/**
* 更新
* @time 2020年12月27日 19:04
* @param Request $request
* @param $id
*/
public function update(Request $request, $id) : \think\Response
{
return CatchResponse::success($this->usersModel->updateBy($id, $request->post()));
}
/**
* 删除
* @time 2020年12月27日 19:04
* @param $id
*/
public function delete($id) : \think\Response
{
return CatchResponse::success($this->usersModel->deleteBy($id));
}
}