scUser.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. Doo::loadCore('db/DooModel');
  3. class scUser extends DooModel {
  4. public $sid;
  5. public $uid;
  6. public $Name;
  7. public $MobileNum;
  8. public $Company;
  9. public $PhoneNum;
  10. public $QQ;
  11. public $Province;
  12. public $Address;
  13. public $KnowFrom;
  14. public $KnowOther;
  15. public $_table = 'sc_user';
  16. public $_primarykey = 'sid';
  17. public $_fields = array('sid', 'uid', 'Name', 'MobileNum', 'Company', 'PhoneNum', 'QQ','Province' ,'Address', 'KnowFrom',
  18. 'KnowOther');
  19. public function __construct() {
  20. parent::setupModel(__CLASS__);
  21. }
  22. /**
  23. *
  24. * @param type $param
  25. */
  26. public function userAdd($uArray) {
  27. if (!is_array($uArray))
  28. return FALSE;
  29. $this->username = $uArray['username'];
  30. $this->useremail = $uArray['useremail'];
  31. $this->userpasswd = $uArray['userpasswd'];
  32. $this->actstate = 0;
  33. $this->regip = $uArray['clientip'];
  34. $this->intime = time();
  35. $this->salt = $uArray['salt'];
  36. return $this->insert();
  37. }
  38. /**
  39. *
  40. * @param type $param
  41. */
  42. public function getAll($limit) {
  43. return $this->find(array('select' => 'username,useremail,lastloginip,lastlogintime', 'limit' => $limit, 'asArray' => TRUE));
  44. }
  45. /**
  46. *
  47. * @param type $param
  48. */
  49. public function getCountz() {
  50. return $this->count();
  51. }
  52. /**
  53. *
  54. * @param type $param
  55. */
  56. public function updateBank($uid, $money) {
  57. $this->bank = new DooDbExpression('bank+' . $money);
  58. return $this->update(array('where' => 'id=' . $uid));
  59. }
  60. public function getRowByUid($uid) {
  61. if (empty($uid))
  62. return false;
  63. return $this->find(array('select' => 'bank,username,useremail', 'where' => 'id=' . $uid, 'asArray' => TRUE));
  64. }
  65. }
  66. ?>