DT內核圓柱模板行業站點主動tags三項主動推送插件
阿新 • • 發佈:2018-11-16
接口 item 頁面 result key lai port bst pla 因為自己最近做搜索聚合頁面,有大量的搜索標簽,於是自己開發了一個多功能推送插件,包括:MIP推送+熊掌號推送+歷史普通推送。發布在這裏,如果有需要的朋友,可以拿去參考改進!
`<?php
/
百度主動推送三項合一功能
作者:68喜科技
用於:DT6.0
功能模塊:tags標簽推送熊掌號+MIP+普通主動推送
/
//引入錯誤顯示
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require ‘../common.inc.php‘; //引入公用函數
$starid =1; //初始ID 開
$limitList=2000; //限制條數
//資訊標簽推送
$query = "SELECT letter FROM {$DT_PRE}keyword WHERE itemid> $starid AND MODULEID=21 ORDER BY itemid ASC LIMIT $limitList"; //查詢數據庫限制
//產品展示推送
//$query = "SELECT letter FROM {$DT_PRE}keyword WHERE itemid> $starid AND MODULEID=5 ORDER BY itemid ASC LIMIT $limitList"; //查詢數據庫限制
//圖庫展示推送
//$query = "SELECT letter FROM {$DT_PRE}keyword WHERE itemid> $starid AND MODULEID=12 ORDER BY itemid ASC LIMIT $limitList"; //查詢數據庫限制
//推送核心代碼
$result = $db->query($query);
$urls="";
$domain="http://zhimo.yuanzhumuban.cc/";//域名
while ($r=$db->fetch_array(($result)))
{
$linkId = $r[‘letter‘]; //獲取文章ID
$linkurl ="news/search-htm-kw-".$linkId.".html";//定義模塊URL
//修改域名
$urls.=$domain.$linkurl.",";
echo "為您推送的URL為:<br/>".$urls."<br/>";
}
$urls=substr($urls,0,-1);
$urls = explode(",",$urls);
//接口推送
$api = ‘MIP接口‘;
$bdxzhapi=‘熊掌號歷史接口‘;//熊掌號歷史推送
$pttsapi=‘主動推送接口‘;//普通推送
$ch = curl_init();
$options = array(
CURLOPT_URL => $api,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => implode("\n", $urls),
CURLOPT_HTTPHEADER => array(‘Content-Type: text/plain‘),
);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
echo "百度MIP 推送成功:". $result."<br/>";
`<?php
/
百度主動推送三項合一功能
作者:68喜科技
用於:DT6.0
功能模塊:tags標簽推送熊掌號+MIP+普通主動推送
/
//引入錯誤顯示
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require ‘../common.inc.php‘; //引入公用函數
$starid =1; //初始ID 開
$limitList=2000; //限制條數
//資訊標簽推送
$query = "SELECT letter FROM {$DT_PRE}keyword WHERE itemid> $starid AND MODULEID=21 ORDER BY itemid ASC LIMIT $limitList"; //查詢數據庫限制
//$query = "SELECT letter FROM {$DT_PRE}keyword WHERE itemid> $starid AND MODULEID=5 ORDER BY itemid ASC LIMIT $limitList"; //查詢數據庫限制
//圖庫展示推送
//$query = "SELECT letter FROM {$DT_PRE}keyword WHERE itemid> $starid AND MODULEID=12 ORDER BY itemid ASC LIMIT $limitList"; //查詢數據庫限制
$result = $db->query($query);
$urls="";
$domain="http://zhimo.yuanzhumuban.cc/";//域名
while ($r=$db->fetch_array(($result)))
{
$linkId = $r[‘letter‘]; //獲取文章ID
$linkurl ="news/search-htm-kw-".$linkId.".html";//定義模塊URL
//修改域名
$urls.=$domain.$linkurl.",";
echo "為您推送的URL為:<br/>".$urls."<br/>";
$urls=substr($urls,0,-1);
$urls = explode(",",$urls);
//接口推送
$api = ‘MIP接口‘;
$bdxzhapi=‘熊掌號歷史接口‘;//熊掌號歷史推送
$pttsapi=‘主動推送接口‘;//普通推送
$ch = curl_init();
$options = array(
CURLOPT_URL => $api,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => implode("\n", $urls),
CURLOPT_HTTPHEADER => array(‘Content-Type: text/plain‘),
);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
echo "百度MIP 推送成功:". $result."<br/>";
$options = array(
CURLOPT_URL => $bdxzhapi,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => implode("\n", $urls),
CURLOPT_HTTPHEADER => array(‘Content-Type: text/plain‘),
);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
echo "百度熊掌號推送成功:". $result."<br/>";
$options = array(
CURLOPT_URL => $pttsapi,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => implode("\n", $urls),
CURLOPT_HTTPHEADER => array(‘Content-Type: text/plain‘),
);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
echo "百度普通推送成功:". $result."<br/>";
?>`
另外做了聚合索引頁面,http://zhimo.yuanzhumuban.cc/hotkey/
DT內核圓柱模板行業站點主動tags三項主動推送插件