|
@@ -59,10 +59,11 @@ class AuctionController
|
|
|
$data = UtilService::postMore([
|
|
|
['id']
|
|
|
]);
|
|
|
+ User::rollbackTrans();
|
|
|
if (!$data['id']) return app('json')->fail('数据传入错误');
|
|
|
if (cache($request->uid())) return app('json')->fail('请勿频繁点击');
|
|
|
$auctionModel = new Auction();
|
|
|
- $auction = $auctionModel->find($data['id']);
|
|
|
+ $auction = $auctionModel->lock(true)->find($data['id']);
|
|
|
if (!$auction)return app('json')->fail('没有此数据');
|
|
|
|
|
|
if (time() < strtotime($auction['add_time'])){
|
|
@@ -81,7 +82,7 @@ class AuctionController
|
|
|
if ($user['anticipate'] < $auction['anticipate']) return app('json')->fail('易趣卷不足');
|
|
|
$user['anticipate'] = $user['anticipate'] - $auction['anticipate'];// 扣除预约卷
|
|
|
|
|
|
- User::rollbackTrans();
|
|
|
+
|
|
|
$res = $user->save();
|
|
|
if ($res){
|
|
|
AuctionBooking::booking($user['uid'], $auction);
|