staff.php 2.3 KB

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