本文整理匯總了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');
}
}