shish преди 1 година
родител
ревизия
6c332bbadb
променени са 1 файла, в които са добавени 36 реда и са изтрити 0 реда
  1. 36 0
      app-hd/controllers/DeductController.php

+ 36 - 0
app-hd/controllers/DeductController.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace hd\controllers;
+
+use bizHd\custom\classes\CustomClass;
+use common\components\util;
+use Yii;
+
+class DeductController extends BaseController
+{
+
+    public $guestAccess = [];
+
+    //减少余额 ssh 20250329(这个方法应该建在CustomController的)
+    public function actionDeductBalance()
+    {
+        $post = Yii::$app->request->post();
+        $customId = $post['customId'] ?? 0;
+        $custom = CustomClass::getByID($customId, true);
+        if (empty($custom)) {
+            util::fail('没有找到客户');
+        }
+        if ($custom->shopId != $this->shopId) {
+            util::fail('不是你的客户');
+        }
+        $amount = $post['amount'] ?? 0;
+        if (empty($amount)) {
+            util::fail('请填写金额');
+        }
+        if ($amount < 0) {
+            util::fail('金额要大于0');
+        }
+        util::complete('减少成功');
+    }
+
+}