|
@@ -6,6 +6,7 @@ namespace Heanup\App\Api;
|
|
|
use Exception;
|
|
use Exception;
|
|
|
use Heanup\App\Api\Controller\Search;
|
|
use Heanup\App\Api\Controller\Search;
|
|
|
use Heanup\Library\Memcached;
|
|
use Heanup\Library\Memcached;
|
|
|
|
|
+use Heanup\Library\Redis;
|
|
|
|
|
|
|
|
abstract class Controller extends \Heanup\Frame\Controller
|
|
abstract class Controller extends \Heanup\Frame\Controller
|
|
|
{
|
|
{
|
|
@@ -18,6 +19,28 @@ abstract class Controller extends \Heanup\Frame\Controller
|
|
|
protected function main()
|
|
protected function main()
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ public function addSitemap($url){
|
|
|
|
|
+ $urls = array(
|
|
|
|
|
+ $url,
|
|
|
|
|
+ );
|
|
|
|
|
+ $api = 'http://data.zz.baidu.com/urls?site=www.taoqu88.com&token=pKgc8vvoowMXccMI';
|
|
|
|
|
+ $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);
|
|
|
|
|
+ file_put_contents(APP_DIR."/baidu.log", $result);
|
|
|
|
|
+// $hashKey="sitemap:".md5($url);
|
|
|
|
|
+// $exist=Redis::instance()->get($hashKey);
|
|
|
|
|
+// if (!$exist){
|
|
|
|
|
+// Redis::instance()->set($hashKey, $url,86400*3);
|
|
|
|
|
+// }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|