Article.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 Article extends Base
  7. {
  8. // 新增
  9. public function save(){
  10. model('Article')->add($this->userId,$this->orgId);
  11. HelpHander::success([],'操作成功');
  12. }
  13. // 编辑
  14. public function update(){
  15. model('Article')->add($this->userId,$this->orgId);
  16. HelpHander::success([],'操作成功');
  17. }
  18. // 详情
  19. public function detail(){
  20. $id = input('id/d',0);
  21. $ret = model('Article')->info($id);
  22. HelpHander::success($ret);
  23. }
  24. // 列表
  25. public function list(){
  26. $page = input('page/d',1);
  27. $size = input('size/d',10);
  28. $enable = input('enable/d',-1);
  29. $title = input('title','','trim');
  30. $type = input('type/d',0);
  31. $ret = model('Article')->lists($page,$size,$this->orgId,$title,$enable,$type);
  32. HelpHander::success($ret);
  33. }
  34. // 用户公告列表
  35. public function noticeList(){
  36. $page = input('page/d',1);
  37. $size = input('size/d',10);
  38. $status = input('status/d',-1);
  39. $type = input('type/d',0);
  40. $title = input('title','','trim');
  41. $ret = model('Article')->userLists($page,$size,$this->userId,$status,$title,$type);
  42. HelpHander::success($ret);
  43. }
  44. public function recentNoticeList(){
  45. $ret = model('Article')->recentNoticeList($this->userId);
  46. HelpHander::success($ret);
  47. }
  48. // 未读状态改为已读
  49. public function changeStatus(){
  50. $id = input('id/d',0);
  51. model('Article')->changeStatus($id,$this->userId);
  52. HelpHander::success([],'操作成功');
  53. }
  54. // 删除
  55. public function del(){
  56. $id = input('id/d',0);
  57. model('Article')->del($id);
  58. HelpHander::success([],'操作成功');
  59. }
  60. // 全部已读
  61. public function setAllNoticeRead(){
  62. model('Article')->setAllNoticeRead($this->userId,$this->orgId);
  63. HelpHander::success([],'操作成功');
  64. }
  65. //查询公告详情
  66. public function queryAppDetail(){
  67. $id = input('id/d',0);
  68. $ret = model('Article')->queryAppDetail($id);
  69. HelpHander::success($ret);
  70. }
  71. // 消息列表
  72. public function queryNewsList(){
  73. $ret = model('Article')->queryNewsList($this->userId,$this->orgId);
  74. HelpHander::success($ret);
  75. }
  76. }