1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace catchAdmin\yunying\controller;
- use catcher\base\CatchRequest as Request;
- use catcher\CatchResponse;
- use catcher\base\CatchController;
- use catchAdmin\yunying\model\StolenVehicle as stolenVehicleModel;
- class StolenVehicle extends CatchController
- {
- protected $stolenVehicleModel;
-
- public function __construct(stolenVehicleModel $stolenVehicleModel)
- {
- $this->stolenVehicleModel = $stolenVehicleModel;
- }
-
- /**
- * 列表
- * @time 2022年01月20日 10:42
- * @param Request $request
- */
- public function index(Request $request) : \think\Response
- {
- $field = $request->get('field')?:'id';
- $order = $request->get('order')?:'desc';
- return CatchResponse::paginate($this->stolenVehicleModel->getStolenList($field,$order));
- }
-
- /**
- * 保存信息
- * @time 2022年01月20日 10:42
- * @param Request $request
- */
- public function save(Request $request) : \think\Response
- {
- return CatchResponse::success($this->stolenVehicleModel->storeBy($request->post()));
- }
-
- /**
- * 读取
- * @time 2022年01月20日 10:42
- * @param $id
- */
- public function read($id) : \think\Response
- {
- return CatchResponse::success($this->stolenVehicleModel->findBy($id));
- }
-
- /**
- * 更新
- * @time 2022年01月20日 10:42
- * @param Request $request
- * @param $id
- */
- public function update(Request $request, $id) : \think\Response
- {
- return CatchResponse::success($this->stolenVehicleModel->updateBy($id, $request->post()));
- }
-
- /**
- * 删除
- * @time 2022年01月20日 10:42
- * @param $id
- */
- public function delete($id) : \think\Response
- {
- return CatchResponse::success($this->stolenVehicleModel->deleteBy($id));
- }
- }
|