staff.php 2.8 KB

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