login_white = array();//登录白名单 $this->check_status = array();//用户状态校验 $this->check_mobile = array();//需要手机号 $this->check_headimg = array();//授权微信信息 $this->load->model('receiver/receiver_clues_model', 'clues_model'); $this->load->model('receiver/receiver_customers_model', 'customers_model'); $this->load->model('receiver/receiver_clues_cfrom_model', 'clues_cfrom_model'); $this->load->model('receiver/order/receiver_orders_model', 'orders_model'); $this->load->model('receiver/order/receiver_order_datas_model'); $this->load->model('receiver/order/receiver_order_oplogs_model'); $this->load->model('auto/auto_brand_model'); $this->load->model('auto/auto_series_model'); $this->load->model('auto/auto_cars_model'); $this->load->model('app/licheb/app_licheb_users_model', 'app_user_model'); $this->load->model("biz/biz_model"); $this->load->model('biz/biz_visit_log_model'); $this->load->library('receiver/customers_entity'); $this->load->library('receiver/orders_entity'); $this->load->library('receiver/order_datas_entity'); $this->biz_id = $this->get_biz_id(); } protected function get() { $id = $this->input_param('id'); if ($id) { return $this->detail($id); } else { return $this->lists(); } } //创建订单 protected function post() { $cus_id = $this->input_param('cus_id'); $car_id = $this->input_param('car_id'); $color = $this->input_param('color'); $in_color = $this->input_param('in_color'); $payway = $this->input_param('payway'); $main_type = $this->input_param('main_type'); $name = trim($this->input_param('name')); $cardid = trim($this->input_param('cardid')); $delry_time = $this->input_param('delry_time'); $if_num = $this->input_param('if_num'); $if_insure = $this->input_param('if_insure'); $register_amount = $this->input_param('register_amount'); //上牌费 $if_equity = $this->input_param('if_equity'); //贷款相关参数 $downpayment_type = $this->input_param('downpayment_type'); $loan_amount = $this->input_param('loan_amount'); $loan_periods = $this->input_param('loan_periods'); $monthly_payment = $this->input_param('monthly_payment'); $confirm_amount = $this->input_param('confirm_amount'); $discount_amount = $this->input_param('discount_amount'); $row = $this->customers_model->get(['id' => $cus_id]); $biz = $this->biz_model->get(['id' => $this->biz_id]); $car_row = $this->auto_cars_model->get(['id' => $car_id]); if (!$row || !$car_row || !$name || !$cardid) { throw new Exception('参数错误', ERR_PARAMS_ERROR); } $data = [ 'sid' => create_order_no($biz['city_id'], $this->app_key), 'customer_id' => $row['id'], 'name' => $name, 'mobile' => $row['mobile'], 'card_id' => $cardid, 'biz_id' => $this->biz_id, 'brand_id' => $car_row['brand_id'], 'series_id' => $car_row['series_id'], 'car_id' => $car_id, 'admin_id' => $this->session['uid'], 'sale_id' => $this->session['uid'], 'order_time' => date('Y-m-d H:i:s'), 'c_time' => time() ]; $row['rid'] && $data['clue_id'] = $row['rid']; $payway && $data['payway'] = 1; $main_type && $data['main_type'] = 1; $delry_time && $data['delry_time'] = $delry_time; $color && $data['color'] = $color; $in_color && $data['in_color'] = $in_color; $if_num && $data['if_num'] = 1; $if_insure && $data['if_insure'] = 1; $if_equity && $data['if_equity'] = 1; $money_json = []; $money_json['confirm_amount'] = $confirm_amount ? $confirm_amount : 0; $money_json['discount_amount'] = $discount_amount ? $discount_amount : 0; if (!$payway) { //贷款 $data['downpayment_type'] = $downpayment_type ?: 0; $money_json['loan_amount'] = $loan_amount ? $loan_amount : 0; $money_json['loan_periods'] = $loan_periods ? $loan_periods : 0; $money_json['monthly_payment'] = $monthly_payment ? $monthly_payment : 0; } if ($if_num) { $money_json['register_amount'] = $register_amount ? $register_amount : 0; } $data['money_json'] = json_encode($money_json, JSON_UNESCAPED_UNICODE); $data['cps_type'] = $this->orders_model->get_cps_type($data['brand_id']); $o_id = $this->orders_model->add($data); if (is_numeric($o_id)) { //更新客户 $this->customers_model->update(['status' => 2, 'order_time' => date('Y-m-d H:i:s')], ['id' => $cus_id]); $this->customers_entity->add_log($cus_id, $this->session['uid'], $this->session['uname'], '生成订单', 6); //发短信 $users = $this->app_user_model->select(array('status' => 1, 'group_id' => 4, 'biz_id like "%,' . $this->biz_id . ',%"' => null)); if ($users) { foreach ($users as $v) { $content = "【好店云(厦门)科技】亲爱的客户成功经理,您管理的" . $biz['biz_name'] . '新增了一个订单。'; b2m_send_sms($v['mobile'], $content); // ems_sms($v['mobile'], "亲爱的客户成功经理,您管理的" . $biz['biz_name'] . '新增了一个订单。'); } } return ['id' => $o_id]; } else { throw new Exception('创建失败', ERR_PARAMS_ERROR); } } protected function put() { $id = $this->input_param('id'); $car_id = $this->input_param('car_id'); $color = $this->input_param('color'); $in_color = $this->input_param('in_color'); $payway = $this->input_param('payway'); $delry_time = $this->input_param('delry_time'); $if_num = $this->input_param('if_num'); $if_insure = $this->input_param('if_insure'); $if_equity = $this->input_param('if_equity'); $register_amount = $this->input_param('register_amount'); //上牌费 //贷款相关参数 $downpayment_type = $this->input_param('downpayment_type'); $loan_amount = $this->input_param('loan_amount'); $loan_periods = $this->input_param('loan_periods'); $monthly_payment = $this->input_param('monthly_payment'); $confirm_amount = $this->input_param('confirm_amount'); $discount_amount = $this->input_param('discount_amount'); $row = $this->orders_model->get(['id' => $id]); $car_row = $this->auto_cars_model->get(['id' => $car_id]); if (!$row || !$car_row) { throw new Exception('参数错误', ERR_PARAMS_ERROR); } $data = [ 'brand_id' => $car_row['brand_id'], 'series_id' => $car_row['series_id'], 'car_id' => $car_id, 'payway' => $payway ? 1 : 0 ]; $delry_time && $data['delry_time'] = $delry_time; $color && $data['color'] = $color; $in_color && $data['in_color'] = $in_color; $data['if_num'] = $if_num ? 1 : 0; $data['if_insure'] = $if_insure ? 1 : 0; $data['if_equity'] = $if_equity ? 1 : 0; $money_json = json_decode($row['money_json'], true); $money_json['confirm_amount'] = $confirm_amount ? $confirm_amount : 0; $money_json['discount_amount'] = $discount_amount ? $discount_amount : 0; if (!$payway) { //贷款 $data['downpayment_type'] = $downpayment_type ?: 0; $money_json['loan_amount'] = $loan_amount ? $loan_amount : 0; $money_json['loan_periods'] = $loan_periods ? $loan_periods : 0; $money_json['monthly_payment'] = $monthly_payment ? $monthly_payment : 0; } if ($if_num) { $money_json['register_amount'] = $register_amount ? $register_amount : 0; } $data['money_json'] = json_encode($money_json, JSON_UNESCAPED_UNICODE); $result = $this->orders_model->update($data, ['id' => $row['id']]); if ($result) { throw new Exception('修改成功', API_CODE_SUCCESS); } else { throw new Exception('修改失败', ERR_PARAMS_ERROR); } } //修改用户基本信息 protected function put_info() { $id = $this->input_param('id'); $row = $this->orders_model->get(['id' => $id]); if (!$row) { throw new Exception('参数错误', ERR_PARAMS_ERROR); } $name = trim($this->input_param('name')); $cardid = trim($this->input_param('cardid')); $data['name'] = $name; $data['card_id'] = $cardid; $result = $this->orders_model->update($data, ['id' => $row['id']]); if ($result) { throw new Exception('修改成功', API_CODE_SUCCESS); } else { throw new Exception('修改失败', ERR_PARAMS_ERROR); } } //修改订单状态 protected function put_status() { $biz = $this->get_biz_info(); $id = $this->input_param('id'); $status = $this->input_param('status'); $row = $this->orders_model->get(['id' => $id]); $clues = $this->clues_model->get(['id' => $row['clue_id']]); $data_row = $this->receiver_order_datas_model->get(['o_id' => $id]); if (!$row || !$status) throw new Exception('参数错误', ERR_PARAMS_ERROR); if ($clues['app_id'] != Receiver_clues_model::APP_ID_ACTIVITY) { //不是4s店铺 if ($status == 1) { //下定信息确认无误 判断:合同、付款凭证、身份证、权益书必须上传 if (!$data_row['contract_img']) throw new Exception('合同未上传', ERR_PARAMS_ERROR); if (!$data_row['cardida'] && !$row['main_type']) throw new Exception('身份证未上传', ERR_PARAMS_ERROR); if (!$data_row['bill_img'] && $row['main_type']) throw new Exception('营业执照未上传', ERR_PARAMS_ERROR); if (!$data_row['pay_img']) throw new Exception('付款凭证未上传', ERR_PARAMS_ERROR); //if (!$data_row['equity_ck_img']) throw new Exception('权益书未上传', ERR_PARAMS_ERROR); } elseif ($status == 2) { //开票信息确认无误:判断 发票 必须上传 if (!$data_row['bill_img']) throw new Exception('发票未上传', ERR_PARAMS_ERROR); } elseif ($status == 3) {//车辆交付信息: 判断 行驶证、保单 必须上传 if (!$data_row['car_img']) throw new Exception('行驶证未上传', ERR_PARAMS_ERROR); if (!$data_row['insurance_img']) throw new Exception('保单未上传', ERR_PARAMS_ERROR); } } else { $status = 3; } $update = ['status' => $status]; if ($status == 3) { $update['over_time'] = date('Y-m-d H:i:s'); } $res = $this->orders_model->update($update, ['id' => $id]); if ($res) { if ($status == -1) { throw new Exception('操作成功', API_CODE_SUCCESS); } //记日志 $uid = $this->session['uid']; $user = $this->app_user_model->get(array('id' => $uid)); $log = array( 'order_id' => $id, 'uid' => $uid, 'uname' => $user['uname'], 'type' => 0, 'cf_platform' => '理车宝', 'c_time' => time(), ); switch ($status) { case 1: $log['log'] = '下定信息审核通过'; case 2: $log['log'] = '开票信息审核通过'; case 3: $log['log'] = '车辆交付审核通过'; } $this->receiver_order_oplogs_model->add($log); //数据提交汽车之家 // $res = $this->orders_entity->post_auto($id); // if (!$res['code']) { // throw new Exception('网络错误,请联系管理员', ERR_PARAMS_ERROR); // } throw new Exception('审核通过,操作成功', API_CODE_SUCCESS); } else { throw new Exception('操作失败,请联系管理员', ERR_PARAMS_ERROR); } } //获取客户订单 protected function get_customer() { $customer_id = intval($this->input_param('customer_id')); if (!$customer_id) { throw new Exception('参数错误', ERR_PARAMS_ERROR); } $where = ['status>=' => 0, 'customer_id' => $customer_id]; $total = $this->orders_model->count($where); $lists = []; if ($total) { $rows = $this->orders_model->select($where, 'id desc', 0, 0, 'id,name,mobile,brand_id,series_id,car_id'); //品牌车型 $brand_arr = array_unique(array_column($rows, 'brand_id')); $brands = $this->auto_brand_model->get_map_by_ids($brand_arr, 'id,name'); //车系车型 $series_arr = array_unique(array_column($rows, 'series_id')); $series = $this->auto_series_model->get_map_by_ids($series_arr, 'id,name'); foreach ($rows as $key => $val) { $car_name = $name = $mobile = ''; $lists[] = [ 'id' => $val['id'], 'car_name' => $car_name, 'name' => $val['owner_name'] ? $val['owner_name'] : $val['name'], 'mobile' => $val['owner_mobile'] ? $val['owner_mobile'] : $val['mobile'] ]; } } $data = [ 'list' => $lists, 'total' => $total ]; return $data; } //订单列表头部 protected function get_tabs() { $group_id = $this->session['group_id']; $uid = $this->session['uid']; $where = []; if ($group_id == 1) { $where['admin_id'] = $uid;//销售 } else if ($group_id == 2 || $group_id == 3) {//店长/老板 $where["(biz_id = {$this->biz_id} OR admin_id = {$uid})"] = null; } else if ($group_id == 4) { $where['biz_id'] = $this->biz_id; } else if ($group_id == 5) { $where['biz_id'] = $this->biz_id; } $where['status<'] = 3; $where['status>'] = -1; $d_count = $this->orders_model->count($where); unset($where['status<']); unset($where['status>']); $where['status'] = 3; $f_count = $this->orders_model->count($where); $lists = [ ['key' => 11, 'name' => "进行中({$d_count})"], ['key' => 12, 'name' => "已完成({$f_count})"], ]; $status_array = $this->orders_model->get_status(); $type = []; foreach ($status_array as $key => $value) { $type[] = ['key' => $key, 'name' => $value]; } $data['filters'] = [ 'type' => $type, ]; $data['tabs'] = $lists; return $data; } private function lists() { $group_id = $this->session['group_id']; $biz = $this->get_biz_info(); $uid = $this->session['uid']; $keyword = $this->input_param('keyword'); $status = $this->input_param('status'); $brand_id = $this->input_param('brand_id'); $s_id = $this->input_param('car_id'); $v_id = $this->input_param('v_id'); $page = $this->input_param('page'); $size = $this->input_param('size'); $type = $this->input_param('type'); $order_s_time = $this->input_param('order_s_time'); $order_e_time = $this->input_param('order_e_time'); $admin_ids = $this->input_param('admin_ids');//多选销售人员 !$page && $page = 1; !$size && $size = 10; $tab_id = intval($this->input_param('visit_tab_id')); if ($tab_id) {//数据看版数据 if ($tab_id == 2) {//今日 $s_c_time = date('Y-m-01', strtotime(date("Y-m-d"))) . ' 00:00:00'; $e_c_time = date('Y-m-d', strtotime("$s_c_time +1 month -1 day")) . ' 23:59:59'; } else {//本月 $s_c_time = date('Y-m-d') . ' 00:00:00'; $e_c_time = date('Y-m-d') . ' 23:59:59'; } if ($status == 6) { $status = ''; $where = ['order_time>=' => $s_c_time, 'order_time<=' => $e_c_time]; } else if ($status == 8) { $status = 2; $where = ['refund_time>=' => $s_c_time, 'refund_time<=' => $e_c_time]; } } $admin_ids && $where["admin_id in ({$admin_ids})"] = null; $brand_id && $where['brand_id'] = $brand_id; $s_id && $where['series_id'] = $s_id; $v_id && $where['v_id'] = $v_id; if ($group_id == 1) { $where['admin_id'] = $uid;//销售 } else if ($group_id == 2 || $group_id == 3) {//店长/老板 $where["(biz_id = {$this->biz_id} OR admin_id = {$uid})"] = null; } else if ($group_id == 4) { $where['biz_id'] = $this->biz_id; } elseif ($group_id == 5) { // 4s店 $where['biz_id'] = $this->biz_id; } if ($keyword) { if (is_numeric($keyword)) { $where["mobile like '%{$keyword}%'"] = null; } else { $where["name like '%{$keyword}%'"] = null; } } if ($status == 11) { //进行中 $where['status<'] = 3; $where['status>'] = -1; } elseif ($status == 12) { //已完成 $where['status'] = 3; } else { if (strlen($status)) { $where['status'] = $status; } else { $where['status>='] = 0; } } strlen($type) && $where['status'] = $type; //下定时间 if ($order_s_time && $order_e_time) { $where["order_time >="] = date('Y-m-d 00:00:00', strtotime($order_s_time)); $where["order_time <="] = date('Y-m-d 00:00:00', strtotime($order_e_time)); } $count = $this->orders_model->count($where); $lists = $map_users = []; if ($count) { $rows = $this->orders_model->select($where, 'id desc', $page, $size); $biz = $this->biz_model->get(['id' => $this->biz_id]); //销售顾问 $str_user_ids = implode(',', array_unique(array_column($rows, 'admin_id'))); $str_user_ids && $map_users = $this->app_user_model->map('id', 'uname', ["id in({$str_user_ids})" => null]); //品牌车型 $brand_arr = array_unique(array_column($rows, 'brand_id')); $brands = $this->auto_brand_model->get_map_by_ids($brand_arr, 'id,name'); //车系车型 $series_arr = array_unique(array_column($rows, 'series_id')); $series = $this->auto_series_model->get_map_by_ids($series_arr, 'id,name'); //车系车型 $car_arr = array_unique(array_column($rows, 'car_id')); $cars = $this->auto_cars_model->get_map_by_ids($car_arr, 'id,name'); //获取订单资料 $order_datas = $this->receiver_order_datas_model->get_map_by_oids(array_column($rows, 'id')); $status_arr = $this->orders_model->get_status(); $allot = $this->get_allot(); foreach ($rows as $key => $val) { $brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : ''; $serie_name = isset($series[$val['series_id']]) ? $series[$val['series_id']][0]['name'] : ''; $car_name = isset($cars[$val['car_id']]) ? $cars[$val['car_id']][0]['name'] : ''; $img_status = $this->order_datas_entity->data_status($order_datas[$val['id']][0], $val['status']); $customer = $this->customers_model->get(['id' => $val['customer_id']]); $clues = $this->clues_model->get(['id' => $val['clue_id']]); $of_title = ''; if ($customer['of_id']) { $of = $this->clues_cfrom_model->get(array('id' => $customer['of_id'])); $of_title = $of['title']; if ($customer['of2_id']) { $of = $this->clues_cfrom_model->get(array('id' => $customer['of2_id'])); $of_title .= '-' . $of['title']; } } $title = "{$brand_name}-{$serie_name}"; $o_data_1 = [ '购车主体' => ['type' => 'text', 'value' => $val['main_type'] ? '公司' : '个人', 'bg_color' => ''], '品牌' => ['type' => 'text', 'value' => $title, 'bg_color' => ''], '车型' => ['type' => 'text', 'value' => $car_name, 'bg_color' => ''], ]; $o_data_4 = $o_data_3 = $o_data_2 = []; if ($clues['app_id'] == Receiver_clues_model::APP_ID_ACTIVITY) { $o_data_1['客户身份证'] = ['type' => 'text', 'value' => $img_status['cardida']['text'], 'bg_color' => $img_status['cardida']['color']]; } else { $o_data_1['付款方式'] = ['type' => 'text', 'value' => $val['payway'] ? '全款' : '按揭', 'bg_color' => '']; if ($val['main_type']) {//公司 $o_data_1['营业执照'] = ['type' => 'text', 'value' => $img_status['business_licence']['text'], 'bg_color' => $img_status['business_licence']['color']]; } else { $o_data_1['客户身份证'] = ['type' => 'text', 'value' => $img_status['cardida']['text'], 'bg_color' => $img_status['cardida']['color']]; } $o_data_1['订单合同'] = ['type' => 'text', 'value' => $img_status['contract_img']['text'], 'bg_color' => $img_status['contract_img']['color']]; $o_data_1['付款凭证'] = ['type' => 'text', 'value' => $img_status['pay_img']['text'], 'bg_color' => $img_status['pay_img']['color']]; //$o_data_1['权益确认书'] = ['type' => 'text', 'value' => $img_status['equity_ck_img']['text'], 'bg_color' => $img_status['equity_ck_img']['color']]; $o_data_2 = [ '发票' => ['type' => 'text', 'value' => $img_status['bill_img']['text'], 'bg_color' => $img_status['bill_img']['color']] ]; $o_data_3 = [ '保单' => ['type' => 'text', 'value' => $img_status['insurance_img']['text'], 'bg_color' => $img_status['insurance_img']['color']], '行驶证' => ['type' => 'text', 'value' => $img_status['car_img']['text'], 'bg_color' => $img_status['car_img']['color']], //'交车合照' => ['type' => 'text', 'value' => $img_status['delivery_ck_img']['text'], 'bg_color' => $img_status['delivery_ck_img']['color']] ]; } $val['order_time'] != '0000-00-00 00:00:00' && $o_data_4['下定时间'] = ['type' => 'text', 'value' => date('Y-m-d', strtotime($val['order_time'])), 'bg_color' => '']; //$val['delry_time'] != '0000-00-00 00:00:00' && $o_data_4['期望交付'] = ['type' => 'text', 'value' => date('Y-m-d', strtotime($val['delry_time'])), 'bg_color' => '']; if ($map_users[$val['admin_id']]) { $o_data_4['客户来源'] = ['type' => 'text', 'value' => $of_title, 'bg_color' => '']; $o_data_4['车卖场'] = ['type' => 'text', 'value' => $biz['biz_name'], 'bg_color' => '']; $o_data_4['车管家'] = ['type' => 'text', 'value' => $map_users[$val['admin_id']], 'bg_color' => '']; } $other_data['o_data_1'] = $o_data_1; $other_data['o_data_2'] = $o_data_2; $other_data['o_data_3'] = $o_data_3; $other_data['o_data_4'] = $o_data_4; $destroy_show = [ 'is_show' => false, //是否显示核销按钮 'text' => '', 'status' => 0 //核销状态 0未核销 1已核销 ]; if ($clues['app_id'] == Receiver_clues_model::APP_ID_ACTIVITY) { $destroy_show = $this->orders_entity->getDestroy($val['id']); } $lists[] = [ 'id' => $val['id'], 'cus_id' => $val['customer_id'], 'name' => $val['name'], 'mobile' => $val['mobile'], 'company' => '', 'status_name' => $status_arr[$val['status']], 'other_data' => $other_data, 'allot' => $allot, 'destroy' => $destroy_show, 'app_id' => $clues['app_id'] ?: 0 ]; } } $data = [ 'list' => $lists, 'total' => $count ]; //增加埋点 $logData = [ 'uid' => $this->session['uid'], 'biz_id' => $this->biz_id, 'title' => '订单列表' ]; $this->biz_visit_log_model->addDataPushQueue($logData); return $data; } private function detail($id) { $group_id = $this->session['group_id']; $biz = $this->get_biz_info(); $row = $this->orders_model->get(['id' => $id]); if (!$row) { throw new Exception('订单不存在', ERR_PARAMS_ERROR); } $clues = $this->clues_model->get(['id' => $row['clue_id']]); $money_json = json_decode($row['money_json'], true); $brand = $this->auto_brand_model->get(['id' => $row['brand_id']], 'name'); $series = $this->auto_series_model->get(['id' => $row['series_id']], 'name'); $car = $this->auto_cars_model->get(['id' => $row['car_id']], 'name'); $payway = $row['payway']; $car_data = []; $car_data['车辆品牌'] = $brand['name'] . $series['name']; $car_data['车型'] = $car['name']; $row['color'] && $car_data['车身颜色'] = $row['color']; $row['in_color'] && $car_data['内饰颜色'] = $row['in_color']; $bt_cn_array = [0 => '下定信息确认无误', 1 => '发票信息确认无误', 2 => '交付信息确认无误']; $bt_cn = $bt_cn_array[$row['status']]; if ($clues['app_id'] != Receiver_clues_model::APP_ID_ACTIVITY) { $row['delry_time'] != '0000-00-00 00:00:00' && $car_data['期望交付时间'] = date('Y-m-d', strtotime($row['delry_time'])); $money_json['confirm_amount'] && $car_data['定金'] = $money_json['confirm_amount']; $money_json['discount_amount'] && $car_data['车身优惠'] = $money_json['discount_amount']; $car_data['付款方式'] = $payway ? '全款' : '分期'; if (!$payway) { // 分期 $car_data['按揭信息'] = ''; } $car_data['投保买贵必赔'] = $row['if_equity'] ? '是' : '否'; $car_data['是否店内投保'] = $row['if_insure'] ? '是' : '否'; $car_data['是否店内上牌'] = $row['if_num'] ? '是' : '否'; if ($row['if_num']) { $car_data['上牌费'] = $money_json['register_amount'] ? $money_json['register_amount'] : 0; } } else { $bt_cn = '确认订单'; } $edit_info_status = false; if ($clues['app_id'] != Receiver_clues_model::APP_ID_ACTIVITY && $row['status'] > 0) { $edit_info_status = true; } $data = [ 'id' => $id, 'name' => $row['name'], 'mobile' => $row['mobile'], 'payway' => $row['brand_id'] ? $row['payway'] : '', 'main_type' => intval($row['main_type']), 'brand_id' => $row['brand_id'], 'brand_name' => $brand['name'], 'series_id' => $row['series_id'], 'car_id' => $row['car_id'], 'cus_id' => $row['customer_id'], 'color' => $row['color'], 'in_color' => $row['in_color'], 'status' => $row['status'], 'bt_cn' => $bt_cn, 'car_data' => $car_data, 'if_num' => $row['if_num'], 'if_insure' => $row['if_insure'], 'if_equity' => $row['if_equity'], 'delry_time' => date('Y-m-d', strtotime($row['delry_time'])), 'money_json' => $row['money_json'] ? json_decode($row['money_json'], true) : [], 'downpayment_type' => $row['downpayment_type'], 'cardid' => $row['card_id'], 'edit_info_status' => $edit_info_status, 'edit_order_status' => $row['status'] > 1 ? false : true, 'group_id' => $this->session['group_id'], 'app_id' => $clues['app_id'] ?: 0 ]; if ($row['admin_id']) { $admin_row = $this->app_user_model->get(['id' => $row['admin_id']], 'uname'); $data['admin_name'] = $admin_row['uname']; } //增加埋点 $logData = [ 'uid' => $this->session['uid'], 'biz_id' => $this->biz_id, 'title' => '订单详情' ]; $this->biz_visit_log_model->addDataPushQueue($logData); return $data; } /** * Notes:判断分配客户权限 * Created on: 2022/7/27 10:02 * Created by: dengbw * @return int */ private function get_allot() { $allot = 1; $group_id = $this->session['group_id']; if ($group_id == 1) {//销售不可分配用户 $allot = 0; } return $allot; } }