staff.php 2.5 KB

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