123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- namespace catchAdmin\transport\controller;
- use catcher\base\CatchRequest as Request;
- use catcher\CatchResponse;
- use catcher\base\CatchController;
- use catchAdmin\transport\model\StuckSection as stuckSectionModel;
- class StuckSection extends CatchController
- {
- protected $stuckSectionModel;
-
- public function __construct(StuckSectionModel $stuckSectionModel)
- {
- $this->stuckSectionModel = $stuckSectionModel;
- }
-
- /**
- * 列表
- * @time 2022年11月01日 16:27
- * @param Request $request
- */
- public function index(Request $request) : \think\Response
- {
- return CatchResponse::paginate($this->stuckSectionModel->getList());
- }
-
- /**
- * 保存信息
- * @time 2022年11月01日 16:27
- * @param Request $request
- */
- public function save(Request $request) : \think\Response
- {
- return CatchResponse::success($this->stuckSectionModel->storeBy($request->post()));
- }
-
- /**
- * 读取
- * @time 2022年11月01日 16:27
- * @param $id
- */
- public function read($id) : \think\Response
- {
- return CatchResponse::success($this->stuckSectionModel->findBy($id));
- }
-
- /**
- * 更新
- * @time 2022年11月01日 16:27
- * @param Request $request
- * @param $id
- */
- public function update(Request $request, $id) : \think\Response
- {
- return CatchResponse::success($this->stuckSectionModel->updateBy($id, $request->post()));
- }
-
- /**
- * 删除
- * @time 2022年11月01日 16:27
- * @param $id
- */
- public function delete($id) : \think\Response
- {
- return CatchResponse::success($this->stuckSectionModel->deleteBy($id));
- }
- /**
- *
- * @time 2019年12月07日
- * @param $id
- * @return \think\response\Json
- */
- public function switchRetrograde($id): \think\response\Json
- {
-
- $info = $this->stuckSectionModel->findBy($id);
- $this->stuckSectionModel->updateBy($id, [
- 'retrograde_stat' => $info->retrograde_stat == 1 ? 0 : 1,
- ]);
- return CatchResponse::success([], '操作成功');
- }
- /**
- *
- * @time 2019年12月07日
- * @param $id
- * @return \think\response\Json
- */
- public function switchOverSpeed($id): \think\response\Json
- {
- $info = $this->stuckSectionModel->findBy($id);
- $this->stuckSectionModel->updateBy($id, [
- 'over_speed_stat' => $info->over_speed_stat == 1 ? 0 : 1,
- ]);
- return CatchResponse::success([], '操作成功');
- }
- }
|