|
@@ -82,8 +82,8 @@ class AuctionProductController
|
|
['product_id'],
|
|
['product_id'],
|
|
]);
|
|
]);
|
|
if (!$data['product_id']) return app('json')->fail('数据传入错误');
|
|
if (!$data['product_id']) return app('json')->fail('数据传入错误');
|
|
-
|
|
|
|
- $product = AuctionProduct::where('id', $data['product_id'])->find();
|
|
|
|
|
|
+ AuctionOrder::beginTrans();
|
|
|
|
+ $product = AuctionProduct::where('id', $data['product_id'])->lock(true)->find();
|
|
if ($product['is_show'] == 0) return app('json')->fail('商品未挂售');
|
|
if ($product['is_show'] == 0) return app('json')->fail('商品未挂售');
|
|
$auction = Auction::where('id', $product['auction_id'])->find();
|
|
$auction = Auction::where('id', $product['auction_id'])->find();
|
|
$user = $request->user();
|
|
$user = $request->user();
|
|
@@ -109,7 +109,6 @@ class AuctionProductController
|
|
|
|
|
|
if ($product['uid'] == $request->uid()) return app('json')->fail('无法购买自己商品');
|
|
if ($product['uid'] == $request->uid()) return app('json')->fail('无法购买自己商品');
|
|
if ($product){
|
|
if ($product){
|
|
- AuctionOrder::beginTrans();
|
|
|
|
//查询商品是否以卖出
|
|
//查询商品是否以卖出
|
|
$order = AuctionOrder::where('product_id', $data['product_id'])->where('status', '>', 0)->where('auction_id', $auction['id'])->where('frequency', $auction['frequency'])->find();
|
|
$order = AuctionOrder::where('product_id', $data['product_id'])->where('status', '>', 0)->where('auction_id', $auction['id'])->where('frequency', $auction['frequency'])->find();
|
|
if ($order){
|
|
if ($order){
|
|
@@ -379,6 +378,7 @@ class AuctionProductController
|
|
if (($money+$product['hanging_price']) > (float)$max) return app('json')->fail('今天挂售金额已超出上限');
|
|
if (($money+$product['hanging_price']) > (float)$max) return app('json')->fail('今天挂售金额已超出上限');
|
|
|
|
|
|
$datas = AuctionProduct::bs($data['id']);// 获取挂售详情
|
|
$datas = AuctionProduct::bs($data['id']);// 获取挂售详情
|
|
|
|
+ if($datas == false) return app('json')->fail('计算错误,请重新挂售');
|
|
if ($user['anticipate'] < $datas['anticipate']) return app('json')->fail('预约券不足');
|
|
if ($user['anticipate'] < $datas['anticipate']) return app('json')->fail('预约券不足');
|
|
$product['price'] = $product['hanging_price'];
|
|
$product['price'] = $product['hanging_price'];
|
|
$product['hanging_price'] = $datas['hanging_price']; // 商品变为挂售价格
|
|
$product['hanging_price'] = $datas['hanging_price']; // 商品变为挂售价格
|