| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- Doo::loadCore('db/DooModel');
- class Users extends DooModel {
- public $id;
- public $username;
- public $useremail;
- public $userpasswd;
- public $userquestion;
- public $defquestion;
- public $useranswer;
- public $actstate;
- public $salt;
- public $regip;
- public $regdate;
- public $lastloginip;
- public $lastlogintime;
- public $lastip;
- public $uptime;
- public $intime;
- public $bank;
- public $mobile;
- public $keys_auth;
- public $_table = 'zh_users';
- public $_primarykey = 'id';
- public $_fields = array('id', 'username', 'useremail', 'userpasswd', 'userquestion', 'defquestion', 'useranswer', 'actstate', 'salt', 'regip', 'regdate', 'lastloginip', 'lastlogintime', 'lastip', 'uptime', 'intime', 'bank', 'mobile','keys_auth');
- public function __construct() {
- parent::setupModel(__CLASS__);
- }
- /**
- *
- * @param type $param
- */
- public function userAdd($uArray) {
- if (!is_array($uArray))
- return FALSE;
- $this->username = $uArray['username'];
- $this->useremail = $uArray['useremail'];
- $this->userpasswd = $uArray['userpasswd'];
- $this->actstate = 0;
- $this->regip = $uArray['clientip'];
- $this->intime = time();
- $this->salt = $uArray['salt'];
- return $this->insert();
- }
- /**
- *
- * @param type $param
- */
- public function getAll($limit) {
- return $this->find(array('select' => 'id,username,mobile,useremail,lastloginip,lastlogintime', 'desc' => 'regdate', 'limit' => $limit, 'asArray' => TRUE));
- }
- /**
- *
- * @param type $param
- */
- public function getCountz() {
- return $this->count();
- }
- /**
- *
- * @param type $param
- */
- public function updateBank($uid, $money) {
- $this->bank = new DooDbExpression('bank+' . $money);
- return $this->update(array('where' => 'id=' . $uid));
- }
- public function getRowByUid($uid) {
- if (empty($uid))
- return false;
- return $this->find(array('select' => 'bank,username,useremail', 'where' => 'id=' . $uid, 'asArray' => TRUE));
- }
- public function getRowByMobile($mobile) {
- return $this->getOne(array('where' => 'mobile="' . $mobile . '"', 'asArray' => TRUE));
- }
- public function getRowByName($name) {
- return $this->getOne(array('where' => 'username="' . $name . '"', 'asArray' => TRUE));
- }
- public function getRowByid($uid) {
- return $this->getOne(array('select' => 'mobile,useremail', 'where' => 'id=' . $uid, 'asArray' => TRUE));
- }
- public function getidBysearch($search) {
- return $this->getOne(array('select' => 'id' ,'where' => 'username=? or useremail=? or mobile=?', 'param' => array($search,$search,$search), 'asArray' => TRUE));
- }
- }
- ?>
|