destoon采集论坛

 找回密码
 立即注册
查看: 1531|回复: 0

Destoon B2B如何批量添加文章

[复制链接]

227

主题

0

回帖

1627

积分

版主

Rank: 7Rank: 7Rank: 7

积分
1627
发表于 2017-4-23 01:05:17 | 显示全部楼层 |阅读模式
最近在使用destoon来配置网站,需要一些示例数据来填充页面,一条一条的添加比较麻烦,因为是一些示例数据,并不需要什么意义,所以批量生成一些信息

具体的步骤如下,我要添加的是一些购买信息,信息存放在dt_buy_6与dt_buy_data_6中,
我们通过后台加入一条测试数据,然后,使用navicate导出这两个表,就可以拿到sql语句了,下面是我的sql语句

portant;">
[sql] view plaincopy



portant;">
    portant; padding: 0px 3px 0px 10px !important;">INSERT INTO `dt_buy_6` VALUES ('51', '492', '0', '1', '0', '独家采购信息正在添加中....', '', '0', '独家采购信息正在添加中....', '', '', '', '', '', '', '', '', '', '0', '', '独家采购信息正在添加中....,求购,独家采购', '', '0', '', '', '', 'admin', '1', '中国轴承', '0', '1', '嘉客', '0635-2312627', '', '聊城', '', 'admin@yourdomain.com', '', '', '', '0', 'admin', '1403772546', '2014-06-26', '1403772540', '2014-06-26', '192.168.0.89', '', '3', 'show.php?itemid=51', '', '');  
[/ol]
portant;">
[sql] view plaincopy



portant;">
    portant; padding: 0px 3px 0px 10px !important;">INSERT INTO `dt_buy_data_6` VALUES ('29', ' 独家采购信息正在添加中....');  
[/ol]
这两个表是通过itemid来进行关联的,dt_buy_data_6中显示的是详细信息,dt_buy_6中显示的是一些添加时间,添加人这样的信息,

可以看到我们只需要变换一下itemid就可以了,那么我们写一段php代码来生成一下,这些sql语句


portant;">
[php] view plaincopy



portant;">
    portant; padding: 0px 3px 0px 10px !important;">
    portant; padding: 0px 3px 0px 10px !important;">header("Content-Type:text/html;charset=utf-8");  
    portant; padding: 0px 3px 0px 10px !important;">$a=
    portant; padding: 0px 3px 0px 10px !important;">INSERT INTO `dt_buy_data_6` VALUES ('*', ' 独家采购信息正在添加中....');  
    portant; padding: 0px 3px 0px 10px !important;">EOT;  
    portant; padding: 0px 3px 0px 10px !important;">  
    portant; padding: 0px 3px 0px 10px !important;">  
    portant; padding: 0px 3px 0px 10px !important;">for($i=29;$i$i++)  
    portant; padding: 0px 3px 0px 10px !important;">{  
    portant; padding: 0px 3px 0px 10px !important;">    echo str_replace("*",$i,$a);  
    portant; padding: 0px 3px 0px 10px !important;">    echo "
";  
    portant; padding: 0px 3px 0px 10px !important;">}  
    portant; padding: 0px 3px 0px 10px !important;">   
    portant; padding: 0px 3px 0px 10px !important;">?>  
[/ol]
我的ID是从29的开始的,所以$i=29你可以根据自己的情况来设定起始的ID号,注意第一个sql语句中有,两个地方需要替换,
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|destoon采集论坛

GMT+8, 2025-11-23 04:20 , Processed in 0.014159 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表