和哥们研究淘宝客,找到微购这个程序觉得挺不错的,但是地图和RSS功能不是特别完善,于是小憩一下,做了下初级的拓展,分享给大家,开源精神嘛,大家也可以去我的网站我要购物平台去看看。

1.拓展后台seoAction.class.php

<?php
!defined("BUILD_BATCH_COUNT")&&define("BUILD_BATCH_COUNT",200);
class seoAction extends baseAction
{
//显示列表
public function index(){
$this->showindex("网站首页");
}
public function seller()
{
$this->showindex("返现商家");
}
public function search()
{
$this->showindex("逛宝贝");
}
public function album()
{
$this->showindex("专辑");
}
public function promo()
{
$this->showindex("促销活动页");
}
public function exchange_goods()
{
$this->showindex("积分商城");
}
public function cate()
{
$this->showindex("商品分类页");
}
public function item()
{
$this->showindex("商品详细页");
}
public function showindex($title)
{
$map['actionname'] = ACTION_NAME;
$info = $this->seo_mod->where($map)->find();
$this->assign('info',$info);
$this->assign('title',$title);
$this->display("index");
}
//修改
public function edit()
{
$this->seo_mod->create();
$status = $_POST['id'] ? $this->seo_mod->save() : $this->seo_mod->add(); if($status){
$this->success("操作成功!");
}else{
$this->error("操作失败!");
}
}
//伪静态设置
function rewrite(){
$this->assign('set',$this->setting);
$this->display();
}
//设置seo信息
function doEditSeo(){
if(isset($_POST["site"]["url_model"])){
$_POST["site"]["url_model"];
$address = ROOT_PATH."/index/Conf/config.php";
$configFile = file_get_contents($address);
$newFile = str_replace("'URL_MODEL' => {$this->setting['url_model']}","'URL_MODEL' => {$_POST['site']['url_model']}",$configFile);
if(!file_put_contents($address,$newFile)){
$this->error("保存伪静态模式错误!请查看目录是否有修改权限");
}
if(unlink(ROOT_PATH."/index/Runtime/~runtime.php")){
// $success = "保存数据成功";
}
//保存伪静态后缀
if(!empty($_POST['site']['html_suffix'])&&trim($_POST['site']['html_suffix'])!='/'){
$_br = "\r\n";
$_tab = "\t";
$_profile = '<?php'.$_br;
$_profile .= $_tab."//seo后缀配置文件".$_br; $_profile .= $_tab."return array(
'URL_HTML_SUFFIX'=>'{$_POST['site']['html_suffix']}'
);".$_br; $_profile .= $_br;
$_profile .= '?>'.$_br;
if (!file_put_contents(ROOT_PATH."/index/Conf/html_suffix.php", $_profile)) {
$this->error("保存后缀配置文件失败,请重试!");
}
}else{
$_br = "\r\n";
$_tab = "\t";
$_profile = '<?php'.$_br;
$_profile .= $_tab."//seo后缀配置文件".$_br; $_profile .= $_tab."return array( );".$_br; $_profile .= $_br;
$_profile .= '?>'.$_br;
if (!file_put_contents(ROOT_PATH."/index/Conf/html_suffix.php", $_profile)) {
$this->error("保存后缀配置文件失败,请重试!");
}
} $map["name"] = 'url_model';
M('setting')->where($map)->setField('data',$_POST['site']['url_model']);
$map["name"] = 'html_suffix';
M('setting')->where($map)->setField('data',trim($_POST['site']['html_suffix']));
$this->success("保存数据成功!"); }
}
//显示伪静态信息
function showRewriteRules(){
$where=array('name'=>'html_suffix');
$setting_mod=D('setting');
$html_suffix_rel=$setting_mod->where($where)->find();
$this->assign('suffix',$html_suffix_rel['data']); // $where=array('name'=>'url_model');
$url_model_rel=$setting_mod->where($where)->find();
$this->assign('url_model',$url_model_rel['data']); //
$this->display();
} function sitemap(){
if(!empty($_POST['dosubmit'])){
vendor("sitemap.WSitemap");
$_sitemap=new WSiteMap();
$lastmod=date("Y-m-d");
//首页
$_sitemap->add($this->setting['site_domain']."/index.php",$lastmod,"always","1.0");
//导航
$nav_cate = M("nav")->where("is_show=1 AND in_site!='0'")->order("sort_order")->select();
foreach($nav_cate as $v){
if($v['system']=='1')
$loc=$this->setting['site_domain']."/index.php?a=index&m=".$v['alias'];
else{
if($v['in_site']=='0')
$loc=$v['url'];
else
$loc=$this->setting['site_domain']."/index.php?a=index&m=cate&cid=".$v['items_cate_id'];
}
$_sitemap->add($loc,$lastmod,"monthly","0.7");
}
//逛宝贝热门搜索
$setting_cate = M('setting')->where("name='search_words'")->select();
$setting = explode(",",$setting_cate[0]['data']);
foreach($setting as $v)
$_sitemap->add($this->setting['site_domain']."/index.php?a=index&m=search&keywords=".$v,$lastmod,"always","0.8"); //专辑分类
$album_cate = M("album_cate")->where("status=1")->order("sort_order")->select();
foreach($album_cate as $v)
$_sitemap->add($this->setting['site_domain']."/index.php?m=album&a=index&cid=".$v['id'],$lastmod,"monthly","0.7"); //返现商家
$seller_cate = M("seller_cate")->where("status=1")->order("sort")->select();
foreach($seller_cate as $v)
$_sitemap->add($this->setting['site_domain']."/index.php?m=seller&a=index&id=".$v['id'],$lastmod,"monthly","0.9");
//读取标签
$getlabel = file_get_contents("./data/label.txt");
$label = explode(",",$getlabel);
//所有标签
$items_tags = M("items_tags")->where("status=1")->select();
foreach($items_tags as $v){
if(!preg_match("/\w|【|】|、|(|)|\/",$v['name'])){
if(in_array($v['name'],$label))
$_sitemap->add($this->setting['site_domain']."/index.php?m=cate&a=tag&id=".$v['id'],$lastmod,"always","0.9");
}
}
$data=$_sitemap->get();
//读取产品
$data = str_replace('><', ">\n<", $data);
//$data = iconv("GB2312", 'UTF-8',$data);
$data=str_replace("&","&amp;",$data);
if(file_put_contents("sitemap.xml",$_sitemap->begin().$data)){
//读取商品数据
$this->success("提交成功,接下来将分析大数据,请耐心等候...","/admin.php?m=seo&a=sitemap_items",1);
}else{
$this->error("提交失败!");
}
}
$this->display();
} public function sitemap_items(){
import('ORG.Util.Page');
vendor("sitemap.WSitemap");
$_sitemap=new WSiteMap();
$_items=M("items");
$count=!empty($_GET['count'])?$_GET['count']:0;
$nowPage=!empty($_GET['p'])?$_GET['p']:0;
!$count&&$count=$_items->where("status=1")->count("id");
$_page=new Page($count,BUILD_BATCH_COUNT);// 实例化分页类 传入总记录数
$list=$_items->order('add_time DESC')->field("id,add_time")->page($nowPage.','.$_page->listRows)->select();
foreach($list as $v){
$lastmod=date("Y-m-d",$v['add_time']);
$_sitemap->add($this->setting['site_domain']."/index.php?a=index&m=item&id=".$v['id'],$lastmod,"daily","0.9");
}
//读取产品
$data = str_replace('><', ">\n<", $_sitemap->get());
//$data = iconv("GB2312", 'UTF-8',$data);
$data=str_replace("&","&amp;",$data);
if(!file_put_contents("sitemap.xml",$data,FILE_APPEND)){
@file_put_contents("sitemap.xml",$_sitemap->end(),FILE_APPEND);
$this->error("提交失败。","/admin.php?m=seo&a=sitemap",1);
}
if($nowPage>=$_page->totalPages){
@file_put_contents("sitemap.xml",$_sitemap->end(),FILE_APPEND);
$this->success("生成完毕,共生成条".$count."记录。","/admin.php?m=seo&a=sitemap");
}else{
//生成下一页
$this->success("共".$_page->totalPages."页,第".($nowPage+1)."页,请耐心等候...","/admin.php?m=seo&a=sitemap_items&p=".($nowPage+1)."&count=".$count,1);
}
} public function item_rss(){
import('ORG.Util.Page');
vendor("rss.WRss");
$_rss=new WRss();
$_items=M("items");
$count=!empty($_GET['count'])?$_GET['count']:0;
$nowPage=!empty($_GET['p'])?$_GET['p']:0;
if(!$nowPage)
@file_put_contents("rss.xml",$_rss->begin().$_rss->site($this->setting['site_title'],$this->setting['site_domain'],$this->setting['site_description']));
!$count&&$count=$_items->where("status=1")->count("id");
$_page=new Page($count,BUILD_BATCH_COUNT);// 实例化分页类 传入总记录数
$list=$_items->order('add_time DESC')->field("id,title,img,seller_name,add_time")->page($nowPage.','.$_page->listRows)->select();
foreach($list as $v){
$lastmod=date("D d F Y h:i:s",$v['add_time']);
$link=$this->setting['site_domain']."/index.php?a=index&m=item&id=".$v['id'];
$_rss->add($v['title'],$link,$v['title']."<img src=\"{$v[img]}\"/>",$v['seller_name'],$lastmod,$link);
}
//读取产品
$data = str_replace('><', ">\n<", $_rss->get());
//$data = iconv("GB2312", 'UTF-8',$data);
$data=str_replace("&","&amp;",$data);
if(!file_put_contents("rss.xml",$data,FILE_APPEND)){
@file_put_contents("rss.xml",$_rss->end(),FILE_APPEND);
$this->error("提交失败。","/admin.php?m=seo&a=sitemap",1);
}
if($nowPage>=$_page->totalPages){
@file_put_contents("rss.xml",$_rss->end(),FILE_APPEND);
$this->success("生成完毕,共生成条".$count."记录。","/admin.php?m=seo&a=sitemap");
}else{
//生成下一页
$this->success("共".$_page->totalPages."页,第".($nowPage+1)."页,请耐心等候...","/admin.php?m=seo&a=item_rss&p=".($nowPage+1)."&count=".$count,3);
}
} public function ping(){
$ids=$_GET['ids'];
$p=isset($_GET['p'])?$_GET['p']:0;
$idsArray=explode('_',$ids);
$idsCount=count($idsArray);
if($p<$idsCount){
//百度google推送
vendor("ping.WPing");
$_ping=new WPing();
$_items=M("items");
$currentId=$idsArray[$p];
$items=$_items->where("id=".$currentId)->field("title")->find();
if(!$items){
$this->error("记录".$currentId."不存在,将推送下一条请耐心等候...","/admin.php?m=seo&a=ping&p=".($p+1)."&ids=".$ids,1);
}
$link=$this->setting['site_domain']."/index.php?a=index&m=item&id=".$currentId;
$_ping->method($this->setting['site_name'],$this->setting['site_domain'],$link,$this->setting['site_domain'].'/rss.xml');
$sb=$_ping->baidu()?"成功":"失败";
$gb=$_ping->google()?"成功":"失败";
$this->success("共".$idsCount."条记录需要需要推送,当前第".($p+1)."条,百度反馈{$sb},谷歌反馈{$gb}。请耐心等候...","/admin.php?m=seo&a=ping&p=".($p+1)."&ids=".$ids,2);
}else{
$this->success("推送完毕,共生成条".$idsCount."记录。","/admin.php?m=seo&a=sitemap");
}
}
function get_itmes_cate($pid){
$model = M('items_cate');
$map["status"] = 1;
$map["pid"] = $pid;
$list = $model->field('id')->where($map)->select();
foreach($list as $v){
$id .= $v['id'].",";
}
$pid = trim($id,",");
$maps["status"] = 1;
$maps["pid"] = array('in',$pid);
$lists = $model->field('id,name')->where($maps)->select();
foreach($lists as $v){
$str .= "<a href='/index.php?a=index&m=cate&cid=".$v['id']."'>{$v['name']}</a>";
}
return $str;
}
function test(){
$items_tags = M("items_tags")->where("status=1")->select();
foreach($items_tags as $v){
if(!preg_match("/\w|【|】|、|(|)|\/",$v['name'])){
echo $v['name']."&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;http://www.qianbao.cn/index.php?m=cate&a=tag&id=".$v['id']."</br>";
}
}
}
}
?>

追加系统Vendar需要的库文件RSS、Sitemap、Ping

/includes/thinkphp/Extend/Vendar/ping/WPing.php

<?php
/**
+------------------------------------------------------------------------------
* 通知搜索引擎过来抓去最新发布的内容。秒收不是梦
* 目前仅支持Google和Baidu
+------------------------------------------------------------------------------
*/
class WPing {
public $method, $callback;
public function method($site_name,$site_url,$update_url,$update_rss) {
$this->method = "
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<methodCall>
<methodName>weblogUpdates.extendedPing</methodName>
<params>
<param><value>{$site_name}</value></param>
<param><value>{$site_url}</value></param>
<param><value>{$update_url}</value></param>
<param><value>{$update_rss}</value></param>
</params>
</methodCall>";
return $this->method;
} public function _post($url, $postvar) {
$ch=curl_init ();
$headers=array ("POST " . $url . " HTTP/1.0", "Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Content-length: " . strlen ( $postvar ) );
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch,CURLOPT_POSTFIELDS,$postvar);
$res=curl_exec($ch);
curl_close($ch);
return $res;
} public function google() {
$this->callback = $this->_post ( 'http://blogsearch.google.com/ping/RPC2', $this->method );
return strpos ( $this->callback, "<boolean>0</boolean>" ) ? true : false;
} public function baidu() {
$this->callback = $this->_post ( 'http://ping.baidu.com/ping/RPC2', $this->method );
return strpos ( $this->callback, "<int>0</int>" ) ? true : false;
} }
?>

/includes/thinkphp/Extend/Vendar/rss/WRss.php

<?php
class WRss{
private $urls="";
public function add($title,$link,$description,$author,$pubDate,$guid=0,$share=true){
!empty($title)&&$tmp.="<title>{$title}</title>";
!empty($link)&&$tmp.="<link>{$link}</link>";
!empty($description)&&$tmp.="<description>{$description}</description>";
!empty($author)&&$tmp.="<author>{$author}</author>";
!empty($pubDate)&&$tmp.="<pubDate>{$pubDate}</pubDate>";
!empty($guid)&&$tmp.="<guid>{$guid}</guid >";
$this->urls.="<item>".$tmp."</item>";
} public function get($charset="UTF-8"){
return $this->urls;
} public function begin(){
return '<?xml version="1.0" encoding="UTF-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0"><channel>';
} public function end(){
return "</channel></rss>";
} public function site($title,$link,$description,$managingEditor="mengdj@outlook.com",$webMaster="mengdj@outlook.com"){
return "<title>{$title}</title><link>{$link}</link><description>{$description}</description><managingEditor>{$managingEditor}</managingEditor><webMaster>{$webMaster}</webMaster>";
}
}
?>

/includes/thinkphp/Extend/Vendar/sitemap/WSitemap.php

<?php
class WSiteMap{
private $urls="";
public function add($loc,$lastmod,$changefreq=0,$priority=0){
!empty($loc)&&$tmp.="<loc>{$loc}</loc>";
!empty($loc)&&$tmp.="<lastmod>{$lastmod}</lastmod>";
!empty($loc)&&$tmp.="<changefreq>{$changefreq}</changefreq>";
!empty($loc)&&$tmp.="<priority>{$priority}</priority>";
$this->urls.="<url>".$tmp."</url>";
} public function get($charset="UTF-8"){
return $this->urls;
} public function begin(){
return '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
} public function end(){
return "</urlset>";
}
}
?>

另外修改了thinkphp默认的Page类文件,其实也就开放了一个统计页数的属性

修改完成后再后台添加对应的菜单就可以了,祝你好运。另外还有个拍拍平台采集插件,需要的可联系我。¥5元免费使用升级,哈哈...,当是资助开发了。

文件以及目录可在此处下载:http://files.cnblogs.com/mengdejun/wyao.in.zip

php源码zend加密和解密方案:http://re.paipai.com/tws/...

wego微购RSS、Sitemap、Ping、腾讯拍拍网购采集插件的更多相关文章

  1. 让wego微购购物分享系统采集拍拍数据功能之腾讯paipai功能采集插件

    wego是一款很不错的导购系统,无论前后台设计风格和功能都还不错,可有时我们的确需要一些自定义的功能,毕竟万千世界,大家都做一样的东西,采集同样的数据,能不烦吗?哈哈,今天就奉献上一个wego拍拍采集 ...

  2. 高性能高可用的微服务框架TarsGo的腾讯实践

    conference/2.3 高性能高可用的微服务框架TarsGo的腾讯实践 - 陈明杰.pdf at master · gopherchina/conferencehttps://github.co ...

  3. Ionic2中集成腾讯Bugly之自定义插件

    Ionic2混合开发,入坑系列:Ionic2中集成腾讯Bugly之自定义插件 1.编写Bugly.js代码 var exec = require('cordova/exec'); module.exp ...

  4. JeeWx全新版本发布!捷微二代微信活动平台1.0发布!活动插件持续开源更新!

    JeeWx捷微二代微信活动平台 (专业微信营销活动平台,活动插件持续更新ing~)    终于等到你!还好我没放弃! 在团队持续多年的努力下,Jeewx微信管家和H5活动平台不断更新迭代,积累了许许多 ...

  5. 腾讯用过的插件jQuery twentytwenty 效果对比

    在线实例 左右对比 上下对比 使用方法 <div class="twentytwenty-container">     <img src="/api/ ...

  6. 智芯微版本的智能配变融合终端交流采集APP

    1.  交采APP基本原理 通过SPI总线周期性的召测交流采集底板的“实时数据”,对“实时数据”变换.加工.统计分析得到“分析数据”和“统计数据”后,通过MQTT总线把这些数据同步到“数据中心”供其他 ...

  7. 深度观察:腾讯收购大众点评背景下的O2O大格局

    [亿欧导读] 腾讯入股大众点评获得20%股权,详情解读:①大众点评:独立自主为底线,要钱大于要流量:②腾讯:承认原生活服务O2O失败,丰富移动支付应用场景:③美团承受压力,拉手窝窝继续苦等买家:④BA ...

  8. 腾讯ISUX网页前端代码分析

    看了一下腾讯ISUX网页,无论是pc端还是移动端,展示都挺好看的,先对其代码进行分析如下: 1,先看前三行代码 <!DOCTYPE html> <!-- 腾讯 ISUX 是腾讯集团核 ...

  9. 【BUG】wego购物分享系统未登陆分享宝贝时查看宝贝自动新增产品数据

    1.登录微购http://demo.wego360.com/站. 2.分享宝贝功能检索第三方平台商品数据. 1.登录微购http://demo.wego360.com/站. 2.分享宝贝功能检索第三方 ...

随机推荐

  1. phpcms_v9 多图字段 内容页,首页,分页自定义字段调用

    phpcms_v9 多图字段 内容页,首页,分页自定义字段调用 说明:自定义多图字段名 shigongtu 1 内容页调用 {loop $shigongtu $r}      <img src= ...

  2. SOA 架构中的ESB是更好的应用于异构系统集成整合还是用于统一服务调用/基础服务实施

    一.讨论主题与观点 写一篇文章.发现一次自觉得有意思的SOA架构方面的讨论,源于昨天AgileEAS.NET SOA 平台群(113723486)里几个群友的一次关于ESB的一次讨论. 大家的讨论观点 ...

  3. 在ASP.NET 5中如何方便的添加前端库

    (此文章同时发表在本人微信公众号“dotNET每日精华文章”,欢迎右边二维码来关注.) 题记:ASP.NET 5和之前的ASP.NET版本有很大的不同,其中之一就是对前端库的管理不再使用Nuget,而 ...

  4. OpenMesh 之向量操作

    OpenMesh 提供了许多可供使用的向量操作函数,使用特别方便. 计算距离: 从官方文档可以看到OpenMesh提供了5个函数,分别为 Scalar length() const        // ...

  5. HDU 5869 Different GCD Subarray Query 离线+树状数组

    Different GCD Subarray Query Problem Description   This is a simple problem. The teacher gives Bob a ...

  6. PC端重置

    -PC 一,meta <!DOCTYPE html> <html lang="zh-cmn-Hans"> <head> <meta cha ...

  7. hash 分区的用途是什么?

    Hash partitioning enables easy partitioning of data that does not lend itself to rangeor list partit ...

  8. ExpandableListView 里面嵌套GridView实现高度自适应

    很早之前做过一个商城的app 也是第一次做安卓. 实现的效果如下: 因为一开始做安卓,很多写的代码都不规范,在下面上代码的地方,还请高手指点(勿喷,楼主是自尊心很强的屌丝) 这个效果要解决2个大问题, ...

  9. java的几种连接池

    连接池的管理用了了享元模式,这里对连接池进行简单设计. 一.设计思路 1.连接池配置属性DBbean:里面存放可以配置的一些属性 2.连接池接口IConnectionPool:里面定义一些基本的获取连 ...

  10. 线段树(区间合并) LA 3989 "Ray, Pass me the dishes!"

    题目传送门 题意:动态最大连续子序列和,静态的题目 分析:nlogn的归并思想.线段树维护结点的三个信息,最大前缀和,最大后缀和,该区间的最大和的两个端点,然后答案是三个的better.书上用pair ...