本文整理匯總了PHP中CommonUtil::getDefStr方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonUtil::getDefStr方法的具體用法?PHP CommonUtil::getDefStr怎麽用?PHP CommonUtil::getDefStr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonUtil
的用法示例。
在下文中一共展示了CommonUtil::getDefStr方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: listAction
/**
* 添加地址
*/
function listAction()
{
//global $_F;
// $_F["debug"] = true;
$page = max(1, FRequest::getInt('page'));
$type = CommonUtil::getDefStr(FRequest::getString('type'), "main");
$this->assign('type', $type);
$where = array();
$shanchu_id = FRequest::getInt('shanchu_id');
if ($shanchu_id) {
$focus = new FTable('focus');
$focus->where(array('id' => $shanchu_id))->remove(true);
}
$xiaxian_id = FRequest::getInt('xiaxian_id');
if ($xiaxian_id) {
$events_table = new FTable("focus");
$events_table->where(array("id" => $xiaxian_id))->update(array("status" => 0));
}
$shangxian_id = FRequest::getInt('shangxian_id');
if ($shangxian_id) {
$events_table = new FTable("focus");
$events_table->where(array("id" => $shangxian_id))->update(array("status" => 1));
}
if ($type) {
$where['type'] = $type;
}
$table = new FTable("focus");
$focus = $table->fields(array("id", "type", "text", "pic", "action", "position", "status"))->where($where)->page($page)->limit(20)->order(array("position" => "asc", "id" => "desc"))->select();
foreach ($focus as &$focu) {
$focu["pic"] = CommonUtil::getMoreSizeImg($focu["pic"], 100, 100);
$focu["action"] = json_decode($focu["action"]);
}
$page_info = $table->getPagerInfo();
$this->assign('page_info', $page_info);
$this->assign('focus', $focus);
$this->display('admin/focus_list');
}
示例2: zaixianAction
/**
* 按時間地區在線人數
*/
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();
//.........這裏部分代碼省略.........
示例3: listAction
function listAction()
{
//global $_F;
//$_F["debug"] = true;
$uid = CommonUtil::getDefStr(FRequest::getPostString('uid'), "");
$tj25 = json_decode(FRequest::getPostString('tj25'));
$tj26 = json_decode(FRequest::getPostString('tj26'));
$tj27 = json_decode(FRequest::getPostString('tj27'));
$tj28 = json_decode(FRequest::getPostString('tj28'));
$tj30 = json_decode(FRequest::getPostString('tj30'));
$tj31 = json_decode(FRequest::getPostString('tj31'));
$tj32 = json_decode(FRequest::getPostString('tj32'));
$stats_date = FRequest::getString('stats_date');
if (!$stats_date) {
$this->showMessage("請輸入統計日期", error);
return;
}
$url = FConfig::get('global.service_mumu_url') . "/user/AdminTjInfo";
/* $params = array("uid"=>$uid,"date"=>$stats_date);
$params=Service_Common::post($url,json_encode($params));
$params=json_decode($params);
if($params->status=="ok"){
$this->assign("tj",$params->res);
} else{
$this->showMessage("查找失敗",$messageType = 'success');
return;
}*/
if (!$uid || $uid == 25) {
$params25 = array("uid" => 25, "date" => $stats_date);
$params25 = Service_Common::post($url, json_encode($params25));
$params25 = json_decode($params25);
if ($params25->status == "ok") {
$tj25 = $params25->res;
}
}
if (!$uid || $uid == 26) {
$params26 = array("uid" => 26, "date" => $stats_date);
$params26 = Service_Common::post($url, json_encode($params26));
$params26 = json_decode($params26);
if ($params26->status == "ok") {
$tj26 = $params26->res;
}
}
if (!$uid || $uid == 27) {
$params27 = array("uid" => 27, "date" => $stats_date);
$params27 = Service_Common::post($url, json_encode($params27));
$params27 = json_decode($params27);
if ($params27->status == "ok") {
$tj27 = $params27->res;
}
}
if (!$uid || $uid == 28) {
$params28 = array("uid" => 28, "date" => $stats_date);
$params28 = Service_Common::post($url, json_encode($params28));
$params28 = json_decode($params28);
if ($params28->status == "ok") {
$tj28 = $params28->res;
}
}
if (!$uid || $uid == 30) {
$params30 = array("uid" => 30, "date" => $stats_date);
$params30 = Service_Common::post($url, json_encode($params30));
$params30 = json_decode($params30);
if ($params30->status == "ok") {
$tj30 = $params30->res;
}
}
if (!$uid || $uid == 31) {
$params31 = array("uid" => 31, "date" => $stats_date);
$params31 = Service_Common::post($url, json_encode($params31));
$params31 = json_decode($params31);
if ($params31->status == "ok") {
$tj31 = $params31->res;
}
}
if (!$uid || $uid == 32) {
$params32 = array("uid" => 32, "date" => $stats_date);
$params32 = Service_Common::post($url, json_encode($params32));
$params32 = json_decode($params32);
if ($params32->status == "ok") {
$tj32 = $params32->res;
}
}
$this->assign("tj25", $tj25);
$this->assign("tj26", $tj26);
$this->assign("tj27", $tj27);
$this->assign("tj28", $tj28);
$this->assign("tj30", $tj30);
$this->assign("tj31", $tj31);
$this->assign("tj32", $tj32);
$this->assign("tj25_jd", json_encode($tj25));
$this->assign("tj26_jd", json_encode($tj26));
$this->assign("tj27_jd", json_encode($tj27));
$this->assign("tj28_jd", json_encode($tj28));
$this->assign("tj30_jd", json_encode($tj30));
$this->assign("tj31_jd", json_encode($tj31));
$this->assign("tj32_jd", json_encode($tj32));
$this->assign("uid", $uid);
$this->assign("stats_date", $stats_date);
//.........這裏部分代碼省略.........
示例4: ageSpreadAction
/**
* 用戶地區分部或者年齡分部
*/
public function ageSpreadAction()
{
$c_uid = CommonUtil::getDefStr(FRequest::getString('c_uid'), "");
$c_sid = CommonUtil::getDefStr(FRequest::getString('c_sid'), "");
$stats_date = FRequest::getString('stats_date');
$this->assign('sc_uid', $c_uid);
$this->assign('sc_sid', $c_sid);
$this->assign('stats_date', $stats_date);
$where = array("um.uid" => array("gt" => 5000000));
if ($c_uid != "") {
$where["um.channel_uid"] = $c_uid;
}
if ($c_sid != "") {
$where["um.channel_sid"] = $c_sid;
}
if ($stats_date) {
$stm = date("Y-m-d 00:00:00", strtotime($stats_date));
// 昨天淩晨
$etm = date("Y-m-d 00:00:00", strtotime($stats_date . "+1 day"));
$where["str"] = " um.reg_time > '" . $stm . "' and um.reg_time < '" . $etm . "'";
}
// 查詢用戶省份數據
$user_table = new FTable("user_main", "um");
$data = $user_table->fields(array("(YEAR(curdate())-YEAR(ud.birthday)) as age", "um.gender", "count(*) as num"))->leftJoin("user_detail", "ud", "um.uid = ud.uid")->groupBy("um.gender,YEAR(ud.birthday)")->where($where)->select();
// echo(json_encode($data));
$user_table2 = new FTable("user_main", "um");
$data2 = $user_table2->fields(array("(YEAR(curdate())-YEAR(ud.birthday)) as age", "count(*) as num"))->leftJoin("user_detail", "ud", "um.uid = ud.uid")->groupBy("YEAR(ud.birthday)")->where($where)->order(array("num" => "desc"))->limit(30)->select();
$rs = array("default" => array("1" => 0, "2" => 0));
$p_arr = array();
foreach ($data2 as $ages) {
$age = $ages["age"];
if (!$age || empty($age)) {
$age = "缺省";
}
array_push($p_arr, $age);
}
foreach ($data as $d) {
$rm = array("1" => 0, "2" => 0);
$age = $d["age"];
if (!$age || empty($age)) {
$age = "缺省";
}
$gender = $d["gender"];
if (array_key_exists($age, $rs)) {
$rm = $rs[$age];
}
$rm[$gender] += $d["num"];
$rs[$age] = $rm;
}
$data_1 = array();
$data_2 = array();
foreach ($p_arr as $p) {
$d = $rs[$p];
$d_1 = 0;
$d_2 = 0;
if ($d && $d["1"]) {
$d_1 = $d["1"];
}
if ($d && $d["2"]) {
$d_2 = $d["2"];
}
$data_1[count($data_1)] = $d_1;
$data_2[count($data_2)] = $d_2;
}
$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($data_1));
$this->assign("data_2", json_encode($data_2));
$this->assign("ages", json_encode($p_arr));
$this->display('admin/user_age_spread');
}
示例5: reportAction
/**
* 主報表查詢
*/
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; }
//.........這裏部分代碼省略.........