staff.php 3.5 KB

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