Browse Source

提现限制

master
weigang 5 years ago
parent
commit
2d30559f5d
  1. 2
      app/Constants/v3/ErrorCode.php
  2. 2
      app/Controller/v3/WithdrawController.php
  3. 27
      app/Service/v3/Implementations/GoodsActivityService.php
  4. 2
      app/Service/v3/Implementations/OrderOnlineService.php

2
app/Constants/v3/ErrorCode.php

@ -286,7 +286,7 @@ class ErrorCode extends AbstractConstants
/**
* 商品超过限购数量
* @Message("同类活动商品超过限购数")
* @Message("同类活动商品超过限购")
*/
const GOODS_ACTIVITY_RESTRICT_LIMIT = 1155;

2
app/Controller/v3/WithdrawController.php

@ -128,7 +128,7 @@ class WithdrawController extends BaseController
$userId = $this->request->input('user_id');
$storeId = $this->request->input('store_id');
if ($money > 1000) {
if ($money > 3000) {
$this->log->event(LogLabel::STORE_WITHDRAW_FAIL_LOG, [
'msg' => '提现失败[1000]',
'params' => json_encode(['money' => $money, 'user_id' => $userId, 'store_id' => $storeId]),

27
app/Service/v3/Implementations/GoodsActivityService.php

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

2
app/Service/v3/Implementations/OrderOnlineService.php

@ -337,7 +337,7 @@ class OrderOnlineService implements OrderOnlineServiceInterface
// 判断是否有购买多个特价商品
$check = $this->goodsActivityService->checkOrderActivityCount($activityGoodsIds);
if(!$check){
$this->log->event(LogLabel::ORDER_ONLINE_LOG, ['msg' => '订单中有活动商品超过限购数量', 'data' => json_encode($dataOrderGoods)]);
$this->log->event(LogLabel::ORDER_ONLINE_LOG, ['msg' => '同一订单中有活动商品不可同时购买多款', 'data' => json_encode($dataOrderGoods)]);
throw new ErrorCodeException(ErrorCode::GOODS_ACTIVITY_RESTRICT_LIMIT);
}

Loading…
Cancel
Save