| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- Doo::loadCore('db/DooModel');
- class UserSwitch extends DooModel {
- public $uid;
- public $actcode;
- public $rndcode;
- public $actime;
- public $_table = 'zh_users_switch';
- public $_primarykey = 'uid';
- public $_fields = array('uid', 'actcode', 'rndcode', 'actime');
- public function __construct() {
- parent::setupModel(__CLASS__);
- }
- public function userAdd($uid, $actcode, $rndcode) {
- if (empty($uid) || empty($actcode) || empty($rndcode))
- return FALSE;
- $this->uid = $uid;
- $this->actcode = $actcode;
- $this->rndcode = $rndcode;
- return $this->insert();
- }
- public function actUser($uid) {
- if (empty($uid))
- return FALSE;
- $this->actime = time();
- return $this->insert();
- }
- public function checkUserStatus($uid) {
- if (empty($uid))
- return FALSE;
- $actime = $this->getOne(array('select' => 'actime', 'where' => 'uid=?', 'param' => array($uid), 'asArray' => TRUE));
- return $actime['actime'];
- }
- }
- ?>
|