這篇文章主要介紹了Android中微信單圖文、多圖文推送、列表中排序的示例分析,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

成都創(chuàng)新互聯(lián)是一家朝氣蓬勃的網(wǎng)站建設(shè)公司。公司專注于為企業(yè)提供信息化建設(shè)解決方案。從事網(wǎng)站開發(fā),網(wǎng)站制作,網(wǎng)站設(shè)計,網(wǎng)站模板,微信公眾號開發(fā),軟件開發(fā),微信平臺小程序開發(fā),十余年建站對成都建筑動畫等多個行業(yè),擁有豐富的營銷推廣經(jīng)驗。
<?php
/**
* @author yinhuiying(改于)
* @since version - 2014-10-31
* @deprecated version - 2014-10-31
* 騰訊客服接口
*/
class ServiceModel extends Model{
/**
* 客服接口(高級接口)
* @param int $uid
* @param String openid 微信唯一標(biāo)識
* @param String array 回復(fù)數(shù)組內(nèi)容
* @param int type 類型 1表示文字回復(fù) 2表示圖文回復(fù)
* */
public function Service($openid,$array,$type){
switch($type){
case 1: $json = '{
"touser":"'.strval($openid).'",
"msgtype":"text",
"text":
{
"content":"'.$array['content'].'"
}
}';
$this->postService($json);
break;
case 2: $json = '{
"touser":"OPENID",
"msgtype":"image",
"image":
{
"media_id":"MEDIA_ID"
}
}';
$this->postService($json);
break;
case 3: $json = '{
"touser":"OPENID",
"msgtype":"voice",
"voice":
{
"media_id":"MEDIA_ID"
}
}';
$this->postService($json);
break;
case 4: $json = '{
"touser":"OPENID",
"msgtype":"video",
"video":
{
"media_id":"MEDIA_ID",
"title":"TITLE",
"description":"DESCRIPTION"
}
}';
$this->postService($json);
break;
case 5: $json = '{
"touser":"OPENID",
"msgtype":"music",
"music":
{
"title":"MUSIC_TITLE",
"description":"MUSIC_DESCRIPTION",
"musicurl":"MUSIC_URL",
"hqmusicurl":"HQ_MUSIC_URL",
"thumb_media_id":"THUMB_MEDIA_ID"
}
}';
$this->postService($json);
break;
case 6: $json = '{
"touser":"OPENID",
"msgtype":"news",
"news":{
"articles": [
{
"title":"'.$array['title1'].'",
"description":"'.$array['description1'].'",
"url":"'.$array['url1'].'",
"picurl":"'.$array['picurl1'].'"
},
{
"title":"'.$array['title2'].'",
"description":"'.$array['description2'].'",
"url":"'.$array['url2'].'",
"picurl":"'.$array['picurl2'].'"
},
{
"title":"'.$array['title3'].'",
"description":"'.$array['description3'].'",
"url":"'.$array['url3'].'",
"picurl":"'.$array['picurl3'].'"
}
]
}
}';
$this->postService($json);
break;
}
}
public function postService($json){
$access_token = model('WeixinInterface')->getACCESS_TOKEN(330);
//Log :: write("客服接口獲得的accessToken是".$access_token, log :: INFO);
$url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token='.$access_token;
model('WeixinInterface')->getHttpResponsePOST($url,$json);
}
}
?>
---------------或者---------------------
MODEL中
public function Service($uid,$json){
self::$wxInterFace = M('WXInterFace','wxmenu');
$access_token = $this->getACCESS_TOKEN($uid);
$url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token='.$access_token;
$this->getHttpResponsePOST($url,$json);
}
在ACTION中
//圖文回復(fù)
public function msgReturn(){
$json = '{
"touser":"'.strval($_SESSION['oauthopenid']).'",
"msgtype":"news",
"news":{
"articles": [
{
"title":"大華雙十一購房狂歡節(jié),團(tuán)購優(yōu)惠等你來!",
"description":"",
"url":"http://dc.exweixin.com/index.php?app=Dhcheap&mod=Index&act=index&aid=11",
"picurl":"/upload/otherpic76/15126.jpg"
},
{
"title":"一口價房源再享折上折",
"description":"",
"url":"http://dc.exweixin.com/index.php?app=RedPacket&mod=Coupon&act=welcome&uid=330",
"picurl":"/upload/otherpic76/15170.jpg"
},
{
"title":"我要搶紅包",
"description":"",
"url":"http://dc.exweixin.com/index.php?app=redPacket&mod=Welcome&act=welcome&uid=330",
"picurl":"/upload/otherpic76/15176.jpg"
},
{
"title":"土豪排行榜",
"description":"",
"url":"http://dc.exweixin.com/index.php?app=RedPacket&mod=Index&act=ranking",
"picurl":"/upload/otherpic76/15185.jpg"
},
{
"title":"我的錢包",
"description":"",
"url":"http://dc.exweixin.com/index.php?app=RedPacket&mod=Index&act=person&openid='.strval($_SESSION['oauthopenid']).'",
"picurl":"/upload/otherpic76/15210.jpg"
}
]
}
}';
//調(diào)用客服接口
$uid=330;
M('CustomService','wxmenu')->Service($uid,$json);
}
//----------------------------------//
列表中排序、效果
1、
2、
3、
代碼
<li class="count">{$i+$n}</li>感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“Android中微信單圖文、多圖文推送、列表中排序的示例分析”這篇文章對大家有幫助,同時也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識等著你來學(xué)習(xí)!
標(biāo)題名稱:Android中微信單圖文、多圖文推送、列表中排序的示例分析
瀏覽地址:http://chinadenli.net/article32/phossc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、網(wǎng)站設(shè)計、網(wǎng)站制作、響應(yīng)式網(wǎng)站、網(wǎng)站維護(hù)、
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)