staff.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. Doo::loadCore ( 'db/DooModel' );
  3. class staff extends DooModel {
  4. public $sid;
  5. public $username;
  6. public $passwork;
  7. public $isadmin;
  8. public $cid;
  9. public $othercid;
  10. public $category;
  11. public $othercategory;
  12. public $gender;
  13. public $qq;
  14. public $phone;
  15. public $telephone;
  16. public $email;
  17. public $birthday;
  18. public $position;
  19. public $avatar;
  20. public $appDate;
  21. public $hiredate;
  22. public $nature;
  23. public $_table = 'CLD_staff';
  24. public $_primarykey = 'sid';
  25. public $_fields = array (
  26. 'sid',
  27. 'username',
  28. 'birthday',
  29. 'position',
  30. 'passwork',
  31. 'isadmin',
  32. 'cid',
  33. 'othercid',
  34. 'appDate',
  35. 'category',
  36. 'othercategory',
  37. 'gender',
  38. 'qq',
  39. 'phone',
  40. 'telephone',
  41. 'email',
  42. 'avatar',
  43. 'hiredate',
  44. 'nature'
  45. );
  46. public function checkUser($uid, $passwork) {
  47. return $this->find ( array (
  48. 'select' => 'position,birthday,sid,username,isadmin,cid,othercid,category,othercategory,gender,qq,phone,telephone,email,avatar,hiredate,nature',
  49. 'where' => "username= '" . $uid . "' and passwork = '" . md5 ( $passwork ) . "'",
  50. 'asArray' => TRUE
  51. ) );
  52. }
  53. public function getStaffByName($username=''){
  54. return $this->getOne ( array (
  55. 'asc' => 'sid',
  56. 'where' => "username= '" . $username . "'",
  57. 'asArray' => TRUE
  58. ) );
  59. }
  60. public function getStaff() {
  61. return $this->find ( array (
  62. 'desc' => 'sid',
  63. 'asArray' => TRUE
  64. ) );
  65. }
  66. public function getStaffByCid($cid = 0) {
  67. return $this->find ( array (
  68. 'asc' => 'sid',
  69. 'where' => "cid= '" . $cid . "'",
  70. 'asArray' => TRUE
  71. ) );
  72. }
  73. public function getUserById($sid = 0) {
  74. return $this->find ( array (
  75. 'asc' => 'sid',
  76. 'where' => "sid= '" . $sid . "'",
  77. 'asArray' => TRUE
  78. ) );
  79. }
  80. public function getUserByIdList($puid) {
  81. Doo::loadClass ( 'XDeode' );
  82. $XDeode = new XDeode ( 5 );
  83. $puid = $XDeode->decode ( $puid );
  84. return $this->find ( array (
  85. 'where' => "sid= '" . $puid . "'",
  86. 'asArray' => TRUE
  87. ) );
  88. }
  89. /**
  90. * 根据用户ID获取相关信息
  91. * @param number $sid 用户ID
  92. */
  93. public function getStaffBySid($sid = 0) {
  94. $detail = array ();
  95. if (! empty ( $sid ))
  96. $detail = $this->getOne ( array (
  97. 'where' => "sid= '" . $sid . "'",
  98. 'asArray' => TRUE
  99. ) );
  100. return $detail;
  101. }
  102. }
  103. ?>