ApiActivity.Class.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * 活动
  4. * Created by PhpStorm.
  5. * User: XiaoMing
  6. * Date: 2019/12/26
  7. * Time: 9:21
  8. */
  9. namespace JinDouYun\Controller\Market;
  10. use JinDouYun\Controller\BaseController;
  11. use JinDouYun\Model\Market\MActivity;
  12. use Mall\Framework\Core\ErrorCode;
  13. class ApiActivity extends BaseController
  14. {
  15. private $objMActivity;
  16. /**
  17. * ApiActivity constructor.
  18. * @param bool $isCheckAcl
  19. * @param bool $isMustLogin
  20. * @param bool $checkToken
  21. * @param bool $getAreaCode
  22. * @throws \Exception
  23. */
  24. public function __construct($isCheckAcl = false, $isMustLogin = false,$checkToken=true,$getAreaCode=true)
  25. {
  26. parent::__construct($isCheckAcl, $isMustLogin, $checkToken,$getAreaCode);
  27. $authorization = $this->request->getServerParam('HTTP_AUTHORIZATION');
  28. if (!empty($authorization)) {
  29. self::getUserIdByAuthorization();
  30. }
  31. $this->objMActivity = new MActivity($this->onlineUserId, $this->onlineEnterpriseId,$this->areaCode);
  32. }
  33. /**
  34. * @throws \Exception
  35. */
  36. public function getActivityAll()
  37. {
  38. $dbResult = $this->objMActivity->getActivityAll();
  39. if ($dbResult->isSuccess()) {
  40. $returnData = $dbResult->getData();
  41. parent::sendOutput($returnData['data'], 0);
  42. }
  43. parent::sendOutput($dbResult->getData(), ErrorCode::$dberror);
  44. }
  45. }