$arr = $dsql->GetOne("SELECT * FROM `zuimoban_sys_enum` WHERE egroup='$egroup' AND (evalue MOD 500)=0 ORDER BY disorder DESC ");
if(!is_array($arr)) $disorder = $evalue = ($issign==1 ? 1 : 500);
else $disorder = $evalue = $arr['disorder'] + ($issign==1 ? 1 : 500);
$father = intval(floor($evalue/500))*500;
$dsql->ExecuteNoneQuery("INSERT INTO `zuimoban_sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`,`father`)
VALUES('$ename','$evalue','$egroup','$disorder','$issign','$father'); ");
}
WriteEnumsCache($egroup);
ShowMsg("成功添加枚举分类!".$dsql->GetError(), $ENV_GOBACK_URL);
exit();
} else if ($issign == 2 && $topvalue != 0)
{
$minid = $topvalue;
$maxnum = 500; // 三级子类最多500个
$enames = explode(',', $ename);
foreach ($enames as $ename)
{
$arr = $dsql->GetOne("SELECT * FROM `zuimoban_sys_enum` WHERE egroup='$egroup' AND evalue LIKE '$topvalue.%%%' ORDER BY evalue DESC ");
if(!is_array($arr))
{
$disorder = $minid;
$evalue = $minid.'.001';
}
else
{
$disorder = $minid;
preg_match("#([0-9]{1,})\.([0-9]{1,})#", $arr['evalue'], $matchs);
$addvalue = $matchs[2] + 1;
$addvalue = sprintf("%03d", $addvalue);
$evalue = $matchs[1].'.'.$addvalue;
}
$father = intval(floor($evalue/500))*500;
$sql = "INSERT INTO `zuimoban_sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`,`father`)
VALUES('$ename','$evalue','$egroup','$disorder','$issign','$father'); ";
// echo $sql;exit;
$dsql->ExecuteNoneQuery($sql);
}
// echo $minid;
WriteEnumsCache($egroup);
ShowMsg("成功添加枚举分类!", $ENV_GOBACK_URL);
exit();
} else {
$minid = $topvalue;
$maxid = $topvalue + 500;
$enames = explode(',', $ename);
foreach($enames as $ename)
{