es
wmc 7 months ago
parent 4b172f54ac
commit c0cae0d03d
  1. 2
      app/api/model/sharp/ActiveTime.php
  2. 37
      app/api/service/sharp/Active.php

@ -81,6 +81,6 @@ class ActiveTime extends ActiveTimeModel
return $this->where('active_id', '=', $activeId) return $this->where('active_id', '=', $activeId)
->where('status', '=', 1) ->where('status', '=', 1)
->order(['active_time' => 'asc']) ->order(['active_time' => 'asc'])
->find(); ->select();
} }
} }

@ -306,13 +306,9 @@ class Active extends BaseService
// 获取即将开始的活动 // 获取即将开始的活动
$data = array_merge($data, $this->getSoonActive($todyActive)); $data = array_merge($data, $this->getSoonActive($todyActive));
} }
$tmoActive = $this->ActiveModel->gettmoActive();
if (!empty($tmoActive)) {
// 获取即将开始的活动
$data = array_merge($data, $this->getmingActive($tmoActive));
}
// 获取预告的活动 // 获取预告的活动
// $data[] = $this->getNoticeActive(); $data = array_merge($data, $this->getNoticeActive());
return array_values(array_filter($data)); return array_values(array_filter($data));
} }
@ -427,22 +423,39 @@ class Active extends BaseService
// 第一个时间点 // 第一个时间点
$model = $this->ActiveTimeModel->getRecentActiveTime($nextActive['active_id']); $model = $this->ActiveTimeModel->getRecentActiveTime($nextActive['active_id']);
if (empty($model)) return []; if (empty($model)) return [];
// 整理数据 // // 整理数据
$startTime = $nextActive['active_date'] + ($model->getData('active_time') * 60 * 60); // $startTime = $nextActive['active_date'] + ($model->getData('active_time') * 60 * 60);
// $endTime = $startTime + (1 * 60 * 60);
// return [
// 'active_id' => $nextActive['active_id'],
// 'active_time_id' => $model['active_time_id'],
// 'active_time' => $model['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) . ' 开始',
// ];
foreach ($model as $item) {
$startTime = $nextActive['active_date'] + ($item->getData('active_time') * 60 * 60);
$endTime = $startTime + (1 * 60 * 60); $endTime = $startTime + (1 * 60 * 60);
return [ $data[] = [
'active_id' => $nextActive['active_id'], 'active_id' => $nextActive['active_id'],
'active_time_id' => $model['active_time_id'], 'active_time_id' => $item['active_time_id'],
'active_time' => $model['active_time'], 'active_time' => $item['active_time'],
'start_time' => $this->onFormatTime($startTime), 'start_time' => $this->onFormatTime($startTime),
'end_time' => $this->onFormatTime($endTime), 'end_time' => $this->onFormatTime($endTime),
'count_down_time' => $this->onFormatTime($startTime), 'count_down_time' => $this->onFormatTime($startTime),
'status' => ActiveStatusEnum::STATE_NOTICE, 'status' => ActiveStatusEnum::STATE_NOTICE,
'status_text' => '预告', 'status_text' => '明日预告',
'status_text2' => $this->onFormatTime($startTime) . ' 开始', 'status_text2' => $this->onFormatTime($startTime) . ' 开始',
'sharp_modular_text' => $this->onFormatTime($startTime) . ' 开始', 'sharp_modular_text' => $this->onFormatTime($startTime) . ' 开始',
]; ];
} }
return $data;
}
/** /**
* 将时间戳格式化为日期时间 (精确到分钟) * 将时间戳格式化为日期时间 (精确到分钟)

Loading…
Cancel
Save