store->is_rest == 1){ return ErrorCode::STORE_REST; } // 商品下架或已删除 if($goods->on_sale == 0 || !is_null($goods->deleted_at)){ return ErrorCode::GOODS_ON_SALE_NO; } // 商品库存不足 if($goods->is_infinite != 1 && $goods->inventory < $num){ return ErrorCode::GOODS_INVENTORY_ERROR; } // 是否超过限购数量 if ($goods->restrict_num != 0 && $goods->restrict_num < $num) { return ErrorCode::GOODS_RESTRICT_LIMIT; } //服务站最晚营业时间 if (env('APP_ENV') === 'prod') { $closedTime = strtotime(config('market_rest_time')); if(time() > $closedTime){ throw new ErrorCodeException(ErrorCode::MARKET_REST); } } return true; } public function undo() { // TODO: Implement undo() method. } public function getBanner($goodsId) { $banner = GoodsBanner::query()->where('goods_id',$goodsId)->orderByDesc('type')->get(); return $banner; } public function detail($goodsId) { $res = Goods::query()->with('store')->where('id',$goodsId)->first(); return $res; } }