Example #1
0
File: Spm.php Project: jiatower/php
 public function indexAction()
 {
     global $_F;
     //        $_F['debug'] = 1;
     $page = max(1, FRequest::getInt('page'));
     $spmT = new FTable('stats_spm');
     $spmList = $spmT->order(array('id' => 'desc'))->page($page)->limit(20)->select();
     $this->assign('page_info', $spmT->getPagerInfo());
     $this->assign('spmList', $spmList);
     $this->display('admin/spm-index');
 }
Example #2
0
File: App.php Project: jiatower/php
 public function appListAction()
 {
     $page = max(1, FRequest::getInt('page'));
     $table = new FTable("app_version_config");
     $app_data = $table->order(array("ver" => "desc"))->page($page)->limit(5)->select();
     foreach ($app_data as &$app) {
         $summary_arr = explode("\n", $app["summary"]);
         $app["summary"] = $summary_arr;
     }
     $page_info = $table->getPagerInfo();
     $this->assign("page_info", $page_info);
     $this->assign("app_version", $app_data);
     $this->display("app_version");
 }
Example #3
0
 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');
 }
Example #4
0
 /**
  * 按省查询人数
  */
 public function provinceAction()
 {
     //global $_F;
     //$_F["debug"] = true;
     $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');
     $sc_config = FRequest::getString('sc_config');
     $this->assign('sc_uid', $c_uid);
     $this->assign('sc_sid', $c_sid);
     $this->assign('sc_config', $sc_config);
     $this->assign('sc_config_1', $sc_config . "_1");
     $this->assign('sc_config_2', $sc_config . "_2");
     $where = array("s.interval" => "day");
     if ($c_uid != "") {
         $where["channel"] = $c_uid;
     }
     if ($c_sid != "") {
         $where["sub_channel"] = $c_sid;
     }
     if ($sc_config != "") {
         $where["s.key"] = $sc_config;
     }
     if ($user_type >= 0) {
         // $where["user_type"] = $user_type;
     }
     if ($stats_date && $stats_date != "") {
         $where["tm"] = $stats_date;
     }
     $table1 = new FTable("Config", "c", FDB::$DB_MUMU_STAT);
     $Config = $table1->order(array("c.id" => "asc"))->select();
     foreach ($Config as &$c) {
         $c["id_1"] = $c["id"] . "_1";
         $c["id_2"] = $c["id"] . "_2";
     }
     $fields = array("s.tm", "s.key", "s.province", "s.gender", "sum(s.value) as sum");
     $table = new FTable("Stat", "s", FDB::$DB_MUMU_STAT);
     $Stat = $table->fields($fields)->where($where)->groupBy("s.province,s.gender")->order(array("sum" => "desc"))->select();
     $Stats = array();
     foreach ($Stat as &$s) {
         $sub_arr = array();
         if (array_key_exists($s["province"], $Stats)) {
             $sub_arr = $Stats[$s["province"]];
         }
         array_push($sub_arr, $s);
         $Stats[$s["province"]] = $sub_arr;
     }
     $Stats2 = array();
     foreach ($Stats as &$s) {
         $sub_arr = array();
         foreach ($s as &$s_x) {
             $sub_arr["province"] = $s_x["province"];
             $stats_key = $s_x["key"] . "_" . $s_x["gender"];
             $sub_arr[$stats_key] = $s_x["sum"];
         }
         array_push($Stats2, $sub_arr);
     }
     //echo(json_encode($Stats2));
     /*foreach($Stat as &$s){
                 $where["province"] = $s["province"];
     
                 $table2 = new FTable("Stat","s",FDB::$DB_MUMU_STAT);
                 $datas = $table2->fields(array(
                     "s.key",
                     "s.gender",
                     "sum(s.value) as sum"
                 )) ->where($where)->groupBy("s.gender")->select();
                 foreach($datas as &$data) {
                     $s[$data["key"]."_".$data["gender"]] = $data["sum"];
                 }
     
             }*/
     $spmList = Service_Edit::getAllSpm();
     $this->assign('spmarr', json_encode($spmList));
     $c_names = Service_Edit::getSpmMap($spmList);
     $this->assign('spmList', $c_names);
     $this->assign('Stat', $Stats2);
     $this->assign('Config', $Config);
     $this->assign('user_type', $user_type);
     $this->assign('stats_date', $stats_date);
     $this->display('admin/stats_wxw_province_detail');
     //  echo(json_encode($logList));
 }