This repository has been archived on 2026-06-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
EDT/admin/debug/zdb/zdb_ls.php
T
wsh5485 7e47ce238b chore: 添加多个图片和资源文件
添加了管理后台所需的图片资源、Excel文件、安装程序以及设计相关的图片文件
2025-06-15 13:04:37 +08:00

157 lines
5.4 KiB
PHP

<?php
//-------------------------------------------------------智订宝,历史畅销款
require "../../config.php";
include "../../../tmpl/config.php";
require THIS_FILE_ROOT."/include/function.php";
require THIS_FILE_ROOT."/include/db_mysql.php";
//require THIS_FILE_ROOT."/include/page.class.php";
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//-------------------------------mysql connect
$msg="";
$db=new DB_Sql;
$db->connect($dbhost,$dbuser,$dbpw,$dbname,"p");
$is_submit=$_POST["is_submit"];
if($is_submit=="y"){
//初始化
$table="web_zdb_ls";
$dd=$_POST["dd"];
if($dd==1){
$db->query("truncate table ".$table.";");
//
$content=$_POST["content"];
$arr=explode("\n",$content);
$num=0;
for($i=0;$i<count($arr);$i++){
$arr1=explode(" ",$arr[$i]);
//
$kh=trim($arr1[0]);
$pl=trim($arr1[1]);
$price=trim($arr1[2]);
$ph=trim($arr1[3]);
$xsje_zb=trim($arr1[4]);
$xsje=trim($arr1[5]);
$ljxsje_zb=trim($arr1[6]);
$zfs=trim($arr1[7]);
$dzl=trim($arr1[8]);
$ml=trim($arr1[9]);
$m2=trim($arr1[10]);
$m3=trim($arr1[11]);
$m4=trim($arr1[12]);
$m5=trim($arr1[13]);
$m6=trim($arr1[14]);
$m=trim($arr1[15]);
$m8=trim($arr1[16]);
$m9=trim($arr1[17]);
$m10=trim($arr1[18]);
$m11=trim($arr1[19]);
$m12=trim($arr1[20]);
if(!empty($kh)){
$sql_value.="('".$kh."','".$pl."','".$price."','".$ph."','".$xsje_zb."','".$xsje."','".$ljxsje_zb."','".$zfs."','".$dzl."','".$m1."','".$m2."','".$m3."','".$m4."','".$m5."','".$m6."','".$m7."','".$m8."','".$m9."','".$m10."','".$m11."','".$m12."'),";
$num++;
}
}
if($num>0){
$sql_value=substr($sql_value,0,-1);
$q1="insert into ".$table." (kh,pl,price,ph,xsje_zb,xsje,ljxsje_zb,zfs,dzl,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12) values ".$sql_value;
//echo $q1."<br>";
$db->query($q1);
$msg.="<span class=\"right\">导入成功!</span><br>";
}
}else{
$content=$_POST["content"];
$arr=explode("\n",$content);
$num=0;
for($i=0;$i<count($arr);$i++){
$arr1=explode(" ",$arr[$i]);
//
$kh=trim($arr1[0]);
$pl=trim($arr1[1]);
$price=trim($arr1[2]);
$ph=trim($arr1[3]);
$xsje_zb=trim($arr1[4]);
$xsje=trim($arr1[5]);
$ljxsje_zb=trim($arr1[6]);
$zfs=trim($arr1[7]);
$dzl=trim($arr1[8]);
$ml=trim($arr1[9]);
$m2=trim($arr1[10]);
$m3=trim($arr1[11]);
$m4=trim($arr1[12]);
$m5=trim($arr1[13]);
$m6=trim($arr1[14]);
$m=trim($arr1[15]);
$m8=trim($arr1[16]);
$m9=trim($arr1[17]);
$m10=trim($arr1[18]);
$m11=trim($arr1[19]);
$m12=trim($arr1[20]);
if(!empty($kh)){
$check=get_db_msg("select id from web_zdb_ls where kh='".$kh."' limit 0,1");
if($check["id"]){
$q1="update ".$table." set pl='".$pl."',price='".$price."',ph='".$ph."',xsje_zb='".$xsje_zb."',xsje='".$xsje."',ljxsje_zb='".$ljxsje_zb."',dzl='".$dzl."',zfs='".$zfs."',m1='".$m1."',m2='".$m2."',m3='".$m3."',m4='".$m4."',m5='".$m5."',m6='".$m6."',m7='".$m7."',m8='".$m8."',m9='".$m9."',m10='".$m10."',m11='".$m11."',m12='".$m12."' where id='".$check["id"]."'";
$db->query($q1);
}else{
$q1="insert into ".$table." (kh,pl,price,ph,xsje_zb,xsje,ljxsje_zb,zfs,dzl,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12) values('".$kh."','".$pl."','".$price."','".$ph."','".$xsje_zb."','".$xsje."','".$ljxsje_zb."','".$zfs."','".$dzl."','".$m1."','".$m2."','".$m3."','".$m4."','".$m5."','".$m6."','".$m7."','".$m8."','".$m9."','".$m10."','".$m11."','".$m12."')";
$db->query($q1);
}
}
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>智订宝,历史畅销款导入</title>
<style>
BODY{
font-family:宋体;FONT-SIZE:12px;margin:0px;padding:0px;
}
a,a:link,a:visited,a:active {
text-decoration:none;COLOR: #0000ff;FONT-SIZE:12px;
}
a:hover {
TEXT-DECORATION: underline;COLOR: #aaaa9f;FONT-SIZE:12px;
}
body,input,td,select,div,li,ul,textarea,form {
font-family:宋体;
FONT-SIZE:12px;
}
.wrong{
color:#ff0000;font-weight:bold;
}
</style>
</head>
<body>
<br />
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#cccccc">
<form name="form1" action="" method="post">
<input type="hidden" name="is_submit" value="y">
<tr>
<td align="center" bgcolor="#f0f0f0"><b>智订宝,历史畅销款导入</b></td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">
<label><input type="radio" name="dd" value="1" checked>清空导入</label>
<label><input type="radio" name="dd" value="2">新增导入</label>
</td>
</tr>
<tr>
<td align="left" bgcolor="#ffffff" style="line-height:25px;">格式说明:款号,品类,价格,排名,销售占比,销售额,累计销售占比,Z分数,打折率,1月销售量,2月销售量,3月销售量,4月销售量,5月销售量,6月销售量,7月销售量,8月销售量,9月销售量,10月销售量,11月销售量,12月销售量;用制表符分隔;多条记录请回车。<Br>
<textarea name="content" style="width:100%;" rows="20"><?php echo $content; ?></textarea></td>
</tr>
<tr>
<td align="center" bgcolor="#f0f0f0"><input type="submit" value=" 提 交 "></td>
</tr>
<?php
if($msg){
echo "<tr><td align=\"left\" bgcolor=\"#ffffff\" valign=\"top\" style=\"line-height:150%;\">".$msg."</td></tr>";
}
?>
</form>
</table>
</body>
</html>