feedbackclose.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * The feedback close entry point of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Chunsheng Wang <chunsheng@cnezsoft.com>
  8. * @package entries
  9. * @version 1
  10. * @link https://www.zentao.net
  11. */
  12. class feedbackCloseEntry extends entry
  13. {
  14. /**
  15. * POST method.
  16. *
  17. * @param int $feedbackID
  18. * @access public
  19. * @return string
  20. */
  21. public function post($feedbackID)
  22. {
  23. $control = $this->loadController('feedback', 'close');
  24. $feedback = $this->loadModel('feedback')->getById($feedbackID);
  25. $fields = 'closedReason,comment';
  26. $this->batchSetPost($fields);
  27. if(empty($_POST)) $this->setPost('status', 'closed');
  28. $control->close($feedbackID);
  29. $data = $this->getData();
  30. if(!$data) return $this->send400('error');
  31. if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
  32. $feedback = $this->loadModel('feedback')->getById($feedbackID);
  33. return $this->send(200, $feedback);
  34. }
  35. }