['BETWEEN',[$starttime,$endtime]], 'status' => ['IN','1,2'], ]; $today_order_amount = Db::name('order')->where($map)->sum('pay_fee'); //七日 $starttime = strtotime(date('Y-m-d')) - (86400*6); $endtime = $starttime + (86400*7) - 1; $map = [ 'paytime' => ['BETWEEN',[$starttime,$endtime]], 'status' => ['IN','1,2'], ]; $serventoday_order_amount = Db::name('order')->where($map)->sum('pay_fee'); //全部 $map = [ 'status' => ['IN','1,2'], ]; $alltoday_order_amount = Db::name('order')->where($map)->sum('pay_fee'); $this->view->assign([ 'today_order_amount' => $today_order_amount, 'serventoday_order_amount' => $serventoday_order_amount, 'alltoday_order_amount' => $alltoday_order_amount, ]); return $this->view->fetch(); } }