Commit 6a37de71 authored by 蔡闯's avatar 蔡闯

新增租客审核

parent cf7575fb
...@@ -35,6 +35,13 @@ abstract class BaseController ...@@ -35,6 +35,13 @@ abstract class BaseController
'gas' =>'元/立方米', 'gas' =>'元/立方米',
'property' =>'元/平方米' 'property' =>'元/平方米'
]; ];
protected $userType = [
'0' =>'房主',
'1' =>'家人',
'2' =>' 租客',
'3' =>'替换业主'
];
/** /**
* Request实例 * Request实例
* @var \think\Request * @var \think\Request
......
...@@ -142,6 +142,7 @@ class Index extends Base ...@@ -142,6 +142,7 @@ class Index extends Base
//当前用户的所有的房间列表 //当前用户的所有的房间列表
public function allVacancy() { public function allVacancy() {
$uid = $this->uid; $uid = $this->uid;
$userType = $this->userType;
$where[] = ['hub.uid','=',$uid]; $where[] = ['hub.uid','=',$uid];
$page = Request::param('page',1); $page = Request::param('page',1);
$data = Db::name('house_user_bind')->alias('hub')->where($where) $data = Db::name('house_user_bind')->alias('hub')->where($where)
...@@ -162,6 +163,7 @@ class Index extends Base ...@@ -162,6 +163,7 @@ class Index extends Base
$data[$k]['cars'] = $cars[0]; $data[$k]['cars'] = $cars[0];
} }
$data[$k]['car_total'] = $car_total; $data[$k]['car_total'] = $car_total;
$data[$k]['type_zh'] = $userType[$v['type']];
} }
$total = Db::name('house_user_bind')->alias('hub')->where($where)->count(); $total = Db::name('house_user_bind')->alias('hub')->where($where)->count();
$res['total'] = $total; $res['total'] = $total;
...@@ -255,6 +257,7 @@ class Index extends Base ...@@ -255,6 +257,7 @@ class Index extends Base
$uid = $this->uid; $uid = $this->uid;
$where[] = ['hub.uid','=',$uid]; $where[] = ['hub.uid','=',$uid];
$where[] = ['hub.house_user_bind_id','=',$bind_id]; $where[] = ['hub.house_user_bind_id','=',$bind_id];
$where[] = ['hub.status','=',1];
$data = Db::name('house_user_bind')->alias('hub')->where($where) $data = Db::name('house_user_bind')->alias('hub')->where($where)
->leftJoin('house_vacancy hv','hv.vacancy_id = hub.vacancy_id') ->leftJoin('house_vacancy hv','hv.vacancy_id = hub.vacancy_id')
->leftJoin('house_village hvi','hvi.village_id = hub.village_id') ->leftJoin('house_village hvi','hvi.village_id = hub.village_id')
...@@ -264,12 +267,14 @@ class Index extends Base ...@@ -264,12 +267,14 @@ class Index extends Base
$data['vacancy_address'] = $res['vacancy_address']; $data['vacancy_address'] = $res['vacancy_address'];
if($data['type'] ==0 ){ if($data['type'] ==0 ){
//查询家属 //查询家属
$data['family'] = $this->getFamily($data['vacancy_id']); $family = $this->getFamily($data['vacancy_id']);
//查询租客 //查询租客
$data['tenant'] = $this->getTenant($data['vacancy_id']); $tenant = $this->getTenant($data['vacancy_id']);
$data['user'] = array_merge($family,$tenant);
} elseif($data['type'] ==2){ } elseif($data['type'] ==2){
$data['tenant'] = $this->getTenant($data['vacancy_id']); $data['user'] = $this->getTenant($data['vacancy_id']);
} }
...@@ -283,34 +288,51 @@ class Index extends Base ...@@ -283,34 +288,51 @@ class Index extends Base
//查询租客 //查询租客
$tenant = Db::name('house_user_bind')->alias('hub')->leftJoin('user','user.uid = hub.uid') $tenant = Db::name('house_user_bind')->alias('hub')->leftJoin('user','user.uid = hub.uid')
->where(['hub.vacancy_id'=>$vacancy_id,'hub.type'=>2]) ->where(['hub.vacancy_id'=>$vacancy_id,'hub.type'=>2])
->field('hub.name,hub.phone,user.avatar,user.uid,hub.village_id')->select()->toArray(); ->where('hub.status','<>',3)
->where('hub.uid','<>',null)
->field('hub.name,hub.phone,user.avatar,user.uid,hub.village_id,hub.status,hub.type')->select()->toArray();
foreach ($tenant as $k =>$v) { foreach ($tenant as $k =>$v) {
$car = Db::name('car')->where(['uid'=>$v['uid'],'village_id'=>$v['village_id']])->select()->toArray(); $car = Db::name('car')->where(['uid'=>$v['uid'],'village_id'=>$v['village_id']])->select()->toArray();
$tenant[$k]['cars'] = $car; $tenant[$k]['cars'] = $car;
$tenant[$k]['car_total'] = count($car); $tenant[$k]['car_total'] = count($car);
$family[$k]['type_zh'] = "租客";
} }
return $tenant; return $tenant;
} }
//根据房间id,查询家属 //根据房间id,查询家属
public function getFamily($vacancy_id) { public function getFamily($vacancy_id) {
//查询租客 //查询租客
$family = Db::name('house_user_bind')->alias('hub')->leftJoin('user','user.uid = hub.uid') $family = Db::name('house_user_bind')->alias('hub')->leftJoin('user','user.uid = hub.uid')
->where(['hub.vacancy_id'=>$vacancy_id,'hub.type'=>1]) ->where(['hub.vacancy_id'=>$vacancy_id,'hub.type'=>1])
->where('hub.status','<>',3)
->where('hub.uid','<>',null) ->where('hub.uid','<>',null)
->field('hub.house_user_bind_id,hub.village_id,hub.name,hub.phone,user.avatar,hub.uid')->select()->toArray(); ->field('hub.house_user_bind_id,hub.village_id,hub.name,hub.phone,user.avatar,hub.uid,hub.status,hub.type')->select()->toArray();
foreach ($family as $k =>$v) { foreach ($family as $k =>$v) {
$car = Db::name('car')->where(['uid'=>$v['uid'],'village_id'=>$v['village_id']])->select()->toArray(); $car = Db::name('car')->where(['uid'=>$v['uid'],'village_id'=>$v['village_id']])->select()->toArray();
$family[$k]['cars'] = $car; $family[$k]['cars'] = $car;
$family[$k]['car_total'] = count($car); $family[$k]['car_total'] = count($car);
$family[$k]['type_zh'] = "家属";
} }
return $family; return $family;
} }
//业主审核租客和家属,或家属租客申请解绑
public function changeStatus() {
$bind_id = Request::param('bind_id');
$status = Request::param('status'); //1接受,0拒绝,4申请解绑,3已解绑
$save['status'] = $status;
$save['pass_time'] = time();
$change = Db::name('house_user_bind')->where(['house_user_bind_id'=>$bind_id])->save($save);
if($change) {
return $this->returnJson();
} else {
return $this->returnJson([],'操作失败!',400);
}
}
......
...@@ -265,7 +265,6 @@ class Payorder extends Base ...@@ -265,7 +265,6 @@ class Payorder extends Base
$limit = count($property_cost_ids); $limit = count($property_cost_ids);
$cost_property_ids = Db::name('cost')->where($where)->where($whereOne)->limit($limit)->column('cost_id'); $cost_property_ids = Db::name('cost')->where($where)->where($whereOne)->limit($limit)->column('cost_id');
if($cost_property_ids != $property_cost_ids) { if($cost_property_ids != $property_cost_ids) {
return $this->returnJson([],'物业费缴费必须连续!',400); return $this->returnJson([],'物业费缴费必须连续!',400);
} }
} }
...@@ -348,14 +347,11 @@ class Payorder extends Base ...@@ -348,14 +347,11 @@ class Payorder extends Base
//更改订单的支付方式 //更改订单的支付方式
Db::name('pay_order')->where(['order_id'=>$order_id])->save(['pay_type'=>"微信"]); Db::name('pay_order')->where(['order_id'=>$order_id])->save(['pay_type'=>"微信"]);
} }
return $this->returnJson($res); return $this->returnJson($res);
} else { } else {
return $this->returnJson([],'非法的订单信息!',400); return $this->returnJson([],'非法的订单信息!',400);
} }
} }
//获取支付宝支付参数 //获取支付宝支付参数
public function getAliPaySign($param) { public function getAliPaySign($param) {
require_once "../extend/aliPay/AopClient.php"; require_once "../extend/aliPay/AopClient.php";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment