接口修改6
This commit is contained in:
parent
b2f0338660
commit
78ed2babc3
app
@ -45,7 +45,7 @@ class Index extends BaseController
|
||||
public function main()
|
||||
{
|
||||
if ($this->adminInfo['id']!=1){
|
||||
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->adminInfo['id'])->find();
|
||||
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->adminInfo['user_id'])->find();
|
||||
if ($find) {
|
||||
if ($find['auth_range']==1){
|
||||
$where[] = ['village_id', '=', $find['village_id']];
|
||||
@ -53,6 +53,8 @@ class Index extends BaseController
|
||||
$where[] = ['street_id', '=', $find['street_id']];
|
||||
}elseif ($find['auth_range']==3){
|
||||
$where[] = ['area_id', '=', $find['area_id']];
|
||||
}elseif ($find['auth_range']==5){
|
||||
$where[] = ['brigade_id', '=', $find['brigade_id']];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
@ -32,17 +32,12 @@ class Article extends BaseController
|
||||
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
|
||||
if ($user_address) {
|
||||
if ($user_address['auth_range'] == 1) {
|
||||
$mmm['area_id'] = $user_address['area_id'];
|
||||
$mmm['street_id'] = $user_address['street_id'];
|
||||
$mmm['village_id'] = $user_address['village_id'];
|
||||
$where[]= ['county','=',$user_address['area_id']];
|
||||
$where[] =['township','=', $user_address['street_id']];
|
||||
$where[] =['village','=', $user_address['village_id']];
|
||||
} elseif ($user_address['auth_range'] == 2) {
|
||||
$mmm['area_id'] = $user_address['area_id'];
|
||||
$mmm['street_id'] = $user_address['street_id'];
|
||||
}elseif ($user_address['auth_range'] == 5) {
|
||||
$mmm['area_id'] = $user_address['area_id'];
|
||||
$mmm['street_id'] = $user_address['street_id'];
|
||||
$mmm['village_id'] = $user_address['village_id'];
|
||||
$mmm['brigade_id'] = $user_address['brigade_id'];
|
||||
$where[]= ['county','=',$user_address['area_id']];
|
||||
$where[] =['township','=', $user_address['street_id']];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,18 @@ class Maturity extends BaseController
|
||||
->where($where)
|
||||
->count();
|
||||
$list = Db::table('cms_agriculture_products')
|
||||
->withAttr('area_id',function ($value,$data){
|
||||
return Db::table('fa_geo_area')->where('area_code',$data['area_id'])->value('area_name');
|
||||
})
|
||||
->withAttr('street_id',function ($value,$data){
|
||||
return Db::table('fa_geo_street')->where('street_code',$data['street_id'])->value('street_name');
|
||||
})
|
||||
->withAttr('village_id',function ($value,$data){
|
||||
return Db::table('fa_geo_village')->where('village_id',$data['village_id'])->value('village_name');
|
||||
})
|
||||
->withAttr('image',function ($value,$data){
|
||||
return Db::table('fa_szxc_planting_type')->where('id',$data['szxc_planting_type_id'])->value('image');
|
||||
})
|
||||
->withAttr('status',function ($value,$data){
|
||||
if($value == 1){
|
||||
return '正常';
|
||||
|
@ -52,21 +52,15 @@ class StreetCulture extends BaseController
|
||||
$user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find();
|
||||
if ($user_address) {
|
||||
if ($user_address['auth_range'] == 1) {
|
||||
$mmm['area_id'] = $user_address['area_id'];
|
||||
$mmm['street_id'] = $user_address['street_id'];
|
||||
$mmm['village_id'] = $user_address['village_id'];
|
||||
$where[]= ['county','=',$user_address['area_id']];
|
||||
$where[] =['township','=', $user_address['street_id']];
|
||||
$where[] =['village','=', $user_address['village_id']];
|
||||
} elseif ($user_address['auth_range'] == 2) {
|
||||
$mmm['area_id'] = $user_address['area_id'];
|
||||
$mmm['street_id'] = $user_address['street_id'];
|
||||
}elseif ($user_address['auth_range'] == 5) {
|
||||
$mmm['area_id'] = $user_address['area_id'];
|
||||
$mmm['street_id'] = $user_address['street_id'];
|
||||
$mmm['village_id'] = $user_address['village_id'];
|
||||
$mmm['brigade_id'] = $user_address['brigade_id'];
|
||||
$where[]= ['county','=',$user_address['area_id']];
|
||||
$where[] =['township','=', $user_address['street_id']];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$map[] = ['category_id','in',[307,308,309,310,311,312]];
|
||||
$total = Db::table('fa_article')
|
||||
->where($where)
|
||||
|
@ -136,329 +136,9 @@
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script src="https://cdn.staticfile.org/echarts/5.3.0/echarts.min.js"></script>
|
||||
<script>
|
||||
function getLogs() {
|
||||
$.ajax({
|
||||
url: "/admin/api/get_log_list",
|
||||
type: 'post',
|
||||
data: {
|
||||
page: 1,
|
||||
limit: 20
|
||||
},
|
||||
success: function (e) {
|
||||
if (e.code == 0) {
|
||||
var html = '';
|
||||
$.each(e.data, function (key, value) {
|
||||
html += '<li class="layui-timeline-item">\
|
||||
<i class="layui-icon layui-timeline-axis"></i>\
|
||||
<div class="layui-timeline-content layui-text">\
|
||||
<div class="layui-timeline-title"><span title="'+ value.id + '">' + value.times + '</span>,' + value.content + '</div>\
|
||||
</div>\
|
||||
</li>';
|
||||
});
|
||||
$('#logs').html(html);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const moduleInit = ['tool'];
|
||||
function gouguInit() {
|
||||
var table = layui.table;
|
||||
$('body').on('click','[data-event="pay"]',function(){
|
||||
var src=$(this).attr('src');
|
||||
layer.open({
|
||||
type:1,
|
||||
title:'感谢您给作者加鸡腿🍗🍗',
|
||||
content:'<img src="'+src+'" style="width:100%" align=center />',
|
||||
});
|
||||
})
|
||||
// getLogs();
|
||||
//注册用户
|
||||
table.render({
|
||||
elem: '#UserList'
|
||||
, url: '/admin/api/get_user_list' //数据接口
|
||||
, page: false //开启分页
|
||||
, cols: [[ //表头
|
||||
{ field: 'username', title: '用户名'}
|
||||
,{ field: 'username', title: '昵称', align: 'center', 'width': 120}
|
||||
,{ field: 'sex', title: '性别','width': 60, align: 'center', templet: function (d) {
|
||||
let str='-';
|
||||
if(d.sex==1){
|
||||
str='男';
|
||||
}
|
||||
else if(d.sex==2){
|
||||
str='女';
|
||||
}
|
||||
return str;
|
||||
}}
|
||||
, {
|
||||
field: 'headimgurl', title: '头像', align: 'center','width': 60, templet: function (d) {
|
||||
return '<img src="' + d.headimgurl + '" width="20" height="20" />';
|
||||
}
|
||||
}
|
||||
, { field: 'login_num', title: '登录次数', align: 'center','width': 100}
|
||||
, { field: 'last_login_time', title: '最后登录时间', align: 'center','width': 168}
|
||||
]]
|
||||
});
|
||||
|
||||
//文章
|
||||
table.render({
|
||||
elem: '#Article'
|
||||
, url: '/admin/api/get_article_list' //数据接口
|
||||
, page: false //开启分页
|
||||
, cols: [[ //表头
|
||||
{ field: 'title', title: '文章标题'}
|
||||
, { field: 'cate_title', title: '文章分类', align: 'center','width': 150 }
|
||||
, { field: 'read', title: '访问量', align: 'center','width': 100 }
|
||||
, { field: 'create_time', title: '发布时间', align: 'center','width': 168}
|
||||
]]
|
||||
});
|
||||
// get_view_data();
|
||||
}
|
||||
|
||||
|
||||
function setHour(num) {
|
||||
var str = num + ':00';
|
||||
if (num < 10) {
|
||||
str = '0' + num + ':00';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
var chartView = echarts.init(document.getElementById('chartView'));
|
||||
function get_view_data() {
|
||||
$.ajax({
|
||||
url: "/admin/api/get_view_data",
|
||||
type: 'post',
|
||||
data: {},
|
||||
success: function (e) {
|
||||
if (e.code == 0) {
|
||||
var data_first = e.data.data_first;
|
||||
var data_second = e.data.data_second;
|
||||
archiveCalendar = e.data.data_three;
|
||||
var myDate = new Date();
|
||||
var nowHour = myDate.getHours(); //获取当前小时数(0-23)
|
||||
var xData = [];
|
||||
var yData1 = [];
|
||||
var yData2 = [];
|
||||
$.each(data_first, function (key, value) {
|
||||
if (key <= nowHour) {
|
||||
yData1.push(value);
|
||||
}
|
||||
});
|
||||
$.each(data_second, function (key, value) {
|
||||
xData.push(setHour(key));
|
||||
yData2.push(value);
|
||||
});
|
||||
var ops = {
|
||||
title: {
|
||||
top: '12px',
|
||||
text: '今日与昨日访问统计',
|
||||
left: '10px',
|
||||
textStyle: {
|
||||
fontSize: '18',
|
||||
color: '#333',
|
||||
}
|
||||
},
|
||||
color: ["#1AAD19", "#1890FF"],
|
||||
grid: {
|
||||
left: '16px',
|
||||
right: '30px',
|
||||
bottom: '12px',
|
||||
top: '60px',
|
||||
containLabel: true
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'cross',
|
||||
crossStyle: {
|
||||
color: '#999'
|
||||
}
|
||||
}
|
||||
},
|
||||
toolbox: {
|
||||
show: true,
|
||||
},
|
||||
legend: {
|
||||
data: ["今日", "昨日"],
|
||||
top: '16px',
|
||||
},
|
||||
xAxis: [{
|
||||
type: "category",
|
||||
boundaryGap: !1,
|
||||
data: xData,
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#999999',
|
||||
width: 1,
|
||||
}
|
||||
},
|
||||
}],
|
||||
yAxis: [{
|
||||
type: "value",
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: '#999999',
|
||||
width: 1,
|
||||
}
|
||||
},
|
||||
}],
|
||||
series: [{
|
||||
name: "今日",
|
||||
type: "line",
|
||||
smooth: !0,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
areaStyle: {
|
||||
type: "default",
|
||||
opacity: 0.2
|
||||
}
|
||||
}
|
||||
},
|
||||
data: yData1
|
||||
}, {
|
||||
name: "昨日",
|
||||
type: "line",
|
||||
smooth: !0,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
areaStyle: {
|
||||
type: "default",
|
||||
opacity: 0.2
|
||||
}
|
||||
}
|
||||
},
|
||||
data: yData2
|
||||
}]
|
||||
}
|
||||
chartView.setOption(ops);
|
||||
|
||||
|
||||
let myChart = echarts.init(document.getElementById('chartYear'));
|
||||
let option = {
|
||||
title: {
|
||||
top: '12px',
|
||||
text: '近一年访问统计',
|
||||
left: '10px',
|
||||
textStyle: {
|
||||
fontSize: '18',
|
||||
color: '#333',
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
padding: 6,
|
||||
formatter: function (obj) {
|
||||
var value = obj.value;
|
||||
return '<div style="font-size: 12px;">' + value[0] + ':' + value[1] + ' 个访客</div>';
|
||||
}
|
||||
},
|
||||
visualMap: {
|
||||
min: 0,
|
||||
max: 300,
|
||||
show: false,
|
||||
inRange: {
|
||||
color: ['#fafafa', '#1AAD19']
|
||||
}
|
||||
},
|
||||
calendar: {
|
||||
top: 75,
|
||||
left: 50,
|
||||
right: 20,
|
||||
range: getRange(),
|
||||
cellSize: ['auto', 21],
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: '#aaa',
|
||||
type: 'dashed'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
borderWidth: 0.5
|
||||
},
|
||||
yearLabel: { show: false },
|
||||
monthLabel: {
|
||||
nameMap: 'cn',
|
||||
fontSize: 12
|
||||
},
|
||||
dayLabel: {
|
||||
show: true,
|
||||
formatter: '{start} 1st',
|
||||
fontWeight: 'lighter',
|
||||
nameMap: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
|
||||
fontSize: 12
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
type: 'heatmap',
|
||||
coordinateSystem: 'calendar',
|
||||
calendarIndex: 0,
|
||||
data: getDay()
|
||||
}]
|
||||
};
|
||||
myChart.setOption(option);
|
||||
|
||||
setTimeout(function () {
|
||||
window.onresize = function () {
|
||||
chartView.resize();
|
||||
myChart.resize();
|
||||
}
|
||||
})
|
||||
console.log(e.data);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
var archiveCalendar = {};
|
||||
function getRange() {
|
||||
let today = new Date();
|
||||
let tYear = today.getFullYear();
|
||||
let tMonth = today.getMonth() + 1;
|
||||
let tDate = today.getDate();
|
||||
let dateFirst = tYear + "-" + tMonth + "-" + tDate;
|
||||
let datelast = (tYear - 1) + "-" + tMonth + "-" + tDate;
|
||||
let dataRange = [];
|
||||
dataRange.push(dateFirst);
|
||||
dataRange.push(datelast);
|
||||
return dataRange;
|
||||
}
|
||||
|
||||
function getDay() {
|
||||
var today = new Date();
|
||||
var dayArray = [];
|
||||
for (var i = 0; i < 366; i++) {
|
||||
var targetday_milliseconds = today.getTime() - 1000 * 60 * 60 * 24 * i;
|
||||
var date = new Date(targetday_milliseconds);
|
||||
dayArray.push(retunDay(date));
|
||||
}
|
||||
return dayArray;
|
||||
}
|
||||
|
||||
function retunDay(day) {
|
||||
var tYear = day.getFullYear();
|
||||
var tMonth = day.getMonth();
|
||||
var tDate = day.getDate();
|
||||
tMonth = tMonth + 1;
|
||||
if (tMonth.toString().length == 1) {
|
||||
tMonth = "0" + tMonth;
|
||||
}
|
||||
if (tDate.toString().length == 1) {
|
||||
tDate = "0" + tDate;
|
||||
}
|
||||
var dateStr = tYear + "-" + tMonth + "-" + tDate;
|
||||
var dateArray = [];
|
||||
dateArray.push(dateStr);
|
||||
if (archiveCalendar[dateStr]) {
|
||||
dateArray.push(archiveCalendar[dateStr]);
|
||||
}
|
||||
else {
|
||||
dateArray.push(0);
|
||||
}
|
||||
return dateArray;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
{/block}
|
||||
|
@ -23,12 +23,24 @@
|
||||
</script>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
|
||||
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加">+ 添加</span>
|
||||
{/if}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group"><a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
|
||||
<div class="layui-btn-group">
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[4])}==true}
|
||||
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
|
||||
{/if}
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
{/if}
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
||||
{/if}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
|
@ -21,12 +21,24 @@
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
|
||||
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加">+ 添加</span>
|
||||
{/if}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group"><a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
|
||||
<div class="layui-btn-group">
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[4])}==true}
|
||||
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
|
||||
{/if}
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
{/if}
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
||||
{/if}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
@ -52,27 +64,35 @@
|
||||
field: 'id',
|
||||
title: '编号',
|
||||
align: 'center',
|
||||
width:80,
|
||||
},{
|
||||
field: 'area_id',
|
||||
title: '区县',
|
||||
align: 'center',
|
||||
},{
|
||||
field: 'street_id',
|
||||
title: '乡镇',
|
||||
align: 'center',
|
||||
},{
|
||||
field: 'village_id',
|
||||
title: '街道/村',
|
||||
align: 'center',
|
||||
},{
|
||||
field: 'title',
|
||||
title: '农作物名称',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
field: 'content',
|
||||
title: '内容',
|
||||
field: 'image',
|
||||
title: '图片',
|
||||
align: 'center',
|
||||
width:150,
|
||||
templet: '<div><img src="{{ d.images }}" style="width:30px; height:30px;"></div>',
|
||||
},{
|
||||
field: 'add_time',
|
||||
title: '添加时间',
|
||||
align: 'center',
|
||||
width:150,
|
||||
},{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
align: 'center',
|
||||
width:100,
|
||||
},{
|
||||
fixed: 'right',
|
||||
field: 'right',
|
||||
|
@ -23,14 +23,25 @@
|
||||
</script>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
|
||||
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加">+ 添加</span>
|
||||
{/if}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-btn-group"><a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
|
||||
<div class="layui-btn-group">
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[4])}==true}
|
||||
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
|
||||
{/if}
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
{/if}
|
||||
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
||||
{/if}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
|
@ -667,7 +667,7 @@ class Statistics extends BaseController
|
||||
// $where[] = ['village_id', '=', $village_id];
|
||||
// }
|
||||
|
||||
$list = Db::connect('shop')->table('eb_broadcast_room')->field('name,cover_img,share_img,start_time,end_time,anchor_name,anchor_wechat,phone,live_status')->where($where)->select();
|
||||
$list = Db::connect('shop')->table('eb_broadcast_room')->field('room_id,name,cover_img,share_img,start_time,end_time,anchor_name,anchor_wechat,phone,live_status')->where($where)->select();
|
||||
$this->apiSuccess('获取成功',$list);
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,15 @@ use think\facade\Config;
|
||||
use think\facade\Db;
|
||||
use think\facade\Request;
|
||||
|
||||
//权限判断
|
||||
function auth_cache($key,$url)
|
||||
{
|
||||
if ($key==1){
|
||||
return true;
|
||||
}
|
||||
$arr=Cache::get('RulesSrc' . $key);
|
||||
return in_array(substr($url,1),$arr);
|
||||
}
|
||||
//设置缓存
|
||||
function set_cache($key, $value, $date = 86400)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user