SupplierOrder.Class.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace JinDouYun\Controller\Order;
  3. use JinDouYun\Controller\BaseController;
  4. use JinDouYun\Model\Order\MSupplierOrderDetails;
  5. use Mall\Framework\Core\ErrorCode;
  6. use Mall\Framework\Core\ResultWrapper;
  7. use Mall\Framework\Core\StatusCode;
  8. class SupplierOrder extends BaseController
  9. {
  10. /**
  11. * @var MSupplierOrderDetails
  12. */
  13. private $objMSupplierOrderDetails;
  14. /**
  15. * SupplierOrder constructor.
  16. * @param bool $isCheckAcl
  17. * @param false $isMustLogin
  18. * @param bool $checkToken
  19. * @param false $getAreaCode
  20. * @param bool $checkShopToken
  21. * @param bool $checkSupplierToken
  22. * @throws \Exception
  23. */
  24. public function __construct($isCheckAcl = true, $isMustLogin = false, $checkToken = true, $getAreaCode = false, $checkShopToken = true, $checkSupplierToken = true)
  25. {
  26. parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode, $checkShopToken, $checkSupplierToken);
  27. $this->objMSupplierOrderDetails = new MSupplierOrderDetails($this->onlineEnterpriseId,$this->onlineUserId);
  28. }
  29. /**
  30. * Doc: (des="")
  31. * User: XMing
  32. * Date: 2020/12/22
  33. * Time: 5:20 下午
  34. */
  35. public function getAll()
  36. {
  37. $params = $this->request->getRawJson();
  38. $page = getArrayItem($params,'page',1);
  39. $pageSize = getArrayItem($params,'pageSize',10);
  40. $pageParams = pageToOffset($page, $pageSize);
  41. $params['limit'] = $pageParams['limit'];
  42. $params['offset'] = $pageParams['offset'];
  43. !empty($this->supplierId) && $params['supplierId'] = $this->supplierId;
  44. $params['auditStatus'] = StatusCode::$auditStatus['auditPass'];
  45. $result = $this->objMSupplierOrderDetails->getAll($params);
  46. if ($result->isSuccess()) {
  47. $returnData = $result->getData();
  48. $pageData = [
  49. 'pageIndex' => $page,
  50. 'pageSize' => $pageSize,
  51. 'pageTotal' => $returnData['total'],
  52. ];
  53. parent::sendOutput($returnData['data'], 0, $pageData);
  54. }
  55. parent::sendOutput($result->getData(), $result->getErrorCode());
  56. }
  57. /**
  58. * Doc: (des="")
  59. * User: XMing
  60. * Date: 2020/12/22
  61. * Time: 6:14 下午
  62. * @throws \Exception
  63. */
  64. public function get()
  65. {
  66. $id = $this->request->param('request_id');
  67. if (empty($id)) {
  68. parent::sendOutput('id参数错误', ErrorCode::$paramError);
  69. }
  70. $result = $this->objMSupplierOrderDetails->get($id);
  71. if (!$result->isSuccess()) {
  72. parent::sendOutput($result->getData(), $result->getErrorCode());
  73. }
  74. parent::sendOutput($result->getData());
  75. }
  76. }