国产激情综合,欧美香蕉视频,国产成人免费精品,久久激情中文

快消品貨源批發市場
快消品貨源分銷平臺
 
 
當前位置: 貨源批發網 » 網商學院 » 網店推廣 » 營銷技巧 » 微信營銷 » destoon微信接口代碼

destoon微信接口代碼

放大字體  縮小字體 發布日期:2025-10-28 06:42:09  來源:電商聯盟  作者:樂發網  瀏覽次數:284

<?php

class Wechat
{
const MSGTYPE_TEXT = 'text';
const MSGTYPE_IMAGE = 'image';
const MSGTYPE_LOCATION = 'location';
const MSGTYPE_link = 'link';
const MSGTYPE_EVENT = 'event';
const MSGTYPE_MUSIC = 'music';
const MSGTYPE_NEWS = 'news';
const MSGTYPE_VOICE = 'voice';
const MSGTYPE_VIDEO = 'video';
const API_URL_PREFIX = 'https://api.weixin.qq.com/cgi-bin';
const AUTH_URL = '/token?grant_type=client_credential&';
const MENU_CREATE_URL = '/menu/create?';
const MENU_GET_URL = '/menu/get?';
const MENU_DELETE_URL = '/menu/delete?';
const MEDIA_GET_URL = '/media/get?';

private $token;
private $appid;
private $appsecret;
private $access_token;
private $_msg;
private $_funcflag = false;
private $_receive;
public $debug = false;
public $errCode = 40001;
public $errMsg = "no access";
private $_logcallback;

public function __construct($options)
{
$this->token = isset($options['token'])?$options['token']:'';
$this->appid = isset($options['appid'])?$options['appid']:'';
$this->appsecret = isset($options['appsecret'])?$options['appsecret']:'';
$this->debug = isset($options['debug'])?$options['debug']:false;
$this->_logcallback = isset($options['logcallback'])?$options['logcallback']:false;
}


private function checkSignature()
{
$signature = isset($_GET["signature"])?$_GET["signature"]:'';
$timestamp = isset($_GET["timestamp"])?$_GET["timestamp"]:'';
$nonce = isset($_GET["nonce"])?$_GET["nonce"]:'';

$token = $this->token;
$tmpArr = array($token, $timestamp, $nonce);
sort($tmpArr);
$tmpStr = implode( $tmpArr );
$tmpStr = sha1( $tmpStr );

if( $tmpStr == $signature ){
return true;
}else{
return false;
}
}


public function valid($return=false)
{
$echoStr = isset($_GET["echostr"]) ? $_GET["echostr"]: '';
if ($return) {
if ($echoStr) {
if ($this->checkSignature())
return $echoStr;
else
return false;
} else
return $this->checkSignature();
} else {
if ($echoStr) {
if ($this->checkSignature())
die($echoStr);
else
die('no access');
} else {
if ($this->checkSignature())
return true;
else
die('no access');
}
}
return false;
}


public function Message($msg = '',$append = false){
if (is_null($msg)) {
$this->_msg =array();
}elseif (is_array($msg)) {
if ($append)
$this->_msg = array_merge($this->_msg,$msg);
else
$this->_msg = $msg;
return $this->_msg;
} else {
return $this->_msg;
}
}

public function setFuncFlag($flag) {
$this->_funcflag = $flag;
return $this;
}

private function log($log){
if ($this->debug && function_exists($this->_logcallback)) {
if (is_array($log)) $log = print_r($log,true);
return call_user_func($this->_logcallback,$log);
}
}


public function getRev()
{
$postStr = file_get_contents("php://input");
$this->log($postStr);
if (!empty($postStr)) {
$this->_receive = (array)simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
}
return $this;
}


public function getRevData()
{
return $this->_receive;
}


public function getRevFrom() {
if ($this->_receive)
return $this->_receive['FromUserName'];
else
return false;
}


public function getRevTo() {
if ($this->_receive)
return $this->_receive['ToUserName'];
else
return false;
}


public function getRevType() {
if (isset($this->_receive['MsgType']))
return $this->_receive['MsgType'];
else
return false;
}


public function getRevID() {
if (isset($this->_receive['MsgId']))
return $this->_receive['MsgId'];
else
return false;
}


public function getRevCtime() {
if (isset($this->_receive['CreateTime']))
return $this->_receive['CreateTime'];
else
return false;
}


public function getRevContent(){
if (isset($this->_receive['Content']))
return $this->_receive['Content'];
else if (isset($this->_receive['Recognition'])) //獲取語音識別文字內容,需申請開通
return $this->_receive['Recognition'];
else
return false;
}


public function getRevPic(){
if (isset($this->_receive['PicUrl']))
return $this->_receive['PicUrl'];
else
return false;
}


public function getRevlink(){
if (isset($this->_receive['Url'])){
return array(
'url'=>$this->_receive['Url'],
'title'=>$this->_receive['Title'],
'description'=>$this->_receive['Description']
);
} else
return false;
}


public function getRevGeo(){
if (isset($this->_receive['Location_X'])){
return array(
'x'=>$this->_receive['Location_X'],
'y'=>$this->_receive['Location_Y'],
'scale'=>$this->_receive['Scale'],
'label'=>$this->_receive['Label']
);
} else
return false;
}


public function getRevEvent(){
if (isset($this->_receive['Event'])){
return array(
'event'=>$this->_receive['Event'],
'key'=>$this->_receive['EventKey'],
);
} else
return false;
}


public function getRevVoice(){
if (isset($this->_receive['MediaId'])){
return array(
'mediaid'=>$this->_receive['MediaId'],
'format'=>$this->_receive['Format'],
);
} else
return false;
}


public function getRevVideo(){
if (isset($this->_receive['MediaId'])){
return array(
'mediaid'=>$this->_receive['MediaId'],
'thumbmediaid'=>$this->_receive['ThumbMediaId']
);
} else
return false;
}

public static function xmlSafeStr($str)
{
return '<![CDATA['.preg_replac("/[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]/",'',$str).']]>';
}


public static function data_to_xml($data) {
$xml = '';
foreach ($data as $key => $val) {
is_numeric($key) && $key = "item id=\"$key\"";
$xml .= "<$key>";
$xml .= ( is_array($val) || is_object($val)) ? self::data_to_xml($val) : self::xmlSafeStr($val);
list($key, ) = explode(' ', $key);
$xml .= "</$key>";
}
return $xml;
}


public function xml_encode($data, $root='xml', $item='item', $attr='', $id='id', $encoding='utf-8') {
if(is_array($attr)){
$_attr = array();
foreach ($attr as $key => $value) {
$_attr[] = "{$key}=\"{$value}\"";
}
$attr = implode(' ', $_attr);
}
$attr = trim($attr);
$attr = empty($attr) ? '' : " {$attr}";
$xml = "<{$root}{$attr}>";
$xml .= self::data_to_xml($data, $item, $id);
$xml .= "</{$root}>";
return $xml;
}


public function text($text='')
{
$FuncFlag = $this->_funcflag ? 1 : 0;
$msg = array(
'ToUserName' => $this->getRevFrom(),
'FromUserName'=>$this->getRevTo(),
'MsgType'=>self::MSGTYPE_TEXT,
'Content'=>$text,
'CreateTime'=>time(),
'FuncFlag'=>$FuncFlag
);
$this->Message($msg);
return $this;
}


public function music($title,$desc,$musicurl,$hgmusicurl='') {
$FuncFlag = $this->_funcflag ? 1 : 0;
$msg = array(
'ToUserName' => $this->getRevFrom(),
'FromUserName'=>$this->getRevTo(),
'CreateTime'=>time(),
'MsgType'=>self::MSGTYPE_MUSIC,
'Music'=>array(
'Title'=>$title,
'Description'=>$desc,
'MusicUrl'=>$musicurl,
'HQMusicUrl'=>$hgmusicurl
),
'FuncFlag'=>$FuncFlag
);
$this->Message($msg);
return $this;
}

public function news($newsData=array())
{
$FuncFlag = $this->_funcflag ? 1 : 0;
$count = count($newsData);

$msg = array(
'ToUserName' => $this->getRevFrom(),
'FromUserName'=>$this->getRevTo(),
'MsgType'=>self::MSGTYPE_NEWS,
'CreateTime'=>time(),
'ArticleCount'=>$count,
'Articles'=>$newsData,
'FuncFlag'=>$FuncFlag
);
$this->Message($msg);
return $this;
}


public function reply($msg=array(),$return = false)
{
if (empty($msg))
$msg = $this->_msg;
$xmldata= $this->xml_encode($msg);
$this->log($xmldata);
if ($return)
return $xmldata;
else
echo $xmldata;
}



private function http_get($url){
$oCurl = curl_init();
if(stripos($url,"https://")!==FALSE){
curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, FALSE);
}
curl_setopt($oCurl, CURLOPT_URL, $url);
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );
$sContent = curl_exec($oCurl);
$aStatus = curl_getinfo($oCurl);
curl_close($oCurl);
if(intval($aStatus["http_code"])==200){
return $sContent;
}else{
return false;
}
}


private function http_post($url,$param){
$oCurl = curl_init();
if(stripos($url,"https://")!==FALSE){
curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, false);
}
if (is_string($param)) {
$strPOST = $param;
} else {
$aPOST = array();
foreach($param as $key=>$val){
$aPOST[] = $key."=".urlencode($val);
}
$strPOST = join("&", $aPOST);
}
curl_setopt($oCurl, CURLOPT_URL, $url);
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($oCurl, CURLOPT_POST,true);
curl_setopt($oCurl, CURLOPT_POSTFIELDS,$strPOST);
$sContent = curl_exec($oCurl);
$aStatus = curl_getinfo($oCurl);
curl_close($oCurl);
if(intval($aStatus["http_code"])==200){
return $sContent;
}else{
return false;
}
}


public function checkAuth($appid='',$appsecret=''){
if (!$appid || !$appsecret) {
$appid = $this->appid;
$appsecret = $this->appsecret;
}
//TODO: get the cache access_token
$result = $this->http_get(self::API_URL_PREFIX.self::AUTH_URL.'appid='.$appid.'&secret='.$appsecret);
if ($result)
{
$json = json_decode($result,true);
if (!$json || isset($json['errcode'])) {
$this->errCode = $json['errcode'];
$this->errMsg = $json['errmsg'];
return false;
}
$this->access_token = $json['access_token'];
$expire = $json['expires_in'] ? intval($json['expires_in'])-100 : 3600;
//TODO: cache access_token
return $this->access_token;
}
return false;
}


public function resetAuth($appid=''){
$this->access_token = '';
//TODO: remove cache
return true;
}


static function json_encode($arr) {
$parts = array ();
$is_list = false;
//Find out if the given array is a numerical array
$keys = array_keys ( $arr );
$max_length = count ( $arr ) - 1;
if (($keys [0] === 0) && ($keys [$max_length] === $max_length )) { //See if the first key is 0 and last key is length - 1
$is_list = true;
for($i = 0; $i < count ( $keys ); $i ++) { //See if each key correspondes to its position
if ($i != $keys [$i]) { //A key fails at position check.
$is_list = false; //It is an associative array.
break;
}
}
}
foreach ( $arr as $key => $value ) {
if (is_array ( $value )) { //Custom handling for arrays
if ($is_list)
$parts [] = self::json_encode ( $value );
else
$parts [] = '"' . $key . '":' . self::json_encode ( $value );
} else {
$str = '';
if (! $is_list)
$str = '"' . $key . '":';
//Custom handling for multiple data types
if (is_numeric ( $value ) && $value<2000000000)
$str .= $value; //Numbers
elseif ($value === false)
$str .= 'false'; //The booleans
elseif ($value === true)
$str .= 'true';
else
$str .= '"' . addslashes ( $value ) . '"'; //All other things
// :TODO: Is there any more datatype we should be in the lookout for? (Object?)
$parts [] = $str;
}
}
$json = implode ( ',', $parts );
if ($is_list)
return '[' . $json . ']'; //Return numerical JSON
return '{' . $json . '}'; //Return associative JSON
}


public function createMenu($data){
if (!$this->access_token && !$this->checkAuth()) return false;
$result = $this->http_post(self::API_URL_PREFIX.self::MENU_CREATE_URL.'access_token='.$this->access_token,self::json_encode($data));
if ($result)
{
$json = json_decode($result,true);
if (!$json || $json['errcode']>0) {
$this->errCode = $json['errcode'];
$this->errMsg = $json['errmsg'];
return false;
}
return true;
}
return false;
}


public function getMenu(){
if (!$this->access_token && !$this->checkAuth()) return false;
$result = $this->http_get(self::API_URL_PREFIX.self::MENU_GET_URL.'access_token='.$this->access_token);
if ($result)
{
$json = json_decode($result,true);
if (!$json || isset($json['errcode'])) {
$this->errCode = $json['errcode'];
$this->errMsg = $json['errmsg'];
return false;
}
return $json;
}
return false;
}


public function deleteMenu(){
if (!$this->access_token && !$this->checkAuth()) return false;
$result = $this->http_get(self::API_URL_PREFIX.self::MENU_DELETE_URL.'access_token='.$this->access_token);
if ($result)
{
$json = json_decode($result,true);
if (!$json || $json['errcode']>0) {
$this->errCode = $json['errcode'];
$this->errMsg = $json['errmsg'];
return false;
}
return true;
}
return false;
}


public function getMedia($media_id){
if (!$this->access_token && !$this->checkAuth()) return false;
$result = $this->http_get(self::API_URL_PREFIX.self::MEDIA_GET_URL.'access_token='.$this->access_token).'&media_id='.$media_id;
if ($result)
{
$json = json_decode($result,true);
if (isset($json['errcode'])) {
$this->errCode = $json['errcode'];
$this->errMsg = $json['errmsg'];
return false;
}
return $result;
}
return false;
}
}

快消品貨源網提供超市貨源信息,超市采購進貨渠道。超市進貨網提供成都食品批發,日用百貨批發信息、微信淘寶網店超市采購信息和超市加盟信息.打造國內超市采購商與批發市場供應廠商搭建網上批發市場平臺,是全國批發市場行業中電子商務權威性網站。

本文內容整合網站:百度百科知乎淘寶平臺規則

本文來源: destoon微信接口代碼

分享與收藏:  網商學院搜索  告訴好友  關閉窗口  打印本文 本文關鍵字:
 
更多..資源下載
微信營銷圖文
最先進的病毒式微信營銷模式就是這樣的!!! 想要流量往上漲,微商零售該如何玩?
微信營銷網商學院推薦
微信營銷點擊排行
 
手機版 手機掃描訪問
国产激情综合,欧美香蕉视频,国产成人免费精品,久久激情中文
亚洲综合专区| 五月国产精品| 日本一不卡视频| 免费黄网站欧美| 欧美粗暴jizz性欧美20| 特黄毛片在线观看| 国产中文字幕一区二区三区| 天堂va蜜桃一区二区三区| 国产一区二区三区四区五区传媒| 日本午夜精品| 国产亚洲精品美女久久久久久久久久| 亚洲在线国产日韩欧美| 丝袜美腿亚洲一区二区图片| 老牛国产精品一区的观看方式| 午夜亚洲一区| 午夜一区在线| 国产一区二区三区免费在线| 亚洲特级毛片| 日韩欧美激情| 成人国产精选| 日韩一区中文| 日韩电影免费网址| 在线观看一区| 天堂8中文在线最新版在线| 国产婷婷精品| 久久一区欧美| 视频精品一区二区| 日韩毛片视频| 麻豆久久一区| 男人的天堂久久精品| 欧美a一区二区| 丝袜亚洲精品中文字幕一区| 欧美成a人免费观看久久| 麻豆精品av| 欧美在线黄色| 国产精品日本| av在线日韩| 日韩1区在线| 九九99久久精品在免费线bt| 日韩1区2区3区| 久久夜色精品| 国产亚洲一区在线| 欧美日韩色图| 精品一区二区三区在线观看视频| 亚洲一区二区三区免费在线观看| 久久精品国产一区二区| 国产精品入口久久| 国产美女撒尿一区二区| 欧美日韩亚洲一区三区| 国产亚洲精aa在线看| 日本欧美在线| 国产香蕉精品| 欧美自拍一区| 欧美一级二区| 欧美日韩调教| 免费视频一区二区三区在线观看 | 日韩中文字幕区一区有砖一区| av中文资源在线资源免费观看| 日本aⅴ精品一区二区三区| 日本在线成人| 九九99久久精品在免费线bt| 国产精品高潮呻吟久久久久| 国产一区精品福利| 福利一区和二区| 免费亚洲婷婷| 久久久久国产| 羞羞答答国产精品www一本| 日韩视频在线一区二区三区| 久久男人天堂| 亚洲永久字幕| 精品国产黄a∨片高清在线| 偷拍欧美精品| 成人亚洲欧美| 综合视频一区| 欧美日韩色图| 中文在线а√在线8| 91亚洲精品视频在线观看| 午夜国产精品视频免费体验区| 欧美激情视频一区二区三区在线播放| 国产亚洲午夜| 亚洲精品2区| 国内激情久久| 亚洲国产综合在线看不卡| 三级欧美在线一区| 亚洲国产福利| 午夜视频一区二区在线观看| 免费高潮视频95在线观看网站| 亚洲在线观看| 欧美激情91| 久久电影一区| 日韩av一区二区在线影视| 免费一二一二在线视频| 亚洲免费一区二区| 丁香婷婷久久| 日韩高清三区| 久久不射网站| 亚洲四虎影院| 国产欧美在线| 日韩精品一二三四| 国精品一区二区三区| 精品国产欧美日韩一区二区三区| 亚洲欧美不卡| 蜜桃国内精品久久久久软件9| 国产精品九九| 91精品在线免费视频| 久久福利精品| 999在线观看精品免费不卡网站| 日韩综合在线| 国产一区二区三区黄网站| 久久激五月天综合精品| 亚洲人成网77777色在线播放| 在线综合亚洲| 99在线精品免费视频九九视| 一区二区精彩视频| 久久av一区二区三区| 国产视频一区三区| 亚洲一区二区三区高清不卡| 午夜精品影院| 久久男女视频| 欧美亚洲精品在线| 国产韩日影视精品| 久热精品在线| 天堂va欧美ⅴa亚洲va一国产| 日本在线成人| 欧美国产极品| 日韩中文在线播放| 久久亚洲色图| 久久激情综合网| 成人在线超碰| 亚洲精品成人| 日韩和欧美一区二区三区| 国产精品一区高清| 亚洲精品一区三区三区在线观看| 999久久久亚洲| 亚洲三级网址| 97视频热人人精品免费| 欧美一区=区| 久久亚洲人体| 蜜桃久久久久久| 精品少妇av| 国产精品丝袜xxxxxxx| 国产伦精品一区二区三区千人斩| 日本一二区不卡| 亚洲精品动态| 91精品蜜臀一区二区三区在线 | 黑森林国产精品av| 999久久久精品国产| 日韩和欧美一区二区三区| 日韩成人精品一区| 亚洲欧美专区| 日韩在线看片| 一区在线免费| 在线看片一区| 久久精品观看| 精品丝袜久久| 欧美久久香蕉| 免费在线欧美视频| 日韩理论视频| 快she精品国产999| 国产精品原创| 国产精品18| 亚洲精选成人| 丝袜国产日韩另类美女| 久久婷婷久久| 麻豆国产精品| 欧美日本久久| 日韩av在线播放中文字幕| 久久最新视频| 男人的天堂久久精品| 亚洲高清成人| 久久久精品午夜少妇| 亚洲天堂免费电影| 裤袜国产欧美精品一区| 久久精品国产久精国产| 日本欧美大码aⅴ在线播放| 亚洲精品韩国| 亚洲三级网站| 日韩精品中文字幕吗一区二区 | 日韩中文在线电影| 亚洲人成在线网站| 久久久久国产精品一区二区| 福利一区二区三区视频在线观看| 国产精品v日韩精品v欧美精品网站 | 亚洲一区二区日韩| 99在线观看免费视频精品观看| 久久精品电影| 免费毛片在线不卡| 在线看片不卡| 日韩在线观看一区二区| 亚洲欧美日本国产专区一区| 亚洲人成高清| 久久精品99国产精品日本| 捆绑调教美女网站视频一区| 国产suv精品一区二区四区视频 | 亚洲日本免费电影| 国产日韩在线观看视频| 国产高潮在线| 国产精品嫩草99av在线| 日韩高清中文字幕一区| 欧美激情aⅴ一区二区三区|