/** * 添加焦点图 */ function addAction() { if ($this->isPost()) { $text = FRequest::getPostString('text'); $pic = FRequest::getPostString('pic'); $url = FRequest::getPostString('url'); $title = FRequest::getPostString('title'); $position = CommonUtil::getComParam(FRequest::getPostInt('position'), 0); if (!$pic) { $this->showMessage("图片不能为空", error); return; } if (!$title) { $this->showMessage("标题不能为空", error); return; } //打开网页 //print_r($content); $data2 = array('title' => $title, 'text' => $text, 'pic' => $pic, 'url' => $url, 'position' => $position); $mumu_youxi_table = new FTable("mumu_youxi"); $mumu_youxi_table->insert($data2); $this->showMessage("添加成功", "success", "/MumuYouxi/list"); return; } $this->display('admin/mumu_youxi_add'); }
public function addUpdateAction() { if ($this->isPost()) { return; } $ver = CommonUtil::getComParam(FRequest::getInt("ver"), 0); if ($ver == 0) { $this->error("ver 版本错误"); return; } $table = new FTable("app_version_config"); $app_data = $table->where(array("ver" => $ver))->find(); $summary_arr = explode("\n", $app_data["summary"]); $app_data["summary"] = $summary_arr; $table2 = new FTable("app_version"); $update_data = $table2->where(array("ver" => $ver))->order(array("tm" => "desc"))->select(); $this->assign("update_data", $update_data); $this->assign("app_version", $app_data); $spmList = Service_Edit::getAllSpm(); $this->assign('spmarr', json_encode($spmList)); $c_names = Service_Edit::getSpmMap($spmList); $this->assign('spmList', $c_names); $this->display("add_version"); }
function listAction() { global $_F; //$_F["debug"] = true; $province = FRequest::getString('province'); $city = FRequest::getString('city'); $gender = CommonUtil::getComParam(FRequest::getInt('gender'), 2); $age = FRequest::getInt('age'); $table = new FTable("user_province_area"); $provinces = $table->order(array("region_id" => "asc"))->select(); if ($province) { $where = array("city" => $province); $user_province = new FTable("user_province_area"); $user_provinces = $user_province->where($where)->find(); $stm_str = "-" . $age . " year"; $etm_str = "-" . ($age - 1) . " year"; $stm_birthday = date("Y-01-01 00:00:00", strtotime($stm_str)); $etm_birthday = date("Y-01-01 00:00:00", strtotime($etm_str)); $query_str = " ud.birthday >= '" . $stm_birthday . "' and ud.birthday < '" . $etm_birthday . "' "; $user_table = new FTable("user_main", "um"); $user = $user_table->where(array("um.gender" => $gender, "str" => $query_str))->leftJoin("user_detail", "ud", "um.uid=ud.uid")->find(); $url = FConfig::get('global.service_mumu_url') . "/s/discovery/IAdjacent"; //$url = "http://yfservice.admin.docker:8081/s/discovery/IAdjacent"; //echo($url); $post_data = array("lng" => $user_provinces['x'], "lat" => $user_provinces['y'], "cur" => 1, "refresh" => true, "ps" => 30, "uid" => $user["uid"]); //$cookie = "sid=306123456;uid=5000513;key=306123456"; $cookie = "sid=" . FSession::get('sid') . ";uid=" . FSession::get('user_id') . ";key=" . FSession::get('sid'); $output = FHttp::doPost($url, $post_data, $cookie); // print_r($output); $output = json_decode($output); $status = $output->status; $users = $output->res; $users = $users->users; $users = $users->list; if (count($users) <= 30) { $post_data = array("lng" => $user_provinces['x'], "lat" => $user_provinces['y'], "cur" => 2, "refresh" => true, "ps" => 30, "uid" => $user["uid"]); $output2 = FHttp::doPost($url, $post_data, $cookie); $output2 = json_decode($output2); $users2 = $output2->res; $users2 = $users2->users; $users2 = $users2->list; } $users = array_merge($users, $users2); $ids = array(); foreach ($users as $u) { array_push($ids, $u->uid); } if (count($ids) > 0) { $users_table = new FTable("user_main", "um"); $u_arr = $users_table->fields(array("um.uid", "um.gender", "ud.localtag", "ud.birthday"))->where(array("um.uid" => array("in" => $ids)))->leftJoin("user_detail", "ud", "um.uid = ud.uid")->select(); } $u_m = array(); foreach ($u_arr as $u) { $u_m[$u["uid"]] = $u; } foreach ($users as &$u) { $uid = $u->uid; $r_u = $u_m[$uid]; $u->age = CommonUtil::birthdayToAge($r_u["birthday"]); $u->tag = $r_u["localtag"]; $u->gender = $r_u["gender"]; } $this->assign('users', $users); $this->assign('status', $status); $this->assign('province', $province); $this->assign('city', $city); $this->assign('age', $age); } $this->assign('gender', $gender); $this->assign('provinces', $provinces); $this->display('admin/user_avataradd_list'); }
/** * 按时间地区在线人数 */ public function zaixianAction() { $c_uid = CommonUtil::getDefStr(FRequest::getString('c_uid'), ""); $c_sid = CommonUtil::getDefStr(FRequest::getString('c_sid'), ""); $stats_date = FRequest::getString('stats_date'); $province = FRequest::getString('province'); $user_type = CommonUtil::getComParam(FRequest::getInt('user_type'), -1); $this->assign('sc_uid', $c_uid); $this->assign('sc_sid', $c_sid); $this->assign('stats_date', $stats_date); $this->assign('province', $province); $this->assign('user_type', $user_type); $table = new FTable("user_province_area"); $user_province = $table->groupBy("province")->order(array("id" => "asc"))->select(); $this->assign('user_province', $user_province); $data = array(); $data_1 = array(); $data_2 = array(); $where = array("s.key" => "on_top_users"); if ($c_uid != "") { $where["channel"] = $c_uid; } if ($c_sid != "") { $where["sub_channel"] = $c_sid; } if ($province) { $where["province"] = $province; } if ($user_type >= 0) { // $where["user_type"] = $user_type; } if ($stats_date && $stats_date != "") { $where["tm"] = array('like' => $stats_date); $where["s.interval"] = "hour"; } else { $where["s.interval"] = "day"; } $fields = array("s.tm", "s.key", "s.gender", "sum(s.value) as sum"); $table2 = new FTable("Stat", "s", FDB::$DB_MUMU_STAT); $total_rs = $table2->fields($fields)->where($where)->groupBy("s.tm")->order(array("s.tm" => "desc"))->select(); $total = count($total_rs); $kaishi_time = $total_rs[30][tm]; $jieshu_time = $total_rs[0][tm]; /* if ($total>30) { $jieshu_time=$total_rs[29][tm]; } else { $jieshu_time=$total_rs[$total-1][tm]; }*/ // echo($kaishi_time.$jieshu_time); if ($total > 0) { $query_str = " s.tm >= '" . $kaishi_time . "' and s.tm <= '" . $jieshu_time . "' "; $where["str"] = $query_str; } $table = new FTable("Stat", "s", FDB::$DB_MUMU_STAT); $Stat = $table->fields($fields)->where($where)->groupBy("s.tm,s.key,s.gender")->order(array("s.tm" => "desc"))->select(); $Stats = array(); foreach ($Stat as &$s) { $sub_arr = array(); $s["tm"] = $s["tm"]; if (array_key_exists($s["tm"], $Stats)) { $sub_arr = $Stats[$s["tm"]]; } array_push($sub_arr, $s); $Stats[$s["tm"]] = $sub_arr; } $Stats2 = array(); foreach ($Stats as &$s) { $sub_arr = array("tm" => ""); foreach ($s as &$s_x) { $sub_arr["tm"] = $s_x["tm"]; $stats_key = $s_x["key"] . "_" . $s_x["gender"]; $sub_arr[$stats_key] = $s_x["sum"]; } $data[$sub_arr["tm"]] = $sub_arr["tm"]; if ($sub_arr["on_top_users_1"]) { $data_1[$sub_arr["tm"]] = $sub_arr["on_top_users_1"]; } else { $data_1[$sub_arr["tm"]] = 0; } if ($sub_arr["on_top_users_2"]) { $data_2[$sub_arr["tm"]] = $sub_arr["on_top_users_2"]; } else { $data_2[$sub_arr["tm"]] = 0; } array_push($Stats2, $sub_arr); } $data1 = array(); $i = 0; foreach ($data as $d) { if ($stats_date && $stats_date != "") { $data1[$i] = substr(substr($d, 0, 13), -2); } else { $data1[$i] = substr($d, 0, 10); } $i++; } $data1_1 = array(); $i = 0; foreach ($data_1 as $d) { $data1_1[$i] = $d; $i++; } $data1_2 = array(); $i = 0; foreach ($data_2 as $d) { $data1_2[$i] = $d; $i++; } $spmList = Service_Edit::getAllSpm(); $this->assign('spmarr', json_encode($spmList)); $c_names = Service_Edit::getSpmMap($spmList); $this->assign('spmList', $c_names); $this->assign("data_1", json_encode(array_reverse($data1_1))); $this->assign("data_2", json_encode(array_reverse($data1_2))); $this->assign("data", json_encode(array_reverse($data1))); $this->display('admin/user_spread_zaixian'); }
/** * 添加焦点图 */ function addAction() { $type = FRequest::getString('type'); $this->assign('type', $type); if ($this->isPost()) { $text = FRequest::getPostString('text'); $pic = FRequest::getPostString('pic'); $anniu_caozuo = FRequest::getPostInt('anniu_caozuo'); $events_id = FRequest::getPostInt('events_id'); $type = FRequest::getPostString('type'); $position = CommonUtil::getComParam(FRequest::getPostInt('position'), 0); if (!$pic) { $this->showMessage("图片不能为空", error); return; } //打开网页 $url = FRequest::getPostString('url'); //打开游戏 $gid = FRequest::getPostString('gid'); $area_id = FRequest::getPostString('area_id'); $buts = array(); if ($anniu_caozuo == 1) { $data = array("url" => $url); if (!$url) { $this->showMessage("链接地址不能为空", error); return; } $buts = array("cmd" => "cmd_open_web", "data" => $data); } if ($anniu_caozuo == 2) { $data = array(); $buts = array("cmd" => "cmd_open_actlist", "data" => $data); } if ($anniu_caozuo == 3) { $data = array("id" => $events_id); $buts = array("cmd" => "cmd_open_act", "data" => $data); } if ($anniu_caozuo == 4) { $data = array(); $buts = array("cmd" => "cmd_open_actaward", "data" => $data); } if ($anniu_caozuo == 5) { $data = array("gid" => $gid, "area_id" => $area_id); $buts = array("cmd" => "cmd_entry_game", "data" => $data); } $text = str_replace("<p>", "", $text); $text = str_replace("</p>", "<br>", $text); $action = self::decodeUnicode(json_encode($buts)); //print_r($content); $data2 = array('type' => $type, 'text' => $text, 'pic' => $pic, 'action' => $action, 'position' => $position, 'status' => 1); $events_table = new FTable("focus"); $events_table->insert($data2); $this->showMessage("添加成功", "success", "/FocusList/list?type=" . $type . ""); return; } $this->display('admin/focus_add'); }
/** * 按小时查询详情 * @throws Exception */ public function hoursDetailAction() { global $_F; $page_size = 24; //$flag == 1 获取时间段相主渠道数据, flag ==2 获取时间段某子渠道时间段数据 $flag = FRequest::getInt('flag'); $page = max(1, FRequest::getInt('page')); $c_uid = CommonUtil::getDefStr(FRequest::getString('c_uid'), ""); $c_sid = CommonUtil::getDefStr(FRequest::getString('c_sid'), ""); $user_type = CommonUtil::getComParam(FRequest::getInt('user_type'), -1); $stats_date = FRequest::getString('stats_date'); $this->assign('sc_uid', $c_uid); $this->assign('sc_sid', $c_sid); $this->assign('user_type', $user_type); $this->assign('stats_date', $stats_date); $this->assign('flag', $flag); $fields = array("stats_date", "hours", "c_uid", "c_sid", "user_type", "sum(reg_cnt) as reg_cnt", "sum(charge_user_cnt) as charge_user_cnt", "sum(charge_sum) as charge_sum", "sum(gived_sum) as gived_sum"); $stats_table = new FTable("stats"); $stats_table->fields($fields); $where = array(); if ($c_uid != "") { $where["c_uid"] = $c_uid; } if ($c_sid != "") { $where["c_sid"] = $c_sid; } if ($stats_date && $stats_date != "") { $where["stats_date"] = $stats_date; } if ($user_type >= 0) { $where["user_type"] = $user_type; } $group_by = "stats_date,hours"; if ($flag == 2) { $group_by = "stats_date,hours"; } $logList = $stats_table->where($where)->groupBy($group_by)->order(array("hours" => "asc"))->page($page)->limit($page_size)->select(); $stats_table2 = new FTable("stats"); $total_rs = $stats_table2->fields(array("id"))->where($where)->groupBy($group_by)->select(); $total = count($total_rs); $spmList = Service_Edit::getAllSpm(); $this->assign('spmList', $spmList); $c_name = Service_Edit::getSpmMap($spmList); $c_s_name = Service_Edit::getSubSpmMap($spmList); $this->assign('spmarr', json_encode($spmList)); $this->assign('spmList', $c_name); foreach ($logList as &$item) { $item["c_name"] = ""; if (array_key_exists($item["c_uid"], $c_name)) { $item["c_name"] = $c_name[$item["c_uid"]]; } $item["c_s_name"] = ""; if (array_key_exists($item["c_sid"], $c_s_name)) { $item["c_s_name"] = $c_s_name[$item["c_sid"]]; } $item["charge_sum"] = $item["charge_sum"] / 100; } $this->assign('logList', $logList); $this->assign('page_info', FPager::getPagerInfo($total, $page, $page_size)); $this->display('admin/stats_hours_detail'); // echo(json_encode($logList)); }
/** * 主报表查询 */ public function reportAction() { //global $_F; //$_F["debug"] = true; $page_size = 30; $page = max(1, FRequest::getInt('page')); $c_uid = CommonUtil::getDefStr(FRequest::getString('c_uid'), ""); $user_gender = CommonUtil::getComParam(FRequest::getInt('user_gender'), -1); $stats_date = FRequest::getString('stats_date'); $stats_key = FRequest::getString('stats_key'); $province = FRequest::getString('province'); $ver = FRequest::getString('ver'); $table = new FTable("user_province_area"); $user_province = $table->groupBy("province")->order(array("id" => "asc"))->select(); $this->assign('user_province', $user_province); $this->assign('province', $province); $this->assign('ver', $ver); if (!$stats_key) { $stats_key = "online_award_users"; // $stats_key="on_top_users"; // $this->showMessage("查询留存不能为空",error,"/admin/ReportLiucun/default"); // // return; // exit; } $where = array("s.interval" => "day"); if ($c_uid != "") { $where["channel"] = $c_uid; } if ($user_gender >= 0) { $where["gender"] = $user_gender; } if ($province) { $where["province"] = $province; } if ($ver) { $where["ver"] = $ver; } $stats_key0 = $stats_key . "_lc_0"; $stats_key1 = $stats_key . "_lc_1"; $stats_key2 = $stats_key . "_lc_2"; $stats_key3 = $stats_key . "_lc_3"; $stats_key4 = $stats_key . "_lc_4"; $stats_key5 = $stats_key . "_lc_5"; $stats_key6 = $stats_key . "_lc_6"; $stats_key7 = $stats_key . "_lc_7"; $stats_key15 = $stats_key . "_lc_15"; $stats_key30 = $stats_key . "_lc_30"; $stats_key_array = array("'register'", "'" . $stats_key0 . "'", "'" . $stats_key1 . "'", "'" . $stats_key2 . "'", "'" . $stats_key3 . "'", "'" . $stats_key4 . "'", "'" . $stats_key5 . "'", "'" . $stats_key6 . "'", "'" . $stats_key7 . "'", "'" . $stats_key15 . "'", "'" . $stats_key30 . "'"); $fields = array("s.tm", "s.key", "sum(s.value) as sum"); //echo(json_encode($stats_key_array)); $where["s.key"] = array('in' => $stats_key_array); $datetime_riqi_qiantian = date("Y-m-d", time() - 86400); $query_str = " s.tm <= '" . $datetime_riqi_qiantian . " 00:00:00' "; $where["str"] = $query_str; $table2 = new FTable("Stat", "s", FDB::$DB_MUMU_STAT); $total_rs = $table2->fields($fields)->where($where)->groupBy("s.tm")->order(array("s.tm" => "desc"))->select(); //echo(json_encode($where)); $total = count($total_rs); $jieshu_time = $total_rs[$page_size * $page - $page_size][tm]; if ($page_size * $page > $total) { $kaishi_time = $total_rs[$total - 1][tm]; } else { $kaishi_time = $total_rs[$page_size * $page - 1][tm]; } //echo($kaishi_time.$jieshu_time); if ($total > 0) { $query_str = " s.tm >= '" . $kaishi_time . "' and s.tm <= '" . $jieshu_time . "' "; $where["str"] = $query_str; } $table = new FTable("Stat", "s", FDB::$DB_MUMU_STAT); $Stat = $table->fields($fields)->where($where)->groupBy("s.tm,s.key")->order(array("s.tm" => "desc"))->select(); $Stats = array(); foreach ($Stat as &$s) { $sub_arr = array(); $s["tm"] = substr($s["tm"], 0, 10); if (array_key_exists($s["tm"], $Stats)) { $sub_arr = $Stats[$s["tm"]]; } array_push($sub_arr, $s); $Stats[$s["tm"]] = $sub_arr; // $where["s.tm"] = $s["tm"]; // $where["s.key"] = "register"; // $table = new FTable("Stat","s",FDB::$DB_MUMU_STAT); // $data = $table->fields(array("sum(s.value) as sum" )) ->where($where)->find(); // $s["register"] = $data["sum"]; // // // if ($stats_key) { $where["s.key"] = $stats_key1; } // $table1 = new FTable("Stat","s",FDB::$DB_MUMU_STAT); // $data1 = $table1->fields(array("sum(s.value) as sum" )) ->where($where)->find(); // $s["stats_key1"] = $data1["sum"]; // if ($stats_key) { $where["s.key"] = $stats_key2; } // $table2 = new FTable("Stat","s",FDB::$DB_MUMU_STAT); // $data2 = $table2->fields(array("sum(s.value) as sum" )) ->where($where)->find(); // $s["stats_key2"] = $data2["sum"]; // if ($stats_key) { $where["s.key"] = $stats_key3; } // $table3 = new FTable("Stat","s",FDB::$DB_MUMU_STAT); // $data3 = $table3->fields(array("sum(s.value) as sum")) ->where($where)->find(); // $s["stats_key3"] = $data3["sum"]; // if ($stats_key) { $where["s.key"] = $stats_key4; } // $table4 = new FTable("Stat","s",FDB::$DB_MUMU_STAT); // $data4 = $table4->fields(array("sum(s.value) as sum")) ->where($where)->find(); // $s["stats_key4"] = $data4["sum"]; // if ($stats_key) { $where["s.key"] = $stats_key5; } // $table5 = new FTable("Stat","s",FDB::$DB_MUMU_STAT); // $data5 = $table5->fields(array("sum(s.value) as sum")) ->where($where)->find(); // $s["stats_key5"] = $data5["sum"]; // if ($stats_key) { $where["s.key"] = $stats_key6; } // $table6 = new FTable("Stat","s",FDB::$DB_MUMU_STAT); // $data6 = $table6->fields(array("sum(s.value) as sum")) ->where($where)->find(); // $s["stats_key6"] = $data6["sum"]; // if ($stats_key) { $where["s.key"] = $stats_key7; } // $table7 = new FTable("Stat","s",FDB::$DB_MUMU_STAT); // $data7 = $table7->fields(array("sum(s.value) as sum")) ->where($where)->find(); // $s["stats_key7"] = $data7["sum"]; // if ($stats_key) { $where["s.key"] = $stats_key15; } // $table15 = new FTable("Stat","s",FDB::$DB_MUMU_STAT); // $data15 = $table15->fields(array("sum(s.value) as sum")) ->where($where)->find(); // $s["stats_key15"] = $data15["sum"]; // if ($stats_key) { $where["s.key"] = $stats_key30; } // $table30 = new FTable("Stat","s",FDB::$DB_MUMU_STAT); // $data30 = $table30->fields(array("sum(s.value) as sum")) ->where($where)->find(); // $s["stats_key30"] = $data30["sum"]; //$s["stats_date"] = substr($s["tm"],0,10); } /*print_r($Stats);*/ $Stats2 = array(); foreach ($Stats as &$s) { $sub_arr = array("tm" => "", "register" => 0, $stats_key0 => 0, $stats_key1 => 0, $stats_key2 => 0, $stats_key3 => 0, $stats_key4 => 0, $stats_key5 => 0, $stats_key6 => 0, $stats_key7 => 0, $stats_key15 => 0, $stats_key30 => 0); foreach ($s as &$s_x) { $sub_arr["tm"] = $s_x["tm"]; if ($s_x["key"] == "register") { $sub_arr["register"] = $s_x["sum"]; } if ($s_x["key"] == $stats_key0) { $sub_arr[$stats_key0] = $s_x["sum"]; } if ($s_x["key"] == $stats_key1) { $sub_arr[$stats_key1] = $s_x["sum"]; } if ($s_x["key"] == $stats_key2) { $sub_arr[$stats_key2] = $s_x["sum"]; } if ($s_x["key"] == $stats_key3) { $sub_arr[$stats_key3] = $s_x["sum"]; } if ($s_x["key"] == $stats_key4) { $sub_arr[$stats_key4] = $s_x["sum"]; } if ($s_x["key"] == $stats_key5) { $sub_arr[$stats_key5] = $s_x["sum"]; } if ($s_x["key"] == $stats_key6) { $sub_arr[$stats_key6] = $s_x["sum"]; } if ($s_x["key"] == $stats_key7) { $sub_arr[$stats_key7] = $s_x["sum"]; } if ($s_x["key"] == $stats_key15) { $sub_arr[$stats_key15] = $s_x["sum"]; } if ($s_x["key"] == $stats_key30) { $sub_arr[$stats_key30] = $s_x["sum"]; } } array_push($Stats2, $sub_arr); } //echo(json_encode($Stats2)); // $total = count($Stats); $page_info = FPager::getPagerInfo($total, $page, $page_size); $spmList = Service_Edit::getAllSpm(); $this->assign('spmarr', json_encode($spmList)); $c_names = Service_Edit::getSpmMap($spmList); $this->assign('spmList', $c_names); $this->assign('page_info', $page_info); $this->assign('Stat', $Stats2); $this->assign('stats_key', $stats_key); $this->assign('sc_uid', $c_uid); $this->assign('user_gender', $user_gender); $this->assign('stats_date', $stats_date); $this->assign('stats_key0', $stats_key0); $this->assign('stats_key1', $stats_key1); $this->assign('stats_key2', $stats_key2); $this->assign('stats_key3', $stats_key3); $this->assign('stats_key4', $stats_key4); $this->assign('stats_key5', $stats_key5); $this->assign('stats_key6', $stats_key6); $this->assign('stats_key7', $stats_key7); $this->assign('stats_key15', $stats_key15); $this->assign('stats_key30', $stats_key30); $this->display('admin/stats_liucun'); }