Complain.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\common\model\Config;
  5. use app\hander\HelpHander;
  6. use think\App;
  7. use think\Db;
  8. class Complain extends Base
  9. {
  10. public function __construct(App $app = null) {
  11. parent::__construct($app);
  12. $this->model = new \app\common\model\Complain();
  13. }
  14. public function add(){
  15. $info = [
  16. 'orgId'=>$this->orgId,
  17. 'depId'=>input('depId/d',0),
  18. 'createUserId'=>$this->userId,
  19. 'hide'=>input('hide',0),
  20. 'content'=>input('content',''),
  21. 'images'=>input('images',''),
  22. 'voices'=>input('voices',''),
  23. 'videos'=>input('videos',''),
  24. ];
  25. $ret=$this->model->addSave($info);
  26. if($ret){
  27. HelpHander::success([],'添加成功');
  28. }else{
  29. HelpHander::error($this->model->getError());
  30. }
  31. }
  32. public function selectAllByOrgId(){
  33. $page=input('page/d',1);
  34. $size=input('size/d',10);
  35. $ret=$this->model->lists($page,$size,$this->orgId,$this->userId);
  36. HelpHander::success($ret);
  37. }
  38. public function detail(){
  39. $id=input('id');
  40. $ret=$this->model->detail($id);
  41. if($ret){
  42. HelpHander::success($ret);
  43. }else{
  44. HelpHander::error('暂无数据');
  45. }
  46. }
  47. public function lists(){
  48. $type = input('type/d',0); // 0=全部 1=超时
  49. $page=input('page/d',1);
  50. $size=input('size/d',10);
  51. $ret=$this->model->alllists($page,$size,$type,$this->orgId);
  52. HelpHander::success($ret);
  53. }
  54. }