staff.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 getStaff() {
  54. return $this->find ( array (
  55. 'desc' => 'sid',
  56. 'asArray' => TRUE
  57. ) );
  58. }
  59. public function getStaffByCid($cid = 0) {
  60. return $this->find ( array (
  61. 'asc' => 'sid',
  62. 'where' => "cid= '" . $cid . "'",
  63. 'asArray' => TRUE
  64. ) );
  65. }
  66. public function getUserById($sid = 0) {
  67. return $this->find ( array (
  68. 'asc' => 'sid',
  69. 'where' => "sid= '" . $sid . "'",
  70. 'asArray' => TRUE
  71. ) );
  72. }
  73. public function getUserByIdList($puid) {
  74. Doo::loadClass ( 'XDeode' );
  75. $XDeode = new XDeode ( 5 );
  76. $puid = $XDeode->decode ( $puid );
  77. return $this->find ( array (
  78. 'where' => "sid= '" . $puid . "'",
  79. 'asArray' => TRUE
  80. ) );
  81. }
  82. /**
  83. * 根据用户ID获取相关信息
  84. * @param number $sid 用户ID
  85. */
  86. public function getStaffBySid($sid = 0) {
  87. $detail = array ();
  88. if (! empty ( $sid ))
  89. $detail = $this->getOne ( array (
  90. 'where' => "sid= '" . $sid . "'",
  91. 'asArray' => TRUE
  92. ) );
  93. return $detail;
  94. }
  95. }
  96. ?>