Commit bfd6511e authored by pengfei's avatar pengfei

update 团长分销-增加获取活动时间范围方法

parent 35ac8468
......@@ -10,6 +10,9 @@ use App\Models\marketing\mysql\ColonelDistributorConfig;
class PindanActivityColonelConfigService
{
// 活动默认时间范围点
const ACTIVITY_DEFAULT_HOUR = 12;
/**
* 编辑团长分销活动配置
* @param array $params
......@@ -127,4 +130,26 @@ class PindanActivityColonelConfigService
}
return ["number" => $num, 'list' => $configList];
}
/**
* Notes: 获取活动时间范围
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 2:50 下午
* @return string[]
*/
public static function getActivityTimeRange() : array
{
// 获取活动时间范围 例如活动时间(2021-09-03) --- 2021-09-03:12:00:00 - 2021-09-04:12:00:00
$hour = ' '.self::ACTIVITY_DEFAULT_HOUR . ":00:00";
if (date("H") >= 12) {
$startTime = date("Y-m-d").$hour;
$endTime = date("Y-m-d", strtotime("+1 day")).$hour;
} else {
$startTime = date("Y-m-d", strtotime("-1 day")).$hour;
$endTime = date("Y-m-d").$hour;
}
return ['start_time' => $startTime,'end_time' => $endTime];
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment