diff --git a/app/api/model/sharp/Active.php b/app/api/model/sharp/Active.php index cc351d57..ed25ec1d 100644 --- a/app/api/model/sharp/Active.php +++ b/app/api/model/sharp/Active.php @@ -44,7 +44,18 @@ class Active extends ActiveModel $todayTime = strtotime(date('Y-m-d')); return $this->getActiveByDate($todayTime, '='); } - + /** + * 获取明天的活动 + * @return Active|array|null + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function getTmowActive() + { + $todayTime = strtotime(date('Y-m-d',strtotime("+1 day"))); + return $this->getActiveByDate($todayTime, '='); + } /** * 获取当天的活动 * @return Active|array|null @@ -74,4 +85,4 @@ class Active extends ActiveModel ->where('is_delete', '=', 0) ->find(); } -} \ No newline at end of file +} diff --git a/app/api/service/sharp/Active.php b/app/api/service/sharp/Active.php index 4f9ba1d9..653ab9b6 100644 --- a/app/api/service/sharp/Active.php +++ b/app/api/service/sharp/Active.php @@ -306,6 +306,12 @@ class Active extends BaseService // 获取即将开始的活动 $data = array_merge($data, $this->getSoonActive($todyActive)); } + //获取明天活动 + $tmowActive = $this->ActiveModel->getNowActive(); + if (!empty($tmowActive)) { + // 获取即将开始的活动 + $data = array_merge($data, $this->getSoonActive($todyActive)); + } // 获取预告的活动 $data[] = $this->getNoticeActive(); return array_values(array_filter($data)); @@ -359,18 +365,35 @@ class Active extends BaseService foreach ($list as $item) { $startTime = $todyActive['active_date'] + ($item->getData('active_time') * 60 * 60); $endTime = $startTime + (1 * 60 * 60); - $data[] = [ - 'active_id' => $todyActive['active_id'], - 'active_time_id' => $item['active_time_id'], - 'active_time' => $item['active_time'], - 'start_time' => $this->onFormatTime($startTime), - 'end_time' => $this->onFormatTime($endTime), - 'count_down_time' => $this->onFormatTime($startTime), - 'status' => ActiveStatusEnum::STATE_SOON, - 'status_text' => '即将开抢', - 'status_text2' => '即将开抢', - 'sharp_modular_text' => "{$item['active_time']} 场预告", - ]; + if(strtotime(date('Y-m-d',$startTime))>strtotime(date("y-m-d",time()))){ + $data[] = [ + 'active_id' => $todyActive['active_id'], + 'active_time_id' => $item['active_time_id'], + 'active_time' => $item['active_time'], + 'start_time' => $this->onFormatTime($startTime), + 'end_time' => $this->onFormatTime($endTime), + 'count_down_time' => $this->onFormatTime($startTime), + 'status' => ActiveStatusEnum::STATE_NOTICE, + 'status_text' => '明日预告', + 'status_text2' => $this->onFormatTime($startTime) . ' 开始', + 'sharp_modular_text' => $this->onFormatTime($startTime) . ' 开始', + ]; + }else{ + $data[] = [ + 'active_id' => $todyActive['active_id'], + 'active_time_id' => $item['active_time_id'], + 'active_time' => $item['active_time'], + 'start_time' => $this->onFormatTime($startTime), + 'end_time' => $this->onFormatTime($endTime), + 'count_down_time' => $this->onFormatTime($startTime), + 'status' => ActiveStatusEnum::STATE_SOON, + 'status_text' => '即将开抢', + 'status_text2' => '即将开抢', + 'sharp_modular_text' => "{$item['active_time']} 场预告", + ]; + } + + } return $data; } @@ -401,7 +424,7 @@ class Active extends BaseService 'end_time' => $this->onFormatTime($endTime), 'count_down_time' => $this->onFormatTime($startTime), 'status' => ActiveStatusEnum::STATE_NOTICE, - 'status_text' => '预告', + 'status_text' => '明日预告', 'status_text2' => $this->onFormatTime($startTime) . ' 开始', 'sharp_modular_text' => $this->onFormatTime($startTime) . ' 开始', ]; @@ -416,4 +439,4 @@ class Active extends BaseService { return date('Y-m-d H:i', $timeStamp); } -} \ No newline at end of file +}