HouseFloorInfo.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\api\controller\Base;
  4. use app\hander\HelpHander;
  5. use think\Db;
  6. class HouseFloorInfo extends Base
  7. {
  8. public function floorInfo(){
  9. $bulidingInfo=Db::table('house_building')
  10. ->field('id,title,type')
  11. ->where('org_id',$this->orgId)
  12. ->select();
  13. if($bulidingInfo){
  14. foreach ($bulidingInfo as $k=>$val){
  15. if($val['type']==2){
  16. $trunInfo=Db::table('house_turn')
  17. ->where([
  18. 'enable'=>1,
  19. 'del'=>0,'status'=>0,
  20. 'building_id'=>$val['id'],
  21. 'org_id'=>$this->orgId
  22. ])
  23. ->select();
  24. $authInfo=Db::table('house_auth')
  25. ->field('type,ids')
  26. ->where([
  27. 'type'=>$val['type'],
  28. 'user_id'=>$this->userId,
  29. 'org_id'=>$this->orgId
  30. ])
  31. ->find();
  32. $arrayIds=explode(',',$authInfo['ids']);
  33. foreach ($trunInfo as $v){
  34. if(in_array($v['level_id'],$arrayIds)){
  35. $ret=Db::table('house_turn')
  36. ->where([
  37. 'enable'=>1,
  38. 'del'=>0,
  39. 'status'=>0,
  40. 'building_id'=>$val['id'],
  41. 'org_id'=>$this->orgId
  42. ])
  43. ->select();
  44. }else{
  45. $ret= [];
  46. }
  47. }
  48. }
  49. }
  50. }else{
  51. $ret=[];
  52. }
  53. HelpHander::success($ret);
  54. }
  55. }