diff --git a/admin/controllers/receiver/Orders.php b/admin/controllers/receiver/Orders.php index 3d3fb072..4d59a1b1 100644 --- a/admin/controllers/receiver/Orders.php +++ b/admin/controllers/receiver/Orders.php @@ -469,14 +469,8 @@ class Orders extends HD_Controller $update['loan_time'] = date('Y-m-d H:i:s', strtotime($loan_time)); } $result = $this->order_loans_model->update($update, ['id' => $row['id']]); - if ($result && $params['status'] == 3) { //设置完成按揭 - $order_row = $this->orders_model->get(['id'=>$row['o_id']],'status'); - if($order_row['status']==4){ //完成代办 - $this->orders_model->update(['status' => 5], ['id' => $oid]); - if (!$this->order_deliverys_model->count(['o_id' => $oid])) { - $this->order_deliverys_model->add(['o_id' => $oid, 'c_time' => time]); - } - }else{ + if($result){ + if($params['status']==2){ //设置等待放款 $this->orders_model->update(['status' => 2], ['id' => $row['o_id']]); $ckcar = $this->order_ckcars_model->get(['o_id' => $row['o_id']]); $replace = [ @@ -486,6 +480,24 @@ class Orders extends HD_Controller ]; $ckcar && $replace['id'] = $ckcar['id']; $this->order_ckcars_model->replace($replace); + }elseif($params['status']==3){ //设置完成按揭 + $order_row = $this->orders_model->get(['id'=>$row['o_id']],'status'); + if($order_row['status']==4){ //完成代办 + $this->orders_model->update(['status' => 5], ['id' => $oid]); + if (!$this->order_deliverys_model->count(['o_id' => $oid])) { + $this->order_deliverys_model->add(['o_id' => $oid, 'c_time' => time]); + } + }else{ + $this->orders_model->update(['status' => 2], ['id' => $row['o_id']]); + $ckcar = $this->order_ckcars_model->get(['o_id' => $row['o_id']]); + $replace = [ + 'o_id' => $row['o_id'], + 'status' => 0, + 'c_time' => time() + ]; + $ckcar && $replace['id'] = $ckcar['id']; + $this->order_ckcars_model->replace($replace); + } } } $this->data['params'] = $params; diff --git a/api/controllers/wxapp/licheb/Statistics.php b/api/controllers/wxapp/licheb/Statistics.php index 0145a286..83541ccb 100644 --- a/api/controllers/wxapp/licheb/Statistics.php +++ b/api/controllers/wxapp/licheb/Statistics.php @@ -178,11 +178,15 @@ class Statistics extends Wxapp{ //数据分析页面客户数据 protected function get_scust(){ $day = $this->input_param('day'); + $month = $this->input_param('month'); $biz_id = $this->input_param('biz_id'); $admin_id = $this->input_param('admin_id'); if(!$biz_id){ throw new Exception('参数错误', ERR_PARAMS_ERROR); } + if(!$day && $month){ + $day = date("Y-{$month}-01"); + } !$day && $day = date('Y-m-d');//获取当天 $status_list = [ [ @@ -222,8 +226,8 @@ class Statistics extends Wxapp{ ]; $admin_id && $where['admin_id'] = $admin_id; if($day){ - $s_time = date('Y-m-d 00:00:00',strtotime($day)); - $e_time = date('Y-m-d 23:59:59',strtotime($day)); + $s_time = date('Y-m-01 00:00:00',strtotime($day)); + $e_time = date('Y-m-t 23:59:59',strtotime($day)); $where['c_time>='] = strtotime($s_time); $where['c_time<='] = strtotime($e_time); } @@ -308,10 +312,14 @@ class Statistics extends Wxapp{ protected function get_ocust(){ $day = $this->input_param('day'); $biz_id = $this->input_param('biz_id'); + $month = $this->input_param('month'); $admin_id = $this->input_param('admin_id'); if(!$biz_id){ throw new Exception('参数错误', ERR_PARAMS_ERROR); } + if(!$day && $month){ + $day = date("Y-{$month}-01"); + } !$day && $day = date('Y-m-d');//获取当天 $status_list = [ @@ -362,8 +370,8 @@ class Statistics extends Wxapp{ 'brand_id!=' => 3, ]; if($day){ - $s_time = date('Y-m-d 00:00:00',strtotime($day)); - $e_time = date('Y-m-d 23:59:59',strtotime($day)); + $s_time = date('Y-m-01 00:00:00',strtotime($day)); + $e_time = date('Y-m-t 23:59:59',strtotime($day)); $where['c_time>='] = strtotime($s_time); $where['c_time<='] = strtotime($e_time); }