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

快消品貨源批發(fā)市場(chǎng)
快消品貨源分銷平臺(tái)
 
 
當(dāng)前位置: 貨源批發(fā)網(wǎng) » 網(wǎng)商學(xué)院 » 網(wǎng)店推廣 » 營銷技巧 » 微信營銷 » destoon微信接口代碼

destoon微信接口代碼

放大字體  縮小字體 發(fā)布日期:2025-10-28 06:42:09  來源:電商聯(lián)盟  作者:樂發(fā)網(wǎng)  瀏覽次數(shù):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'])) //獲取語音識(shí)別文字內(nèi)容,需申請(qǐng)開通
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;
}
}

快消品貨源網(wǎng)提供超市貨源信息,超市采購進(jìn)貨渠道。超市進(jìn)貨網(wǎng)提供成都食品批發(fā),日用百貨批發(fā)信息、微信淘寶網(wǎng)店超市采購信息和超市加盟信息.打造國內(nèi)超市采購商與批發(fā)市場(chǎng)供應(yīng)廠商搭建網(wǎng)上批發(fā)市場(chǎng)平臺(tái),是全國批發(fā)市場(chǎng)行業(yè)中電子商務(wù)權(quán)威性網(wǎng)站。

本文內(nèi)容整合網(wǎng)站:百度百科、知乎淘寶平臺(tái)規(guī)則

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

分享與收藏:  網(wǎng)商學(xué)院搜索  告訴好友  關(guān)閉窗口  打印本文 本文關(guān)鍵字:
 
更多..資源下載
微信營銷圖文
最先進(jìn)的病毒式微信營銷模式就是這樣的?。。?/></a>
<ul><li><a href=想要流量往上漲,微商零售該如何玩?
微信營銷網(wǎng)商學(xué)院推薦
微信營銷點(diǎn)擊排行
 
手機(jī)版 手機(jī)掃描訪問
国产激情综合,欧美香蕉视频,国产成人免费精品,久久激情中文
日韩在线中文| 99re国产精品| 亚洲精品看片| 日韩在线观看一区二区| 中文一区二区| 久久亚洲美女| 亚洲一区二区三区久久久| 午夜久久99| 国产美女精品| 综合欧美精品| 国产九一精品| 国产一区丝袜| 久久男女视频| 亚洲在线一区| 日韩精品免费一区二区夜夜嗨 | 久久中文视频| 欧美亚洲在线日韩| 五月天久久777| 在线综合欧美| 日韩一区二区三区精品| 日本视频在线一区| 国产精品毛片一区二区三区| 国产日韩电影| 在线综合视频| 开心激情综合| 久久精品123| 日韩欧美四区| 欧美综合另类| 国产一区三区在线播放| 亚洲女同一区| 日韩和欧美一区二区| 精品一区三区| 91成人在线网站| 日韩黄色av| 国产99在线| 亚洲美洲欧洲综合国产一区| 国产成人精品福利| 成人av动漫在线观看| 日韩精品免费一区二区三区| 中文字幕中文字幕精品| 日韩精品久久久久久| 日本aⅴ亚洲精品中文乱码| 精品成人18| 亚洲精华国产欧美| 国产乱码精品一区二区亚洲| 秋霞影院一区二区三区| 日韩一区二区久久| 91欧美极品| 中文字幕亚洲精品乱码| 一本一道久久a久久精品蜜桃| 成人日韩在线观看| 日本欧美韩国一区三区| 精品美女视频 | 国产日韩在线观看视频| 国产一区二区三区四区| 影音先锋久久| 国产精品啊啊啊| 亚洲激情中文在线| 97精品资源在线观看| 日韩黄色大片| 深夜日韩欧美| 欧美羞羞视频| 亚州精品视频| 日韩毛片在线| 国产日产一区| 欧美一区二区三区高清视频| 日韩一区免费| 久久久久久久久99精品大| 日韩av午夜在线观看| 久久久久国产| 国产精品二区影院| 国户精品久久久久久久久久久不卡 | 少妇精品在线| 欧洲亚洲一区二区三区| 国产欧美在线观看免费| 午夜精品免费| 精品国产亚洲一区二区三区在线| 蜜桃成人av| 久久精品国产999大香线蕉| 免费成人av在线播放| 美女一区网站| 麻豆精品视频在线观看视频| 蜜臀a∨国产成人精品| 久久国产成人午夜av影院宅| 欧美91在线|欧美| 亚洲图片久久| 久久国产中文字幕| 久久中文欧美| 欧美一级网站| 蜜桃久久久久久| 99久久精品费精品国产| 精品一区二区三区在线观看视频| 久久午夜精品| 欧美日韩国产免费观看 | 美女视频黄 久久| 少妇精品久久久一区二区| 香蕉人人精品| 中文av在线全新| 麻豆中文一区二区| 91精品在线免费视频| 喷白浆一区二区| 欧美综合另类| 天堂√中文最新版在线| 麻豆国产精品| 国产精品一区二区三区美女 | 亚洲三级国产| 在线综合亚洲| 激情欧美亚洲| 亚洲成人不卡| 中文字幕高清在线播放| 久久久亚洲欧洲日产| 日本亚洲欧美天堂免费| 蜜桃久久久久久久| 首页国产欧美日韩丝袜| 影音国产精品| 亚洲电影在线一区二区三区| 一区二区小说| 欧美不卡在线| 国产欧美一区二区三区精品酒店| 欧美aa在线视频| 欧美成人一二区| 精品网站999| 国产在线不卡一区二区三区 | 久久99蜜桃| 国产精品网站在线看| 91伊人久久| 欧美一级网址| 欧美一区二区三区免费看| 综合色一区二区| 91精品国产自产观看在线| 日本少妇精品亚洲第一区| 午夜视频一区二区在线观看| 亚洲一区av| 97精品国产99久久久久久免费| 四虎精品一区二区免费| 日韩av一区二区在线影视| 欧美一区免费| 国产亚洲精品美女久久| 久久不卡国产精品一区二区| 精品视频一区二区三区在线观看 | 亚洲1区在线观看| 日韩手机在线| 国产欧美另类| 国产成人精品一区二区三区在线| 欧美国产专区| 国产精品毛片久久| 久久人人97超碰国产公开结果| 久久精品免费一区二区三区| 午夜国产欧美理论在线播放 | 国产日韩一区二区三区在线| 久久不见久久见免费视频7| 成人在线视频中文字幕| 精品国产网站| 日韩电影免费在线观看| 日韩欧美另类一区二区| 免费一区二区三区在线视频| 麻豆91精品91久久久的内涵| 精品高清久久| 韩国精品主播一区二区在线观看| 亚洲成av在线| 国产精品一区二区中文字幕| 久久国产精品99国产| 久久久精品五月天| 国产乱码精品一区二区三区亚洲人| 麻豆网站免费在线观看| 国产精品色婷婷在线观看| 蜜臀a∨国产成人精品| 国产精品a级| 婷婷综合成人| 亚洲精品一级| 九色精品91| 成人在线网站| 精品理论电影在线| 国产精品99久久免费观看| 欧美精选一区二区三区| 亚洲免费资源| 亚洲一区二区三区中文字幕在线观看| 欧美激情亚洲| 激情综合网五月| 国产成人精品一区二区免费看京 | 日本h片久久| 成人在线免费观看网站| 日韩午夜电影| 国产精品最新| 国产毛片久久| 亚洲精品一区二区妖精| 在线亚洲人成| 国产精品1区| 亚洲日韩视频| 精品一区二区三区中文字幕 | 免费在线观看成人| 成人精品天堂一区二区三区| 亚洲v在线看| 成人av三级| 亚州精品视频| 日韩综合在线| 亚洲资源网站| 视频福利一区| 欧美黑人做爰爽爽爽| 午夜在线播放视频欧美|