shish il y a 4 ans
Parent
commit
80d68fd87d
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  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)) {
                     util::fail('没有门店信息');
                 }
-                $hasMoney = $main->money ?? 0;
-                if ($amount > $hasMoney) {
+                $main->money = bcsub($main->money, $amount, 2);
+                if ($main->money < 0) {
                     util::fail('现金不足');
                 }
+                $main->save();
 
                 $staffId = $this->shopAdminId;
                 $staff = $this->shopAdmin;