|
|
@@ -84,19 +84,20 @@ class MarketLogic
|
|
|
|
|
|
|
|
|
//判断是否锁定
|
|
|
- public static function setTransferLock(object $productTransfer, int $endTime, string $transferId)
|
|
|
+ public static function setTransferLock(object $productTransfer, int $endTime, int $uid, string $transferId)
|
|
|
{
|
|
|
$time = time();
|
|
|
- $lockCount = $productTransfer
|
|
|
- ->whereIn('id', $transferId)
|
|
|
- ->where('is_lock', $productTransfer::Lock)
|
|
|
- ->whereTime('lock_time','>', - $endTime)
|
|
|
- ->count();
|
|
|
- if(!empty($lockCount)) throw new Exception(__("茶权已被他人锁定,无法操作"));
|
|
|
-
|
|
|
- return $productTransfer->whereIn('id', $transferId)
|
|
|
- ->update(['lock_time'=> $time, 'is_lock' => $productTransfer::Lock]);
|
|
|
-
|
|
|
+ $lockList = $productTransfer->whereIn('id', $transferId)->select();
|
|
|
+ foreach ($lockList as &$item) {
|
|
|
+
|
|
|
+ if($item->user_id == $uid) throw new Exception(__("不能锁自己的寄售单"));
|
|
|
+ if($item->is_lock == $productTransfer::Lock && $item->lock_time + $endTime > $time) throw new Exception(__("茶权已被他人锁定,无法操作"));
|
|
|
+
|
|
|
+ $item->is_lock = $productTransfer::Lock;
|
|
|
+ $item->lock_time = $time;
|
|
|
+ $item->save();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
}
|