Commit 75a10dbf authored by 蔡闯's avatar 蔡闯

2020-1-13

parent b9137ca7
...@@ -24,15 +24,27 @@ class Index extends Base ...@@ -24,15 +24,27 @@ class Index extends Base
$data = Db::name('house_village')->where(['village_id'=>$village_id])->field('village_id,village_name')->find(); $data = Db::name('house_village')->where(['village_id'=>$village_id])->field('village_id,village_name')->find();
} }
//首页推荐新闻
$news= Db::name('news')->where(['village_id'=>$data['village_id'],'is_recommend'=>1])->order('recommend_sort_id','desc') $news= Db::name('news')->where(['village_id'=>$data['village_id'],'is_recommend'=>1])->order('recommend_sort_id','desc')
->field('title,pic,content') ->field('title,pic,content')
->page($page,config('app.limit')) ->page($page,config('app.limit'))
->select()->toArray(); ->select()->toArray();
foreach ($news as $k=>$v) { foreach ($news as $k=>$v) {
$news[$k]['content'] = mb_substr(strip_tags($v['content']),0,100); $news[$k]['content'] = mb_substr(strip_tags($v['content']),0,100);
} }
$data['news'] = $news; $data['news'] = $news;
//首页轮播图
$banner = Db::name('village_banner')->where(['village_id'=>$village_id])->order(['sort_id'=>'desc','create_time'=>'desc'])->select()->toArray();
$data['banner'] = $banner;
return $this->returnJson($data);
}
//获取布局
public function getLayoutList(){
$where['village_id'] = Request::param('village_id');
$data = Db::name('layout_list')->where($where)->select()->toArray();
return $this->returnJson($data); return $this->returnJson($data);
} }
...@@ -62,7 +74,6 @@ class Index extends Base ...@@ -62,7 +74,6 @@ class Index extends Base
} else { } else {
$data = $this->getBuildInfo($where); $data = $this->getBuildInfo($where);
} }
return $this->returnJson($data); return $this->returnJson($data);
} }
...@@ -78,11 +89,9 @@ class Index extends Base ...@@ -78,11 +89,9 @@ class Index extends Base
foreach ($data as $k =>$v) { foreach ($data as $k =>$v) {
$data[$k]['code_name'] = $v['code'].explode('-',$v['list_code'])[$v['level']-1]; $data[$k]['code_name'] = $v['code'].explode('-',$v['list_code'])[$v['level']-1];
} }
return $data; return $data;
} }
//获取单个房间基本信息 //获取单个房间基本信息
public function getVacancyInfo() { public function getVacancyInfo() {
$vacancy_id = Request::param('vacancy_id'); $vacancy_id = Request::param('vacancy_id');
...@@ -101,6 +110,7 @@ class Index extends Base ...@@ -101,6 +110,7 @@ class Index extends Base
} }
//常用电话 //常用电话
public function commonPhone() { public function commonPhone() {
$village_id = Request::param('village_id'); $village_id = Request::param('village_id');
......
...@@ -195,27 +195,28 @@ class Payorder extends Base ...@@ -195,27 +195,28 @@ class Payorder extends Base
public function createOrder(){ public function createOrder(){
$vacancy_id = Request::param('vacancy_id'); $vacancy_id = Request::param('vacancy_id');
$bind_id = Request::param('bind_id'); $bind_id = Request::param('bind_id');
$cost_ids = Request::param('cost_ids'); $all_cost_arr = Request::param('cost_ids');
$total_money = Request::param('total_money',0); foreach ($all_cost_arr as $k => $v) {
//验证物业费订单是否是连续的 $cost_ids = Request::param('cost_ids');
$where['type'] = 'property'; //验证物业费订单是否是连续的
$where['is_pay'] = 0; $where['type'] = 'property';
$where['vacancy_id'] = $vacancy_id; $where['is_pay'] = 0;
$property_cost_ids = Db::name('cost')->where($where)->whereIn('cost_id',$cost_ids)->column('cost_id'); //上传的未缴物业费的连续cost_id $where['vacancy_id'] = $v['vacancy_id'];
$limit = count($property_cost_ids); $property_cost_ids = Db::name('cost')->where($where)->whereIn('cost_id',$cost_ids)->column('cost_id'); //上传的未缴物业费的连续cost_id
$cost_property_ids = Db::name('cost')->where($where)->limit($limit)->column('cost_id'); $limit = count($property_cost_ids);
$cost_property_ids = Db::name('cost')->where($where)->limit($limit)->column('cost_id');
if($cost_property_ids != $property_cost_ids) { if($cost_property_ids != $property_cost_ids) {
return $this->returnJson([],'物业费缴费必须连续!'); return $this->returnJson([],'物业费缴费必须连续!');
}
} }
$total_money = Request::param('total_money',0);
//判断金额是否一致 //判断金额是否一致
unset($where['type']); unset($where['type']);
$total = Db::name('cost')->where($where)->whereIn('cost_id',$cost_ids)->sum('pay_money'); $total = Db::name('cost')->where($where)->whereIn('cost_id',$cost_ids)->sum('pay_money');
if($total != $total_money) { if($total != $total_money) {
return $this->returnJson([],'支付金额不正确!',400); return $this->returnJson([],'支付金额不正确!',400);
} }
$data['uid'] = $this->uid; $data['uid'] = $this->uid;
if(count($cost_ids)>1){ if(count($cost_ids)>1){
$data['order_type'] = "多订单收费"; $data['order_type'] = "多订单收费";
...@@ -341,4 +342,5 @@ class Payorder extends Base ...@@ -341,4 +342,5 @@ class Payorder extends Base
} }
\ No newline at end of file
...@@ -28,11 +28,11 @@ class User extends Base ...@@ -28,11 +28,11 @@ class User extends Base
$where['area_id'] = $area_id; $where['area_id'] = $area_id;
} }
if($keyword) { //如果有关键字就搜索关键字的小区 if($keyword) { //如果有关键字就搜索关键字的小区
$villages = Db::name('house_village')->where($where)->where('village_name','like','%'.$keyword.'%')->field('village_name,village_id')->page($page,config('app.limit'))->select()->toArray(); $villages = Db::name('house_village')->where($where)->where('village_name','like','%'.$keyword.'%')->field('village_name,village_id,province_name,city_name,area_name,village_logo,village_address')->page($page,config('app.limit'))->select()->toArray();
$res['total'] = Db::name('house_village')->where($where)->where('village_name','like','%'.$keyword.'%')->count(); $res['total'] = Db::name('house_village')->where($where)->where('village_name','like','%'.$keyword.'%')->count();
$rest=[]; $rest=[];
foreach ($villages as $k =>$v) { foreach ($villages as $k =>$v) {
$rest['village_name'] = $v['village_name']; $rest['village_info'] =$villages;
$rest['vacancy'] = Common::getVacancy($v['village_id'],$this->uid); $rest['vacancy'] = Common::getVacancy($v['village_id'],$this->uid);
$res['data'][] = $rest; $res['data'][] = $rest;
} }
...@@ -118,8 +118,8 @@ class User extends Base ...@@ -118,8 +118,8 @@ class User extends Base
$data['status'] = 2; $data['status'] = 2;
$data['create_time'] =$car['create_time']= time(); $data['create_time'] =$car['create_time']= time();
$data['memo'] = Request::param('memo'); $data['memo'] = Request::param('memo');
$data['emer_user'] = Request::param('emer_user');//紧急联系人 // $data['emer_user'] = Request::param('emer_user');//紧急联系人
$data['emer_phone'] = Request::param('emer_phone'); //紧急联系人电话 // $data['emer_phone'] = Request::param('emer_phone'); //紧急联系人电话
$car['brand'] = Request::param('barnd'); $car['brand'] = Request::param('barnd');
$car['car_type'] = Request::param('car_type'); $car['car_type'] = Request::param('car_type');
$car['license_plate'] = Request::param('license_plate'); $car['license_plate'] = Request::param('license_plate');
...@@ -155,7 +155,13 @@ class User extends Base ...@@ -155,7 +155,13 @@ class User extends Base
try{ try{
Db::name('house_user_bind')->save($data); Db::name('house_user_bind')->save($data);
if($car['brand'] && $car['car_type'] && $car['license_plate']) { if($car['brand'] && $car['car_type'] && $car['license_plate']) {
Db::name('car')->save($car); //查看系统中是否存在了,存在则修改,不存在则添加
$is_exit = Db::name('car')->where(['village_id'=>$village_id,'license_plate'=>$data['license_plate']])->find();
if($is_exit){
Db::name('car')->where(['village_id'=>$village_id,'license_plate'=>$data['license_plate']])->save($car);
}else{
Db::name('car')->save($car);
}
} }
Db::commit(); Db::commit();
......
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