<?php
header("Content-type: text/html; charset=utf-8");
@define("CORE",dirname(__FILE__)."/"); 	  //根目录
require_once("include/mysql.php");        //数据类
require_once("include/conn.php");         //核心类
require_once("include/inc.php");          //核心类
require_once("include/pinyin.php");		  //拼音
set_time_limit(0);
if(empty($cs)){$cs = "";echo "2,<a href=\"update.php?cs=py\" target=\"_blank\">更新拼音库，可以拼音简写搜索》》</a>";exit;}
if($cs=='py'){
echo "<font style=\"color:#f00;\"> 开始更新^-^，，</font></br>";
sleep(2);
	$sql="SELECT item FROM `cs_price` ";
	$db->query($sql);
	$row=$db->fetchAll();
	foreach($row as $key=>$val){
		$item=$row[$key][item];
		$py=iconv("utf-8","gbk",$item);
		$word=$PingYing->getFirstPY($py)." ".$PingYing->getAllPY($py);
		$sql="UPDATE `cs_price` SET  `word` = '$word' where `cs_price`.`item`='$item'";
		$db->query($sql);
		echo $row[$key][item]."----成功</br>";	
	}
echo "</br><font style=\"color:#f00;\">价格拼音库更新完毕-------请勿关闭浏览器--正在更新客户拼音库(数据多的速度很慢，耐心等候)</font></br>";
print str_pad("",10000);
sleep(3);
	$sql2="SELECT id,name FROM `cs_info` order by id";
	$db->query($sql2);
	$list=$db->fetchAll();
	foreach($list as $key=>$val){
		$name=$list[$key][name];
		$py=iconv("utf-8","gbk",$name);
		$word=$PingYing->getFirstPY($py)." ".$PingYing->getAllPY($py);
		$sql2a="UPDATE `cs_info` SET  `word` = '$word' where `cs_info`.`name`='$name'";
		$db->query($sql2a);
		echo $list[$key][name].$list[$key][id]."----生成</br>";
		print str_pad("...",1000);
	}
	

	echo "</br><font style=\"color:#f00;\">拼音库更新完毕-------</font></br>现在可以关闭浏览器了，谢谢使用";
print str_pad("",10000);
exit;
}

print str_pad("",10000);
echo "</br><font style=\"color:#f00;\"> <a href=\"update.php?cs=py\" target=\"_blank\">需要更新拼音库的点这里》》</a>--更新后客服表可以按拼音简写搜索--数据量大的会很久，耐心等候^-^，，</font></br>";
print str_pad("",10000);

exit;
?>