فهرست منبع

客户结账记录

shish 1 سال پیش
والد
کامیت
e4421866da
1فایلهای تغییر یافته به همراه37 افزوده شده و 0 حذف شده
  1. 37 0
      app-ghs/controllers/CheckOutController.php

+ 37 - 0
app-ghs/controllers/CheckOutController.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace ghs\controllers;
+
+use bizGhs\clear\classes\ClearClass;
+use bizGhs\clear\services\ClearService;
+use bizGhs\custom\classes\CustomClass;
+use common\components\util;
+use Yii;
+
+class CheckOutController extends BaseController
+{
+
+    //客户的结帐记录 ssh 20241212
+    public function actionList()
+    {
+        $get = Yii::$app->request->get();
+        $where = [];
+        if (isset($get['status']) && is_numeric($get['status'])) {
+            $where['status'] = $get['status'];
+        }
+        $customId = $get['customId'] ?? 0;
+        if (!empty($customId)) {
+            $custom = CustomClass::getById($customId, true);
+            CustomClass::valid($custom, $this->shopId);
+            $where['customId'] = $customId;
+        }
+        $where['ghsShopId'] = $this->shopId ?? 0;
+        $list = ClearService::getClearList($where);
+
+        $totalAmount = ClearClass::sum(['ghsShopId' => $this->shopId, 'status' => 2, 'customId' => $customId], 'realPrice');
+        $list['totalAmount'] = floatval($totalAmount);
+
+        util::success($list);
+    }
+
+}