UserWechatuserServices.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\services\user;
  13. use app\services\BaseServices;
  14. use app\dao\user\UserWechatUserDao;
  15. /**
  16. *
  17. * Class UserWechatuserServices
  18. * @package app\services\user
  19. */
  20. class UserWechatuserServices extends BaseServices
  21. {
  22. /**
  23. * UserWechatuserServices constructor.
  24. * @param UserWechatUserDao $dao
  25. */
  26. public function __construct(UserWechatUserDao $dao)
  27. {
  28. $this->dao = $dao;
  29. }
  30. /**
  31. * 自定义简单查询总数
  32. * @param array $where
  33. * @return int
  34. */
  35. public function getCount(array $where): int
  36. {
  37. return $this->dao->getCount($where);
  38. }
  39. /**
  40. * 复杂条件搜索列表
  41. * @param array $where
  42. * @param string $field
  43. * @return array
  44. */
  45. public function getWhereUserList(array $where, string $field): array
  46. {
  47. [$page, $limit] = $this->getPageValue();
  48. $order_string = '';
  49. $order_arr = ['asc', 'desc'];
  50. if (isset($where['now_money']) && in_array($where['now_money'], $order_arr)) {
  51. $order_string = 'now_money ' . $where['now_money'];
  52. }
  53. $list = $this->dao->getListByModel($where, $field, $order_string, $page, $limit);
  54. $count = $this->dao->getCountByWhere($where);
  55. return [$list, $count];
  56. }
  57. }