123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <?php namespace App\Servers\WechatWork;
- /**
- * 联系方式 联系我
- *
- */
- class ContactWay extends Work {
- /**
- * 获取列表
- *
- * @param string $cursor 分页查询使用的游标,为上次请求返回的 next_cursor
- * @param int $limit 每页条数
- */
- public function getList($cursor,$limit=10){
- // 获取部门列表
- $result = $this->work->contact_way->list($cursor,$limit);
- // 返回列表
- if( $result['errcode'] == 0 ) return ['contact_way'=>$result['contact_way'],'next_cursor'=>empty($result['next_cursor'])?'':$result['next_cursor']];
- // 如果请求失败,返回空数据
- return ['contact_way'=>[],'next_cursor'=>''];
- }
- /**
- * 获取详情
- *
- * @param string $configId 配置ID
- *
- */
- public function getOne($configId){
- // 获取部门列表
- $result = $this->work->contact_way->get($configId);
- // 返回列表
- if( $result['errcode'] == 0 ) return $result['contact_way'];
- // 如果请求失败,返回空数据
- return [];
- }
- /**
- * 添加
- *
- * @param int $type 联系方式类型,1-单人, 2-多人
- * @param int $scene 场景,1-在小程序中联系,2-通过二维码联系
- * @param array $config 配置信息
- * array party 使用该联系方式的部门id列表,只在type为2时有效
- * array user 使用该联系方式的用户userID列表,在type为1时为必填,且只能有一个
- * bool skip_verify 外部客户添加时是否无需验证,默认为true
- * string remark 联系方式的备注信息,用于助记,不超过30个字符
- * string state 企业自定义的state参数,用于区分不同的添加渠道 不超过30个字符
- */
- public function add($config,$type=2,$scene=2){
- // 获取部门列表
- $result = $this->work->contact_way->create($type,$scene,$config);
- // 返回列表
- if( $result['errcode'] == 0 ) return ['config_id'=>$result['config_id'],'qr_code'=>(empty($result['qr_code'])?'':$result['qr_code'])];
- // 如果请求失败,返回空数据
- return [];
- }
- /**
- * 修改
- *
- * @param string $configId 配置ID
- * @param array $config 配置信息
- * array party 使用该联系方式的部门id列表,只在type为2时有效
- * array user 使用该联系方式的用户userID列表,在type为1时为必填,且只能有一个
- * bool skip_verify 外部客户添加时是否无需验证,默认为true
- * string remark 联系方式的备注信息,用于助记,不超过30个字符
- * string state 企业自定义的state参数,用于区分不同的添加渠道 不超过30个字符
- *
- */
- public function edit($configId,$config){
- // 获取部门列表
- $result = $this->work->contact_way->update($configId,$config);
- // 返回列表
- if( $result['errcode'] == 0 ) return $configId;
- // 如果请求失败,返回空数据
- return '';
- }
- /**
- * 删除
- *
- * @param string $configId 配置ID
- *
- */
- public function del($configId){
- // 获取部门列表
- $result = $this->work->contact_way->delete($configId);
- // 返回列表
- if( $result['errcode'] == 0 ) return $configId;
- // 如果请求失败,返回空数据
- return '';
- }
- }
|