|
@@ -82,7 +82,7 @@ class Dashboard extends Backend
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 订单统计
|
|
|
|
|
|
+ * 订单统计笔数
|
|
*/
|
|
*/
|
|
public function order(){
|
|
public function order(){
|
|
$starttime = strtotime(date('Y-m-d',strtotime("-30 day"))); //默认30天前
|
|
$starttime = strtotime(date('Y-m-d',strtotime("-30 day"))); //默认30天前
|
|
@@ -106,6 +106,9 @@ class Dashboard extends Backend
|
|
$ec_ordernum = [];
|
|
$ec_ordernum = [];
|
|
// $ec_orderfee = [];
|
|
// $ec_orderfee = [];
|
|
|
|
|
|
|
|
+ $whereop = $this->whereop('company_id');
|
|
|
|
+ $whereop['status'] = 3;
|
|
|
|
+
|
|
for($i=$starttime;$i<$endtime;$i+=86400){
|
|
for($i=$starttime;$i<$endtime;$i+=86400){
|
|
$starttime_i = $i;
|
|
$starttime_i = $i;
|
|
$endtime_i = $i + 86399;
|
|
$endtime_i = $i + 86399;
|
|
@@ -113,7 +116,8 @@ class Dashboard extends Backend
|
|
//日历
|
|
//日历
|
|
$ec_date[] = date('Y-m-d',$starttime_i);
|
|
$ec_date[] = date('Y-m-d',$starttime_i);
|
|
//下单人数
|
|
//下单人数
|
|
- $ec_ordernum[] = Db::name('order')->where(['finish_time'=>['between',[$starttime_i,$endtime_i]]])->count('id');
|
|
|
|
|
|
+ $whereop['finish_time'] = ['between',[$starttime_i,$endtime_i]];
|
|
|
|
+ $ec_ordernum[] = Db::name('order')->where($whereop)->count('id');
|
|
//下单金额
|
|
//下单金额
|
|
// $ec_orderfee[] = Db::name('order')->where(['createtime'=>['between',[$starttime_i,$endtime_i]]])->sum('pay_fee');
|
|
// $ec_orderfee[] = Db::name('order')->where(['createtime'=>['between',[$starttime_i,$endtime_i]]])->sum('pay_fee');
|
|
|
|
|
|
@@ -127,4 +131,36 @@ class Dashboard extends Backend
|
|
return $this->view->fetch();
|
|
return $this->view->fetch();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 订单统计各类型
|
|
|
|
+ */
|
|
|
|
+ public function orderservicetype(){
|
|
|
|
+ $starttime = strtotime(date('Y-m-d',strtotime("-30 day"))); //默认30天前
|
|
|
|
+ $endtime = strtotime(date('Y-m-d')) - 1;
|
|
|
|
+
|
|
|
|
+ //接收
|
|
|
|
+ $choicedatetime = input('choicedatetime','');
|
|
|
|
+ if(!empty($choicedatetime)){
|
|
|
|
+ $choicedatetime = explode(' - ',$choicedatetime);
|
|
|
|
+ $starttime = strtotime($choicedatetime[0]);
|
|
|
|
+ $endtime = strtotime($choicedatetime[1]) + 86399;
|
|
|
|
+ }
|
|
|
|
+ $this->view->assign('defaultdatetime',date('Y-m-d',$starttime).' - '.date('Y-m-d',$endtime));
|
|
|
|
+
|
|
|
|
+ //饼图
|
|
|
|
+ $whereop = $this->whereop('company_id');
|
|
|
|
+ $whereop['status'] = 3;
|
|
|
|
+ $whereop['finish_time'] = ['between',[$starttime,$endtime]];
|
|
|
|
+ $servicetype = Db::name('servicetype')->field('id,title as name')->select();
|
|
|
|
+ foreach($servicetype as $key => &$val){
|
|
|
|
+ $whereop['servicetype_id'] = $val['id'];
|
|
|
|
+ $val['value'] = Db::name('order')->where($whereop)->count('id');
|
|
|
|
+ unset($val['id']);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $this->assignconfig('servicetype', $servicetype);
|
|
|
|
+
|
|
|
|
+ return $this->view->fetch();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|