diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 7fdb64a..caa8d8e 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -133,6 +133,7 @@ class Index extends BaseController ->alias('u') ->where($where) ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=69')->sum('p.land_area'); + // 荒地面积 $sum_waste_land_area = Db::table('fa_szxc_information_useraddress') ->alias('u') @@ -145,6 +146,12 @@ class Index extends BaseController ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=69')->sum('p.breed_area'); $hd_num = $sum_waste_land_area - $breed_area; + + $waste_land_area = Db::table('fa_szxc_information_useraddress') + ->alias('u') + ->where($where) + ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id')->sum('p.waste_land_area'); + View::assign( [ 'totaluser' => $num,//User::where($whe)->count(),// 总用户数 @@ -158,6 +165,7 @@ class Index extends BaseController 'nation_h_num' => $nation_h_num, 'work_num' => $work_num, 'land_area_num' => $land_area_num, + 'waste_land_area' => $waste_land_area, 'sum_218' => $sum_218, 'sum_217' => $sum_217, 'sum_216' => $sum_216, diff --git a/app/admin/controller/nk/Village.php b/app/admin/controller/nk/Village.php index 96b9784..c490fa4 100644 --- a/app/admin/controller/nk/Village.php +++ b/app/admin/controller/nk/Village.php @@ -65,45 +65,35 @@ class Village extends BaseController { if (request()->isAjax()) { $params= get_params(); - if (isset($params['is_hot']) && $params['is_hot']=='on'){ + if (!empty($params['is_hot'])&&$params['is_hot']=='on'){ $params['is_hot']=1; }else{ $params['is_hot']=0; } - if (isset($params['is_tourism']) && $params['is_tourism']=='on'){ + if (!empty($params['is_tourism'])&&$params['is_tourism']=='on'){ $params['is_tourism']=1; }else{ $params['is_tourism']=0; } - - // 组装地址名 - if ($params['area_id'] != '') { - $area_name = Db::table('fa_geo_area')->where('area_code', $params['area_id'])->value('area_name'); - } - if ($params['street_id'] != '') { - $street_name = Db::table('fa_geo_street')->where('street_code', $params['street_id'])->value('street_name'); - } - - if ($params['village_id'] != '') { - $village = Db::table('fa_geo_village')->where('village_code', $params['village_id'])->find(); - $params['village_id']=$village['village_id']; - } - $address_name = $area_name . $street_name . $village['village_name'] ; - $params['address'] = $address_name; + $area_code=Db::table('fa_geo_area')->where('area_code',$params['area_id'])->value('area_name'); + $street_code=Db::table('fa_geo_street')->where('street_code',$params['street_id'])->value('street_name'); + $village_id=Db::table('fa_geo_village')->where('village_id',$params['village_id'])->value('village_name'); + $params['address']='泸州市'.$area_code.$street_code.$village_id; + $params['createtime']=time(); $res=Db::table('fa_szxc_village')->strict(false)->field(true)->insertGetId($params); if ($res){ return to_assign(0,'操作成功',['aid'=>$res]); } return to_assign(1, '操作失败,原因:'.$res); - }else{ - View::assign('editor', get_system_config('other','editor')); - View::assign('url', $this->url); - $street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500']) - ->field('area_id id,area_code code,area_name name') - ->select(); - View::assign('street', $street); - return view(); } + + $street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500']) + ->field('area_id id,area_code code,area_name name') + ->select(); + View::assign('street', $street); + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + return view(); } /** * 修改 @@ -112,33 +102,20 @@ class Village extends BaseController { $params= get_params(); if (request()->isAjax()) { - - if (isset($params['is_hot']) && $params['is_hot']=='on'){ + if (!empty($params['is_hot'])&&$params['is_hot']=='on'){ $params['is_hot']=1; }else{ $params['is_hot']=0; } - if (isset($params['is_tourism']) && $params['is_tourism']=='on'){ + if (!empty($params['is_tourism'])&&$params['is_tourism']=='on'){ $params['is_tourism']=1; }else{ $params['is_tourism']=0; } - - // 组装地址名 - if ($params['area_id'] != '') { - $area_name = Db::table('fa_geo_area')->where('area_code', $params['area_id'])->value('area_name'); - } - if ($params['street_id'] != '') { - $street_name = Db::table('fa_geo_street')->where('street_code', $params['street_id'])->value('street_name'); - } - - if ($params['village_id'] != '') { - $village = Db::table('fa_geo_village')->where('village_code', $params['village_id'])->find(); - $params['village_id']=$village['village_id']; - } - $address_name = $area_name . $street_name . $village['village_name'] ; - $params['address'] = $address_name; - + $area_code=Db::table('fa_geo_area')->where('area_code',$params['area_id'])->value('area_name'); + $street_code=Db::table('fa_geo_street')->where('street_code',$params['street_id'])->value('street_name'); + $village_id=Db::table('fa_geo_village')->where('village_id',$params['village_id'])->value('village_name'); + $params['address']='泸州市'.$area_code.$street_code.$village_id; $res=Db::table('fa_szxc_village')->where('id',$params['id'])->strict(false)->field(true)->update($params); if ($res){ return to_assign(); @@ -147,13 +124,12 @@ class Village extends BaseController } } $detail = Db::table('fa_szxc_village')->where('id',$params['id'])->find(); - $detail['village_code'] = Db::table('fa_geo_village')->where('village_id', $detail['village_id'])->value('village_code'); - View::assign('detail', $detail); - View::assign('url', $this->url); $street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500']) ->field('area_id id,area_code code,area_name name') ->select(); View::assign('street', $street); + View::assign('detail', $detail); + View::assign('url', $this->url); return view(); } /** @@ -176,7 +152,7 @@ class Village extends BaseController $param= get_params(); $id = isset($param['id']) ? $param['id'] : 0; $type = isset($param['type']) ? $param['type'] : 0; - $res = Db::table('fa_szxc_village')->where('id',$id)->delete(); + $res = Db::table('fa_szxc_village')->where('id',$id)->update(['status'=>$type]); if ($res){ return to_assign(); }else{ diff --git a/app/admin/view/index/main.html b/app/admin/view/index/main.html index 773da73..8db5333 100644 --- a/app/admin/view/index/main.html +++ b/app/admin/view/index/main.html @@ -1,17 +1,17 @@ {extend name="common/base"/} {block name="style"}