|
|
@ -99,8 +99,12 @@ class GoodsActivityService implements GoodsActivityServiceInterface |
|
|
$expireTime = 0; |
|
|
$expireTime = 0; |
|
|
if ($goods->time_limit_days >= 1) { |
|
|
if ($goods->time_limit_days >= 1) { |
|
|
$expireTime += strtotime(date('Y-m-d 23:59:59')) - time(); |
|
|
$expireTime += strtotime(date('Y-m-d 23:59:59')) - time(); |
|
|
} |
|
|
|
|
|
$expireTime += ($goods->time_limit_days-1) * 86400; |
|
|
$expireTime += ($goods->time_limit_days-1) * 86400; |
|
|
|
|
|
} elseif ($goods->time_limit_days > 0 && $goods->time_limit_days < 1) { |
|
|
|
|
|
$expireTime += bcmul($goods->time_limit_days,86400,0); |
|
|
|
|
|
} else { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$ssdb = ApplicationContext::getContainer()->get(SSDBTask::class); |
|
|
$ssdb = ApplicationContext::getContainer()->get(SSDBTask::class); |
|
|
|
|
|
|
|
|
@ -145,17 +149,26 @@ class GoodsActivityService implements GoodsActivityServiceInterface |
|
|
->get()->toArray(); |
|
|
->get()->toArray(); |
|
|
|
|
|
|
|
|
$limitNums = [ |
|
|
$limitNums = [ |
|
|
ActivityType::FLASH_SALE => 1, |
|
|
|
|
|
ActivityType::GROUP_BUY => 1, |
|
|
|
|
|
ActivityType::NEW_PRODUCT => 1, |
|
|
|
|
|
|
|
|
ActivityType::FLASH_SALE => 0, |
|
|
|
|
|
ActivityType::GROUP_BUY => 0, |
|
|
|
|
|
ActivityType::NEW_PRODUCT => 0, |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
$buyNum = 0; |
|
|
|
|
|
|
|
|
$buyNum = [ |
|
|
|
|
|
ActivityType::FLASH_SALE => 0, |
|
|
|
|
|
ActivityType::GROUP_BUY => 0, |
|
|
|
|
|
ActivityType::NEW_PRODUCT => 0, |
|
|
|
|
|
]; |
|
|
foreach ($sourceGoods as $key => &$goods) { |
|
|
foreach ($sourceGoods as $key => &$goods) { |
|
|
if ($buyNum >= $limitNums[$goods['type']]) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($limitNums[$goods->type] == 0) { // 不限制同类购买商品种数,也就是可以同时购买多款不同商品
|
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$buyNum[$goods->type] += 1; |
|
|
|
|
|
if ($buyNum[$goods->type] > $limitNums[$goods->type]) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
$buyNum++; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|
|