diff --git a/app/admin/controller/nk/Category.php b/app/admin/controller/nk/Category.php index 6b2a3fe..bb958a5 100644 --- a/app/admin/controller/nk/Category.php +++ b/app/admin/controller/nk/Category.php @@ -65,6 +65,7 @@ class Category extends BaseController return to_assign(1, '操作失败,原因:'.$res); }else{ + $param['status'] = 'normal'; $param['nickname'] = $param['name']; $param['createtime'] = time(); unset($param['id']); diff --git a/app/admin/view/nk/category/add.html b/app/admin/view/nk/category/add.html index c25b0cf..3fbc67f 100644 --- a/app/admin/view/nk/category/add.html +++ b/app/admin/view/nk/category/add.html @@ -102,6 +102,14 @@ autocomplete="off" placeholder="请输入权重" class="layui-input" value="{$detail.weigh}"> + + 状态* + + + + + + {/if}
diff --git a/app/api/controller/Census.php b/app/api/controller/Census.php new file mode 100644 index 0000000..da442d1 --- /dev/null +++ b/app/api/controller/Census.php @@ -0,0 +1,192 @@ +where('user_id', JWT_UID)->find(); +// if ($find) { +// if ($find['auth_range']==1){ +// $mmm[] = $where[] = ['b.village_id', '=', $find['village_id']]; +// }elseif ($find['auth_range']==2){ +// $mmm[] = $where[] = ['b.street_id', '=', $find['street_id']]; +// }elseif ($find['auth_range']==3){ +// $mmm[] = $where[] = ['b.area_id', '=', $find['area_id']]; +// } +// } +// } + if ($post) { + if (isset($post['area_id']) && !empty($post['area_id'])) { + $mmm['b.area_id'] = $www['d.area_id'] = $where[] = $post['area_id']; + } + if (isset($post['street_id']) && !empty($post['street_id'])) { + $mmm['b.street_id'] = $www['d.street_id'] = $where[] = $post['street_id']; + } + if (isset($post['village_id']) && !empty($post['village_id'])) { + $mmm['b.village_id'] = $www['d.village_id'] = $where[] = $post['village_id']; + } + } + + $map[] = ['a.status','=',1]; + $map[] = ['a.is_del','=',0]; + //本镇已录入的商户 + $num_4 = Db::connect('shop')->table('eb_merchant')->alias('a')->join('eb_merchant_address b','a.mer_id = b.mer_id')->where($mmm)->where($map)->count(); + + //企业农产品销量 + $num_2 = Db::table('eb_product_order_log')->where($where)->where('status',1)->where('mer_type_id','in','2,3')->count(); + + //加工企业和品牌企业数量 + $map[] = ['a.type_id','in','2,3']; + $num_1 = Db::connect('shop')->table('eb_merchant')->alias('a')->join('eb_merchant_address b','a.mer_id = b.mer_id')->where($mmm)->where($map)->count(); + + //企业通过我们平台采购的农产品(差用户标签条件) + $num_3 = Db::connect('shop')->table('eb_user')->alias('a')->join('eb_nk_user b','a.uid = b.user_id')->join('nk_lihaink_cn.eb_product_order_log c','a.uid = c.uid')->join('nk_lihaink_cn.fa_szxc_information_useraddress d','b.n_user_id = d.user_id')->where($www)->where('a.status',1)->where('c.status',1)->count(); + + //镇农产品需求量分析(事业单位、企业、居民) + //农产品市场行情分析、显示 + //农产品市内需求量 + //已婚 未婚 离异 可根据年龄统计各年龄层人员,学历统计 + //土地面积 + //园地 耕地 林地 牧草地 养殖 坑塘 农田水利设施用地 + //种植面积 养殖面积 荒地面积 + //镇农产品结构展示 + //运输距离显示 + // 大于60岁人数 + $old_num = Db::table('fa_szxc_information_usermsg')->where($where)->whereAge('>=', 60)->count(); +// 儿童人数 + $children_num = Db::table('fa_szxc_information_usermsg')->where($where)->whereAge('<', 15)->count(); +// 未婚男 + $unmarried_man_num = Db::table('fa_szxc_information_usermsg')->where($where)->where([['gender', '=', 1], ['marital_status', '=', 169]])->count(); +// 未婚女 + $unmarried_woman_num = Db::table('fa_szxc_information_usermsg')->where($where)->where([['gender', '=', 2], ['marital_status', '=', 169]])->count(); +// 少数民族 + $nation_s_num = Db::table('fa_szxc_information_usermsg')->where($where)->whereBetween('nation', [13, 68])->count(); +// 汉族 + $nation_h_num = Db::table('fa_szxc_information_usermsg')->where($where)->where('nation', 12)->count(); + //残疾人数 + $whether_disabled_num = Db::table('fa_szxc_information_usermsg') + ->alias('m') + ->where($where) + ->join(['fa_szxc_information_insurance'=>'i'],'m.user_id=i.user_id and i.whether_disabled!=112')->count(); +// 参保人数 + $insurance_type_num = Db::table('fa_szxc_information_usermsg') + ->alias('m') + ->where($where) + ->join(['fa_szxc_information_insurance'=>'i'],'m.user_id=i.user_id and i.insurance_type!=219')->count(); + + //土地总面积 + $land_area_num = Db::table('fa_szxc_information_useraddress') + ->alias('u') + ->where($where) + ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id')->sum('p.land_area'); + //农田水利 + $sum_218 = Db::table('fa_szxc_information_useraddress') + ->alias('u') + ->where($where) + ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=218')->sum('p.land_area'); + //坑塘 + $sum_217 = Db::table('fa_szxc_information_useraddress') + ->alias('u') + ->where($where) + ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=217')->sum('p.land_area'); + //养殖 + $sum_216 = Db::table('fa_szxc_information_useraddress') + ->alias('u') + ->where($where) + ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id')->sum('p.breed_area'); + //牧草地 + $sum_215 = Db::table('fa_szxc_information_useraddress') + ->alias('u') + ->where($where) + ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=215')->sum('p.land_area'); + //林地 + $sum_214 = Db::table('fa_szxc_information_useraddress') + ->alias('u') + ->where($where) + ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=214')->sum('p.land_area'); + //耕地 + $sum_70 = Db::table('fa_szxc_information_useraddress') + ->alias('u') + ->where($where) + ->join(['fa_szxc_information_planting'=>'p'], 'u.user_id = p.user_id and p.nature_of_land=70')->sum('p.land_area'); + //园地 + $sum_69 = Db::table('fa_szxc_information_useraddress') + ->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'); + +// 荒地面积 + $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'); + //农产品种类 + $cms_agriculture_products = Db::table('cms_agriculture_products')->where('status',1)->count(); + //蔬菜基地数量 + $cms_manufacturer = Db::table('cms_manufacturer')->where('status',1)->count(); + //农贸市场数量 + $cms_farm_product_market = Db::table('cms_farm_product_market')->where('status',1)->count(); + //种植面积 + $zz_mianji = $land_area_num - $sum_216 - $waste_land_area; + //总人口 + $num = Db::table('fa_szxc_information_usermsg')->where($where)->count(); + //成熟周期 [{"name": "白菜", "pic": "http:agaagag.png", "zhouqi": "5周"}] + $zhouqi = Db::table('cms_agriculture_products_traceability') + ->withAttr('content', function ($value, $data) { + if ($data['content'] != '') { + return json_decode($data['content'],1); + }else{ + return ''; + } + }) + ->where('status',1)->field('content')->select(); + + $result = [ + ['name' => '总人口','value'=>$num], + ['name' => '农产品种类','value'=>$cms_agriculture_products], + ['name' => '加工和品牌企业数量','value'=>$num_1], + ['name' => '种植面积','value'=>$zz_mianji], + ['name' => '养殖面积','value'=>$sum_216], + ['name' => '荒地面积','value'=>$waste_land_area], + ['name' => '企业农产品销量','value'=>$num_2], + ['name' => '企业采购的农产品','value'=>$num_3], + ['name' => '已录入商户','value'=>$num_4], + ['name' => '大于60岁人数','value'=>$old_num], + ['name' => '儿童人数','value'=>$children_num], + ['name' => '未婚男','value'=>$unmarried_man_num], + ['name' => '未婚女','value'=>$unmarried_woman_num], + ['name' => '少数民族','value'=>$nation_s_num], + ['name' => '汉族','value'=>$nation_h_num], + ['name' => '残疾人数','value'=>$whether_disabled_num], + ['name' => '参保人数','value'=>$insurance_type_num], + ['name' => '土地总面积','value'=>$land_area_num], + ['name' => '农田水利','value'=>$sum_218], + ['name' => '坑塘','value'=>$sum_217], + ['name' => '牧草地','value'=>$sum_215], + ['name' => '林地','value'=>$sum_214], + ['name' => '耕地','value'=>$sum_70], + ['name' => '园地','value'=>$sum_69], + ['name' => '蔬菜基地数量','value'=>$cms_manufacturer], + ['name' => '农贸市场数量','value'=>$cms_farm_product_market], + ['name' => '农产品周期','value'=>$zhouqi], + ]; + $this->apiSuccess('获取成功', $result); + } + + +}