BaseController.Class.php 929 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Jobs\Controller;
  3. use Mall\Framework\Factory;
  4. class BaseController
  5. {
  6. /** @var \Mall\Framework\Core\Request $request */
  7. protected $request;
  8. /** @var \Mall\Framework\Core\Cache $cache */
  9. protected $cache;
  10. public function __construct($isCheckAcl = true)
  11. {
  12. $this->request = Factory::request();
  13. //$this->cache = Factory::cache();
  14. }
  15. public function sendOutput($data, $errorcode = 0)
  16. {
  17. $errorcode = intval($errorcode);
  18. if ($errorcode) {
  19. $sendMessage = [
  20. 'state' => false,
  21. 'data' => $data,
  22. 'errorcode' => $errorcode
  23. ];
  24. } else {
  25. $sendMessage = [
  26. 'state' => true,
  27. 'data' => $data,
  28. 'errorcode' => $errorcode
  29. ];
  30. }
  31. exit(json_encode($sendMessage, JSON_UNESCAPED_UNICODE));
  32. }
  33. }