Commit 2bda122e authored by 蔡闯's avatar 蔡闯

接口修改

parent ad0f02a1
......@@ -61,8 +61,9 @@ class Payorder extends Base
//获取是业主身份的房间
$vacancys = Db::name('house_user_bind')->alias('hub')
->leftJoin('house_vacancy hv','hv.vacancy_id = hub.vacancy_id')
->leftJoin('house_village hvi','hvi.village_id=hv.village_id')
->where(['hub.type'=>0,'hub.status'=>1,'hub.uid'=>$this->uid])
->field('hub.house_user_bind_id,hv.vacancy_id,hv.vacancy_code,hv.layout_id')
->field('hub.house_user_bind_id,hv.vacancy_id,hv.vacancy_code,hv.layout_id,hvi.village_name')
->select()->toArray();
if($vacancys) {
$convertArr = $this->convertArr;
......@@ -77,6 +78,10 @@ class Payorder extends Base
$where['type'] = $key;
//总金额
$data= Db::name('cost')->where($where)->sum('pay_money');
//如果金额是0就跳过
if($data ==0) {
continue;
}
$rest['total_money'] = $data;
if($key == "property" || $key =="park"){
$count = Db::name('cost')->where($where)->count();
......@@ -86,41 +91,25 @@ class Payorder extends Base
$total_num = $num.$unit[$key];
}
$rest['total_num'] = $total_num;
$all[$key] = $rest;
//$vacancys[$k][$key] = $rest;
$rest['name'] = $key;
$rest['name_zh'] = $value;
$all[] = $rest;
}
//获取自定义的
unset($where['type']);
$count = Db::name('cost')->where($where)->whereNotIn('type',$array_keys)->sum('pay_money');
// $vacancys[$k]['other'] = $count;
$all['other'] = $count;
$vacancys[$k]['pay_list'] = $all;
}
//如果已缴费金额为0,删除,不显示
foreach ($vacancys as $k =>$v) {
foreach ($array_keys as $val ) { //删除水电物业费为0的记录
if($v['pay_list'][$val]['total_money'] ==0) {
unset($vacancys[$k]['pay_list'][$val]);
} else {
$pay_time = Db::name('cost')->where(['is_pay'=>1,'type'=>$val,'vacancy_id'=>$v['vacancy_id']])->order('pay_time','desc')->value('pay_time');
$vacancys[$k]['pay_list'][$val]['pay_time'] = date('Y-m-d H:i:s',$pay_time);
$other['name'] = "other";
$other['name_zh'] = "自定义";
$other['total_num'] = $count;
if($other['total_num'] !=0){
$all[] = $other;
}
}
if($v['pay_list']['other'] ==0) {
unset($vacancys[$k]['pay_list']['other']);
} else {
$pay_time = Db::name('cost')->where(['is_pay'=>1,'vacancy_id'=>$v['vacancy_id']])->whereNotIn('type',$array_keys)->order('pay_time','desc')->value('pay_time');
$vacancys[$k]['pay_list'][$val]['pay_time'] = date('Y-m-d H:i:s',$pay_time);
}
}
//要分开循环删除
foreach ($vacancys as $k => $v) {
if(!isset($v['pay_list']['water']) && !isset($v['pay_list']['property']) && !isset($v['pay_list']['electric']) && !isset($v['pay_list']['gas']) && !isset($v['pay_list']['park']) && !isset($v['pay_list']['other'])){
$vacancys[$k]['pay_list'] = $all;
//如果当前房间没有已缴费记录,则去掉
if(empty($all)) {
unset($vacancys[$k]);
}
}
} else {
$vacancys = [];
}
......
......@@ -15,19 +15,19 @@ class User extends Base
public function getUserVillage() {
$keyword = Request::param('keyword','');
$page = Request::param('page',1);
$province_id = Request::param('province_id');
$city_id = Request::param('city_id');
$area_id = Request::param('area_id');
// $province_id = Request::param('province_id');
// $city_id = Request::param('city_id');
// $area_id = Request::param('area_id');
$where =[];
if($province_id) {
$where['province_id'] = $province_id;
}
if($city_id) {
$where['city_id'] = $city_id;
}
if($area_id) {
$where['area_id'] = $area_id;
}
// if($province_id) {
// $where['province_id'] = $province_id;
// }
// if($city_id) {
// $where['city_id'] = $city_id;
// }
// if($area_id) {
// $where['area_id'] = $area_id;
// }
if($keyword) { //如果有关键字就搜索关键字的小区
$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();
......@@ -43,9 +43,8 @@ class User extends Base
} else { //没有就展示已入住的小区
$where['hub.uid'] = $this->uid;
$where['hub.status'] = 1;
$village_ids = DB::name('house_user_bind')->alias('hub')->where($where)->column('village_id');
$village_ids = DB::name('house_user_bind')->alias('hub')->where($where)->group('village_id')->column('village_id');
$village_info = Db::name('house_village')->whereIn('village_id',$village_ids)->field('village_name,village_id,province_name,city_name,area_name,village_logo,village_address')->select()->toArray();
$res['total'] = count($village_ids);
$rest=[];
foreach ($village_ids as $k =>$v) {
......@@ -199,8 +198,10 @@ class User extends Base
if($bind_id){
$where['hub.house_user_bind_id'] = $bind_id;
$where['hub.status'] = 1;
}
$where['hub.uid'] = $this->uid;
$where['hub.village_id'] = $village_id;
$data = Db::name('house_user_bind')->alias('hub')
->leftJoin('house_vacancy hv','hv.vacancy_id = hub.vacancy_id')
->leftJoin('user','user.uid = hub.uid')
......@@ -208,7 +209,6 @@ class User extends Base
->where($where)
->field('hub.house_user_bind_id as bind_id,hub.name,hv.vacancy_code,hv.layout_id,hv.village_id,user.sex,user.nickname,user.avatar,user.face_img')
->find();
if(!$data) {
//如果,新用户,只能返回基础信息
$whereOne['uid'] = $this->uid;
......@@ -249,7 +249,7 @@ class User extends Base
public function uploadFaceImg() {
$path = Request::param('path','face');
$file = request()->file('img');
if(!$file || !in_array($path,['header ','face'])){
if(!$file || !in_array($path,['header','face'])){
return $this->returnJson([],'参数错误!',400);
}
$path = '/'.$path;
......@@ -267,7 +267,7 @@ class User extends Base
$bind_id = Request::param('house_user_bind_id');
$uid = $this->uid;
Db::name('house_user_bind')->where(['uid'=>$uid])->save(['is_lately_login'=>0]);
Db::name('house_user_bind')->where(['uid'=>$uid])->save(['is_lately_login'=>1,'house_user_bind_id'=>$bind_id]);
Db::name('house_user_bind')->where(['uid'=>$uid,'house_user_bind_id'=>$bind_id])->save(['is_lately_login'=>1]);
return $this->returnJson([],'success');
}
......
......@@ -13,9 +13,24 @@ class Village extends Base
//搜索小区
public function test() {
$phone = "135883180489";
$content = "新版本推送";
Jpush::push_oppo($phone,$content);
// $phone = "135883180489";
// $content = "新版本推送";
// Jpush::push_oppo($phone,$content);
$arr=[2,1,4,24,57,1,31,434,762];
$length = count($arr);
for($i=0;$i<$length;$i++){
for($j=0;$j<$length-$i-1;$j++) {
if($arr[$j] < $arr[$j+1]) {
$tem = $arr[$j+1];
$arr[$j+1] = $arr[$j];
$arr[$j] = $tem;
}
}
}
return $this->returnJson($arr);
}
}
\ No newline at end of file
......@@ -897,12 +897,12 @@ class Common extends BaseController
}
$savename = \think\facade\Filesystem::putFile($path, $file);
if(isHTTPS()){
$http = "https://";
} else {
$http = "http://";
}
$data['path'] = $http.$_SERVER['SERVER_NAME']."/upload/".$savename;
// if(isHTTPS()){
// $http = "https://";
// } else {
// $http = "http://";
// }
// $data['path'] = $http.$_SERVER['SERVER_NAME']."/upload/".$savename;
$data['data'] = "/upload/".$savename;
return $data;
......
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