staff.php 3.8 KB

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