看了5-6天tp5视频动手毕业设计,今天遇到一个问题.
现在业务需求是查询当月数据,按照create_time数据分组.
希望得到如下数据格式
return [
[{
"id": 24,
"type": 1,
"mark": "",
"delete_time": null,
"create_time": "2021-01-16 00:00:00",
"update_time": "2021-01-16 18:26:00",
"total": 85,
"categoryID": 1,
"user_id": 3,
"asset_id": 0
}],
[{
"id": 38,
"type": 0,
"mark": "",
"delete_time": null,
"create_time": "2021-01-19 00:00:00",
"update_time": "2021-01-19 23:02:56",
"total": 89,
"categoryID": 6,
"user_id": 3,
"asset_id": 5
},
{
"id": 37,
"type": 0,
"mark": "口红",
"delete_time": null,
"create_time": "2021-01-19 00:00:00",
"update_time": "2021-01-19 23:02:02",
"total": 48,
"categoryID": 3,
"user_id": 3,
"asset_id": 0
},
{
"id": 36,
"type": 0,
"mark": "",
"delete_time": null,
"create_time": "2021-01-19 00:00:00",
"update_time": "2021-01-19 23:01:09",
"total": 58,
"categoryID": 1,
"user_id": 3,
"asset_id": 0
}
]
];
数据库的字段如下,还望大佬指点下,该如何实现此需求
|