实现代码

【TP5.1】根据天进行分组查询_php

$userCostRecord = $this->costRecordModel->field('sum(`cr_cost_money`) as cr_cost_money,cr_time')->order('cr_time desc')->group("DATE_FORMAT(FROM_UNIXTIME(cr_time),'%Y-%m-%d')")->select();

显示效果

【TP5.1】根据天进行分组查询_php_02