diff --git a/Application/Admin/Controller/SpendController.class.php b/Application/Admin/Controller/SpendController.class.php index caa56f2f0..4a4a84e8c 100644 --- a/Application/Admin/Controller/SpendController.class.php +++ b/Application/Admin/Controller/SpendController.class.php @@ -83,8 +83,14 @@ class SpendController extends ThinkController $order = ' pay_time desc '; } - $map1 = $map; - $map1['pay_status'] = 1; + if (intval(($endTime + 1) - $startTime) / (24 * 3600) <= 31) { + $map1 = $map; + $map1['pay_status'] = 1; + } else { + $map = '1 = 2'; + $map1 = $map; + } + $total = null_to_0(D(self::model_name)->where($map1)->sum('pay_amount')); $ttotal = null_to_0(D(self::model_name)->where('pay_time' . total(1))->where(array('pay_status' => 1))->sum('pay_amount')); $ytotal = null_to_0(D(self::model_name)->where('pay_time' . total(5))->where(array('pay_status' => 1))->sum('pay_amount')); diff --git a/Application/Admin/View/Spend/lists.html b/Application/Admin/View/Spend/lists.html index 8a0e90e82..c63b9fc4c 100644 --- a/Application/Admin/View/Spend/lists.html +++ b/Application/Admin/View/Spend/lists.html @@ -280,6 +280,17 @@ $(function () { //搜索功能 $("#search").click(function () { + var sdate = Date.parse($('#time-start').val()) / 1000; + var edate = Date.parse($('#time-end').val()) / 1000; + if (sdate > edate) { + layer.msg('开始时间必须小于等于结束时间'); + return false; + } + if ((edate - sdate) > 2592000) { + layer.msg('时间间隔不能超过31天,请重新选择日期'); + return false; + } + var url = $(this).attr('url'); var query = $('.jssearch').find('input').serialize(); query += "&" + $('.jssearch').find('select').serialize();