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])