L_category.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. Doo::loadCore ( 'db/DooModel' );
  3. class L_category extends DooModel {
  4. public $cid;
  5. public $title;
  6. public $defult;
  7. public $districtid;
  8. public $_table = 'CLD_L_category';
  9. public $_primarykey = 'cid';
  10. public $_fields = array (
  11. 'cid',
  12. 'title',
  13. 'defult',
  14. 'districtid'
  15. );
  16. public function checkUser($uid, $passwork) {
  17. return $this->find ( array (
  18. 'where' => "uid= '" . $uid . "' and passwork = '" . addslashes ( $passwork ) . "'",
  19. 'asArray' => TRUE
  20. ) );
  21. }
  22. public function getCategoryById($cid = 0, $othercid = "") {
  23. if (! empty ( $othercid ))
  24. return $this->find ( array (
  25. 'where' => "cid in ( " . $cid . "," . $othercid . ") ",
  26. 'asArray' => TRUE
  27. ) );
  28. else
  29. return $this->find ( array (
  30. 'where' => "cid= '" . $cid . "' ",
  31. 'asArray' => TRUE
  32. ) );
  33. }
  34. public function getCategory() {
  35. Doo::loadClass ( 'XDeode' );
  36. $XDeode = new XDeode ( 5 );
  37. $list=$this->find ( array (
  38. 'asc' => 'cid',
  39. 'asArray' => TRUE
  40. ) );
  41. foreach ($list as $key=>$value){
  42. $list[$key]['cidKey']=$XDeode->encode ( $value ['cid'] );
  43. }
  44. return $list;
  45. }
  46. public function getUserByIdList($puid) {
  47. return $this->find ( array (
  48. 'where' => "uid= '" . $puid . "'",
  49. 'asArray' => TRUE
  50. ) );
  51. }
  52. public function getCategoryStaff() {
  53. $list = $this->find ( array (
  54. 'asArray' => TRUE
  55. ) );
  56. Doo::loadModel ( 'staff' );
  57. $staff = new staff ();
  58. foreach ( $list as $key => $value ) {
  59. $list[$key]['staff']=$staff->getStaffByCid($value['cid']);
  60. }
  61. return $list;
  62. }
  63. }
  64. ?>