/** * * @do ajax 获取月浏览数据 * * @sign public * @author jerry * @copyright rockhippo * @param - * @return html * */ public function ajaxMonthlypointHtmlAction() { $start = reqstr("start", ""); $end = reqstr("end", ""); $PSys_signModel = new PSys_PageviewModel(); $where["month_>="] = $start; $where["month_<="] = $end; $order = "month ASC"; $result = $PSys_signModel->GetList($where, $order, 0, 0, "*", "rhc_lottery_monthly"); $start_num = $new_reg = $new_num = $cost_points = $get_points = $first_get_points = $third_get_points = $second_get_points = $fourth_get_points = $fifth_get_points = ""; foreach ($result["allrow"] as $k => $v) { $start_num += intval($v["start_num"]); $new_reg += intval($v["new_reg"]); $new_num += intval($v["new_num"]); $cost_points += intval($v["cost_points"]); $get_points += intval($v["get_points"]); $first_get_points += intval($v["first_get_points"]); $third_get_points += intval($v["third_get_points"]); $second_get_points += intval($v["second_get_points"]); $fourth_get_points += intval($v["fourth_get_points"]); $fifth_get_points += intval($v["fifth_get_points"]); } $this->smarty->assign("data", $result["allrow"]); $this->smarty->assign("start_num", $start_num); $this->smarty->assign("new_reg", $new_reg); $this->smarty->assign("new_num", $new_num); $this->smarty->assign("cost_points", $cost_points); $this->smarty->assign("get_points", $get_points); $this->smarty->assign("first_get_points", $first_get_points); $this->smarty->assign("third_get_points", $third_get_points); $this->smarty->assign("second_get_points", $second_get_points); $this->smarty->assign("fourth_get_points", $fourth_get_points); $this->smarty->assign("fifth_get_points", $fifth_get_points); $this->forward = "ajaxMonthlyPoint"; }
/** * * @do ajax 获取月浏览数据 * * @package public * @author jerry * @copyright rockhippo * @param - * @return html * */ public function ajaxMonthlyPackageHtmlAction() { $start = reqstr("start", ""); $end = reqstr("end", ""); $game = reqstr("game", ""); $PSys_packageModel = new PSys_PageviewModel(); $where["month_>="] = $start; $where["month_<="] = $end; $where["game"] = $game; $order = "month ASC"; $result = $PSys_packageModel->GetList($where, $order, 0, 0, "*", "rhc_package_monthly"); $send_times = ""; foreach ($result["allrow"] as $k => $v) { $send_times += intval($v["send_times"]); } $this->smarty->assign("data", $result["allrow"]); $this->smarty->assign("send_times", $send_times); $this->forward = "ajaxMonthlyPackage"; }
/** * * @do ajax 获取月浏览数据 * * @sign public * @author jerry * @copyright rockhippo * @param - * @return html * */ public function ajaxMonthlyuserHtmlAction() { $start = reqstr("start", ""); $end = reqstr("end", ""); $PSys_signModel = new PSys_PageviewModel(); $where["month_>="] = $start; $where["month_<="] = $end; $order = "month ASC"; $result = $PSys_signModel->GetList($where, $order, 0, 0, "*", "rhc_wxcompet_monthly"); $open_num = $share_times = $share_ok = $dl_click = $dj_click = $dl_ad_click = $dl_ios_click = $start_dl_times = $new_num = $new_reg = ""; foreach ($result["allrow"] as $k => $v) { $open_num += intval($v["open_num"]); $new_reg += intval($v["new_reg"]); $new_num += intval($v["new_num"]); $share_times += intval($v["share_times"]); $share_ok += intval($v["share_ok"]); $dl_click += intval($v["dl_click"]); $dj_click += intval($v["dj_click"]); $dl_ad_click += intval($v["dl_ad_click"]); $dl_ios_click += intval($v["dl_ios_click"]); $start_dl_times += intval($v["start_dl_times"]); } $this->smarty->assign("data", $result["allrow"]); $this->smarty->assign("open_num", $open_num); $this->smarty->assign("new_reg", $new_reg); $this->smarty->assign("new_num", $new_num); $this->smarty->assign("share_times", $share_times); $this->smarty->assign("share_ok", $share_ok); $this->smarty->assign("dl_click", $dl_click); $this->smarty->assign("dj_click", $dj_click); $this->smarty->assign("dl_ad_click", $dl_ad_click); $this->smarty->assign("dl_ios_click", $dl_ios_click); $this->smarty->assign("start_dl_times", $start_dl_times); $this->forward = "ajaxMonthlyUser"; }
/** * * @do ajax 获取月浏览数据 * * @member public * @author jerry * @copyright rockhippo * @param - * @return html * */ public function ajaxMonthlymemberHtmlAction() { $start = reqstr("start", ""); $end = reqstr("end", ""); $PSys_memberModel = new PSys_PageviewModel(); $where["month_>="] = $start; $where["month_<="] = $end; $order = "month ASC"; $result = $PSys_memberModel->GetList($where, $order, 0, 0, "*", "rhc_member_monthly"); $total_active_user = $total_new_user = $total_old_user = 0; foreach ($result["allrow"] as $k => $v) { $total_new_user += intval($v["new_user"]); $total_old_user += intval($v["old_user"]); $total_active_user += intval($v["active_user"]); $total_open_num += intval($v["open_num"]); } $this->smarty->assign("data", $result["allrow"]); $this->smarty->assign("total_new_user", $total_new_user); $this->smarty->assign("total_old_user", $total_old_user); $this->smarty->assign("total_active_user", $total_active_user); $this->smarty->assign("total_open_num", $total_open_num); $this->forward = "ajaxMonthlyMember"; }
/** * * @do ajax 获取月浏览数据 * * @btnclick public * @author jerry * @copyright rockhippo * @param - * @return html * */ public function ajaxMonthlyBtnclickHtmlAction() { $start = reqstr("start", ""); $end = reqstr("end", ""); $PSys_BtnclickModel = new PSys_PageviewModel(); $where["month_>="] = $start; $where["month_<="] = $end; $order = "month ASC"; $result = $PSys_BtnclickModel->GetList($where, $order, 0, 0, "*", "rhc_click_monthly"); $btn_201 = $btn_202 = $btn_203 = $btn_204 = $btn_205 = $btn_207 = $btn_208 = $btn_301 = $btn_302 = $btn_303 = $btn_401 = $btn_402 = $btn_501 = $btn_601 = $btn_602 = $btn_603 = $btn_604 = $btn_605 = $btn_701 = $btn_702 = $btn_801 = 0; foreach ($result["allrow"] as $k => $v) { $btn_201 += intval($v["btn_201"]); $btn_202 += intval($v["btn_202"]); $btn_203 += intval($v["btn_203"]); $btn_204 += intval($v["btn_204"]); $btn_205 += intval($v["btn_205"]); $btn_207 += intval($v["btn_207"]); $btn_208 += intval($v["btn_208"]); $btn_301 += intval($v["btn_301"]); $btn_302 += intval($v["btn_302"]); $btn_303 += intval($v["btn_303"]); $btn_401 += intval($v["btn_401"]); $btn_402 += intval($v["btn_402"]); $btn_501 += intval($v["btn_501"]); $btn_601 += intval($v["btn_601"]); $btn_602 += intval($v["btn_602"]); $btn_603 += intval($v["btn_603"]); $btn_604 += intval($v["btn_604"]); $btn_605 += intval($v["btn_605"]); $btn_701 += intval($v["btn_701"]); $btn_702 += intval($v["btn_702"]); $btn_801 += intval($v["btn_801"]); } $this->smarty->assign("data", $result["allrow"]); $this->smarty->assign("btn_201", $btn_201); $this->smarty->assign("btn_202", $btn_202); $this->smarty->assign("btn_203", $btn_203); $this->smarty->assign("btn_204", $btn_204); $this->smarty->assign("btn_205", $btn_205); $this->smarty->assign("btn_207", $btn_207); $this->smarty->assign("btn_208", $btn_208); $this->smarty->assign("btn_301", $btn_301); $this->smarty->assign("btn_302", $btn_302); $this->smarty->assign("btn_303", $btn_303); $this->smarty->assign("btn_401", $btn_401); $this->smarty->assign("btn_402", $btn_402); $this->smarty->assign("btn_501", $btn_501); $this->smarty->assign("btn_601", $btn_601); $this->smarty->assign("btn_602", $btn_602); $this->smarty->assign("btn_603", $btn_603); $this->smarty->assign("btn_604", $btn_604); $this->smarty->assign("btn_605", $btn_605); $this->smarty->assign("btn_701", $btn_701); $this->smarty->assign("btn_702", $btn_702); $this->smarty->assign("btn_801", $btn_801); $this->forward = "ajaxMonthlyBtnclick"; }
/** * * @do ajax 获取月浏览数据 * * @sign public * @author jerry * @copyright rockhippo * @param - * @return html * */ public function ajaxMonthlyanswerHtmlAction() { $start = reqstr("start", ""); $end = reqstr("end", ""); $PSys_signModel = new PSys_PageviewModel(); $where["month_>="] = $start; $where["month_<="] = $end; $order = "month ASC"; $result = $PSys_signModel->GetList($where, $order, 0, 0, "*", "rhc_answer_monthly"); $total_01 = $total_02 = $total_03 = $total_04 = $total_05 = $total_06 = $total_07 = $total_08 = $total_09 = $total_10 = $total_11 = $total_start_times = $total_submit_times = ''; $newarr_01 = $newarr_02 = $newarr_03 = $newarr_04 = $newarr_05 = $newarr_06 = $newarr_07 = $newarr_07 = $newarr_08 = $newarr_10 = $newarr_11 = array(); foreach ($result["allrow"] as $k => $v) { $total_start_times += $v['start_times']; $total_submit_times += $v['submit_times']; $answer_1 = $v['answer_1']; $answer_2 = $v['answer_2']; $answer_3 = $v['answer_3']; $answer_4 = $v['answer_4']; $answer_5 = $v['answer_5']; $answer_6 = $v['answer_6']; $answer_7 = $v['answer_7']; $answer_8 = $v['answer_8']; $answer_9 = $v['answer_9']; $answer_10 = $v['answer_10']; $answer_11 = $v['answer_11']; $temparr_01 = explode("-", $answer_1); foreach ($temparr_01 as $k => $v) { $newarr_01[$k] += $v; } $temparr_02 = explode("-", $answer_2); foreach ($temparr_02 as $k => $v) { $newarr_02[$k] += $v; } $temparr_03 = explode("-", $answer_3); foreach ($temparr_03 as $k => $v) { $newarr_03[$k] += $v; } $temparr_04 = explode("-", $answer_4); foreach ($temparr_04 as $k => $v) { $newarr_04[$k] += $v; } $temparr_05 = explode("-", $answer_5); foreach ($temparr_05 as $k => $v) { $newarr_05[$k] += $v; } $temparr_06 = explode("-", $answer_6); foreach ($temparr_06 as $k => $v) { $newarr_06[$k] += $v; } $temparr_07 = explode("-", $answer_7); foreach ($temparr_07 as $k => $v) { $newarr_07[$k] += $v; } $temparr_08 = explode("-", $answer_8); foreach ($temparr_08 as $k => $v) { $newarr_08[$k] += $v; } $temparr_09 = explode("-", $answer_9); foreach ($temparr_09 as $k => $v) { $newarr_09[$k] += $v; } $temparr_10 = explode("-", $answer_10); foreach ($temparr_10 as $k => $v) { $newarr_10[$k] += $v; } $temparr_11 = explode("-", $answer_11); foreach ($temparr_11 as $k => $v) { $newarr_11[$k] += $v; } } foreach ($newarr_01 as $v) { $total_01 .= $v . '-'; } foreach ($newarr_02 as $v) { $total_02 .= $v . '-'; } foreach ($newarr_03 as $v) { $total_03 .= $v . '-'; } foreach ($newarr_04 as $v) { $total_04 .= $v . '-'; } foreach ($newarr_05 as $v) { $total_05 .= $v . '-'; } foreach ($newarr_06 as $v) { $total_06 .= $v . '-'; } foreach ($newarr_07 as $v) { $total_07 .= $v . '-'; } foreach ($newarr_08 as $v) { $total_08 .= $v . '-'; } foreach ($newarr_09 as $v) { $total_09 .= $v . '-'; } foreach ($newarr_10 as $v) { $total_10 .= $v . '-'; } foreach ($newarr_11 as $v) { $total_11 .= $v . '-'; } $PSys_PointRule = new PSys_PointRule(); $sql = 'select DISTINCT answer from rhi_answer where ques_id = 11 and answer not in("A","B","C","D") and cday between ' . date('Ymd', strtotime($start . '-01')) . ' and ' . date('Ymt', strtotime($end)); //$sql = 'select answer from rhi_survey where answer_12 not in("A","B","C","D") and cday between '.date('Ymd',strtotime($start.'-01')).' and '.date('Ymt',strtotime($end)); $gamelist = $PSys_PointRule->answerSql($sql); $this->smarty->assign("gamelist", $gamelist); $this->smarty->assign("data", $result["allrow"]); $this->smarty->assign("total_01", trim($total_01, '-')); $this->smarty->assign("total_02", trim($total_02, '-')); $this->smarty->assign("total_03", trim($total_03, '-')); $this->smarty->assign("total_04", trim($total_04, '-')); $this->smarty->assign("total_05", trim($total_05, '-')); $this->smarty->assign("total_06", trim($total_06, '-')); $this->smarty->assign("total_07", trim($total_07, '-')); $this->smarty->assign("total_08", trim($total_08, '-')); $this->smarty->assign("total_09", trim($total_09, '-')); $this->smarty->assign("total_10", trim($total_10, '-')); $this->smarty->assign("total_11", trim($total_11, '-')); $this->smarty->assign("total_start_times", $total_start_times); $this->smarty->assign("total_submit_times", $total_submit_times); $this->forward = "ajaxMonthlyAnswer"; }
/** * * @do ajax 获取月浏览数据 * * @point public * @author jerry * @copyright rockhippo * @param - * @return html * */ public function ajaxMonthlypointHtmlAction() { $start = reqstr("start", ""); $end = reqstr("end", ""); $PSys_pointModel = new PSys_PageviewModel(); $where["month_>="] = $start; $where["month_<="] = $end; $order = "month ASC"; $result = $PSys_pointModel->GetList($where, $order, 0, 0, "*", "rhc_point_monthly"); $total_send_point = $total_use_point = $sign_point = $download_point = $buy_point = $package_point = $huoban_point = $huafei_point = $other_point = 0; foreach ($result["allrow"] as $k => $v) { $total_send_point += intval($v["total_send_point"]); $total_use_point += intval($v["total_use_point"]); $sign_point += intval($v["sign_point"]); $download_point += intval($v["download_point"]); $buy_point += intval($v["buy_point"]); $package_point += intval($v["package_point"]); $huoban_point += intval($v["huoban_point"]); $huafei_point += intval($v["huafei_point"]); $other_point += intval($v["other_point"]); $result["allrow"][$k]['total_use_point'] = abs($v["total_use_point"]); $result["allrow"][$k]['huafei_point'] = abs($v["huafei_point"]); } $total_use_point = abs($total_use_point); $huafei_point = abs($huafei_point); $this->smarty->assign("data", $result["allrow"]); $this->smarty->assign("total_send_point", $total_send_point); $this->smarty->assign("total_use_point", $total_use_point); $this->smarty->assign("sign_point", $sign_point); $this->smarty->assign("download_point", $download_point); $this->smarty->assign("buy_point", $buy_point); $this->smarty->assign("package_point", $package_point); $this->smarty->assign("huoban_point", $huoban_point); $this->smarty->assign("huafei_point", $huafei_point); $this->smarty->assign("other_point", $other_point); $this->forward = "ajaxMonthlyPoint"; }
/** * * @do ajax 获取月浏览数据 * * @sign public * @author jerry * @copyright rockhippo * @param - * @return html * */ public function ajaxMonthlysignHtmlAction() { $start = reqstr("start", ""); $end = reqstr("end", ""); $PSys_signModel = new PSys_PageviewModel(); $where["month_>="] = $start; $where["month_<="] = $end; $order = "month ASC"; $result = $PSys_signModel->GetList($where, $order, 0, 0, "*", "rhc_sign_monthly"); $total_start_times = $total_sign_times = 0; foreach ($result["allrow"] as $k => $v) { $total_start_times += intval($v["start_times"]); $total_sign_times += intval($v["sign_times"]); $sign_rate = round(intval($v["sign_times"]) / intval($v["start_times"]) * 100, 2); $result["allrow"][$k]['sign_rate'] = $sign_rate . "%"; } $this->smarty->assign("data", $result["allrow"]); $this->smarty->assign("total_start_times", $total_start_times); $this->smarty->assign("total_sign_times", $total_sign_times); $this->forward = "ajaxMonthlySign"; }
/** * * @do ajax 获取月浏览数据 * * @pageview public * @author jerry * @copyright rockhippo * @param - * @return html * */ public function ajaxMonthlyPageviewHtmlAction() { $start = reqstr("start", ""); $end = reqstr("end", ""); $PSys_PageviewModel = new PSys_PageviewModel(); $PSys_PageviewRule = new PSys_PageviewRule(); $where["month_>="] = $start; $where["month_<="] = $end; $order = "month ASC"; $result = $PSys_PageviewModel->GetList($where, $order, 0, 0, "*", "rhc_view_monthly"); $total_start_times = $total_page_views = $total_online_times = 0; foreach ($result["allrow"] as $k => $v) { $total_start_times += intval($v["start_times"]); $total_page_views += intval($v["page_views"]); $total_online_times += $v["online_times"]; $sql = 'SELECT count(client) AS "wifi" FROM rhc_game_platform WHERE type = 1 AND station_id > 0 AND cday like "' . date('Ym', strtotime($v['month'])) . '%"'; $rs = $PSys_PageviewRule->tempQuery($sql); $result["allrow"][$k]['wifi'] = $rs[0]['wifi']; $result["allrow"][$k]['nowifi'] = $v['start_times'] - $rs[0]['wifi']; } $this->smarty->assign("data", $result["allrow"]); $this->smarty->assign("total_start_times", $total_start_times); $this->smarty->assign("total_page_views", $total_page_views); $this->smarty->assign("total_online_times", $total_online_times); $this->forward = "ajaxMonthlyPageview"; }
/** * * @do ajax 获取浏览数据 * * @member public * @author jerry * @copyright rockhippo * @param - * @return html * */ public function ajaxAppuserHtmlAction() { $start = reqstr("start", ""); $end = reqstr("end", ""); $PSys_memberModel = new PSys_PageviewModel(); $where["day_>="] = $start; $where["day_<="] = $end; $order = "day ASC"; $result = $PSys_memberModel->GetList($where, $order, 0, 0, "*", "rhc_member_daily"); $open_app = $active_user = $total_old_user = 0; foreach ($result["allrow"] as $k => $v) { $result["allrow"][$k]['old_appuser'] = intval($v["active_appuser"] - $v["new_appuser"]); $open_app += intval($v["open_app"]); $new_appuser += intval($v["new_appuser"]); $active_appuser += intval($v["active_appuser"]); $old_appuser += intval($v["active_appuser"] - $v["new_appuser"]); } $this->smarty->assign("data", $result["allrow"]); $this->smarty->assign("open_app", $open_app); $this->smarty->assign("new_appuser", $new_appuser); $this->smarty->assign("active_appuser", $active_appuser); $this->smarty->assign("old_appuser", $old_appuser); $this->forward = "ajaxAppuser"; }
/** * * @do ajax 访问人数 uv数据 * * @pageview public * @author Nick * @copyright rockhippo * @param - * @return - * */ public function ajaxUVpageviewAction() { $PSys_PageviewModel = new PSys_PageviewModel(); $where = array(); $fastSearch = reqnum("fastSearch", 0); //快速查询 $dataStatusFS = reqnum("datastatusFS", 1); //快速查询合并、比较筛选按钮 1为合并 2为比较 默认合并 switch ($fastSearch) { case 1: //当天 $date = date("Y-m-d"); $data = array(); //x轴数据 $data['xv'] = array('00' => '0 hour', '01' => '1 hour', '02' => '2 hour', '03' => '3 hour', '04' => '4 hour', '05' => '5 hour', '06' => '6 hour', '07' => '7 hour', '08' => '8 hour', '09' => '9 hour', '10' => '10 hour', '11' => '11 hour', '12' => '12 hour', '13' => '13 hour', '14' => '14 hour', '15' => '15 hour', '16' => '16 hour', '17' => '17 hour', '18' => '18 hour', '19' => '19 hour', '20' => '20 hour', '21' => '21 hour', '22' => '22 hour', '23' => '23 hour'); if ($dataStatusFS == 1) { $group = "`hour`"; $dbname = "rha_aclog_hour"; $result = $PSys_PageviewModel->getDay($date, $group, $dbname); //合并的数据节点设置 $data['data'][1]['name'] = '所有站点'; $data['data'][1]['marker'] = "square"; foreach ($result as $key => $val) { $total[$val['date']] = $val['total']; $data['data'][1]['id'][] = $val['id']; $data['data']['table'][1][] = array('date' => $val['date'], 'total' => $val['total']); } foreach ($data['xv'] as $k => $v) { $data['data'][1]['data'][] = $total[$k] != '' ? intval($total[$k]) : 0; } $data['data']['num'] = 1; } else { $group = "`hour`,`stationid`"; $dbname = "rha_aclog_hour"; $result = $PSys_PageviewModel->getDay($date, $group, $dbname); foreach ($result as $key => $val) { $total[$val['stationid']][$val['date']] = $val['total']; //$data['data'][$val['stationid']]['data'][] = intval($val['total']); $data['data'][$val['stationid']]['id'][] = $val['id']; $data['data']['table'][$val['stationid']][] = array('date' => $val['date'], 'total' => $val['total']); } //比较的数据节点设置 foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['name'] = $val['stationname']; $data['data'][$val['id']]['marker'] = "square"; $data['data']['table'][$val['id']] = is_array($data['data']['table'][$val['id']]) ? $data['data']['table'][$val['id']] : array(); $stationChoice[] = $val['id']; foreach ($data['xv'] as $k => $v) { $data['data'][$val['id']]['data'][] = $total[$val['id']][$k] != '' ? intval($total[$val['id']][$k]) : 0; } } unset($data['data'][0]); unset($data['data']['table'][0]); $data['data']['num'] = count($station['allrow']); } $data['data']['key'] = array("小时", "人数"); //table 栏目提示 array按顺序 break; case 2: //本周 $bdate = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - date("w") + 1, date("Y"))); $edate = date("Y-m-d", mktime(23, 59, 59, date("m"), date("d") - date("w") + 7, date("Y"))); if (date("N", strtotime($bdate)) == 1) { $data = array(); $data['error'] = 'WEEKNODATA'; break; } $data = array(); if ($dataStatusFS == 1) { $group = "date"; $dbname = "rha_wifi_daily"; $result = $PSys_PageviewModel->getWeek($bdate, $edate, $group, $dbname); //x轴数据 $data['xv'] = array(); $data['data'][1]['name'] = "所有站点"; $data['data'][1]['marker'] = "square"; foreach ($result as $key => $val) { $total[$val['date']] = $val['total']; $data['data']['table'][1][] = array('date' => $val['date'], 'total' => $val['total']); } for ($i = 1; $i <= 7; $i++) { $data['xv'][] = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - date("w") + $i, date("Y"))); //$data['data'][1]['data'][] = intval($result[$i-1]['total']); $data['data'][1]['data'][] = $total[date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - date("w") + $i, date("Y")))] ? intval($total[date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - date("w") + $i, date("Y")))]) : 0; } $data['data']['num'] = 1; $data['data']['key'] = array("日期", "人数"); //table 栏目提示 array按顺序 } else { $group = "`date`,`station`"; $dbname = "rha_wifi_daily"; $result = $PSys_PageviewModel->getWeek($bdate, $edate, $group, $dbname); foreach ($result as $key => $val) { $total[$val['station']][$val['date']] = $val['total']; //$data['data'][$val['station']]['data'][] = intval($val['total']); $data['data']['table'][$val['station']][] = array('date' => $val['date'], 'total' => $val['total']); } //x轴数据 $data['xv'] = array(); //比较的数据节点设置 foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['name'] = $val['stationname']; $data['data'][$val['id']]['marker'] = "square"; $data['data']['table'][$val['id']] = is_array($data['data']['table'][$val['id']]) ? $data['data']['table'][$val['id']] : array(); $stationChoice[] = $val['id']; } //print_r($total[1][date("Y-m-d",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y")))]); for ($i = 1; $i <= 7; $i++) { $data['xv'][] = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - date("w") + $i, date("Y"))); foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['data'][] = $total[$val['id']][date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - date("w") + $i, date("Y")))] ? intval($total[$val['id']][date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - date("w") + $i, date("Y")))]) : 0; } } $data['data']['num'] = count($station['allrow']); $data['data']['key'] = array("日期", "人数"); //table 栏目提示 array按顺序 } break; case 3: //本月 $bdate = date("Y-m-d", mktime(0, 0, 0, date("m"), 1, date("Y"))); $edate = date("Y-m-d", mktime(23, 59, 59, date("m"), date("t"), date("Y"))); if (date("j") == 1) { $data = array(); $data['error'] = 'MONTHNODATA'; break; } $data = array(); if ($dataStatusFS == 1) { $group = "date"; $dbname = "rha_wifi_daily"; $result = $PSys_PageviewModel->getWeek($bdate, $edate, $group, $dbname); //x轴数据 $data['xv'] = array(); $data['data'][1]['name'] = "所有站点"; $data['data'][1]['marker'] = "square"; //遍历数据 foreach ($result as $key => $val) { $total[$val['date']] = $val['total']; $data['data']['table'][1][] = array('date' => $val['date'], 'total' => $val['total']); } for ($i = 1; $i <= date("t"); $i++) { $data['xv'][] = date("d", mktime(0, 0, 0, date("m"), $i, date("Y"))); $data['data'][1]['data'][] = $total[date("Y-m-d", mktime(0, 0, 0, date("m"), $i, date("Y")))] ? intval($total[date("Y-m-d", mktime(0, 0, 0, date("m"), $i, date("Y")))]) : 0; } $data['data']['num'] = 1; $data['data']['key'] = array("日期", "人数"); //table 栏目提示 array按顺序 } else { $group = "`date`,`station`"; $dbname = "rha_wifi_daily"; $result = $PSys_PageviewModel->getWeek($bdate, $edate, $group, $dbname); //x轴数据 $data['xv'] = array(); //比较的数据节点设置 foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['name'] = $val['stationname']; $data['data'][$val['id']]['marker'] = "square"; $data['data']['table'][$val['id']] = array(); $stationChoice[] = $val['id']; } //遍历数据 foreach ($result as $key => $val) { $total[$val['date']][$val['station']] = $val['total']; $data['data']['table'][$val['station']][] = array('date' => $val['date'], 'total' => $val['total']); } for ($i = 1; $i <= date("t"); $i++) { $data['xv'][] = date("d", mktime(0, 0, 0, date("m"), $i, date("Y"))); //遍历数据 foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['data'][] = $total[date("Y-m-d", mktime(0, 0, 0, date("m"), $i, date("Y")))][$val['id']] == '' ? 0 : intval($total[date("Y-m-d", mktime(0, 0, 0, date("m"), $i, date("Y")))][$val['id']]); } } $data['data']['num'] = count($station['allrow']); $data['data']['key'] = array("日期", "人数"); //table 栏目提示 array按顺序 } break; default: $dateSearch = reqstr("dateSearch", ""); $datastatus = reqnum("datastatus", 1); $stationC = reqarray("stationC"); $screening['station'] = ""; $stationChoice = array(); if ($stationC == array()) { //若为空则为不排除站点 foreach ($station['allrow'] as $key => $val) { $screening['station'] .= '<a class="btn" id="close-station-' . $val['id'] . '" onclick="screeningSpan(\'close-station\',' . $val['id'] . ');">' . $val['stationname'] . ' <i class="icon-remove"></i><input type="hidden" name="stationCheck[]" value="' . $val['id'] . '" /></a> '; $stationChoice[] = $val['id']; //选中的站点 } } else { foreach ($station['allrow'] as $key => $val) { if (in_array($val['id'], $stationC)) { $screening['station'] .= '<a class="btn" id="close-station-' . $val['id'] . '" onclick="screeningSpan(\'close-station\',' . $val['id'] . ');">' . $val['stationname'] . ' <i class="icon-remove"></i><input type="hidden" name="stationCheck[]" value="' . $val['id'] . '" /></a> '; $stationChoice[] = $val['id']; //选中的站点 } } } switch ($dateSearch) { case "oneday": $date = reqstr("oneday"); $data = array(); //x轴数据 $data['xv'] = array('00' => '0 hour', '01' => '1 hour', '02' => '2 hour', '03' => '3 hour', '04' => '4 hour', '05' => '5 hour', '06' => '6 hour', '07' => '7 hour', '08' => '8 hour', '09' => '9 hour', '10' => '10 hour', '11' => '11 hour', '12' => '12 hour', '13' => '13 hour', '14' => '14 hour', '15' => '15 hour', '16' => '16 hour', '17' => '17 hour', '18' => '18 hour', '19' => '19 hour', '20' => '20 hour', '21' => '21 hour', '22' => '22 hour', '23' => '23 hour'); if ($datastatus == 1) { $group = "`hour`"; $dbname = "rha_aclog_hour"; $result = $PSys_PageviewModel->getDay($date, $group, $dbname, $stationChoice); //合并的数据节点设置 $data['data'][1]['name'] = '所有站点'; $data['data'][1]['marker'] = "square"; foreach ($result as $key => $val) { $total[$val['date']] = $val['total']; $data['data'][1]['id'][] = $val['id']; $data['data']['table'][1][] = array('date' => $val['date'], 'total' => $val['total']); } foreach ($data['xv'] as $k => $v) { $data['data'][1]['data'][] = $total[$k] != '' ? intval($total[$k]) : 0; } $data['data']['num'] = 1; $stationChoice = array(); $stationChoice[0] = 1; } else { $group = "`hour`,`stationid`"; $dbname = "rha_aclog_hour"; $result = $PSys_PageviewModel->getDay($date, $group, $dbname, $stationChoice); foreach ($result as $key => $val) { $total[$val['stationid']][$val['date']] = $val['total']; //$data['data'][$val['stationid']]['data'][] = intval($val['total']); $data['data'][$val['stationid']]['id'][] = $val['id']; $data['data']['table'][$val['stationid']][] = array('date' => $val['date'], 'total' => $val['total']); } //重过滤$station $where = array(); $where['id_IN'] = $stationChoice; $order = "id ASC"; $field = "id,stationname"; $station = $PSys_PageviewModel->GetList($where, $order, 0, 0, $field, "rha_station"); //比较的数据节点设置 foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['name'] = $val['stationname']; $data['data'][$val['id']]['marker'] = "square"; $data['data']['table'][$val['id']] = is_array($data['data']['table'][$val['id']]) ? $data['data']['table'][$val['id']] : array(); foreach ($data['xv'] as $k => $v) { $data['data'][$val['id']]['data'][] = $total[$val['id']][$k] != '' ? intval($total[$val['id']][$k]) : 0; } } unset($data['data'][0]); unset($data['data']['table'][0]); $data['data']['num'] = count($station['allrow']); } $data['data']['key'] = array("小时", "人数"); //table 栏目提示 array按顺序 $data['screening']['date'] = '<a class="btn" onclick="screeningSpan(\'close-date\');">单日/' . $date . ' <i class="icon-remove"></i><input type="hidden" name="dateSearch" value="oneday" /><input type="hidden" name="oneday" value="' . $date . '" /></a> '; break; case "manyday": $bdate = reqstr("bmanyday"); $edate = reqstr("emanyday"); //计算天数差 $Days = round((strtotime($edate) - strtotime($bdate)) / 3600 / 24); $data = array(); if ($datastatus == 1) { $group = "date"; $dbname = "rha_wifi_daily"; $result = $PSys_PageviewModel->getWeek($bdate, $edate, $group, $dbname, $stationChoice); //print_r($result); //x轴数据 $data['xv'] = array(); $data['data'][1]['name'] = "所有站点"; $data['data'][1]['marker'] = "square"; foreach ($result as $key => $val) { $total[$val['date']] = $val['total']; $data['data']['table'][1][] = array('date' => $val['date'], 'total' => $val['total']); } for ($i = 0; $i <= $Days; $i++) { $day = $i; $data['xv'][] = date("Y-m-d", strtotime("{$bdate} +{$day} day")); //$data['data'][1]['data'][] = intval($result[$i-1]['total']); $data['data'][1]['data'][] = $total[date("Y-m-d", strtotime("{$bdate} +{$day} day"))] ? intval($total[date("Y-m-d", strtotime("{$bdate} +{$day} day"))]) : 0; } $data['data']['num'] = 1; $stationChoice = array(); $stationChoice[0] = 1; //to do... } else { $group = "`date`,`station`"; $dbname = "rha_wifi_daily"; $result = $PSys_PageviewModel->getWeek($bdate, $edate, $group, $dbname); foreach ($result as $key => $val) { $total[$val['station']][$val['date']] = $val['total']; //$data['data'][$val['station']]['data'][] = intval($val['total']); $data['data']['table'][$val['station']][] = array('date' => $val['date'], 'total' => $val['total']); } //x轴数据 $data['xv'] = array(); //比较的数据节点设置 foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['name'] = $val['stationname']; $data['data'][$val['id']]['marker'] = "square"; $data['data']['table'][$val['id']] = is_array($data['data']['table'][$val['id']]) ? $data['data']['table'][$val['id']] : array(); } //print_r($total[1][date("Y-m-d",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y")))]); for ($i = 0; $i <= $Days; $i++) { $day = $i; $data['xv'][] = date("Y-m-d", strtotime("{$bdate} +{$day} day")); //$data['data'][1]['data'][] = intval($result[$i-1]['total']); foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['data'][] = $total[$val['id']][date("Y-m-d", strtotime("{$bdate} +{$day} day"))] ? intval($total[$val['id']][date("Y-m-d", strtotime("{$bdate} +{$day} day"))]) : 0; } } $data['data']['num'] = count($station['allrow']); } $data['data']['key'] = array("日期", "人数"); //table 栏目提示 array按顺序 $data['screening']['date'] = '<a class="btn" onclick="screeningSpan(\'close-date\');">多日/' . $bdate . ' ~ ' . $edate . ' <i class="icon-remove"></i><input type="hidden" name="dateSearch" value="manyday" /><input type="hidden" name="manyday" value="' . $date . '" /></a> '; break; case "oneweek": $day = reqstr("oneweek"); $edate = date('Y-m-d', strtotime("{$day} Sunday")); $bdate = date('Y-m-d', strtotime("{$edate} -6 days")); //计算天数差 $Days = round((strtotime($edate) - strtotime($bdate)) / 3600 / 24); if (date("N", strtotime($bdate)) == 1 && $bdate == date("Y-m-d")) { $data = array(); $data['error'] = 'WEEKNODATA'; break; } $data = array(); if ($datastatus == 1) { $group = "date"; $dbname = "rha_wifi_daily"; $result = $PSys_PageviewModel->getWeek($bdate, $edate, $group, $dbname); //x轴数据 $data['xv'] = array(); $data['data'][1]['name'] = "所有站点"; $data['data'][1]['marker'] = "square"; foreach ($result as $key => $val) { $total[$val['date']] = $val['total']; $data['data']['table'][1][] = array('date' => $val['date'], 'total' => $val['total']); } for ($i = 0; $i <= $Days; $i++) { $day = $i; $data['xv'][] = date("Y-m-d", strtotime("{$bdate} +{$day} day")); //$data['data'][1]['data'][] = intval($result[$i-1]['total']); $data['data'][1]['data'][] = $total[date("Y-m-d", strtotime("{$bdate} +{$day} day"))] ? intval($total[date("Y-m-d", strtotime("{$bdate} +{$day} day"))]) : 0; } $data['data']['num'] = 1; $stationChoice = array(); $stationChoice[0] = 1; //to do... } else { $group = "`date`,`station`"; $dbname = "rha_wifi_daily"; $result = $PSys_PageviewModel->getWeek($bdate, $edate, $group, $dbname); foreach ($result as $key => $val) { $total[$val['station']][$val['date']] = $val['total']; //$data['data'][$val['station']]['data'][] = intval($val['total']); $data['data']['table'][$val['station']][] = array('date' => $val['date'], 'total' => $val['total']); } //x轴数据 $data['xv'] = array(); //比较的数据节点设置 foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['name'] = $val['stationname']; $data['data'][$val['id']]['marker'] = "square"; $data['data']['table'][$val['id']] = is_array($data['data']['table'][$val['id']]) ? $data['data']['table'][$val['id']] : array(); } //print_r($total[1][date("Y-m-d",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y")))]); for ($i = 0; $i <= $Days; $i++) { $day = $i; $data['xv'][] = date("Y-m-d", strtotime("{$bdate} +{$day} day")); //$data['data'][1]['data'][] = intval($result[$i-1]['total']); foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['data'][] = $total[$val['id']][date("Y-m-d", strtotime("{$bdate} +{$day} day"))] ? intval($total[$val['id']][date("Y-m-d", strtotime("{$bdate} +{$day} day"))]) : 0; } } $data['data']['num'] = count($station['allrow']); } $data['data']['key'] = array("日期", "人数"); //table 栏目提示 array按顺序 $data['screening']['date'] = '<a class="btn" onclick="screeningSpan(\'close-date\');">单周/' . $bdate . ' ~ ' . $edate . ' <i class="icon-remove"></i><input type="hidden" name="dateSearch" value="oneweek" /><input type="hidden" name="oneweek" value="' . $date . '" /></a> '; break; case "manyweek": $bday = reqstr("bmanyweek"); $edate2 = date('Y-m-d', strtotime("{$bday} Sunday")); $bdate = date('Y-m-d', strtotime("{$edate2} -6 days")); $eday = reqstr("emanyweek"); $edate = date('Y-m-d', strtotime("{$eday} Sunday")); $bdate2 = date('Y-m-d', strtotime("{$edate} -6 days")); //计算周数差 $Weeks = round((strtotime($edate) - strtotime($bdate)) / 3600 / 24 / 7); $data = array(); if ($datastatus == 1) { $group = "date"; $dbname = "rha_wifi_daily"; $result = $PSys_PageviewModel->getWeek($bdate, $edate, $group, $dbname); //x轴数据 $data['xv'] = array(); $data['data'][1]['name'] = "所有站点"; $data['data'][1]['marker'] = "square"; foreach ($result as $key => $val) { $total[$val['date']] = $val['total']; $data['data']['table'][1][] = array('date' => $val['date'], 'total' => $val['total']); } for ($i = 0; $i < $Weeks; $i++) { for ($j = 1; $j <= 7; $j++) { $day = $i * 7 + $j - 1; if ($j == 1) { $data['xv'][$i] = date("Y/m/d", strtotime("{$bdate} +{$day} day")); } if ($j == 7) { $data['xv'][$i] .= ' - ' . date("m/d", strtotime("{$bdate} +{$day} day")); } //$data['data'][1]['data'][] = intval($result[$i-1]['total']); $data['data'][1]['data'][$i] += $total[date("Y-m-d", strtotime("{$bdate} +{$day} day"))] ? intval($total[date("Y-m-d", strtotime("{$bdate} +{$day} day"))]) : 0; } } $data['data']['num'] = 1; $stationChoice = array(); $stationChoice[0] = 1; //to do... } else { $group = "`date`,`station`"; $dbname = "rha_wifi_daily"; $result = $PSys_PageviewModel->getWeek($bdate, $edate, $group, $dbname); foreach ($result as $key => $val) { $total[$val['station']][$val['date']] = $val['total']; //$data['data'][$val['station']]['data'][] = intval($val['total']); $data['data']['table'][$val['station']][] = array('date' => $val['date'], 'total' => $val['total']); } //x轴数据 $data['xv'] = array(); //比较的数据节点设置 foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['name'] = $val['stationname']; $data['data'][$val['id']]['marker'] = "square"; $data['data']['table'][$val['id']] = is_array($data['data']['table'][$val['id']]) ? $data['data']['table'][$val['id']] : array(); } //print_r($total[1][date("Y-m-d",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y")))]); for ($i = 0; $i < $Weeks; $i++) { for ($j = 1; $j <= 7; $j++) { $day = $i * 7 + $j - 1; if ($j == 1) { $data['xv'][$i] = date("Y/m/d", strtotime("{$bdate} +{$day} day")); } if ($j == 7) { $data['xv'][$i] .= ' - ' . date("m/d", strtotime("{$bdate} +{$day} day")); } //to do ..... 2周还是读天数表 see you tomorrow //$data['data'][1]['data'][] = intval($result[$i-1]['total']); foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['data'][$i] += $total[$val['id']][date("Y-m-d", strtotime("{$bdate} +{$day} day"))] ? intval($total[$val['id']][date("Y-m-d", strtotime("{$bdate} +{$day} day"))]) : 0; } } } $data['data']['num'] = count($station['allrow']); } $data['data']['key'] = array("日期", "人数"); //table 栏目提示 array按顺序 $data['screening']['date'] = '<a class="btn" onclick="screeningSpan(\'close-date\');">多周/' . $bdate . ' ~ ' . $edate . ' <i class="icon-remove"></i><input type="hidden" name="dateSearch" value="manyweek" /><input type="hidden" name="manyweek" value="' . $date . '" /></a> '; break; case "onemonth": $date = reqstr("onemonth"); $bdate = date("Y-m-01", strtotime($date)); $edate = date("Y-m-d", strtotime("{$bdate} +1 month -1 day")); $data = array(); if ($datastatus == 1) { $group = "date"; $dbname = "rha_wifi_daily"; $result = $PSys_PageviewModel->getWeek($bdate, $edate, $group, $dbname); //x轴数据 $data['xv'] = array(); $data['data'][1]['name'] = "所有站点"; $data['data'][1]['marker'] = "square"; //遍历数据 foreach ($result as $key => $val) { $total[$val['date']] = $val['total']; $data['data']['table'][1][] = array('date' => $val['date'], 'total' => $val['total']); } for ($i = 1; $i <= date("t", strtotime($date)); $i++) { $day = $i - 1; $data['xv'][] = date("d", strtotime("{$date} + {$day} day")); $data['data'][1]['data'][] = $total[date("Y-m-d", strtotime("{$bdate} +{$day} day"))] ? intval($total[date("Y-m-d", strtotime("{$bdate} +{$day} day"))]) : 0; } $data['data']['num'] = 1; $stationChoice = array(); $stationChoice[0] = 1; //to do... } else { $group = "`date`,`station`"; $dbname = "rha_wifi_daily"; $result = $PSys_PageviewModel->getWeek($bdate, $edate, $group, $dbname); //x轴数据 $data['xv'] = array(); //比较的数据节点设置 foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['name'] = $val['stationname']; $data['data'][$val['id']]['marker'] = "square"; $data['data']['table'][$val['id']] = array(); } //遍历数据 foreach ($result as $key => $val) { $total[$val['date']][$val['station']] = $val['total']; $data['data']['table'][$val['station']][] = array('date' => $val['date'], 'total' => $val['total']); } for ($i = 1; $i <= date("t", strtotime($date)); $i++) { $day = $i - 1; $data['xv'][] = date("d", strtotime("{$date} + {$day} day")); //遍历数据 foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['data'][] = $total[date("Y-m-d", strtotime("{$bdate} +{$day} day"))][$val['id']] ? intval($total[date("Y-m-d", strtotime("{$bdate} +{$day} day"))][$val['id']]) : 0; } } $data['data']['num'] = count($station['allrow']); } $data['data']['key'] = array("日期", "人数"); //table 栏目提示 array按顺序 $data['screening']['date'] = '<a class="btn" onclick="screeningSpan(\'close-date\');">单月/' . $bdate . ' <i class="icon-remove"></i><input type="hidden" name="dateSearch" value="onemonth" /><input type="hidden" name="onemonth" value="' . $date . '" /></a> '; break; case "manymonth": $bday = reqstr("bmanymonth"); $bdate = date("Y-m-01", strtotime($bday)); $eday = reqstr("emanymonth"); $edate = date("Y-m-d", strtotime("{$eday} +1 month -1 day")); //计算月数差 $Months = (date("Y", strtotime($eday)) - date("Y", strtotime($bday))) * 12 + (date("m", strtotime($eday)) - date("m", strtotime($bday))) + 1; for ($i = 0; $i < $Months; $i++) { $dateArr[$i] = date("Y-m", strtotime("{$bday} +{$i} month")); } $data = array(); if ($datastatus == 1) { $group = "date"; $dbname = "rha_wifi_daily"; $result = $PSys_PageviewModel->getWeek($bdate, $edate, $group, $dbname); //x轴数据 $data['xv'] = array(); $data['data'][1]['name'] = "所有站点"; $data['data'][1]['marker'] = "square"; foreach ($result as $key => $val) { $total[$val['date']] = $val['total']; for ($i = 0; $i < count($dateArr); $i++) { if ($dateArr[$i] == date("Y-m", strtotime($val['date']))) { $data['data']['table'][1][$i]['date'] = $dateArr[$i]; $data['data']['table'][1][$i]['total'] += $val['total']; } } } $day = 0; for ($i = 0; $i < $Months; $i++) { $num = date("t", strtotime("{$bday} +{$i} month")); for ($j = 1; $j <= $num; $j++) { if ($j == 1) { $data['xv'][$i] = date("Y/m", strtotime("{$bday} +{$i} month")); } //echo $day."<br/>"; //$data['data'][1]['data'][] = intval($result[$i-1]['total']); $data['data'][1]['data'][$i] += $total[date("Y-m-d", strtotime("{$bday} +{$day} day"))] ? intval($total[date("Y-m-d", strtotime("{$bday} +{$day} day"))]) : 0; $day++; } } $data['data']['num'] = 1; $stationChoice = array(); $stationChoice[0] = 1; //to do... } else { $group = "`date`,`station`"; $dbname = "rha_wifi_daily"; $result = $PSys_PageviewModel->getWeek($bdate, $edate, $group, $dbname); foreach ($result as $key => $val) { $total[$val['station']][$val['date']] = $val['total']; //$data['data'][$val['station']]['data'][] = intval($val['total']); //$data['data']['table'][$val['station']][] = array('date'=>$val['date'],'total'=>$val['total']); for ($i = 0; $i < count($dateArr); $i++) { //创建初始array if ($data['data']['table'][$val['station']][$i]['date'] == '') { $data['data']['table'][$val['station']][$i]['date'] = $dateArr[$i]; $data['data']['table'][$val['station']][$i]['total'] = 0; } if ($dateArr[$i] == date("Y-m", strtotime($val['date']))) { $data['data']['table'][$val['station']][$i]['date'] = $dateArr[$i]; $data['data']['table'][$val['station']][$i]['total'] += $val['total']; } } } //x轴数据 $data['xv'] = array(); //比较的数据节点设置 foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['name'] = $val['stationname']; $data['data'][$val['id']]['marker'] = "square"; $data['data']['table'][$val['id']] = is_array($data['data']['table'][$val['id']]) ? $data['data']['table'][$val['id']] : array(); } $day = 0; //print_r($total[1][date("Y-m-d",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y")))]); for ($i = 0; $i < $Months; $i++) { $num = date("t", strtotime("{$bday} +{$i} month")); for ($j = 1; $j <= $num; $j++) { if ($j == 1) { $data['xv'][$i] = date("Y/m", strtotime("{$bday} +{$i} month")); } //echo $day."<br/>"; //$data['data'][1]['data'][] = intval($result[$i-1]['total']); foreach ($station['allrow'] as $key => $val) { $data['data'][$val['id']]['data'][$i] += $total[$val['id']][date("Y-m-d", strtotime("{$bday} +{$day} day"))] ? intval($total[$val['id']][date("Y-m-d", strtotime("{$bday} +{$day} day"))]) : 0; } $day++; } } $data['data']['num'] = count($station['allrow']); } $data['data']['key'] = array("日期", "人数"); //table 栏目提示 array按顺序 $data['screening']['date'] = '<a class="btn" onclick="screeningSpan(\'close-date\');">多月/' . $bdate . "~" . $edate . ' <i class="icon-remove"></i><input type="hidden" name="dateSearch" value="manymonth" /><input type="hidden" name="manymonth" value="' . $date . '" /></a> '; break; } if (!$data['error']) { $data['screening']['station'] = $screening['station']; } else { $data['screening']['station'] = array(); } } //将所有default = 0 的 都要写一遍 to do ... if (!$stationChoice) { $stationChoice[0] = 1; } if (!$data['error']) { $data['data']['station'] = $stationChoice; } else { $data['data']['station'] = array(); } die(json_encode($data)); }