app
public function getSustainedDays($accountId)
{
$list = $this->getMotionDates($accountId);
$times = 0;
if ($list) {
$i = 0;
$j = 0;
$dates = strtotime(date("Y-m-d",$list[0]["entry_time"]));
foreach ($list as $k => $v){
if (strtotime(date("Y-m-d",$v["entry_time"])) == ($dates - 24*60*60*$j)) {
$iPP;
$jPP;
} else {
if ($i > $times) $times = $i;
$i = 1;
$j = 0;
if ($k+1 < count($list)) $dates = strtotime(date("Y-m-d",$list[$k+1]["entry_time"]));
}
}
if ($i > $times) $times = $i;
}
return $times;
}
public function getMotionDates($accountId)
{
$entryRecord = EntryRecord::find()
->alias("er")
->joinWith(["members m"], FALSE)
->where(["m.member_account_id" => $accountId])
->select("er.entry_time")
->groupBy(["DATE_FORMAT(from_unixtime(er.entry_time),"%Y-%m-%d")"])
->orderBy("er.entry_time desc")
->asArray()
->all();
return $entryRecord;
}
2