"折线图","markArea"=>"点状图","bar"=>"柱形图","barmore"=>"多维柱状图","shadow"=>"堆叠条形图","pie"=>"饼图"); $json_data.="\"uid\":".$uid.","; switch($_a){ case "add": $str1=""; foreach($tbcate_arr as $key=>$val){ $str1.="{\"no\":\"".$key."\",\"title\":\"".$val."\"},"; } // $json_data.="\"tbcate_list\":{\"value\":\"".$tbcate."\",\"op\":[".substr($str1,0,-1)."]},"; break; case "save_add": $tmp=get_db_msg("select id from web_zdb_config where title='".$title."' and title2='".$title2."' limit 0,1"); if($tmp["id"]){ $json_data.="\"code\":\"-1\",\"msg\":\"已存在!\","; }else{ $db->query("insert into web_zdb_config(title,title2,tb_cate) values('".$title."','".$title2."','".$tbcate."')"); $json_data.="\"code\":1,"; } break; case "del": $id=(is_array($id))?$id:array($id); $num=count($id); for($i=0;$i<$num;$i++){ $q="delete from web_zdb_config where id='".$id[$i]."'"; $db->query($q); $lid.=$id[$i].", "; } $lid=substr($lid,0,-2); $json_data.="\"code\":1,"; break; //-------------主界面 default: // $page=$page>0?$page:1; $limit=$limit>0?$limit:10; $start=($page-1)*$limit; $end=$limit; //取得总条数 $tmp=get_db_msg("select count(*) 'num' from web_zdb_config ".$sql_con); $total_num=$tmp["num"]; $json_data.="\"code\":0,\"msg\":\"\",\"count\":".$total_num.",\"data\":["; $count=1; $str_tmp=""; $sql="select * from web_zdb_config ".$sql_con." order by id limit ".$start.",".$end; $res=$db->query($sql); while($msg=$db->fetch_array($res)){ $list=$count+$start; $str_tmp.="{"; $str_tmp.="\"ct\":\"".$list."\","; $str_tmp.="\"id\":\"".$msg["id"]."\","; $str_tmp.="\"title\":\"".$msg["title"]."\","; $str_tmp.="\"title2\":\"".$msg["title2"]."\","; $str_tmp.="\"tbcate\":\"".$msg["tb_cate"]."(".$tbcate_arr[$msg["tb_cate"]].")\""; $str_tmp.="},"; $count++; } $json_data.=substr($str_tmp,0,-1)."],"; break; } } $json_data=substr($json_data,0,-1)."}"; echo $json_data; ?>