Formid.php 849 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. *
  4. * @copyright ©2020 点小铺
  5. * @author hanj
  6. * @link: https://dyuit.com
  7. * Created by VSCode
  8. */
  9. namespace app\store\model\wxapp;
  10. use app\common\model\wxapp\Formid as FormidModel;
  11. /**
  12. * form_id 模型
  13. * Class Formid
  14. * @package app\store\model\wxapp
  15. */
  16. class Formid extends FormidModel
  17. {
  18. /**
  19. * 获取活跃用户列表
  20. * @return \think\Paginator
  21. * @throws \think\exception\DbException
  22. */
  23. public function getUserList()
  24. {
  25. return $this->with(['user'])
  26. ->field(['user_id', 'count(id) AS total_formid'])
  27. ->where('is_used', '=', 0)
  28. ->where('expiry_time', '>', time())
  29. ->group('user_id')
  30. ->order(['total_formid' => 'desc'])
  31. ->paginate(15, false, [
  32. 'query' => request()->request()
  33. ]);
  34. }
  35. }