From 7db4909108caf1413a3b3c7de7d704fea9747734 Mon Sep 17 00:00:00 2001 From: weigang Date: Tue, 27 Oct 2020 17:10:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E5=95=86=E5=93=81=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E5=92=8C=E6=9C=89=E6=95=88=E6=9C=9F=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E5=A4=84=E7=90=86=E8=BF=94=E5=9B=9E=E5=AD=97=E7=AC=A6=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=BA=93=E5=AD=98=E4=B8=BA?= =?UTF-8?q?0=E7=9A=84=E6=B4=BB=E5=8A=A8=E5=95=86=E5=93=81=E4=B9=9F?= =?UTF-8?q?=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/v3/GoodsActivity.php | 15 +++++++++++++-- .../v3/Implementations/ActivityService.php | 6 +++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/Model/v3/GoodsActivity.php b/app/Model/v3/GoodsActivity.php index 70b6e0b..c3097ea 100644 --- a/app/Model/v3/GoodsActivity.php +++ b/app/Model/v3/GoodsActivity.php @@ -76,12 +76,23 @@ class GoodsActivity extends Model public function getIsEffectiveAttribute() { - return 2; + if ($this->attributes['expire_time'] < time() || ($this->attributes['inventory'] <= 0 && $this->attributes['is_infinite'] != 1)) { + return 1; + } + + return 0; } public function getNoneffectiveNoteAttribute() { - return '已抢光'; + $msg = ''; + + if ($this->attributes['expire_time'] < time()) { + $msg = '已结束'; + } elseif ($this->attributes['inventory'] <= 0 && $this->attributes['is_infinite'] != 1) { + $msg = '已抢光'; + } + return $msg; } public function getTotalSecondsAttribute() diff --git a/app/Service/v3/Implementations/ActivityService.php b/app/Service/v3/Implementations/ActivityService.php index 48c8cf2..8ee2e02 100644 --- a/app/Service/v3/Implementations/ActivityService.php +++ b/app/Service/v3/Implementations/ActivityService.php @@ -41,9 +41,9 @@ class ActivityService implements ActivityServiceInterface ->orWhereJsonLength(''.$goodsTable.'.market_ids', '=', 0); }) ->where([''.$goodsTable.'.on_sale' => GoodsConstants::ON_SALE_YES]) - ->where(function ($query) use ($goodsTable) { - $query->where(''.$goodsTable.'.inventory', '>', 0)->orWhere(''.$goodsTable.'.is_infinite', '=', 1); - }) + // ->where(function ($query) use ($goodsTable) { + // $query->where(''.$goodsTable.'.inventory', '>', 0)->orWhere(''.$goodsTable.'.is_infinite', '=', 1); + // }) ->whereRaw(''.$goodsTable.'.deleted_at IS NULL') ->where([''.$storeTable.'.market_id' => $marketId]) ->where([''.$storeTable.'.is_open' => \App\Constants\v3\Store::IS_OPEN_YES])