Android中微信单图文、多图文推送、列表中排序的示例分析

这篇文章主要介绍了Android中微信单图文、多图文推送、列表中排序的示例分析,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

成都创新互联是一家朝气蓬勃的网站建设公司。公司专注于为企业提供信息化建设解决方案。从事网站开发,网站制作,网站设计,网站模板,微信公众号开发,软件开发,微信平台小程序开发,十余年建站对成都建筑动画等多个行业,拥有丰富的营销推广经验。

<?php

/**

* @author yinhuiying(改于)

* @since version - 2014-10-31

* @deprecated version - 2014-10-31

* 腾讯客服接口

*/

class ServiceModel extends Model{



/**

* 客服接口(高级接口)

* @param int $uid

* @param String openid 微信唯一标识

* @param String array 回复数组内容

* @param int type 类型 1表示文字回复 2表示图文回复

* */

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中 

//图文回复

public function msgReturn(){

$json = '{

"touser":"'.strval($_SESSION['oauthopenid']).'",

"msgtype":"news",

"news":{

"articles": [

{

"title":"大华双十一购房狂欢节,团购优惠等你来!",

"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"

}

]

}

}';



//调用客服接口

$uid=330;

M('CustomService','wxmenu')->Service($uid,$json);

}

//----------------------------------//

列表中排序、效果

1、

2、

3、

代码

<li class="count">{$i+$n}</li>

感谢你能够认真阅读完这篇文章,希望小编分享的“Android中微信单图文、多图文推送、列表中排序的示例分析”这篇文章对大家有帮助,同时也希望大家多多支持创新互联,关注创新互联行业资讯频道,更多相关知识等着你来学习!

标题名称:Android中微信单图文、多图文推送、列表中排序的示例分析
浏览地址:https://www.cdcxhl.com/article32/phossc.html

成都网站建设公司_创新互联,为您提供网站收录网站设计网站制作响应式网站网站维护

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都网站建设