mysql相册_查询相册更加mysql 查询

4c5008e0ec58bc551040c27d1e65e72f.png

接到一个项目项目案例相册是这种结构

大佬建议

sql 查询 groip 进行时间统计今天

field根据mysql 时间查询进行统计 今天多少条 新增多少条相册 计算天数

$lists = Album::group("from_unixtime(create_time, '%Y-%m-%d')")

->field("from_unixtime(create_time, '%Y-%m-%d') as day,count(*) as count,from_unixtime(create_time, '%Y-%m') as month")

->order("aid desc")

->paginate();

返回数据

"code": "1",

"msg": "获取成功",

"data": [

{

"day": "2020-11-27",

"count": 3,

"month": "2020-11"

},

{

"day": "2020-11-25",

"count": 2,

"month": "2020-11"

}

],

"time": 1606447964,

"user": "",

"page": {

"total": 2,

"lastPage": 1,

"currentPage": 1,

"listRows": 15

}

借鉴 https://blog.csdn.net/kl28978113/article/details/82387432

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值