mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-22 03:32:47 +08:00
29 lines
660 B
PHP
29 lines
660 B
PHP
<?php
|
|
|
|
namespace App\Repos;
|
|
|
|
use App\Models\Online as OnlineModel;
|
|
use Phalcon\Mvc\Model\Resultset;
|
|
use Phalcon\Mvc\Model\ResultsetInterface;
|
|
|
|
class Online extends Repository
|
|
{
|
|
|
|
/**
|
|
* @param int $userId
|
|
* @param string $activeDate
|
|
* @return ResultsetInterface|Resultset|OnlineModel[]
|
|
*/
|
|
public function findByUserDate($userId, $activeDate)
|
|
{
|
|
$startTime = strtotime($activeDate);
|
|
|
|
$endTime = $startTime + 86400;
|
|
|
|
return OnlineModel::query()
|
|
->where('user_id = :user_id:', ['user_id' => $userId])
|
|
->betweenWhere('active_time', $startTime, $endTime)
|
|
->execute();
|
|
}
|
|
|
|
} |