diff --git a/admin/controllers/receiver/Clues.php b/admin/controllers/receiver/Clues.php index 279401e7..51abd0e6 100644 --- a/admin/controllers/receiver/Clues.php +++ b/admin/controllers/receiver/Clues.php @@ -101,9 +101,9 @@ class Clues extends HD_Controller } } - if(strlen($params['status'])){ + if (strlen($params['status'])) { $where["status"] = $params['status']; - }else{ + } else { $where["status > "] = '-1'; } @@ -473,7 +473,12 @@ class Clues extends HD_Controller $data[] = array( 'name' => $objWorksheet->getCell('A' . $_row)->getValue(), 'mobile' => $objWorksheet->getCell('B' . $_row)->getValue(), - 'cfrom' => $objWorksheet->getCell('C' . $_row)->getValue(), + 'cfrom1' => $objWorksheet->getCell('C' . $_row)->getValue(), + 'cfrom2' => $objWorksheet->getCell('D' . $_row)->getValue(), + 'province_name' => $objWorksheet->getCell('E' . $_row)->getValue(), + 'city_name' => $objWorksheet->getCell('F' . $_row)->getValue(), + 'county_name' => $objWorksheet->getCell('G' . $_row)->getValue(), + 'biz_name' => $objWorksheet->getCell('H' . $_row)->getValue(), ); } $done = $this->add_batch($data); @@ -937,11 +942,22 @@ class Clues extends HD_Controller private function add_batch($lists) { $done = 0; - $adds = array(); - + $adds = $map_province = $map_city = $map_county = $map_biz = []; $where = array('status' => 1); $select = 'id, title'; $map_cfrom = $this->clues_cfrom_model->map('title', 'id', $where, '', 0, 0, $select); + $biz_strings = implode("','", array_unique(array_column($lists, 'biz_name'))); + if ($biz_strings) $where = ["biz_name in ('{$biz_strings}')" => null]; + $biz_strings && $map_biz = $this->biz_model->map('biz_name', 'id', $where, '', 0, 0, 'id,biz_name'); + $province_strings = implode("','", array_unique(array_column($lists, 'province_name'))); + if ($province_strings) $where = ["province_name in ('{$province_strings}')" => null]; + $province_strings && $map_province = $this->area_model->map('province_name', 'province_id', $where, '', 0, 0, 'DISTINCT(province_id),province_name'); + $city_strings = implode("','", array_unique(array_column($lists, 'city_name'))); + if ($city_strings) $where = ["city_name in ('{$city_strings}')" => null]; + $city_strings && $map_city = $this->area_model->map('city_name', 'city_id', $where, '', 0, 0, 'DISTINCT(city_id),city_name'); + $county_strings = implode("','", array_unique(array_column($lists, 'county_name'))); + if ($county_strings) $where = ["county_name in ('{$county_strings}')" => null]; + $county_strings && $map_county = $this->area_model->map('county_name', 'county_id', $where, '', 0, 0, 'DISTINCT(county_id),county_name'); $fails = array(); foreach ($lists as $k => $v) { if (!$v['name']) { @@ -956,18 +972,24 @@ class Clues extends HD_Controller $fails[] = array('data' => $v, 'msg' => '手机号已存在'); continue; } - $cf_id = $map_cfrom[$v['cfrom']]; - $adds[] = array( + $cf_id = $map_cfrom[$v['cfrom1']]; + $cf2_id = $map_cfrom[$v['cfrom2']]; + $temp = array( 'name' => $v['name'], 'mobile' => $v['mobile'], - 'cf_id' => $cf_id ? $cf_id : 0, + 'cf_id' => $cf_id ?: 0, + 'cf2_id' => $cf2_id ?: 0, 'c_time' => time(), + 'province_id' => $map_province[$v['province_name']] ?: 0, + 'city_id' => $map_city[$v['city_name']] ?: 0, + 'county_id' => $map_county[$v['county_name']] ?: 0, + 'biz_id' => $map_biz[$v['biz_name']] ?: 0, + ); + $adds[] = $temp; $done++; } - $fails && debug_log('[warning]# fails=' . json_encode($fails), __FUNCTION__, $this->log_dir); - if ($adds) { $ret = $this->clues_model->add_batch($adds); if (!$ret) { diff --git a/admin/controllers/receiver/Orders.php b/admin/controllers/receiver/Orders.php index ff479fdf..d84c476b 100644 --- a/admin/controllers/receiver/Orders.php +++ b/admin/controllers/receiver/Orders.php @@ -460,7 +460,8 @@ class Orders extends HD_Controller } else { $re_data_id = $re_data['id']; } - if ($field == 'ins_img' || $field == 'other_img') { + $field == 'contract_img' && $save_value = $re_data[$field] ? $re_data[$field] . ',' . $value : $value; + if ($field == 'ins_img') { $val_arr = json_decode($re_data[$field], true); $val_arr[] = $value; $save_value = json_encode($val_arr, JSON_UNESCAPED_UNICODE); @@ -535,17 +536,14 @@ class Orders extends HD_Controller if (!$row) { return $this->show_json(SYS_CODE_FAIL, '参数错误'); } - if ($info['field'] == 'ins_img' || $info['field'] == 'other_img') { - $jsondata = json_decode($row[$info['field']], true); - $new_jsondata = []; - foreach ($jsondata as $item) { - if (strpos($info['value'], $item) !== false) { - } else { - $new_jsondata[] = $item; - } + if ($info['field'] == 'contract_img') { + $img_array = explode(',', $row[$info['field']]); + $new_imgs = []; + foreach ($img_array as $item) { + strpos($info['value'], $item) === false && $new_imgs[] = $item; } $update = [ - $info['field'] => json_encode($new_jsondata, JSON_UNESCAPED_UNICODE) + $info['field'] => implode(',', $new_imgs) ]; } elseif ($info['field'] == 'insurance_img' || $info['field'] == 'business_img' || $info['field'] == 'accident_img' || $info['field'] == 'bill_ck_img') { $update = [ diff --git a/admin/views/receiver/order/get/ckinfo.php b/admin/views/receiver/order/get/ckinfo.php index 229c64b8..498d44e9 100644 --- a/admin/views/receiver/order/get/ckinfo.php +++ b/admin/views/receiver/order/get/ckinfo.php @@ -81,6 +81,7 @@ +

订单合同:

-