32 lines
756 B
PHP
Executable File
32 lines
756 B
PHP
Executable File
<?php
|
|
|
|
namespace app\model;
|
|
|
|
/**
|
|
* 活动
|
|
* Class Activity
|
|
* @package app\model
|
|
*/
|
|
class Activity extends Base
|
|
{
|
|
// 是否有正在进行中的活动
|
|
public static function hasCurrent(): bool
|
|
{
|
|
$now = date('Y-m-d');
|
|
return self::where('is_current', 1)
|
|
->where('begin_at', '<=', $now)
|
|
->where('end_at', '>=', $now)
|
|
->count() > 0;
|
|
}
|
|
|
|
// 指定活动是否是正在进行中的活动
|
|
public static function isCurrent(int $id): bool
|
|
{
|
|
$now = date('Y-m-d');
|
|
return self::where('is_current', 1)
|
|
->where('id', $id)
|
|
->where('begin_at', '<=', $now)
|
|
->where('end_at', '>=', $now)
|
|
->count() > 0;
|
|
}
|
|
} |