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

新增租客审核

parent cf7575fb
......@@ -35,6 +35,13 @@ abstract class BaseController
'gas' =>'元/立方米',
'property' =>'元/平方米'
];
protected $userType = [
'0' =>'房主',
'1' =>'家人',
'2' =>' 租客',
'3' =>'替换业主'
];
/**
* Request实例
* @var \think\Request
......
......@@ -142,6 +142,7 @@ class Index extends Base
//当前用户的所有的房间列表
public function allVacancy() {
$uid = $this->uid;
$userType = $this->userType;
$where[] = ['hub.uid','=',$uid];
$page = Request::param('page',1);
$data = Db::name('house_user_bind')->alias('hub')->where($where)
......@@ -162,6 +163,7 @@ class Index extends Base
$data[$k]['cars'] = $cars[0];
}
$data[$k]['car_total'] = $car_total;
$data[$k]['type_zh'] = $userType[$v['type']];
}
$total = Db::name('house_user_bind')->alias('hub')->where($where)->count();
$res['total'] = $total;
......@@ -255,6 +257,7 @@ class Index extends Base
$uid = $this->uid;
$where[] = ['hub.uid','=',$uid];
$where[] = ['hub.house_user_bind_id','=',$bind_id];
$where[] = ['hub.status','=',1];
$data = Db::name('house_user_bind')->alias('hub')->where($where)
->leftJoin('house_vacancy hv','hv.vacancy_id = hub.vacancy_id')
->leftJoin('house_village hvi','hvi.village_id = hub.village_id')
......@@ -264,12 +267,14 @@ class Index extends Base
$data['vacancy_address'] = $res['vacancy_address'];
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){
$data['tenant'] = $this->getTenant($data['vacancy_id']);
$data['user'] = $this->getTenant($data['vacancy_id']);
}
......@@ -283,34 +288,51 @@ class Index extends Base
//查询租客
$tenant = Db::name('house_user_bind')->alias('hub')->leftJoin('user','user.uid = hub.uid')
->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) {
$car = Db::name('car')->where(['uid'=>$v['uid'],'village_id'=>$v['village_id']])->select()->toArray();
$tenant[$k]['cars'] = $car;
$tenant[$k]['car_total'] = count($car);
$family[$k]['type_zh'] = "租客";
}
return $tenant;
}
//根据房间id,查询家属
public function getFamily($vacancy_id) {
//查询租客
$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.status','<>',3)
->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) {
$car = Db::name('car')->where(['uid'=>$v['uid'],'village_id'=>$v['village_id']])->select()->toArray();
$family[$k]['cars'] = $car;
$family[$k]['car_total'] = count($car);
$family[$k]['type_zh'] = "家属";
}
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
$limit = count($property_cost_ids);
$cost_property_ids = Db::name('cost')->where($where)->where($whereOne)->limit($limit)->column('cost_id');
if($cost_property_ids != $property_cost_ids) {
return $this->returnJson([],'物业费缴费必须连续!',400);
}
}
......@@ -348,14 +347,11 @@ class Payorder extends Base
//更改订单的支付方式
Db::name('pay_order')->where(['order_id'=>$order_id])->save(['pay_type'=>"微信"]);
}
return $this->returnJson($res);
} else {
return $this->returnJson([],'非法的订单信息!',400);
}
}
//获取支付宝支付参数
public function getAliPaySign($param) {
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