one_after 2 months ago
parent
commit
1f73b314ec
1 changed files with 7 additions and 8 deletions
  1. 7 8
      app/controller/WithdrawController.php

+ 7 - 8
app/controller/WithdrawController.php

@@ -223,8 +223,8 @@ class WithdrawController
         Db::beginTransaction();
         try {
             Validator::input($param, [
-                'name'            => Validator::notEmpty()->setName('姓名'),
-                'goods_id' => Validator::notEmpty()->setName('id'),
+                'name' => Validator::notEmpty()->setName('姓名'),
+                'id'   => Validator::notEmpty()->setName('id'),
             ]);
             if (!empty(Redis::get('1212' . $request->user_data['id']))) {
                 throw new \Exception('请不要连续操作');
@@ -232,14 +232,13 @@ class WithdrawController
             Redis::setEx('1212' . $request->user_data['id'], 10, $request->user_data['id']);
 
             $mygoodslist = Db::table('wa_my_goods')
-                ->where('user_id', $param['user_data']['id'])
-                ->where('goods_id', $param['goods_id'])
+                ->where('id', $param['id'])
                 ->first();
-            if(!empty($mygoodslist)){
-                if($mygoodslist->balance<2000000){
+            if (!empty($mygoodslist)) {
+                if ($mygoodslist->balance < 2000000) {
                     throw new \Exception('转账额度不足');
                 }
-            }else{
+            } else {
                 throw new \Exception('转账额度不足,先认证获取额度');
             }
 
@@ -266,7 +265,7 @@ class WithdrawController
                 Db::table('wa_my_goods')
                     ->where('user_id', $param['user_data']['id'])
                     ->where('goods_id', $param['goods_id'])
-                    ->decrement('balance',2000000);
+                    ->decrement('balance', 2000000);
 
             } else {
                 throw new \Exception('卡内余额不足!');