Feedback.php 703 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class Feedback extends Model
  5. {
  6. protected $autoWriteTimestamp = 'int';
  7. // 创建时间字段
  8. protected $createTime = 'createtime';
  9. protected $updateTime = 'updatetime';
  10. /**
  11. * 获取本月数据
  12. */
  13. public function getMonthNum($userId=0)
  14. {
  15. $dateStart = date('Y-m-01');
  16. $monthStart = strtotime($dateStart);
  17. $monthEnd = strtotime($dateStart . '+1 month');//月末时间戳
  18. $where['user_id'] = $userId;
  19. $where['createtime'] = ['egt',$monthStart];
  20. $where['createtime'] = ['lt', $monthEnd];
  21. $count = $this->where($where)->count();
  22. return $count;
  23. }
  24. }