hrjy 2 years ago
parent
commit
1e3145d352

+ 2 - 1
app/api/controller/auction/AuctionProductController.php

@@ -129,7 +129,7 @@ class AuctionProductController
             ['pas']
         ]);
         if (empty($data['pas'])) return app('json')->fail('请填写支付密码');
-        if ($request->user()['payment_pas'] != $data['pas']) return app('json')->fail('支付密码不正确');
+        if ($request->user()['payment_pas'] != md5($data['pas'].'sxg')) return app('json')->fail('支付密码不正确');
         $model = new User();
         $order = AuctionOrder::where('order_id', $data['order_id'])->find();
         if (!$order) return app('json')->fail('订单不存在');
@@ -229,6 +229,7 @@ class AuctionProductController
         ]);
         $product = AuctionProduct::where('id', $data['id'])->find();
         if (!$product)  return app('json')->fail('没有此商品');
+        $product['slider_image'] = json_decode($product['slider_image']);
         $product = $product->toArray();
         return app('json')->successful($product);
     }

+ 10 - 2
app/api/controller/user/UserController.php

@@ -689,8 +689,11 @@ class UserController
     {
         $data = UtilService::postMore([
             'phone',
-            'money'
+            'money',
+            'pas'
         ]);
+        if (empty($data['pas'])) return app('json')->fail('请填写支付密码');
+        if ($request->user()['payment_pas'] != md5($data['pas'].'sxg')) return app('json')->fail('支付密码不正确');
         if ($data['phone'] == $request->user()['account']) return app('json')->fail('不能给自己转账');
         if (empty($data['phone']) or empty($data['money'])) return app('json')->fail('手机号,金额不能未空');
         $user = User::where('account', $data['phone'])->find();
@@ -716,7 +719,12 @@ class UserController
     }
 
     /**
-     * @return void
+     * 购买倒计时
+     * @param Request $request
+     * @return mixed
+     * @throws DataNotFoundException
+     * @throws DbException
+     * @throws ModelNotFoundException
      */
     public function edit_pas(Request $request)
     {

+ 0 - 1
app/http/middleware/AllowOriginMiddleware.php

@@ -98,7 +98,6 @@ class AllowOriginMiddleware implements MiddlewareInterface
         } catch (\Exception $e) {
             Db::rollback();
         }
-
         try {
             Db::startTrans();
             AuctionOrder::th();// 退回广告值

+ 14 - 10
app/models/auction/AuctionOrder.php

@@ -160,16 +160,20 @@ class AuctionOrder extends BaseModel
 
                 if ($booking){
                     foreach ($booking as $key => $value){
-                        $userBok = AuctionBooking::where('uid', '=',$value['uid'])->where('deduct_advert', '>', 0)->count(); //预约未购买退回的次数
-                        $bf =  (0.1*$userBok >= 1)? 1: 0.1*$userBok; // 0.1 * 退回次数
-                        $find = AuctionBooking::find($value['id']);
-                        $find['status'] = 0;
-                        $find['deduct_advert'] = $value['advert']*$bf; // 扣除广告书
-                        $user = User::where('uid', $value['uid'])->find();
-                        $user['aid_val'] = $user['aid_val'] + ($value['advert'] - ($value['advert'] * $bf)); // 增加用户广告值
-                        $user->save();
-                        $find->save();
-                        UserBill::income('未购买解冻但扣除'. $find['deduct_advert'].'广告值',$user['uid'], 'aid_val', 'add_aid_val',$value['advert'] - ($value['advert'] * $bf), 0, $user['aid_val'], '未购买解冻但扣除'. $find['deduct_advert'].'广告值');
+                        $product = AuctionProduct::where('auction_id', $value['auction_id'])->column('id');
+                        $order = AuctionOrder::where([['product_id', 'in', $product], ['frequency', '=', $value['frequency']], ['uid', '=', $value['uid']]])->find();
+                        if (!$order){
+                            $userBok = AuctionBooking::where('uid', '=',$value['uid'])->where('deduct_advert', '>', 0)->count(); //预约未购买退回的次数
+                            $bf =  (0.1*$userBok >= 1)? 1: 0.1*$userBok == 0? 0.1 : 0.1*$userBok; // 0.1 * 退回次数
+                            $find = AuctionBooking::find($value['id']);
+                            $find['status'] = 0;
+                            $find['deduct_advert'] = $value['advert']*$bf; // 扣除广告书
+                            $user = User::where('uid', $value['uid'])->find();
+                            $user['aid_val'] = $user['aid_val'] + ($value['advert'] - ($value['advert'] * $bf)); // 增加用户广告值
+                            $user->save();
+                            $find->save();
+                            UserBill::income('未购买解冻但扣除'. $find['deduct_advert'].'广告值',$user['uid'], 'aid_val', 'add_aid_val',$value['advert'] - ($value['advert'] * $bf), 0, $user['aid_val'], '未购买解冻但扣除'. $find['deduct_advert'].'广告值');
+                        }
                     }
                 }
             }