1234567891011121314151617181920212223242526272829 |
- <?php
- namespace app\common\model;
- use think\Model;
- class Feedback extends Model
- {
- protected $autoWriteTimestamp = 'int';
- // 创建时间字段
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- /**
- * 获取本月数据
- */
- public function getMonthNum($userId=0)
- {
- $dateStart = date('Y-m-01');
- $monthStart = strtotime($dateStart);
- $monthEnd = strtotime($dateStart . '+1 month');//月末时间戳
- $where['user_id'] = $userId;
- $where['createtime'] = ['egt',$monthStart];
- $where['createtime'] = ['lt', $monthEnd];
- $count = $this->where($where)->count();
- return $count;
- }
- }
|