本文整理汇总了PHP中UserModel::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModel::getById方法的具体用法?PHP UserModel::getById怎么用?PHP UserModel::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModel
的用法示例。
在下文中一共展示了UserModel::getById方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: user
protected function user()
{
if (!isset($this->user)) {
$user = new UserModel();
$this->user = $user->getById($this->aAttributes['user_id']);
}
return $this->user;
}
示例2: edit
/**
* 编辑用户信息
*/
function edit()
{
//得到传来的ID得到用户信息
$user_id = trim($_GET['id']);
$users = new UserModel();
$list = $users->getById($user_id);
$this->assign('user_list', $list);
$this->display();
}
示例3: getAllUsers
public function getAllUsers()
{
$userModel = new UserModel();
$database = new Database();
$allId = $this->getAllId($database);
$allUsers = array();
foreach ($allId as $id) {
array_push($allUsers, $userModel->getById($id));
}
return $allUsers;
}
示例4: getById
static function getById($id)
{
if (!$id) {
return false;
}
$model = new UserModel();
$result = $model->getById($id);
if (!$result) {
return false;
}
return $result[0];
}
示例5: isGranted
public function isGranted($role)
{
$session = Request::getInstance()->getSession();
$model = new UserModel();
switch ($role) {
case self::USER_IS_INACTIVE:
$user = $model->getById($session->getInstance()->get('id'));
if ($user) {
return !$user->getActive();
}
break;
case self::USER_IS_ADMIN:
if ($session->isConnected()) {
$user = $model->getById($session->get('id'));
return $user->getAccountLevel() == UserModel::ACCOUNT_LEVEL_ADMIN;
}
break;
case self::USER_IS_CONNECTED:
return $session->isConnected();
case self::USER_IS_NOT_CONNECTED:
return true;
}
return false;
}
示例6: UserloginAddlog
static function UserloginAddlog($id)
{
$userlogin = new UserLoginModel();
$user = new UserModel();
$udata = $user->getById($id);
$data = array('uid' => $id, 'updated' => time(), 'updateip' => Tool_Fnc::realip(), 'fqy' => 1);
if ($fqy = Member::LoginToday($id)) {
if ($fqy['s'] == 1) {
$data['fqy'] = $fqy['fqy'] + 1;
} elseif ($fqy['s'] == 0) {
$data['fqy'] = $fqy['fqy'];
}
}
$userlogin->insert($data);
//添加登陆日志
$type = self::$type;
if ($fqy) {
if ($fqy['s'] == 1) {
if ($data['fqy'] <= 10) {
$credit = $data['fqy'] * 10;
} else {
$credit = 100;
}
self::AddCredit($id, $credit);
self::AddLevelLog($id, 1, $credit, $data['fqy']);
} elseif ($fqy['s'] == 0) {
//同一天
//$credit = 10;
}
} else {
//第一次
$credit = 10;
self::AddCredit($id, $credit);
self::AddLevelLog($id, 1, $credit, $data['fqy']);
}
}
示例7: addmoney
public function addmoney()
{
$userid = I('id', NULL);
$user = new UserModel();
$data = $user->getById($userid);
if (!empty($userid)) {
$this->assign('data', $data);
$this->display();
} else {
$this->message2('非法操作', __APP__ . '/Admin');
}
}