G275483360 发表于 2014-10-2 23:24:19

分享火车头8.X 2.X mysql语法导入ECMS帝国7.0完美无错版

INSERT INTO phome_ecms_stock(classid,title,newstime,Brand,subtitle,goods,moq,spq,Description,stock,leadtime,RMB,qq,com,username,userid,havehtml,newspath,stb) VALUES('[标签:分类ID]','[标签:标题]','[系统时间戳]','[标签:品牌]','[标签:标题]','[标签:类型]','0','0','[标签:描述]','[标签:stock]','1-2周','[标签:Price]','257386','[标签:公司]','admin','1','1','20141002','1')

INSERT INTO phome_ecms_stock_data_2(id,classid,keyid,dokey,newstempid,closepi,haveaddfen,infotags) VALUES ('[文章编号:phome_ecms_stock]','[标签:分类ID]','','0','0','0','0','0')

INSERT INTO phome_ecms_stock_index(id,classid,checked,newstime,truetime,lastdotime,havehtml) VALUES('[文章编号:phome_ecms_stock]','[标签:分类ID]','1','[系统时间戳]','[系统时间戳]','[系统时间戳]','1')

updatephome_ecms_stock set `filename`=`id` where id=[文章编号:phome_ecms_stock]

update `phome_ecms_stock` set titleurl=CONCAT('/stock/','[系统时间戳],'/','[文章编号:phome_ecms_stock]','.html')每个人的需求不一样,字段也不一样,请根据自己的需求更改。

以上是5句MYSQL,每段一个回车,顺应火车头的mysql语法要求。
以及不要在msyq命令后面增加结束符号【;】注意分号哦,分号是命令结束符号。
分享也当做是自己后期的备忘录吧。

G275483360 发表于 2014-10-2 23:26:47

以下为帝国ECMS结合火车头的文件,类似于自定义API工具吧,相关信息需要自己去修改。<?php
/**
1、本接口基本上全部是数据库操作,因此所采集的数据一定要对应数据库字段,否则内容就不是自己想要的了。
2、本接口只适合帝国CMS7.0系统,如果您用的是7.0以下系统请自行修改文件。
3、此接口经过差不多1个月的测试,没有问题。可以正常的更新和添加文章,因此如果您觉得不好用可以找其他接口。
4、由于根据自己的需要做的接口,因此如果你想自己用可能得自己修改了,这个接口只是做一个参考,如果你懂一点点代码改起来应该不难。

**/
header('conten-type:text/html;charset=gb2312');
$password='stock';                        // 验证密码所用, 发表地址后缀: /e/admin/stock.php?pw=stock
if($password!=$_GET['pw']) exit('验证密码错误');   //安全检测,密码不符则退出
define('InEmpireCMS',TRUE);
include("e/config/config.php");
define('DB_HOST',$ecms_config['db']['dbserver']);        //数据库登录地址
define('DB_PASSWORD',$ecms_config['db']['dbpassword']);//数据库密码
define('DB_USER',$ecms_config['db']['dbusername']);//数据库用户名
define('DB_NAME',$ecms_config['db']['dbname']);////数据库名
$db = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) ;
mysql_select_db(DB_NAME,$db) ;
mysql_query("set names gb2312");
mysql_query("SET character_set_results=gb2312");
/////////////////////////////////////////////初始化配置
$times = time();
$times2 = time(); //对应自动发布时间
$id =$_POST['stock_id'];//ID必须有
/////////////////////////////////////////////主表phome_ecms_stock
$stock = ''; //这个为分类,你采集的文章肯定有分类,每个分类对应一个栏目
$title = $_POST['title'] ;
$subtitle = $_POST['subtitle'] ;
$stock_id = $_POST['stock_id'] ; //ID必须有
$titlepic = $_POST['titlepic'] ;
$smalltext = $_POST['smalltext'] ;
$newstime =$times ; //
$diggtop = $_POST['diggtop'] ; //顶
$diggdown = $_POST['diggdown'] ; //踩,如果自己没有加这个字段可以自己加也可放着
$infopfen = $_POST['infopfen'] ; //评分数
$infopfennum = $_POST['infopfennum'] ; //评分人数
$onclick = $_POST['onclick'] ; //浏览人数
$filename= $id ;
$ttid='0';
$plnum=0;
$totaldown=0;
$newspath='';
$userid=1; //管理员ID
$username='admin';   //发布账号
$firsttitle=0;
$isgood=0;
$ispic=0;
$istop=0;
$isqf='0';
$ismember=0;
$isurl=0;
$truetime=$times;
$lastdotime=$times;
$havehtml=1;
$groupid=0;
$userfen=0;
$titlefont='';
$stb=0;
$fstb=1;
$restb=1;
$keyboard='';
$goods=$_POST['goods'];
$moq=$_POST['moq'];
$spq=$_POST['spq'];
$box=$_POST['box'];
$Description=$_POST['Description'];
$stock=$_POST['stock'];
$leadtime=$_POST['leadtime'];
$RMB=$_POST['RMB'];
$qq=$_POST['qq'];
$com=$_POST['com'];
$Brand=$_POST['Brand'];


/////////////////////////////////////////////副表phome_ecms_stock_data_1
$writer = $_POST['writer'] ;
$befrom = $_POST['befrom'] ;
$newstext = $_POST['newstext'] ;
$stock_pf = $_POST['stock_pf'] ;
$keyid='';
$dokey=0;
$newstempid=0;
$closepl=0;
$haveaddfen=0;
$infotags='';
/////////////////////////////////////////////索引表phome_ecms_stock_index
$checked=0; //信息属性:审核   1 为审核0为非审核,只有为0的时候才能延迟发布文章
/////////////////////////////////////////////phome_enewsinfovote
$id3 = 1000010000000000 + $id ;
$pubid = number_format($id3,'','','') ;
$votenum = 0 ;
$voteip = '';
$votetext ='';
$voteclass = 0;
$doip = 0;
$dotime ='0000-00-00';
$tempid =1 ;
$width = 500 ;
$height = 300 ;
$diyotherlink = '';
$infouptime = $times2 ;
$infodowntime = 0;
$copyids = '';





?>
<?php
$enews=$_POST['enews'];
if(empty($enews))
{
        $enews=$_GET['enews'];
}
if(!$_POST){
// 列出终极栏目
$qbrand = mysql_query("SELECT classid,classname,bclassid FROM `".$dbtbpre."enewsclass` where islast=1order by myorder,classid desc ");
    echo '<select name="classid">';
    while($row = mysql_fetch_array($qbrand)){
        $qbrand2 = mysql_query("SELECT classid,classname,bclassid FROM `".$dbtbpre."enewsclass` where classid='".$row['bclassid']."'");
       while($row2 = mysql_fetch_array($qbrand2)){
          echo '<option value="'.$row['classid'].'">'.$row2['classname'].$row['classname'].'</option>';
                }
                }
      echo '</select><br />';               
}else{
   if ( get_magic_quotes_gpc ()) {
      stripslashes ( $_POST );
    }
@extract($_POST);
?>

<?php
$qbrand3 = mysql_query("SELECT classid , classpathFROM `".$dbtbpre."enewsclass` where classname='".$stock."' and bclassid='".$bclassid."' ");
while($row3 = mysql_fetch_array($qbrand3)){
$classid = $row3['classid'] ;//该栏目的ID
$classpath = $row3['classpath'] ;
                }       
if(!$classpath){
$classid = 709;
$classpath = 'lingshi';
}
$titleurl = '/' . $classpath . '/' . $id . '.html'; //外部链接       
       
$qbrand4 = mysql_query("SELECT stock_idFROM `".$dbtbpre."ecms_stock` where id='".$id."' ");
while($row4 = mysql_fetch_array($qbrand4)){
$id_4 = $row4['stock_id'] ;//
                }
$qbrand5 = mysql_query("SELECT stock_idFROM `".$dbtbpre."ecms_stock_check` where id='".$id."' ");
while($row5 = mysql_fetch_array($qbrand5)){
$id_5 = $row5['stock_id'] ;//
                }
?>       
<?php
mysql_query("BEGIN");
if($enews=="AddNews"){
if($id_4)
{
$checked=1;
$phome_ecms_stock = mysql_query(" UPDATE ".$dbtbpre."ecms_stockSETclassid='$classid' , ttid='$ttid' , onclick='$onclick' , plnum='$plnum' , totaldown='$totaldown' , newspath='$newspath' , filename='$filename' , userid='$userid' , username='$username' , firsttitle='$firsttitle' , isgood='$isgood' , ispic='$ispic' , istop='$istop' , isqf='$isqf' , ismember='$ismember' , isurl='$isurl' , truetime='$truetime' , lastdotime='$lastdotime' , havehtml='$havehtml' , groupid='$groupid' , userfen='$userfen' , titlefont='$titlefont' , titleurl='$titleurl' , stb='$stb' , fstb='$fstb' , restb='$restb' , keyboard='$keyboard' , title='$title' , newstime='$newstime' , titlepic='$titlepic' , subtitle='$subtitle' , smalltext='$smalltext' , diggtop='$diggtop' , infopfen='$infopfen' , infopfennum='$infopfennum' , diggdown='$diggdown' , stock='$stock', stock_tel='$stock_tel' , stock_xy='$stock_xy' , stock_xyurl='$stock_xyurl' , stock_rz='$stock_rz' , stock_tg='$stock_tg' , stock_jt='$stock_jt' , stock_rel='$stock_rel' , stock_30yj='$stock_30yj' , stock_dq='$stock_dq' WHERE id = '$id_4'goods=goods',moq=moq',spq=spq',box=box',Description=Description',stock=stock',leadtime=leadtime',RMB=RMB',qq=qq',com=com',Brand=Brand'");
echo '$phome_ecms_stock ' . mysql_errno() . ": " . mysql_error();

$phome_ecms_stock_data_1 = mysql_query(" UPDATE ".$dbtbpre."ecms_stock_data_1 SET classid='$classid' , keyid='$keyid' , dokey='$dokey' , newstempid='$newstempid' , closepl='$closepl' , haveaddfen='$haveaddfen' , infotags='$infotags' , writer='$writer' , befrom='$befrom' , newstext='$newstext' , stock_pf='$stock_pf' WHERE id = '$id_4'");

echo '$phome_ecms_stock_data_1 ' .mysql_errno() . ": " . mysql_error();

$phome_ecms_stock_index = mysql_query(" UPDATE ".$dbtbpre."ecms_stock_index SET classid='$classid' , checked='$checked' , newstime='$newstime' , truetime='$truetime' , lastdotime='$lastdotime' , havehtml='$havehtml' WHERE id = '$id_4'");

echo '$phome_ecms_stock_index ' .mysql_errno() . ": " . mysql_error();

$phome_enewsinfovote = mysql_query(" UPDATE ".$dbtbpre."enewsinfovote SET pubid='$pubid' , classid='$classid' , title='$title' , votenum='$votenum' , voteip='$voteip' , votetext='$votetext' , voteclass='$voteclass' , doip='$doip' , dotime='$dotime' , tempid='$tempid' , width='$width' , height='$height' , diyotherlink='$diyotherlink' , infouptime='$infouptime' , infodowntime='$infodowntime' , copyids='$copyids'WHERE id = '$id_4' ");
echo '$phome_enewsinfovote ' . mysql_errno() . ": " . mysql_error();

echo "id_4已审核产品发布成功!" ;

mysql_query("END");

mysql_close($db);       
}
elseif($id_5)
{
$phome_ecms_stock_check = mysql_query(" UPDATE ".$dbtbpre."ecms_stock_checkSETclassid='$classid' , ttid='$ttid' , onclick='$onclick' , plnum='$plnum' , totaldown='$totaldown' , newspath='$newspath' , filename='$filename' , userid='$userid' , username='$username' , firsttitle='$firsttitle' , isgood='$isgood' , ispic='$ispic' , istop='$istop' , isqf='$isqf' , ismember='$ismember' , isurl='$isurl' , truetime='$truetime' , lastdotime='$lastdotime' , havehtml='$havehtml' , groupid='$groupid' , userfen='$userfen' , titlefont='$titlefont' , titleurl='$titleurl' , stb='$stb' , fstb='$fstb' , restb='$restb' , keyboard='$keyboard' , title='$title' , newstime='$newstime' , titlepic='$titlepic' , subtitle='$subtitle' , smalltext='$smalltext' , diggtop='$diggtop' , infopfen='$infopfen' , infopfennum='$infopfennum' , diggdown='$diggdown' , stock='$stock' , stock_id='$stock_id' , stock_tel='$stock_tel' , stock_xy='$stock_xy' , stock_xyurl='$stock_xyurl' , stock_rz='$stock_rz' , stock_tg='$stock_tg' , stock_jt='$stock_jt' , stock_rel='$stock_rel', stock_30yj='$stock_30yj', stock_dq='$stock_dq' WHERE id = '$id_5'goods=goods',moq=moq',spq=spq',box=box',Description=Description',stock=stock',leadtime=leadtime',RMB=RMB',qq=qq',com=com',Brand=Brand' ");
echo '$phome_ecms_stock_check ' . mysql_errno() . ": " . mysql_error();

$phome_ecms_stock_check_data = mysql_query(" UPDATE ".$dbtbpre."ecms_stock_check_data SET classid='$classid' , keyid='$keyid' , dokey='$dokey' , newstempid='$newstempid' , closepl='$closepl' , haveaddfen='$haveaddfen' , infotags='$infotags' , writer='$writer' , befrom='$befrom' , newstext='$newstext' , stock_pf='$stock_pf' WHERE id = '$id_5'");

echo '$phome_ecms_stock_check_data ' . mysql_errno() . ": " . mysql_error();

$phome_ecms_stock_index = mysql_query(" UPDATE ".$dbtbpre."ecms_stock_index SET classid='$classid' , checked='$checked' , newstime='$newstime' , truetime='$truetime' , lastdotime='$lastdotime' , havehtml='$havehtml' WHERE id = '$id_5'");

echo '$phome_ecms_stock_index ' . mysql_errno() . ": " . mysql_error();

$phome_enewsinfovote = mysql_query(" UPDATE ".$dbtbpre."enewsinfovote SET pubid='$pubid' , classid='$classid' , title='$title' , votenum='$votenum' , voteip='$voteip' , votetext='$votetext' , voteclass='$voteclass' , doip='$doip' , dotime='$dotime' , tempid='$tempid' , width='$width' , height='$height' , diyotherlink='$diyotherlink' , infouptime='$infouptime' , infodowntime='$infodowntime' , copyids='$copyids'WHERE id = '$id_5' ");

echo '$phome_enewsinfovote ' . mysql_errno() . ": " . mysql_error();

echo $id_5 . "id_5未审核产品发布成功!";

mysql_query("END");

mysql_close($db);       

}
else{
?>

<?php
if($checked==0){
$phome_ecms_stock_check = mysql_query("INSERT INTO ".$dbtbpre."ecms_stock_check (id,classid,ttid,onclick,plnum,totaldown,newspath,filename,userid,username,firsttitle,isgood,ispic,istop,isqf,ismember,isurl,truetime,lastdotime,havehtml,groupid,userfen,titlefont,titleurl,stb,fstb,restb,keyboard,title,newstime,titlepic,subtitle,smalltext,diggtop,infopfen,infopfennum,diggdown,stock,stock_id,stock_tel,stock_xy,stock_xyurl,stock_rz,stock_tg,stock_jt,stock_rel,stock_30yj,stock_dq) VALUES ('$id','$classid','$ttid','$onclick','$plnum','$totaldown','$newspath','$filename','$userid','$username','$firsttitle','$isgood','$ispic','$istop','$isqf','$ismember','$isurl','$truetime','$lastdotime','$havehtml','$groupid','$userfen','$titlefont','$titleurl','$stb','$fstb','$restb','$keyboard','$title','$newstime','$titlepic','$subtitle','$smalltext','$diggtop','$infopfen','$infopfennum','$diggdown','$stock','$stock_id','$stock_tel','$stock_xy','$stock_xyurl','$stock_rz','$stock_tg','$stock_jt','$stock_rel','$stock_30yj','$stock_dq')");
echo '$phome_ecms_stock_check ' . mysql_errno() . ": " . mysql_error();

$phome_ecms_stock_check_data = mysql_query("INSERT INTO ".$dbtbpre."ecms_stock_check_data (id,classid,keyid,dokey,newstempid,closepl,haveaddfen,infotags,writer,befrom,newstext,stock_pf) VALUES ('$id','$classid','$keyid','$dokey','$newstempid','$closepl','$haveaddfen','$infotags','$writer','$befrom','$newstext','$stock_pf')");       

echo '$phome_ecms_stock_check_data ' . mysql_errno() . ": " . mysql_error();
}
else{
$phome_ecms_stock = mysql_query("INSERT INTO ".$dbtbpre."ecms_stock (id,classid,ttid,onclick,plnum,totaldown,newspath,filename,userid,username,firsttitle,isgood,ispic,istop,isqf,ismember,isurl,truetime,lastdotime,havehtml,groupid,userfen,titlefont,titleurl,stb,fstb,restb,keyboard,title,newstime,titlepic,subtitle,smalltext,diggtop,infopfen,infopfennum,diggdown,stock,stock_id,stock_tel,stock_xy,stock_xyurl,stock_rz,stock_tg,stock_jt,stock_rel,stock_30yj,stock_dq,'goods','moq','spq','box','Description','stock','leadtime','RMB','qq','com','Brand') VALUES ('$id','$classid','$ttid','$onclick','$plnum','$totaldown','$newspath','$filename','$userid','$username','$firsttitle','$isgood','$ispic','$istop','$isqf','$ismember','$isurl','$truetime','$lastdotime','$havehtml','$groupid','$userfen','$titlefont','$titleurl','$stb','$fstb','$restb','$keyboard','$title','$newstime','$titlepic','$subtitle','$smalltext','$diggtop','$infopfen','$infopfennum','$diggdown','$stock','$stock_id','$stock_tel','$stock_xy','$stock_xyurl','$stock_rz','$stock_tg','$stock_jt','$stock_rel','$stock_30yj','$stock_dq','$goods','$moq','$spq','$box','$Description','$stock','$leadtime','$RMB','$qq','$com','$Brand')");

echo '$phome_ecms_stock ' . mysql_errno() . ": " . mysql_error();

$phome_ecms_stock_data_1 = mysql_query("INSERT INTO ".$dbtbpre."ecms_stock_data_1 (id,classid,keyid,dokey,newstempid,closepl,haveaddfen,infotags,writer,befrom,newstext,stock_pf) VALUES ('$id','$classid','$keyid','$dokey','$newstempid','$closepl','$haveaddfen','$infotags','$writer','$befrom','$newstext','$stock_pf')");       

echo '$phome_ecms_stock_data_1 ' . mysql_errno() . ": " . mysql_error();

}
$phome_ecms_stock_index = mysql_query("INSERT INTO ".$dbtbpre."ecms_stock_index (id,classid,checked,newstime,truetime,lastdotime,havehtml) VALUES ('$id','$classid','$checked','$newstime','$truetime','$lastdotime','$havehtml')");

echo '$phome_ecms_stock_index ' . mysql_errno() . ": " . mysql_error();       

$phome_enewsinfovote = mysql_query("INSERT INTO ".$dbtbpre."enewsinfovote (pubid,id,classid,title,votenum,voteip,votetext,voteclass,doip,dotime,tempid,width,height,diyotherlink,infouptime,infodowntime,copyids) VALUES ('$pubid','$id','$classid','$title','$votenum','$voteip','$votetext','$voteclass','$doip','$dotime','$tempid','$width','$height','$diyotherlink','$infouptime','$infodowntime','$copyids')");

echo '$phome_enewsinfovote ' . mysql_errno() . ": " . mysql_error();       

echo "产品发布成功!";

mysql_query("END");

mysql_close($db);                       

}
}
?>

<?php
}
?>

fk1985 发表于 2014-10-12 12:46:58

请问这个是做什么用的?谢谢。。

wincy 发表于 2014-10-14 00:17:50

貌似不能用吧。一楼提到的那几个表。7.0的帝国。都没有这些表了。


guxiaokang 发表于 2015-1-10 21:54:16

是呀!
有好几个表没有
怎么弄!

jixiejianshe 发表于 2015-4-11 18:11:43

01.<?php

02./**

03.1、本接口基本上全部是数据库操作,因此所采集的数据一定要对应数据库字段,否则内容就不是自己想要的了。

04.2、本接口只适合帝国CMS7.0系统,如果您用的是7.0以下系统请自行修改文件。

05.3、此接口经过差不多1个月的测试,没有问题。可以正常的更新和添加文章,因此如果您觉得不好用可以找其他接口。

06.4、由于根据自己的需要做的接口,因此如果你想自己用可能得自己修改了,这个接口只是做一个参考,如果你懂一点点代码改起来应该不难。

07.

08.**/

09.header('conten-type:text/html;charset=gb2312');

10.$password='stock';                        // 验证密码所用, 发表地址后缀:http://www.jixiejianshe.com/

11.if($password!=$_GET['pw']) exit('验证密码错误');   //安全检测,密码不符则退出

12.define('InEmpireCMS',TRUE);

13.include("e/config/config.php");

14.define('DB_HOST',$ecms_config['db']['dbserver']);      //数据库登录地址

15.define('DB_PASSWORD',$ecms_config['db']['dbpassword']);//数据库密码

16.define('DB_USER',$ecms_config['db']['dbusername']);//数据库用户名

17.define('DB_NAME',$ecms_config['db']['dbname']);////数据库名

18.$db = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) ;

19.mysql_select_db(DB_NAME,$db) ;

20.mysql_query("set names gb2312");

21.mysql_query("SET character_set_results=gb2312");
页: [1]
查看完整版本: 分享火车头8.X 2.X mysql语法导入ECMS帝国7.0完美无错版