You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UserWechatuserServices.php 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. declare (strict_types=1);
  3. namespace app\services\user;
  4. use app\services\BaseServices;
  5. use app\dao\user\UserWechatUserDao;
  6. /**
  7. * Class UserWechatuserServices
  8. * @package app\services\user
  9. * @method getSex($time, $userType) 获取用户性别统计
  10. * @method getRegionNew($time, $userType) 地域新增用户统计
  11. * @method getRegionAll($time, $userType) 地域全部用户统计
  12. */
  13. class UserWechatuserServices extends BaseServices
  14. {
  15. /**
  16. * UserWechatuserServices constructor.
  17. * @param UserWechatUserDao $dao
  18. */
  19. public function __construct(UserWechatUserDao $dao)
  20. {
  21. $this->dao = $dao;
  22. }
  23. /**
  24. * 自定义简单查询总数
  25. * @param array $where
  26. * @return int
  27. */
  28. public function getCount(array $where): int
  29. {
  30. return $this->dao->getCount($where);
  31. }
  32. /**
  33. * 复杂条件搜索列表
  34. * @param array $where
  35. * @param string $field
  36. * @return array
  37. */
  38. public function getWhereUserList(array $where, string $field): array
  39. {
  40. [$page, $limit] = $this->getPageValue();
  41. $order_string = '';
  42. $order_arr = ['asc', 'desc'];
  43. if (isset($where['now_money']) && in_array($where['now_money'], $order_arr)) {
  44. $order_string = 'now_money ' . $where['now_money'];
  45. }
  46. $list = $this->dao->getListByModel($where, $field, $order_string, $page, $limit);
  47. $count = $this->dao->getCountByWhere($where);
  48. return [$list, $count];
  49. }
  50. }