1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-24 20:06:09 +08:00
koogua 6cd3fb6d6c !2 后台运营统计合并
* 修复hash中前一日统计没有更新的问题
* 增加后台运营统计
2020-10-08 10:07:49 +08:00

30 lines
632 B
PHP

<?php
namespace App\Repos;
use App\Models\Online as OnlineModel;
use Phalcon\Mvc\Model;
class Online extends Repository
{
/**
* @param int $userId
* @param string $activeDate
* @return OnlineModel|Model|bool
*/
public function findByUserDate($userId, $activeDate)
{
$activeTime = strtotime($activeDate);
return OnlineModel::findFirst([
'conditions' => 'user_id = ?1 AND active_time BETWEEN ?2 AND ?3',
'bind' => [
1 => $userId,
2 => $activeTime,
3 => $activeTime + 86400,
],
]);
}
}