本文整理匯總了PHP中CommonUtil::birthdayToAge方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonUtil::birthdayToAge方法的具體用法?PHP CommonUtil::birthdayToAge怎麽用?PHP CommonUtil::birthdayToAge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonUtil
的用法示例。
在下文中一共展示了CommonUtil::birthdayToAge方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: youxiuAction
function youxiuAction()
{
//global $_F;
//$_F["debug"] = true;
$page = max(1, FRequest::getInt('page'));
$uid = FRequest::getInt('uid');
$nickname = FRequest::getString('nickname');
$where = array("ud.uid" => array('gte' => '5000000'), "ud.avatarlevel" => 9, "um.stat" => 0);
$datetime_riqi_qiantian = date("Y-m-d", time() - 172800);
$query_str = " um.reg_time >= '" . $datetime_riqi_qiantian . " 00:00:00' ";
$where["str"] = $query_str;
$table = new FTable("user_detail", "ud");
$users = $table->fields(array("um.uid", "um.stat", "um.gender", "um.reg_time", "ud.nickname", "ud.avatar", "ud.province", "ud.city", "ud.birthday", "ud.height", "ud.marry", "ud.aboutme"))->leftJoin("user_main", "um", "ud.uid=um.uid")->where($where)->page($page)->limit(100)->order(array("ud.uid" => "desc"))->select();
foreach ($users as &$user) {
$user["age"] = CommonUtil::birthdayToAge($user["birthday"]);
$user["avatar"] = CommonUtil::getMoreSizeImg($user["avatar"], 50, 50);
}
$page_info = $table->getPagerInfo();
$this->assign('page_info', $page_info);
$this->assign('users', $users);
$this->display('admin/user_list_youxiu');
}
示例2: dynamicAction
public function dynamicAction()
{
global $_F;
// $_F["debug"] = true;
$uid = FRequest::getInt('uid');
$id = FRequest::getInt('id');
$table = new FTable("dynamics", "dy");
$dy = $table->where(array("id" => $id))->find();
// echo(json_encode($dy));
if (!$dy || $dy["uid"] <= 0) {
return;
}
$user = Service_Client::getUserByUid($uid);
$user["age"] = CommonUtil::birthdayToAge($user["birthday"]);
$this->assign('dy', $dy);
$this->assign('user', $user);
$pic = $dy["pic"];
if ($pic) {
$pic_arr = explode(",", $pic);
// echo json_encode($pic_arr);
$this->assign("pic_arr", $pic_arr);
}
$this->display('shareDynamic');
}
示例3: updateAction
/**
* 審核用戶詳情
*/
function updateAction()
{
global $_F;
$uid = FRequest::getInt("uid");
$user_detail_table = new FTable("user_main", "um");
$user = $user_detail_table->leftJoin("user_detail", "ud", "um.uid=ud.uid")->where(array("um.uid" => $uid))->select();
$user[0]["age"] = CommonUtil::birthdayToAge($user[0]["birthday"]);
$interests = explode(",", $user[0]["interest"]);
$this->assign("old_interests", $interests);
$photo_table = new FTable("user_photo_album");
$photos = $photo_table->fields(array("pic", "albumid"))->where(array("uid" => $uid, "first_status" => 0))->select();
$photo_arr = $photos;
$uid_d = $uid;
$table2 = new FTable("image_md5", "im");
$image_md5 = $table2->fields(array("im.md5"))->where(array("im.url" => $user[0]["avatar"]))->find();
// echo($user["avatar"]);
$table3 = new FTable("image_md5", "im");
$images = $table3->fields(array("im.url"))->where(array("im.md5" => $image_md5["md5"], "str" => " im.url<>'" . $user[0]["avatar"] . "' "))->select();
$i = 1;
foreach ($images as $image) {
$i++;
$table4 = new FTable("user_detail", "ud");
$users4 = $table4->fields(array("ud.uid"))->where(array("ud.avatar" => $image['url']))->find();
if ($users4) {
$uid_d = $uid_d . "," . $users4['uid'];
}
}
$user[0]["uid_d"] = $uid_d;
$user[0]["uid_i"] = $i;
$user[0]["avatar"] = CommonUtil::getMoreSizeImg($user[0]["avatar"], 222, 222);
$this->assign("user", $user[0]);
$update_record = new FTable("update_record");
$updates = $update_record->fields(array("item"))->where(array("uid" => $uid, "status" => 0))->select();
//$update_arr = $updates;
//$size = count($updates);
$update_arr = array();
$j = 0;
foreach ($updates as $update) {
$update_arr[$j] = $update['item'];
$j++;
}
//echo(json_encode($update_arr));
if (in_array("nickname", $update_arr)) {
$nickname = "red";
}
if (in_array("avatar", $update_arr)) {
$avatar = "red";
}
if (in_array("aboutme", $update_arr)) {
$aboutme = "red";
}
/* $photo_arr = array();
foreach($photos as $photo){
array_push($photo_arr,$photo["pic"]);
}*/
//echo(count($photo_arr));
$this->assign("photos", $photo_arr);
$this->assign("photos_num", count($photo_arr));
$this->assign("stars", self::$STARS);
$this->assign("nickname", $nickname);
$this->assign("avatar", $avatar);
$this->assign("aboutme", $aboutme);
$this->display('admin/y_user_update');
}
示例4: listAction
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');
}