shish 4 лет назад
Родитель
Сommit
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)) {
                     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;