12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- namespace catchAdmin\synscheme\controller;
- use catcher\base\CatchRequest as Request;
- use catcher\CatchResponse;
- use catcher\base\CatchController;
- use catchAdmin\synscheme\model\Synscheme as synschemeModel;
- class Synscheme extends CatchController
- {
- protected $synschemeModel;
-
- public function __construct(SynschemeModel $synschemeModel)
- {
- $this->synschemeModel = $synschemeModel;
- }
-
- /**
- * 列表
- * @time 2022年05月09日 19:06
- * @param Request $request
- */
- public function index(Request $request) : \think\Response
- {
- return CatchResponse::paginate($this->synschemeModel->getList());
- }
-
- /**
- * 保存信息
- * @time 2022年05月09日 19:06
- * @param Request $request
- */
- public function save(Request $request) : \think\Response
- {
- return CatchResponse::success($this->synschemeModel->storeBy($request->post()));
- }
-
- /**
- * 读取
- * @time 2022年05月09日 19:06
- * @param $id
- */
- public function read($id) : \think\Response
- {
- return CatchResponse::success($this->synschemeModel->findBy($id));
- }
-
- /**
- * 更新
- * @time 2022年05月09日 19:06
- * @param Request $request
- * @param $id
- */
- public function update(Request $request, $id) : \think\Response
- {
- return CatchResponse::success($this->synschemeModel->updateBy($id, $request->post()));
- }
-
- /**
- * 删除
- * @time 2022年05月09日 19:06
- * @param $id
- */
- public function delete($id) : \think\Response
- {
- return CatchResponse::success($this->synschemeModel->deleteBy($id));
- }
- /**
- * 获取方案
- * @param Request $request
- * @return void
- */
- public function getSynscheme(Request $request)
- {
- $data =$request->get();
- $where=[];
- if(!empty($data['id']))
- { $ids =implode(",",$data['id']);
- $where[] = ['id','in',$ids];
- }
- $syn_list=$this->synschemeModel->where($where)->select();
- return CatchResponse::success($syn_list);
- }
- /**
- * 选择同步方案
- *
- * @param Request $request
- * @return void
- */
- public function chooseSynscheme(Request $request)
- {
- $list = $this->synschemeModel->field('id as value,name as text')->select();
- return CatchResponse::success($list);
- }
-
- }
|