PushMoney.Class.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <?php
  2. namespace JInDouYun\Controller\Cashier;
  3. use JinDouYun\Controller\BaseController;
  4. use JinDouYun\Model\Cashier\MCashierPushMoneyDetail;
  5. use Mall\Framework\Core\ErrorCode;
  6. /**
  7. * Description:
  8. * Class PushMoney
  9. * @package JInDouYun\Controller\Cashier
  10. */
  11. class PushMoney extends BaseController
  12. {
  13. /**
  14. * @var MCashierPushMoneyDetail
  15. */
  16. private $objMCashierPushMoneyDetail;
  17. /**
  18. * PushMoney constructor.
  19. * @param bool $isCheckAcl
  20. * @param bool $isMustLogin
  21. * @param bool $checkToken
  22. * @param bool $getAreaCode
  23. * @throws \Exception
  24. */
  25. public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = true, $getAreaCode = false)
  26. {
  27. parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode);
  28. $this->objMCashierPushMoneyDetail = new MCashierPushMoneyDetail($this->onlineUserId,$this->onlineEnterpriseId);
  29. }
  30. /**
  31. * Doc: (des="")
  32. * User: XMing
  33. * Date: 2020/8/31
  34. * Time: 5:41 下午
  35. */
  36. public function getAll()
  37. {
  38. $params = $this->request->getRawJson();
  39. if (empty($params)) {
  40. parent::sendOutput('参数为空', ErrorCode::$paramError);
  41. }
  42. if (!isset($params['pushType']) || empty($params['pushType'])){
  43. parent::sendOutput('pushType参数错误',ErrorCode::$paramError);
  44. }
  45. $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
  46. $params['limit'] = $pageParams['limit'];
  47. $params['offset'] = $pageParams['offset'];
  48. $result = $this->objMCashierPushMoneyDetail->getAll($params);
  49. if (!$result->isSuccess()) {
  50. parent::sendOutput($result->getData(), $result->getErrorCode());
  51. }
  52. $returnData = $result->getData();
  53. $pageData = [
  54. 'pageIndex' => $params['page'],
  55. 'pageSize' => $params['pageSize'],
  56. 'pageTotal' => $returnData['total'],
  57. ];
  58. parent::sendOutput($returnData['data'], 0, $pageData);
  59. }
  60. /**
  61. * Doc: (des="获取交班记录")
  62. * User: XMing
  63. * Date: 2020/9/1
  64. * Time: 11:12 上午
  65. */
  66. public function getRecordList()
  67. {
  68. $params = $this->request->getRawJson();
  69. if (empty($params)) {
  70. parent::sendOutput('参数为空', ErrorCode::$paramError);
  71. }
  72. $pageParams = pageToOffset($params['page'] ?: 1, $params['pageSize'] ?: 10);
  73. $params['limit'] = $pageParams['limit'];
  74. $params['offset'] = $pageParams['offset'];
  75. $result = $this->objMCashierPushMoneyDetail->getRecordList($params);
  76. if (!$result->isSuccess()) {
  77. parent::sendOutput($result->getData(), $result->getErrorCode());
  78. }
  79. $returnData = $result->getData();
  80. $pageData = [
  81. 'pageIndex' => $params['page'],
  82. 'pageSize' => $params['pageSize'],
  83. 'pageTotal' => $returnData['total'],
  84. ];
  85. parent::sendOutput($returnData['data'], 0, $pageData);
  86. }
  87. /**
  88. * Doc: (des="收款记录详情")
  89. * User: XMing
  90. * Date: 2020/9/1
  91. * Time: 11:35 上午
  92. */
  93. public function getRecordInfo()
  94. {
  95. $id = $this->request->param('request_id');
  96. if (empty($id)){
  97. parent::sendOutput('id参数错误',ErrorCode::$paramError);
  98. }
  99. $result = $this->objMCashierPushMoneyDetail->getRecordInfo($id);
  100. if (!$result->isSuccess()){
  101. parent::sendOutput($result->getData(),$result->getErrorCode());
  102. }
  103. parent::sendOutput($result->getData());
  104. }
  105. /**
  106. * Doc: (des="1.获取交接详情")
  107. * User: XMing
  108. * Date: 2020/9/1
  109. * Time: 12:01 下午
  110. */
  111. public function connectDetails()
  112. {
  113. $shopId = $this->request->param('shopId');
  114. if (empty($shopId)){
  115. parent::sendOutput('shopId参数错误',ErrorCode::$paramError);
  116. }
  117. $result = $this->objMCashierPushMoneyDetail->connectDetails($shopId);
  118. if (!$result->isSuccess()){
  119. parent::sendOutput($result->getData(),$result->getErrorCode());
  120. }
  121. parent::sendOutput($result->getData());
  122. }
  123. /**
  124. * Doc: (des="2.确定交接")
  125. * User: XMing
  126. * Date: 2020/9/1
  127. * Time: 12:18 下午
  128. */
  129. public function confirmConnect()
  130. {
  131. $id = $this->request->param('request_id');
  132. if (empty($id)){
  133. parent::sendOutput('缺少id参数',ErrorCode::$paramError);
  134. }
  135. $offDutyTime = $this->request->param('offDutyTime');
  136. if (empty($offDutyTime) || !is_numeric($offDutyTime)){
  137. parent::sendOutput('offDutyTime参数错误',ErrorCode::$paramError);
  138. }
  139. $remark = $this->request->param('remark');
  140. $result = $this->objMCashierPushMoneyDetail->confirmConnect($id,$offDutyTime,$remark);
  141. if (!$result->isSuccess()){
  142. parent::sendOutput($result->getData(),$result->getErrorCode());
  143. }
  144. parent::sendOutput($result->getData());
  145. }
  146. /**
  147. * Doc: (des="3.收银登陆")
  148. * User: XMing
  149. * Date: 2020/9/1
  150. * Time: 2:35 下午
  151. */
  152. public function loggerConnect()
  153. {
  154. $params = $this->request->getRawJson();
  155. /*if (!isset($params['mobile']) || empty($params['mobile'])){
  156. parent::sendOutput('mobile参数错误',ErrorCode::$paramError);
  157. }*/
  158. if (!isset($params['shopId']) || empty($params['shopId'])){
  159. parent::sendOutput('shopId参数错误',ErrorCode::$paramError);
  160. }
  161. $result = $this->objMCashierPushMoneyDetail->loggerConnect($params);
  162. if (!$result->isSuccess()){
  163. parent::sendOutput($result->getData(),$result->getErrorCode());
  164. }
  165. parent::sendOutput($result->getData());
  166. }
  167. }