add User::usertypeChange,userpwdChange

This commit is contained in:
cuixin 2015-03-03 11:59:07 +08:00
parent 4fa342c3ce
commit cf828a938f
1 changed files with 28 additions and 4 deletions

View File

@ -31,7 +31,6 @@ class User extends AbstractEventManager implements ServiceManagerAwareInterface
$this->db = $dbService->getPdo();
}
/**
* 所有用户
* @param $usertype
@ -45,7 +44,6 @@ class User extends AbstractEventManager implements ServiceManagerAwareInterface
return $rs->fetchAll(\PDO::FETCH_ASSOC);
}
/**
* 用户详细信息
* @param $userid
@ -72,6 +70,33 @@ class User extends AbstractEventManager implements ServiceManagerAwareInterface
return true;
}
/**
* 修改用户类型
* @param $userid
* @param $usertype
* @return bool
*/
public function usertypeChange ($userid, $usertype) {
$sql = "UPDATE users SET usertype = '$usertype' WHERE id = $userid";
$this->db->exec($sql);
return true;
}
/**
* 修改用户密码
* @param $userid
* @param $userpwd
* @return bool
*/
public function userpwdChange ($userid, $userpwd) {
$sql = "UPDATE users SET password = '$userpwd' WHERE id = $userid";
$this->db->exec($sql);
return true;
}
/**
* 黑河用户
@ -87,14 +112,13 @@ class User extends AbstractEventManager implements ServiceManagerAwareInterface
return true;
}
/**
* 所有长时间未登录的用户
* @return mixed
*/
public function fetchAllSendmail () {
$time = date("Y-m-d H:i:s", time()-3 * 365 * 24 * 3600);
$time = date("Y-m-d H:i:s", time() - 3 * 365 * 24 * 3600);
$sql = "SELECT * FROM users
WHERE ts_last_login<'$time'