浏览文章
文章信息
Magento2 查询今日数据
13052
$objDate = $this->objectManager->create('Magento\Framework\Stdlib\DateTime\DateTime'); $now = $objDate->timestamp(); $start = date('Y-m-d' . ' 00:00:00', $now); $end = date('Y-m-d' . ' 23:59:59', $now); $list = $this->flushSales->getResourceCollection() ->addFieldToSelect('flash_id') ->addFieldToSelect('title') ->addFieldToSelect('start_at') ->addFieldToSelect('ends_at') ->addFilter('is_active', 1, '=') ->addFieldToFilter('start_at', ['lteq' => $start]) ->addFieldToFilter('ends_at', ['gteq' => $end]) ->getData(); return $this->success('请求成功!', ['list' => $list, 'time' => date('Y-m-d H:i:s')]);