查询七日内活跃用户数
~~~
<?php
namespace app\index\model;
use app\common\model\RemoteModel;
use think\Db;
use think\Log;
class DCharacter extends RemoteModel
{
/**
* 等级活跃角色ID计算
*
* @param int $level 等级
* @return int 等级流失人数
*/
public function doLevelCountActive($level, $active_days_scope)
{
$map['datediff(now(),lastonlogintime)'] = array('elt', 7);
$map['level'] = $level;
$count = self::where($map)->count();
return $count;
}
~~~