CheckOutController.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace ghs\controllers;
  3. use bizGhs\clear\classes\ClearClass;
  4. use bizGhs\clear\services\ClearService;
  5. use bizGhs\custom\classes\CustomClass;
  6. use common\components\util;
  7. use Yii;
  8. class CheckOutController extends BaseController
  9. {
  10. //客户的结帐记录 ssh 20241212
  11. public function actionList()
  12. {
  13. $get = Yii::$app->request->get();
  14. $where = [];
  15. if (isset($get['status']) && is_numeric($get['status'])) {
  16. $where['status'] = $get['status'];
  17. }
  18. $customId = $get['customId'] ?? 0;
  19. if (!empty($customId)) {
  20. $custom = CustomClass::getById($customId, true);
  21. CustomClass::valid($custom, $this->shopId);
  22. $where['customId'] = $customId;
  23. }
  24. $where['ghsShopId'] = $this->shopId ?? 0;
  25. $list = ClearService::getClearList($where);
  26. //累计已结账,app上在使用此数值
  27. $totalAmount = ClearClass::sum(['ghsShopId' => $this->shopId, 'status' => 2, 'customId' => $customId], 'realPrice');
  28. $list['totalAmount'] = floatval($totalAmount);
  29. util::success($list);
  30. }
  31. }