WorkClientFollowServices.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\services\work;
  12. use app\dao\work\WorkClientFollowDao;
  13. use app\services\BaseServices;
  14. use crmeb\traits\ServicesTrait;
  15. /**
  16. * 企业微信客户跟踪
  17. * Class WorkClientFollowServices
  18. * @package app\services\work
  19. * @mixin WorkClientFollowDao
  20. */
  21. class WorkClientFollowServices extends BaseServices
  22. {
  23. use ServicesTrait;
  24. /**
  25. * WorkClientFollowServices constructor.
  26. * @param WorkClientFollowDao $dao
  27. */
  28. public function __construct(WorkClientFollowDao $dao)
  29. {
  30. $this->dao = $dao;
  31. }
  32. /**
  33. * 获取扫描渠道码添加的客户列表
  34. * @param int $channelId
  35. * @param string $name
  36. * @return array
  37. */
  38. public function getChannelCodeClientList(int $channelId, string $name = '')
  39. {
  40. [$page, $limit] = $this->getPageValue();
  41. $where = ['state' => 'channelCode-' . $channelId, 'user_name' => $name, 'is_del_user' => 0];
  42. $list = $this->dao->getDataList($where, ['create_time', 'client_id'], $page, $limit, 'create_time', ['client' => function ($query) {
  43. $query->field(['id', 'name', 'avatar']);
  44. }]);
  45. $count = $this->dao->count($where);
  46. return compact('list', 'count');
  47. }
  48. }