Skip to content

Commit

Permalink
添加订阅号每日群发功能 文本、图文接口 merge from issue dodgepudding#77
Browse files Browse the repository at this point in the history
  • Loading branch information
dodgepudding committed Mar 18, 2014
1 parent 28b931b commit aab3d7d
Show file tree
Hide file tree
Showing 6 changed files with 779 additions and 729 deletions.
4 changes: 2 additions & 2 deletions Thinkphp/Wechat.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,13 +470,13 @@ public function music($title,$desc,$musicurl,$hgmusicurl='') {
* @param array $newsData
* 数组结构:
* array(
* [0]=>array(
* "0"=>array(
* 'Title'=>'msg title',
* 'Description'=>'summary text',
* 'PicUrl'=>'http://www.domain.com/1.jpg',
* 'Url'=>'http://www.domain.com/1.html'
* ),
* [1]=>....
* "1"=>....
* )
*/
public function news($newsData=array())
Expand Down
64 changes: 64 additions & 0 deletions Thinkphp/Wechatext.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,70 @@ public function send($id,$content)
return $send_snoopy->results;
}

/**
* 群发功能 纯文本
* @param string $content
* @return string
*/
public function mass($content) {
$send_snoopy = new Snoopy;
$post = array();
$post['type'] = 1;
$post['token'] = $this->_token;
$post['content'] = $content;
$post['ajax'] = 1;
$post['city']='';
$post['country']='';
$post['f']='json';
$post['groupid']='-1';
$post['imgcode']='';
$post['lang']='zh_CN';
$post['province']='';
$post['random']= rand(0, 1);
$post['sex']=0;
$post['synctxnews']=0;
$post['synctxweibo']=0;
$post['t']='ajax-response';
$send_snoopy->referer = "https://mp.weixin.qq.com/cgi-bin/masssendpage?t=mass/send&token={$this->_token}&lang=zh_CN";
$send_snoopy->rawheaders['Cookie']= $this->cookie;
$submit = "https://mp.weixin.qq.com/cgi-bin/masssend";
$send_snoopy->submit($submit,$post);
$this->log($send_snoopy->results);
return $send_snoopy->results;
}

/**
* 群发功能 图文素材
* @param int $appmsgid 图文素材ID
* @return string
*/
function massNews($appmsgid){
$send_snoopy = new Snoopy;
$post = array();
$post['type'] = 10;
$post['token'] = $this->_token;
$post['appmsgid'] = $appmsgid;
$post['ajax'] = 1;
$post['city']='';
$post['country']='';
$post['f']='json';
$post['groupid']='-1';
$post['imgcode']='';
$post['lang']='zh_CN';
$post['province']='';
$post['random']= rand(0, 1);
$post['sex']=0;
$post['synctxnews']=0;
$post['synctxweibo']=0;
$post['t']='ajax-response';
$send_snoopy->referer = "https://mp.weixin.qq.com/cgi-bin/masssendpage?t=mass/send&token={$this->_token}&lang=zh_CN";
$send_snoopy->rawheaders['Cookie']= $this->cookie;
$submit = "https://mp.weixin.qq.com/cgi-bin/masssend";
$send_snoopy->submit($submit,$post);
$this->log($send_snoopy->results);
return $send_snoopy->results;
}

/**
* 获取用户列表列表
* @param $page 页码(从0开始)
Expand Down
7 changes: 0 additions & 7 deletions nbproject/project.properties

This file was deleted.

9 changes: 0 additions & 9 deletions nbproject/project.xml

This file was deleted.

6 changes: 4 additions & 2 deletions wechat.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,13 +462,13 @@ public function music($title,$desc,$musicurl,$hgmusicurl='') {
* @param array $newsData
* 数组结构:
* array(
* [0]=>array(
* "0"=>array(
* 'Title'=>'msg title',
* 'Description'=>'summary text',
* 'PicUrl'=>'http://www.domain.com/1.jpg',
* 'Url'=>'http://www.domain.com/1.html'
* ),
* [1]=>....
* "1"=>....
* )
*/
public function news($newsData=array())
Expand Down Expand Up @@ -1030,4 +1030,6 @@ public function getOauthUserinfo($access_token,$openid){
}
return false;
}


}
Loading

0 comments on commit aab3d7d

Please sign in to comment.