hrjy 3 years ago
parent
commit
534718ee25

+ 1 - 6
app/api/controller/auction/AuctionController.php

@@ -125,12 +125,7 @@ class AuctionController
                 return app('json')->fail('进场时间已过');
             }
         }
-
-        if ($booking){
-            return app('json')->successful('可进入');
-        }else{
-            return app('json')->fail('未预约');
-        }
+        return app('json')->successful('可进入');
     }
 
 

+ 23 - 3
app/api/controller/auction/AuctionProductController.php

@@ -137,6 +137,26 @@ class AuctionProductController
 
     }
 
+    /**
+     * 挂售详情
+     * @param Request $request
+     * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function gsxq(Request $request)
+    {
+        $data = UtilService::postMore([
+            ['id']
+        ]);
+        $product = AuctionProduct::where('id', $data['id'])->find();
+
+        $data['aid_val'] = round($product['hanging_price'] * 0.0485, 2); // 需要的广告值
+        $data['hanging_price'] = round((int)$product['hanging_price'] + $product['hanging_price'] * 0.06, 2); // 第二天溢价
+
+        return app('json')->successful($data);
+    }
 
     /**
      * 挂售商品
@@ -156,11 +176,11 @@ class AuctionProductController
         $user = User::where('uid', $request->uid())->find();
         if (!$product) return app('json')->fail('商品不存在');
 
-        $aid_val = $product['hanging_price'] * 0.0485; // 需要的广告值
-        $hanging_price = $product['hanging_price'] * 0.06; // 第二天溢价
+        $aid_val = round($product['hanging_price'] * 0.0485,2); // 需要的广告值
+        $hanging_price = round((int)$product['hanging_price'] + $product['hanging_price'] * 0.06, 2); // 第二天溢价
         if ($user['aid_val'] < $aid_val) return app('json')->fail('挂售需要广告值不足');
 
-        $product['hanging_price'] += $hanging_price;
+        $product['hanging_price'] = $hanging_price;
         $product['is_show'] = 1;
         $user['aid_val'] -= $aid_val;
 

+ 2 - 0
route/api/route.php

@@ -174,7 +174,9 @@ Route::group(function () {
     Route::get('seller', 'auction.AuctionProductController/seller')->name('seller');//卖家订单
     Route::get('user_product', 'auction.AuctionProductController/user_product')->name('user_product');//用户商品
     Route::post('zfpay', 'auction.AuctionProductController/zfpay')->name('zfpay');//支付订单
+
     Route::post('hanging_sale', 'auction.AuctionProductController/hanging_sale')->name('hanging_sale');//挂售商品
+    Route::get('gsxq', 'auction.AuctionProductController/gsxq')->name('gsxq');//挂售详情