* fix the bug of 21bird.

This commit is contained in:
wangchunsheng
2010-02-27 03:17:23 +00:00
parent 8b7f8a9f98
commit cf3fbc6824

View File

@@ -71,10 +71,12 @@ class userModel extends model
/* ͨ<><CDA8>id<69><64>ȡijһ<C4B3><D2BB><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>*/
public function getById($userID)
{
$where = $userID > 0 ? " WHERE id = '$userID'" : " WHERE account = '$userID'";
$sql = "SELECT * FROM " . TABLE_USER . $where;
$user = $this->dbh->query($sql)->fetch();
if($user) $user->last = date('Y-m-d H:i:s', $user->last);
$user = $this->dao->select('*')->from(TABLE_USER)
->onCaseOf(is_int($userID))->where('id')->eq((int)$userID)->endCase()
->onCaseOf(is_string($userID))->where('account')->eq($userID)->endCase()
->fetch();
if(!$user) return false;
$user->last = date('Y-m-d H:i:s', $user->last);
return $user;
}