staff.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. return $this->find ( array (
  75. 'where' => "sid= '" . $puid . "'",
  76. 'asArray' => TRUE
  77. ) );
  78. }
  79. /**
  80. * 根据用户ID获取相关信息
  81. * @param number $sid 用户ID
  82. */
  83. public function getStaffBySid($sid = 0) {
  84. $detail = array ();
  85. if (! empty ( $sid ))
  86. $detail = $this->getOne ( array (
  87. 'where' => "sid= '" . $sid . "'",
  88. 'asArray' => TRUE
  89. ) );
  90. return $detail;
  91. }
  92. }
  93. ?>