diff --git a/admin/controllers/receiver/Report.php b/admin/controllers/receiver/Report.php index 48775585..171bd1fd 100644 --- a/admin/controllers/receiver/Report.php +++ b/admin/controllers/receiver/Report.php @@ -12,6 +12,7 @@ class Report extends HD_Controller $this->load->model('receiver/receiver_score_log_model'); $this->load->model('receiver/receiver_score_day_model'); $this->load->model('app/licheb/app_licheb_users_model'); + $this->load->model('receiver/receiver_customers_model'); } //首页信息 @@ -57,11 +58,12 @@ class Report extends HD_Controller { $day = $this->input->get('day'); !$day && $day = date('Y-m-d', strtotime('yesterday')); + $month = date('m', strtotime($day)); $indexs = [ 'biz_name' => '车卖场', 'work_per' => '今日开工率', - 'word_num' => '本月平均开工数', + 'word_month' => '本月平均开工数', 'cust_new' => '今日新增线索数', 'cust_month' => '本月线索总数', 'cust_visit' => '今日新增跟进数', @@ -93,11 +95,28 @@ class Report extends HD_Controller foreach ($bizs as $v){ //开工率 $sales = $this->app_licheb_users_model->count(array('group_id in (1,2)' => null, 'biz_id' => $v['id'], 'status' => 1)); - $work = $this->receiver_score_log_model->count(array('day' => $day, 'biz_id' => $v['id'], 'type' => 0, 'sub_type' => 1), 'uid'); + $works = $this->receiver_score_log_model->count(array('day' => $day, 'biz_id' => $v['id'], 'type' => 0, 'sub_type' => 0, 'score >' => 0)); + + //本月平均开工数 + $work_month = $this->receiver_score_log_model->count(array('MONTH(day)' => $month, 'biz_id' => $v['id'], 'type' => 0, 'sub_type' => 0, 'score >' => 0)); + + //今日新增线索数 + $cust_new = $this->receiver_customers_model->count(array('biz_id' => $v['id'], 'DATE(p_time)' => $day, 'of_id' => 3)); + + //本月线索总数 + $cust_month = $this->receiver_customers_model->count(array('biz_id' => $v['id'], 'MONTH(p_time)' => $month)); + + //今日新增跟进数 + $cust_visit = $works = $this->receiver_score_log_model->count(array('day' => $day, 'biz_id' => $v['id'], 'type' => 1, 'sub_type' => 2, 'target_id <>' => 0)); + $data[] = array( 'biz_name' => $v['biz_name'], - 'work_per' => $work, + 'work_per' => number_format($works/$sales, 2) * 100 .'%', + 'work_month' => number_format($work_month/$month, 1), + 'cust_new' => $cust_new, + 'cust_month' => $cust_month, + 'cust_visit' => $cust_visit, ); } diff --git a/api/controllers/wxapp/licheb/Cusorderdata.php b/api/controllers/wxapp/licheb/Cusorderdata.php index fac88f62..4d577136 100644 --- a/api/controllers/wxapp/licheb/Cusorderdata.php +++ b/api/controllers/wxapp/licheb/Cusorderdata.php @@ -281,19 +281,11 @@ class Cusorderdata extends Wxapp } $res = $this->receiver_order_datas_model->update($update, ['o_id' => $id]); if ($res) { -// if($jsondata['bill_info'] || $jsondata['car_info']){ -// $img_name = $jsondata['bill_info'] ? '已开票' : '已完成交付'; -// -// //发短信 -// $biz = $this->biz_model->get(['id' => $this->biz_id]); -// $users = $this->app_user_model->select(array('group_id' => 4, 'biz_id like "%'.$this->biz_id.'%"' => null)); -// if($users){ -// foreach ($users as $v){ -// $content = "【理车宝】亲爱的客户成功经理,您管理的".$biz['biz_name']."订单(".$row['name'].")".$img_name.",请及时进行审核。"; -// b2m_send_sms($v['mobile'], $content); -// } -// } -// } + //跳过审核 + if($jsondata['bill_info'] && $row['status'] == 1){ + $this->orders_model->update(['status' => 2], ['id' => $id]); + } + $log = array( 'order_id' => $id, 'uid' => $this->session['uid'], @@ -304,8 +296,6 @@ class Cusorderdata extends Wxapp 'c_time' => time(), ); $this->receiver_order_oplogs_model->add($log); - //跳过审核 - $this->orders_model->update(['status' => 2], ['id' => $id]); throw new Exception('修改成功', API_CODE_SUCCESS); } else {