Browse Source

余额判断

afa 10 months ago
parent
commit
925959ffff
1 changed files with 3 additions and 2 deletions
  1. 3 2
      application/api/controller/Order.php

+ 3 - 2
application/api/controller/Order.php

@@ -47,10 +47,11 @@ class Order extends Api
         // 启动事务
         Db::startTrans();
         try {
-
+            
             $amount = $ledgerWalletModel::getWalletChaBao($this->auth->id);
-            if(bccomp($order_info['price'], $amount, 2) < 0) throw new Exception(__("余额不足请前往充值"), 300);
+            if(bccomp($order_info['price'], $amount, 2) > 0) throw new Exception(__("余额不足请前往充值"), 300);
             if($order_info->stock == 0 || time() >= $order_info->end_time) throw new Exception(__("抢购已结束"));
+
             // 生成订单
             $productOrder->create($order_data);
             //修改区域状态