shish пре 4 година
родитељ
комит
80d68fd87d
1 измењених фајлова са 3 додато и 2 уклоњено
  1. 3 2
      app-ghs/controllers/ExpendController.php

+ 3 - 2
app-ghs/controllers/ExpendController.php

@@ -42,10 +42,11 @@ class ExpendController extends BaseController
                 if (empty($main)) {
                 if (empty($main)) {
                     util::fail('没有门店信息');
                     util::fail('没有门店信息');
                 }
                 }
-                $hasMoney = $main->money ?? 0;
-                if ($amount > $hasMoney) {
+                $main->money = bcsub($main->money, $amount, 2);
+                if ($main->money < 0) {
                     util::fail('现金不足');
                     util::fail('现金不足');
                 }
                 }
+                $main->save();
 
 
                 $staffId = $this->shopAdminId;
                 $staffId = $this->shopAdminId;
                 $staff = $this->shopAdmin;
                 $staff = $this->shopAdmin;