123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php namespace App\Servers\WechatWork;
- /**
- * 获取配置了客户联系功能的成员列表
- *
- */
- class ExternalContact extends Work
- {
- /**
- * 获取配置了客户联系功能的成员列表
- *
- *
- */
- public function getFollowUsers(){
- // 获取部门列表
- $result = $this->work->external_contact->getFollowUsers();
- // 返回列表
- if( $result['errcode'] == 0 ) return $result['follow_user'];
- // 如果请求失败,返回空数据
- return [];
- }
- /**
- * 批量获取客户详情
- *
- * @param array $userIdList 接待成员ID列表
- * @param string $cursor 分页游标
- * @param int $limit 每页数量
- *
- */
- public function batchGetByUser($userIdList,$cursor,$limit=100) {
- // 获取部门列表
- $result = $this->work->external_contact->batchGetByUser($userIdList, $cursor, $limit);
- // 返回列表
- if( $result['errcode'] == 0 ) return ['external_contact_list'=>$result['external_contact_list'], 'next_cursor'=> empty($result['next_cursor']) ? '' : $result['next_cursor']];
- // 如果请求失败,返回空数据
- return [];
- }
-
- /**
- * 获取详情
- *
- * @param string $extUserid 外部联系人ID
- *
- */
- public function getOne($extUserid){
- // 获取部门列表
- $result = $this->work->external_contact->get($extUserid);
- // 返回列表
- if( $result['errcode'] == 0 ) return ['external_contact'=>$result['external_contact'],'follow_user'=>$result['follow_user']];
- // 如果请求失败,返回空数据
- return [];
- }
- /**
- * 发送欢迎语
- *
- * @param string $welcomeCode 欢迎语code
- * @param array $msg 欢迎语code
- *
- */
- public function sendWelcome($welcomeCode, $msg){
- // 获取部门列表
- $result = $this->work->external_contact_message->sendWelcome($welcomeCode, $msg);
- // 返回列表
- if( $result['errcode'] == 0 ) return true;
- // 如果请求失败,返回空数据
- return false;
- }
- /**
- * 修改备注信息
- *
- * @param string $extUserid 外部联系人ID
- * @param string $userid 跟进人ID
- * @param array $data 要修改的信息
- *
- */
- public function remark($extUserid, $userid,$data=[]){
- // 修改信息
- $data['external_userid'] = $extUserid;
- $data['userid'] = $userid;
- // 获取部门列表
- $result = $this->work->external_contact->remark($data);
- // 返回列表
- if( $result['errcode'] == 0 ) return true;
- // 如果请求失败,返回空数据
- return false;
- }
- }
|