Document.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. use think\Db;
  6. class Document extends Base
  7. {
  8. // 新增
  9. public function save(){
  10. model('Document')->add();
  11. HelpHander::success([],'操作成功');
  12. }
  13. // 编辑
  14. public function update(){
  15. model('Document')->add();
  16. HelpHander::success([],'操作成功');
  17. }
  18. // 详情
  19. public function detail(){
  20. $id = input('id/d',0);
  21. $ret = model('Document')->info($id);
  22. HelpHander::success($ret);
  23. }
  24. // 列表
  25. public function queryDocumentList(){
  26. $page = input('page/d',1);
  27. $size = input('size/d',10);
  28. $cateId = input('cateId/d',0);
  29. $title = input('title','','trim');
  30. $name = input('name','','trim');
  31. $startTime = input('startTime','','trim');
  32. $endTime = input('endTime','','trim');
  33. $ret = model('Document')->lists($page,$size,$cateId,$title,$name,$startTime,$endTime,$this->userId,$this->orgId);
  34. HelpHander::success($ret);
  35. }
  36. // 删除
  37. public function del(){
  38. $id = input('id/d',0);
  39. model('Document')->del($id,$this->userId);
  40. HelpHander::success([],'操作成功');
  41. }
  42. public function updateViews(){
  43. $id = input('id/d',0);
  44. model('Document')->updateViews($id);
  45. HelpHander::success([],'操作成功');
  46. }
  47. public function queryDocumentByCate(){
  48. $cateId = input('cateId/d',0);
  49. $title = input('title','','trim');
  50. $ret = model('Document')->queryDocumentByCate($cateId,$title,$this->userId,$this->orgId);
  51. HelpHander::success($ret);
  52. }
  53. }