rabin 2 лет назад
Родитель
Сommit
a8d6767d18
1 измененных файлов с 6 добавлено и 3 удалено
  1. 6 3
      lib/Info.php

+ 6 - 3
lib/Info.php

@@ -102,6 +102,9 @@ class Info
 
         $func = 'inc';
         if ($type['type'] == 2) {
+            if ($info['cash'] < $cash) {
+                return $this->alert('账户余额不足', $state);
+            }
             $cash = -1*$cash;
             $func = 'dec';
         }
@@ -123,13 +126,13 @@ class Info
 
         if ($info) {
             $data['yue'] = $info['cash'] + $data['cash'];
+            if ($type['type'] == 2 && $config['balance_alert'] && $data['yue'] <= $config['balance_alert']) {
+                return $this->alert('账户余额不足', $state);
+            }
         } else {
             $data['yue'] = 0;
         }
 
-        if ($data['yue'] < 0) {
-            $data['yue'] = 0;
-        }
         $yue = $data['yue'];
         $data['method'] = $method;
         $admin = Dever::load('manage/auth.data');