コード例 #1
0
ファイル: Broadcast.php プロジェクト: stoneworld/wechat
 /**
  * 消息群发
  * @param  string|array $user    指定用户群
  * @param  string|array $toParty 指定部门
  * @param  string|array $toTag   指定标签 
  * @return 
  */
 public function to($user = '******', $toParty = null, $toTag = null)
 {
     if (empty($this->message)) {
         throw new Exception('未设置要发送的消息');
     }
     $this->message->agentid = $this->agentid;
     $this->message->touser = is_array($user) ? implode('|', $user) : $user;
     $this->message->toparty = is_array($toParty) ? implode('|', $toParty) : $toParty;
     $this->message->totag = is_array($toTag) ? implode('|', $toTag) : $toTag;
     return $this->http->jsonPost(self::API_SEND_MESSAGE, $this->message->buildForBroadcast());
 }
コード例 #2
0
ファイル: Menu.php プロジェクト: stoneworld/wechat
 /**
  * 设置菜单
  *
  * @return bool
  */
 public function set($agentId, $menus)
 {
     $menus = $this->extractMenus($menus);
     $this->http->jsonPost(self::API_CREATE . '?agentid=' . $agentId, array('button' => $menus));
     return true;
 }
コード例 #3
0
ファイル: Media.php プロジェクト: stoneworld/wechat
 /**
  * 上传图文消息内的图片
  * @param  string $filename 图片路径
  * @return string
  */
 public function uploadImg($filename)
 {
     $options = array('files' => array('media' => $filename));
     $response = $this->http->jsonPost(self::API_UPLOAD_IMG, $params = array(), $options);
     return $response['url'];
 }
コード例 #4
0
ファイル: Auth.php プロジェクト: stoneworld/wechat
 /**
  * userid转换成openid接口
  * @param  string $userId  userid
  * @param  int    $agentId 应用id
  * @return array
  */
 public function toOpenId($userId, $agentId)
 {
     $params = array('userid' => $userId, 'agentid' => $agentId);
     return $this->http->jsonPost(self::API_TO_OPENID, $params);
 }
コード例 #5
0
ファイル: User.php プロジェクト: stoneworld/wechat
 /**
  * 批量删除成员
  *
  * @param array $UserID
  * @param int   $groupId
  *
  * @return bool
  */
 public function batchDelete(array $UserID)
 {
     $params = array('useridlist' => $UserID);
     return $this->http->jsonPost(self::API_BATCH_DELETE, $params);
 }