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

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

@ -306,13 +306,9 @@ class Active extends BaseService
// 获取即将开始的活动
$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));
}
@ -427,21 +423,38 @@ class Active extends BaseService
// 第一个时间点
$model = $this->ActiveTimeModel->getRecentActiveTime($nextActive['active_id']);
if (empty($model)) return [];
// 整理数据
$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) . ' 开始',
];
// // 整理数据
// $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);
$data[] = [
'active_id' => $nextActive['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) . ' 开始',
];
}
return $data;
}
/**

Loading…
Cancel
Save