Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4596616f99
@ -253,7 +253,7 @@ class User extends BaseController
|
||||
public function postedit()
|
||||
{
|
||||
$params = get_params();
|
||||
halt($params);
|
||||
// halt($params);
|
||||
if ($params['type'] == 1) {
|
||||
unset($params['type']);
|
||||
$res = Db::table('fa_szxc_information_usermsg')->where('user_id', $params['user_id'])->update($params);
|
||||
@ -264,15 +264,80 @@ class User extends BaseController
|
||||
}
|
||||
}
|
||||
if ($params['type'] == 2) {
|
||||
halt($params);
|
||||
$params['crops_msg'] = json_encode($params['crops_msg']);
|
||||
unset($params['type']);
|
||||
$find = Db::table('fa_szxc_information_insurance')->where('user_id', $params['user_id'])->find();
|
||||
$find = Db::table('fa_szxc_information_planting')->where('user_id', $params['user_id'])->find();
|
||||
if ($find) {
|
||||
$res = Db::table('fa_szxc_information_insurance')->where('id', $find['id'])->update($params);
|
||||
$res = Db::table('fa_szxc_information_planting')->where('id', $find['id'])->update($params);
|
||||
$id = $find['id'];
|
||||
} else {
|
||||
$res = Db::table('fa_szxc_information_insurance')->where('user_id', $params['user_id'])->insert($params);
|
||||
$res = Db::table('fa_szxc_information_planting')->where('user_id', $params['user_id'])->insertGetId($params);
|
||||
$id = $res;
|
||||
}
|
||||
if ($res) {
|
||||
$time = time();
|
||||
// 新增写入种植表
|
||||
Db::table('fa_szxc_planting')->where('user_id',$params['user_id'])->delete();
|
||||
$mianji = 0;
|
||||
if($params['crops_msg']){
|
||||
$crops_msg_arr = json_decode($params['crops_msg'],1);
|
||||
foreach ($crops_msg_arr as $k=>$v){
|
||||
// 根据名字查询分类
|
||||
if($v['name']){
|
||||
$type = Db::table('fa_szxc_planting_type')->where('name',$v['name'])->find();
|
||||
if($type){
|
||||
$planting_data['type_id'] = $type['id'];
|
||||
}else{
|
||||
$type_data['name'] = $v['name'];
|
||||
$type_data['createtime'] = $time;
|
||||
$type_id = Db::table('fa_szxc_planting_type')->strict(false)->insertGetId($type_data);
|
||||
$planting_data['type_id'] = $type_id;
|
||||
}
|
||||
$planting_data['user_id'] = $params['user_id'];
|
||||
$planting_data['num'] = $v['num']??0;
|
||||
$planting_data['measure'] = $v['mianji']??0;
|
||||
$planting_data['createtime'] = $time;
|
||||
Db::table('fa_szxc_planting')->strict(false)->insertGetId($planting_data);
|
||||
}
|
||||
// 计算面积
|
||||
if($v['mianji']){
|
||||
$mianji += $v['mianji'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 新增写入养殖表
|
||||
Db::table('fa_szxc_breed')->where('user_id',$params['user_id'])->delete();
|
||||
// $mianji = 0;
|
||||
if(isset($params['breed_msg']) && !empty($params['breed_msg'])){
|
||||
$breed_msg_arr = json_decode($params['breed_msg'],1);
|
||||
foreach ($breed_msg_arr as $k=>$v){
|
||||
// 根据名字查询分类
|
||||
if($v['name']){
|
||||
$type = Db::table('fa_szxc_breed_type')->where('name',$v['name'])->find();
|
||||
if($type){
|
||||
$breed_data['type_id'] = $type['id'];
|
||||
}else{
|
||||
$type_data['name'] = $v['name'];
|
||||
$type_data['createtime'] = $time;
|
||||
$type_id = Db::table('fa_szxc_breed_type')->strict(false)->insertGetId($type_data);
|
||||
$breed_data['type_id'] = $type_id;
|
||||
}
|
||||
$breed_data['user_id'] = $params['user_id'];
|
||||
$breed_data['num'] = $v['num']??0;
|
||||
$breed_data['measure'] = $v['mianji']??0;
|
||||
$breed_data['createtime'] = $time;
|
||||
Db::table('fa_szxc_breed')->strict(false)->insertGetId($breed_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$waste_land_area = $params['land_area'] - $mianji;
|
||||
if($waste_land_area < 0){
|
||||
$waste_land_area = 0;
|
||||
}
|
||||
$ddd['waste_land_area'] = $waste_land_area;
|
||||
Db::table('fa_szxc_information_planting')->where('id', $id)->update($ddd);
|
||||
return to_assign(0, '操作成功');
|
||||
} else {
|
||||
return to_assign(1, '操作失败');
|
||||
|
@ -84,7 +84,7 @@
|
||||
<div class="layui-input-block">
|
||||
<select name="group_id" lay-verify="required">
|
||||
{volist name='user_group' id='vo'}
|
||||
<option value="{$vo.id}" {if $vo.id==$address['auth_range']} selected {/if}>{$vo.name}</option>
|
||||
<option value="{$vo.id}" {if $vo.id==$user['group_id']} selected {/if}>{$vo.name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
|
@ -181,27 +181,27 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">土地面积</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" value="{$planting['land_area']}" autocomplete="off" class="layui-input">
|
||||
<input type="text" name="land_area" value="{$planting['land_area']}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-item" id="nzw">
|
||||
<label class="layui-form-label">农作物信息</label>
|
||||
{volist name="planting.crops_msg" id="vo"}
|
||||
<div class="aa" style="display: inline-block;">
|
||||
{volist name="planting.crops_msg" key="key" id="vo"}
|
||||
<div2 class="aa" {if $key==1} style="display: inline-block;" {else} style="display: inline-block;margin-left: 100px;" {/if}>
|
||||
<div class="layui-input-inline">
|
||||
农作物名称 <input type="text" name="crops_msg[0][name]" autocomplete="off" class="layui-input" value="{$vo.name}">
|
||||
农作物名称 <input type="text" name="crops_msg[{$key-1}][name]" autocomplete="off" class="layui-input" value="{$vo.name}">
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
数量 <input type="text" name="crops_msg[0][num]" autocomplete="off" class="layui-input" value="{$vo.num}">
|
||||
数量 <input type="text" name="crops_msg[{$key-1}][num]" autocomplete="off" class="layui-input" value="{$vo.num}">
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
面积 <input type="text" name="crops_msg[0][mianji]" autocomplete="off" class="layui-input" value="{$vo.mianji}">
|
||||
面积 <input type="text" name="crops_msg[{$key-1}][mianji]" autocomplete="off" class="layui-input" value="{$vo.mianji}">
|
||||
</div>
|
||||
</div>
|
||||
</div2>
|
||||
{/volist}
|
||||
|
||||
<button type="button" class="layui-btn layui-btn-normal" id="a1" style="display: block; margin-left: 100px;">添加</button>
|
||||
|
||||
<button type="button" class="layui-btn layui-btn-normal" id="a2" style="position: relative; left: 170px;top:-38px">删除</button>
|
||||
</div>
|
||||
<div class="pt-3">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform2">立即提交</button>
|
||||
@ -498,27 +498,37 @@
|
||||
{block name="script"}
|
||||
<script>
|
||||
var moduleInit = ['tool'];
|
||||
var htmlid=1;
|
||||
function gouguInit () {
|
||||
var form = layui.form, tool = layui.tool;
|
||||
var htmlid= $("#nzw").children("div2").length;
|
||||
$("#a1").on("click", function(e) {
|
||||
var html=`
|
||||
<div class="aa" style="display: inline-block;
|
||||
<div2 id="aa`+htmlid+`" class="aa`+htmlid+`" style="display: inline-block;
|
||||
margin-left: 100px;">
|
||||
<div class="layui-input-inline">
|
||||
农作物名称 <input type="text" name="crops_msg[`+htmlid+`][name]" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
数量 <input type="text" name="crops_msg[`+htmlid+`][num]" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
面积 <input type="text" name="crops_msg[`+htmlid+`][mianji]" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
农作物名称 <input type="text" name="crops_msg[`+htmlid+`][name]" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
数量 <input type="text" name="crops_msg[`+htmlid+`][num]" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-input-inline">
|
||||
面积 <input type="text" name="crops_msg[`+htmlid+`][mianji]" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div2>
|
||||
`
|
||||
$(".aa").after(html)
|
||||
|
||||
$("#nzw div2:last").after(html);
|
||||
++htmlid
|
||||
})
|
||||
});
|
||||
|
||||
$("#a2").on("click", function(e) {
|
||||
if(htmlid === 1){
|
||||
return;
|
||||
}
|
||||
$("#nzw div2:last").remove();
|
||||
--htmlid
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform1)', function (data) {
|
||||
let callback = function (e) {
|
||||
|
@ -71,7 +71,7 @@ class Article extends BaseController
|
||||
//查询
|
||||
$select = Db::table('fa_article')->where($where)->page($page)->limit(20)
|
||||
->alias('a')
|
||||
->join('article_vote_side_tables avst',"a.id = avst.article_id and avst.end_time >=".date('Y-m-d'))
|
||||
->join(['article_vote_side_tables' => 'avst'],"a.id = avst.article_id and avst.end_time >=".date('Y-m-d'))
|
||||
->field('a.id,a.title,a.describe,a.user_id,a.view,a.view_time,a.image,a.end_time,a.is_solve,a.is_vote,a.is_nickname,a.video,a.category_type,avst.end_time as die_time')
|
||||
->order('a.id DESC')
|
||||
->select()->toArray();
|
||||
@ -82,7 +82,7 @@ class Article extends BaseController
|
||||
//查询
|
||||
$select = Db::table('fa_article')->where($where)->page($page)->limit(20)
|
||||
->alias('a')
|
||||
->join('article_vote_side_tables avst',"a.id = avst.article_id and avst.end_time <=".date('Y-m-d'))
|
||||
->join(['article_vote_side_tables' => 'avst'],"a.id = avst.article_id and avst.end_time <=".date('Y-m-d'))
|
||||
->field('a.id,a.title,a.describe,a.user_id,a.view,a.view_time,a.image,a.end_time,a.is_solve,a.is_vote,a.is_nickname,a.video,a.category_type,avst.end_time as die_time')
|
||||
->order('a.id DESC')->select()->toArray();
|
||||
}else{
|
||||
@ -649,12 +649,12 @@ class Article extends BaseController
|
||||
}
|
||||
}
|
||||
}
|
||||
$yishi = $model->alias('a')->join('fa_article_vote_side_tables b','a.id=b.article_id')->where($www)->where('a.category_id',162)->whereTime('b.end_time', '>', date('Y-m-d H:i:s'))->count();
|
||||
$maodun = $model->alias('a')->join('article_comment b','a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id',147)->count();
|
||||
$xiejiao = $model->alias('a')->join('article_comment b','a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 148)->count();
|
||||
$saohei = $model->alias('a')->join('article_comment b','a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 149)->count();
|
||||
$sos = $model->alias('a')->join('article_comment b','a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 150)->count();
|
||||
$one_shuqiu = $model->alias('a')->join('article_comment b','a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 165)->count();
|
||||
$yishi = $model->alias('a')->join(['fa_article_vote_side_tables' => 'b'],'a.id=b.article_id')->where($www)->where('a.category_id',162)->whereTime('b.end_time', '>', date('Y-m-d H:i:s'))->count();
|
||||
$maodun = $model->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id',147)->count();
|
||||
$xiejiao = $model->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 148)->count();
|
||||
$saohei = $model->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 149)->count();
|
||||
$sos = $model->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 150)->count();
|
||||
$one_shuqiu = $model->alias('a')->join(['article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id', 165)->count();
|
||||
$select = [
|
||||
'yishi' => $yishi,
|
||||
'maodun' => $maodun,
|
||||
@ -710,7 +710,7 @@ class Article extends BaseController
|
||||
//查询
|
||||
$select = Db::table('fa_article')->where($where)->page($page)->limit(20)
|
||||
->alias('a')
|
||||
->join('article_vote_side_tables avst',"a.id = avst.article_id and avst.end_time >=".date('Y-m-d'))
|
||||
->join(['article_vote_side_tables' => 'avst'],"a.id = avst.article_id and avst.end_time >=".date('Y-m-d'))
|
||||
->field('a.id,a.title,a.describe,a.user_id,a.view,a.view_time,a.image,a.end_time,a.is_solve,a.is_vote,a.is_nickname,a.video,a.category_type,avst.end_time as die_time')
|
||||
->order('a.id DESC')
|
||||
->select()->toArray();
|
||||
@ -721,7 +721,7 @@ class Article extends BaseController
|
||||
//查询
|
||||
$select = Db::table('fa_article')->where($where)->page($page)->limit(20)
|
||||
->alias('a')
|
||||
->join('article_vote_side_tables avst',"a.id = avst.article_id and avst.end_time <=".date('Y-m-d'))
|
||||
->join(['article_vote_side_tables' => 'avst'],"a.id = avst.article_id and avst.end_time <=".date('Y-m-d'))
|
||||
->field('a.id,a.title,a.describe,a.user_id,a.view,a.view_time,a.image,a.end_time,a.is_solve,a.is_vote,a.is_nickname,a.video,a.category_type,avst.end_time as die_time')
|
||||
->order('a.id DESC')->select()->toArray();
|
||||
}else{
|
||||
|
@ -690,7 +690,7 @@ class Maintainentry extends BaseController
|
||||
}
|
||||
// 计算面积
|
||||
if($v['mianji']){
|
||||
$mianji .= $v['mianji'];
|
||||
$mianji += $v['mianji'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -720,7 +720,7 @@ class Maintainentry extends BaseController
|
||||
}
|
||||
//// 计算面积
|
||||
// if($v['mianji']){
|
||||
// $mianji .= $v['mianji'];
|
||||
// $mianji += $v['mianji'];
|
||||
// }
|
||||
}
|
||||
}
|
||||
@ -1353,7 +1353,7 @@ class Maintainentry extends BaseController
|
||||
}
|
||||
// 计算面积
|
||||
if($v['mianji']){
|
||||
$mianji .= $v['mianji'];
|
||||
$mianji += $v['mianji'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1382,7 +1382,7 @@ class Maintainentry extends BaseController
|
||||
}
|
||||
//// 计算面积
|
||||
// if($v['mianji']){
|
||||
// $mianji .= $v['mianji'];
|
||||
// $mianji += $v['mianji'];
|
||||
// }
|
||||
}
|
||||
}
|
||||
@ -1646,6 +1646,9 @@ class Maintainentry extends BaseController
|
||||
$res = Db::table('fa_szxc_information_usermsg')->where($map)
|
||||
->order('id desc')
|
||||
->field("id,user_id,name,age,gender,family_num,political_outlook,householder_id,is_hz,address_name,family_relation")
|
||||
->withAttr('avatar', function ($value, $data) {
|
||||
return Db::table('fa_user')->where('id', $data['user_id'])->value('avatar');
|
||||
})
|
||||
->select()->toArray();
|
||||
if ($res){
|
||||
// 获取户主id
|
||||
@ -1657,6 +1660,7 @@ class Maintainentry extends BaseController
|
||||
if($v['is_hz']==1){
|
||||
$is_set_hz = 1;
|
||||
$res[$k]['householder_name'] = '本人';
|
||||
$res[$k]['avatar'] = 'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230129/0dc8d0a0f3bcc168550ef263a9a170dc.png';
|
||||
}else{
|
||||
$msg= Db::table('fa_szxc_information_usermsg')->where('user_id',$v['householder_id'])->value('name');
|
||||
$res[$k]['householder_name'] = $msg?:'暂无户主';
|
||||
@ -1705,6 +1709,7 @@ class Maintainentry extends BaseController
|
||||
$return['name'] = $name;
|
||||
$return['family_num'] = Db::table('fa_szxc_information_usermsg')->where($map)->count();
|
||||
$return['is_set_hz'] = $is_set_hz;
|
||||
$return['avatar'] = Db::table('fa_user')->where('id', $user_id)->value('avatar');
|
||||
$return['data'] = $res;
|
||||
$this->apiSuccess('获取成功', $return, 1);
|
||||
}
|
||||
|
@ -80,7 +80,12 @@ class MyArticle extends BaseController
|
||||
}
|
||||
$select[$key]['is_read'] = Db::table('fa_article_comment')->where('vote_id',$value['id'])->value('is_read');
|
||||
}
|
||||
return $this->apiSuccess('ok', ['list' => $select, 'count' => ['count' => $count, 'month_count' => $month_count]]);
|
||||
|
||||
$name['address_name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', JWT_UID)->value('address_name');
|
||||
$name['vartar'] = Db::table('fa_user')->where('id', JWT_UID)->value('avatar');
|
||||
$name['name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', JWT_UID)->value('name');
|
||||
|
||||
return $this->apiSuccess('ok', ['list' => $select, 'count' => ['count' => $count, 'month_count' => $month_count],'actor'=>$name]);
|
||||
}
|
||||
|
||||
/**详情
|
||||
|
@ -86,7 +86,7 @@ class Personal extends BaseController
|
||||
$whe[] = ['a.status', '=', 0];
|
||||
$page = $this->request->get('page', 1);
|
||||
$limit = $this->request->get('limit', 10);
|
||||
$list = Db::table('fa_szxc_personal_news_comment')->alias('a')->join('fa_szxc_personal_news b', 'a.personal_news_id=b.id')->where($whe)->field('a.id,a.content,a.createtime,a.user_id,b.user_id as uid')->select()->toArray();
|
||||
$list = Db::table('fa_szxc_personal_news_comment')->alias('a')->join(['fa_szxc_personal_news'=> 'b'], 'a.personal_news_id=b.id')->where($whe)->field('a.id,a.content,a.createtime,a.user_id,b.user_id as uid')->select()->toArray();
|
||||
if ($list) {
|
||||
foreach ($list as $key => $value) {
|
||||
$list[$key]['createtime'] = date('Y-m-d', $value['createtime']);
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\BaseController;
|
||||
use app\api\middleware\Auth;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
@ -11,13 +10,6 @@ use think\facade\Db;
|
||||
*/
|
||||
class Statistics extends BaseController
|
||||
{
|
||||
/**
|
||||
* 控制器中间件 [不需要鉴权]
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
Auth::class => ['except' => [] ]
|
||||
];
|
||||
|
||||
//人口构成(80岁以上、61-80岁、36-60岁、18-35岁、0-17岁)
|
||||
public function get_people($area_id=0,$street_id=0,$village_id=0){
|
||||
@ -79,12 +71,12 @@ class Statistics extends BaseController
|
||||
$num3 = 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();
|
||||
->join(['fa_szxc_information_insurance'=> 'i'],'m.user_id=i.user_id and i.insurance_type!=219')->count();
|
||||
//残疾人员
|
||||
$num5 = 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();
|
||||
->join(['fa_szxc_information_insurance' => 'i'],'m.user_id=i.user_id and i.whether_disabled!=112')->count();
|
||||
$return = [
|
||||
['value'=>$num1,'name'=>'特困人员'],
|
||||
['value'=>$num2,'name'=>'高龄老人'],
|
||||
@ -148,7 +140,7 @@ class Statistics extends BaseController
|
||||
$map[] = ['village_id', '=', $village_id];
|
||||
}
|
||||
// 总耕地面积
|
||||
$num1 = Db::table('fa_szxc_information_planting')->alias('a')->join('fa_szxc_information_usermsg b','a.user_id = b.user_id')->where($where)->sum('land_area');
|
||||
$num1 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where($where)->sum('land_area');
|
||||
//人均耕地面积
|
||||
$all = Db::table('fa_szxc_information_usermsg')->where($map)->whereStatus('=', 1)->count();
|
||||
if($all){
|
||||
@ -160,7 +152,7 @@ class Statistics extends BaseController
|
||||
//退林还耕面积
|
||||
$num3 = $num1*0.3;
|
||||
//种植物种类
|
||||
$num4 = Db::table('fa_szxc_information_planting')->alias('a')->join('fa_szxc_information_usermsg b','a.user_id = b.user_id')->where($where)->column('crops_msg');
|
||||
$num4 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where($where)->column('crops_msg');
|
||||
$a = 0;
|
||||
foreach ($num4 as $k=>$v){
|
||||
$v = json_decode($v,true);
|
||||
@ -273,19 +265,19 @@ class Statistics extends BaseController
|
||||
$where[] = ['b.village_id', '=', $village_id];
|
||||
}
|
||||
// 总耕地面积
|
||||
$num1 = Db::table('fa_szxc_information_planting')->alias('a')->join('fa_szxc_information_usermsg b','a.user_id = b.user_id')->where('nature_of_land',70)->where($where)->sum('land_area');
|
||||
$num1 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where('nature_of_land',70)->where($where)->sum('land_area');
|
||||
//园地
|
||||
$num2 = Db::table('fa_szxc_information_planting')->alias('a')->join('fa_szxc_information_usermsg b','a.user_id = b.user_id')->where('nature_of_land',69)->where($where)->sum('land_area');
|
||||
$num2 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where('nature_of_land',69)->where($where)->sum('land_area');
|
||||
//林地
|
||||
$num3 = Db::table('fa_szxc_information_planting')->alias('a')->join('fa_szxc_information_usermsg b','a.user_id = b.user_id')->where('nature_of_land',214)->where($where)->sum('land_area');
|
||||
$num3 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where('nature_of_land',214)->where($where)->sum('land_area');
|
||||
//牧草地
|
||||
$num4 = Db::table('fa_szxc_information_planting')->alias('a')->join('fa_szxc_information_usermsg b','a.user_id = b.user_id')->where('nature_of_land',215)->where($where)->sum('land_area');
|
||||
$num4 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where('nature_of_land',215)->where($where)->sum('land_area');
|
||||
//养殖
|
||||
$num5 = Db::table('fa_szxc_information_planting')->alias('a')->join('fa_szxc_information_usermsg b','a.user_id = b.user_id')->where('nature_of_land',216)->where($where)->sum('land_area');
|
||||
$num5 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where('nature_of_land',216)->where($where)->sum('land_area');
|
||||
//坑塘
|
||||
$num6 = Db::table('fa_szxc_information_planting')->alias('a')->join('fa_szxc_information_usermsg b','a.user_id = b.user_id')->where('nature_of_land',217)->where($where)->sum('land_area');
|
||||
$num6 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where('nature_of_land',217)->where($where)->sum('land_area');
|
||||
//农田水利设施用地
|
||||
$num7 = Db::table('fa_szxc_information_planting')->alias('a')->join('fa_szxc_information_usermsg b','a.user_id = b.user_id')->where('nature_of_land',218)->where($where)->sum('land_area');
|
||||
$num7 = Db::table('fa_szxc_information_planting')->alias('a')->join(['fa_szxc_information_usermsg' => 'b'],'a.user_id = b.user_id')->where('nature_of_land',218)->where($where)->sum('land_area');
|
||||
$return = [
|
||||
['value'=>$num1,'name'=>'耕地面积'],
|
||||
['value'=>$num2,'name'=>'园地'],
|
||||
@ -553,6 +545,51 @@ class Statistics extends BaseController
|
||||
$this->apiSuccess('获取成功',$return);
|
||||
}
|
||||
|
||||
//农业产量
|
||||
public function get_num14($area_id=0,$street_id=0,$village_id=0){
|
||||
if ($area_id){
|
||||
$where[] = ['area_id', '=', $area_id];
|
||||
}
|
||||
if ($street_id){
|
||||
$where[] = ['street_id', '=', $street_id];
|
||||
}
|
||||
if ($village_id){
|
||||
$where[] = ['village_id', '=', $village_id];
|
||||
}
|
||||
|
||||
$return = [
|
||||
['value'=>1351,'name'=>'萝卜'],
|
||||
['value'=>245,'name'=>'白菜'],
|
||||
['value'=>874,'name'=>'芋头'],
|
||||
['value'=>511,'name'=>'地瓜'],
|
||||
['value'=>1024,'name'=>'土豆'],
|
||||
['value'=>249,'name'=>'山药'],
|
||||
];
|
||||
$this->apiSuccess('获取成功',$return);
|
||||
}
|
||||
|
||||
//农业销量
|
||||
public function get_num15($area_id=0,$street_id=0,$village_id=0){
|
||||
if ($area_id){
|
||||
$where[] = ['area_id', '=', $area_id];
|
||||
}
|
||||
if ($street_id){
|
||||
$where[] = ['street_id', '=', $street_id];
|
||||
}
|
||||
if ($village_id){
|
||||
$where[] = ['village_id', '=', $village_id];
|
||||
}
|
||||
|
||||
$return = [
|
||||
['value'=>835,'name'=>'萝卜'],
|
||||
['value'=>124,'name'=>'白菜'],
|
||||
['value'=>187,'name'=>'芋头'],
|
||||
['value'=>251,'name'=>'地瓜'],
|
||||
['value'=>902,'name'=>'土豆'],
|
||||
['value'=>214,'name'=>'山药'],
|
||||
];
|
||||
$this->apiSuccess('获取成功',$return);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -433,4 +433,46 @@ function camelize($uncamelized_words,$separator='_')
|
||||
function uncamelize($camelCaps,$separator='_')
|
||||
{
|
||||
return strtolower(preg_replace('/([a-z])([A-Z])/', "$1" . $separator . "$2", $camelCaps));
|
||||
}
|
||||
|
||||
if (! function_exists('upload_file')) {
|
||||
/**
|
||||
* 上传文件.
|
||||
*
|
||||
* @param string $file 上传的文件
|
||||
* @param string $name 上传的位置
|
||||
* @param string $path 上传的文件夹
|
||||
* @param string $validate 规则验证
|
||||
* @param string $url 前缀
|
||||
*
|
||||
* @return string|bool
|
||||
* @author niu
|
||||
*/
|
||||
function upload_file($file = null, $name = 'local', $path = '', $validate = '', $url = '/')
|
||||
{
|
||||
//文件
|
||||
if (! $file) {
|
||||
return false;
|
||||
}
|
||||
//上传配置
|
||||
$config_name = 'filesystem.disks.'.$name;
|
||||
$filesystem = config($config_name);
|
||||
if (! $filesystem) {
|
||||
return false;
|
||||
}
|
||||
//上传文件
|
||||
if ($validate) {
|
||||
validate(['file' => $validate])->check(['file' => $file]);
|
||||
}
|
||||
$savename = \think\facade\Filesystem::disk($name)->putFile($path, $file, function ($file) {
|
||||
//重命名
|
||||
return date('Ymd').'/'.md5((string) microtime(true));
|
||||
});
|
||||
if(empty($url)){
|
||||
$url = '/';
|
||||
}
|
||||
$savename = $url.$savename;
|
||||
|
||||
return $savename;
|
||||
}
|
||||
}
|
57
config/upload.php
Normal file
57
config/upload.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* *
|
||||
* * ============================================================================
|
||||
* * Created by PhpStorm.
|
||||
* * User: Ice
|
||||
* * 邮箱: ice@sbing.vip
|
||||
* * 网址: https://sbing.vip
|
||||
* * Date: 2019/9/19 下午3:38
|
||||
* * ============================================================================.
|
||||
*/
|
||||
|
||||
//上传配置
|
||||
return [
|
||||
/**
|
||||
* 引擎
|
||||
*/
|
||||
'driver'=>'local',
|
||||
/**
|
||||
* 上传地址,默认是本地上传
|
||||
*/
|
||||
'uploadurl' => 'ajax/upload',
|
||||
/**
|
||||
* CDN地址
|
||||
*/
|
||||
'cdnurl' => '',
|
||||
/**
|
||||
* 文件保存格式
|
||||
*/
|
||||
'uploaddir' => 'uploads',
|
||||
/**
|
||||
* 最大可上传大小
|
||||
*/
|
||||
'maxsize' => '10mb',
|
||||
/**
|
||||
* 可上传的文件类型
|
||||
*/
|
||||
'mimetype' => 'jpg,png,bmp,jpeg,gif,zip,rar,xls,xlsx,wav,mp4,mp3,pdf',
|
||||
/**
|
||||
* 是否支持批量上传
|
||||
*/
|
||||
'multiple' => false,
|
||||
|
||||
/**
|
||||
* 文件保存格式
|
||||
*/
|
||||
'savekey' => '/uploads/{year}{mon}{day}/{filemd5}{.suffix}',
|
||||
|
||||
/**
|
||||
* 是否支持分片上传
|
||||
*/
|
||||
'chunking' => false,
|
||||
/**
|
||||
* 默认分片大小
|
||||
*/
|
||||
'chunksize' => 2097152,
|
||||
];
|
Loading…
x
Reference in New Issue
Block a user