123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?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);
- }
- }
|