userswitch.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. Doo::loadCore('db/DooModel');
  3. class UserSwitch extends DooModel {
  4. public $uid;
  5. public $actcode;
  6. public $rndcode;
  7. public $actime;
  8. public $_table = 'zh_users_switch';
  9. public $_primarykey = 'uid';
  10. public $_fields = array('uid', 'actcode', 'rndcode', 'actime');
  11. public function __construct() {
  12. parent::setupModel(__CLASS__);
  13. }
  14. public function userAdd($uid, $actcode, $rndcode) {
  15. if (empty($uid) || empty($actcode) || empty($rndcode))
  16. return FALSE;
  17. $this->uid = $uid;
  18. $this->actcode = $actcode;
  19. $this->rndcode = $rndcode;
  20. return $this->insert();
  21. }
  22. public function actUser($uid) {
  23. if (empty($uid))
  24. return FALSE;
  25. $this->actime = time();
  26. return $this->insert();
  27. }
  28. public function checkUserStatus($uid) {
  29. if (empty($uid))
  30. return FALSE;
  31. $actime = $this->getOne(array('select' => 'actime', 'where' => 'uid=?', 'param' => array($uid), 'asArray' => TRUE));
  32. return $actime['actime'];
  33. }
  34. }
  35. ?>