rabin 6 dias atrás
pai
commit
35ba3897b3
2 arquivos alterados com 37 adições e 4 exclusões
  1. 13 4
      src/dai/seller/app/Lib/Info.php
  2. 24 0
      src/dai/seller/workerman.log

+ 13 - 4
src/dai/seller/app/Lib/Info.php

@@ -6,8 +6,13 @@ class Info
     public function dec_commit(){}
     public function dec($id, $cash)
     {
-        $sql = 'UPDATE {table} SET cash = cash - :amount, balance = COALESCE(balance, credit + cash) - :amount WHERE id = :id AND COALESCE(balance, credit + cash) >= :amount';
-        $bind = [':amount' => $cash, ':id' => $id];
+        $sql = 'UPDATE {table} SET cash = cash - :cash_dec, balance = COALESCE(balance, credit + cash) - :balance_dec WHERE id = :id AND COALESCE(balance, credit + cash) >= :need_amount';
+        $bind = [
+            ':cash_dec' => $cash,
+            ':balance_dec' => $cash,
+            ':need_amount' => $cash,
+            ':id' => $id,
+        ];
         $statement = Dever::db('seller/info')->query($sql, $bind, ['method' => 'update']);
         return $statement->rowCount() > 0;
     }
@@ -16,8 +21,12 @@ class Info
     public function inc_commit(){}
     public function inc($id, $cash)
     {
-        $sql = 'UPDATE {table} SET cash = cash + :amount, balance = COALESCE(balance, credit + cash) + :amount WHERE id = :id';
-        $bind = [':amount' => $cash, ':id' => $id];
+        $sql = 'UPDATE {table} SET cash = cash + :cash_inc, balance = COALESCE(balance, credit + cash) + :balance_inc WHERE id = :id';
+        $bind = [
+            ':cash_inc' => $cash,
+            ':balance_inc' => $cash,
+            ':id' => $id,
+        ];
         $statement = Dever::db('seller/info')->query($sql, $bind, ['method' => 'update']);
         return $statement->rowCount() > 0;
     }

+ 24 - 0
src/dai/seller/workerman.log

@@ -5603,3 +5603,27 @@ Stack trace:
 2025-11-16 11:12:38 pid:67997 Workerman[server.php] stopping
 2025-11-16 11:12:38 pid:67997 Workerman[server.php] has been stopped
 2025-11-16 11:12:38 pid:68078 Workerman[server.php] stop success
+2025-11-16 11:29:08 pid:71848 Workerman[server.php] restart
+2025-11-16 11:29:08 pid:71848 Workerman[server.php] is stopping ...
+2025-11-16 11:29:08 pid:68080 Workerman[server.php] received signal SIGINT
+2025-11-16 11:29:08 pid:68080 Workerman[server.php] stopping
+2025-11-16 11:29:08 pid:68080 Workerman[server.php] has been stopped
+2025-11-16 11:29:08 pid:71848 Workerman[server.php] stop success
+2025-11-16 11:29:52 pid:72026 Workerman[server.php] restart
+2025-11-16 11:29:52 pid:72026 Workerman[server.php] is stopping ...
+2025-11-16 11:29:52 pid:71850 Workerman[server.php] received signal SIGINT
+2025-11-16 11:29:52 pid:71850 Workerman[server.php] stopping
+2025-11-16 11:29:52 pid:71850 Workerman[server.php] has been stopped
+2025-11-16 11:29:52 pid:72026 Workerman[server.php] stop success
+2025-11-16 11:30:09 pid:72091 Workerman[server.php] restart
+2025-11-16 11:30:09 pid:72091 Workerman[server.php] is stopping ...
+2025-11-16 11:30:09 pid:72028 Workerman[server.php] received signal SIGINT
+2025-11-16 11:30:09 pid:72028 Workerman[server.php] stopping
+2025-11-16 11:30:09 pid:72028 Workerman[server.php] has been stopped
+2025-11-16 11:30:10 pid:72091 Workerman[server.php] stop success
+2025-11-16 11:31:10 pid:72327 Workerman[server.php] restart
+2025-11-16 11:31:10 pid:72327 Workerman[server.php] is stopping ...
+2025-11-16 11:31:10 pid:72093 Workerman[server.php] received signal SIGINT
+2025-11-16 11:31:10 pid:72093 Workerman[server.php] stopping
+2025-11-16 11:31:10 pid:72093 Workerman[server.php] has been stopped
+2025-11-16 11:31:10 pid:72327 Workerman[server.php] stop success