UserWechatuserServices.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. use think\facade\Log;
  16. /**
  17. *
  18. * Class UserWechatuserServices
  19. * @package app\services\user
  20. */
  21. class UserWechatuserServices extends BaseServices
  22. {
  23. /**
  24. * UserWechatuserServices constructor.
  25. * @param UserWechatUserDao $dao
  26. */
  27. public function __construct(UserWechatUserDao $dao)
  28. {
  29. $this->dao = $dao;
  30. }
  31. /**
  32. * 自定义简单查询总数
  33. * @param array $where
  34. * @return int
  35. */
  36. public function getCount(array $where): int
  37. {
  38. return $this->dao->getCount($where);
  39. }
  40. /**
  41. * 复杂条件搜索列表
  42. * @param array $where
  43. * @param string $field
  44. * @return array
  45. */
  46. public function getWhereUserList(array $where, string $field): array
  47. {
  48. [$page, $limit] = $this->getPageValue();
  49. $order_string = '';
  50. $order_arr = ['ascending', 'descending'];
  51. if (isset($where['now_money']) && in_array($where['now_money'], $order_arr)) {
  52. $order_string = $where['now_money'] == 'ascending' ? 'now_money asc' : 'now_money desc';
  53. }
  54. if (isset($where['score_sort']) && $where['score_sort']) {
  55. $order_string = ' integral desc ';
  56. }
  57. Log::error(1222211);
  58. Log::error($order_string);
  59. $list = $this->dao->getListByModel($where, $field, $order_string, $page, $limit);
  60. $count = $this->dao->getCountByWhere($where);
  61. return [$list, $count];
  62. }
  63. public function getUserByUnionId($unionid)
  64. {
  65. return $this->dao->getUserByUnionId($unionid);
  66. }
  67. public function getUserByUid($uid)
  68. {
  69. return $this->dao->getUserByUid($uid);
  70. }
  71. }