|
|
@@ -746,12 +746,11 @@ class ViolationProduct extends Controller
|
|
|
$sheet->setCellValue('P2', '公司名称*');
|
|
|
$sheet->setCellValue('Q2', '公司分类名称');
|
|
|
$sheet->setCellValue('R2', '信用代码');
|
|
|
- $sheet->setCellValue('S2', '省份');
|
|
|
- $sheet->setCellValue('T2', '城市');
|
|
|
- $sheet->setCellValue('U2', '溯源责任人');
|
|
|
- $sheet->setCellValue('V2', '检索采集日期(Y-m-d)*');
|
|
|
- $sheet->setCellValue('W2', '发货省份');
|
|
|
- $sheet->setCellValue('X2', '发货城市');
|
|
|
+ $sheet->setCellValue('S2', '公司省');
|
|
|
+ $sheet->setCellValue('T2', '公司市');
|
|
|
+ $sheet->setCellValue('U2', '检索采集时间(Y-m-d H:i:s)*');
|
|
|
+ $sheet->setCellValue('V2', '店铺省');
|
|
|
+ $sheet->setCellValue('W2', '店铺市');
|
|
|
// 生成 Excel 文件
|
|
|
$writer = new Xlsx($spreadsheet);
|
|
|
|
|
|
@@ -830,15 +829,15 @@ class ViolationProduct extends Controller
|
|
|
}
|
|
|
$source_responsible_person_id = [];
|
|
|
$source_responsible_person_name = $item[20];
|
|
|
- if ($source_responsible_person_name) {
|
|
|
- $source_responsible_person_name = explode(',', $source_responsible_person_name);
|
|
|
- foreach ($source_responsible_person_name as $k => $v) {
|
|
|
- $v = trim($v);
|
|
|
- if (isset($result[$v])) {
|
|
|
- $source_responsible_person_id[] = $result[$v]['id'];
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // if ($source_responsible_person_name) {
|
|
|
+ // $source_responsible_person_name = explode(',', $source_responsible_person_name);
|
|
|
+ // foreach ($source_responsible_person_name as $k => $v) {
|
|
|
+ // $v = trim($v);
|
|
|
+ // if (isset($result[$v])) {
|
|
|
+ // $source_responsible_person_id[] = $result[$v]['id'];
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
$province_name = $item[18];
|
|
|
//特殊地区1级移除市
|
|
|
if ($province_name && in_array($province_name, ['北京市', '天津市', '上海市', '重庆市'])) {
|
|
|
@@ -875,7 +874,7 @@ class ViolationProduct extends Controller
|
|
|
$city_name = $item[19];
|
|
|
if (!empty($city_name) && !isset($city_id_data[$city_name])) return json_send(['code' => 'error', 'msg' => "第{$key_num}行城市信息不完整", 'data' => $item]);
|
|
|
|
|
|
- $shipment_province_name = isset($item[22]) ? $item[22] : '';
|
|
|
+ $shipment_province_name = isset($item[21]) ? $item[21] : '';
|
|
|
//特殊地区1级移除市
|
|
|
if ($shipment_province_name && in_array($province_name, ['北京市', '天津市', '上海市', '重庆市'])) {
|
|
|
//移除市这个字符
|
|
|
@@ -913,7 +912,7 @@ class ViolationProduct extends Controller
|
|
|
$shipment_province_id = $province_id_data[$shipment_province_name]['id'];
|
|
|
}
|
|
|
$shipment_city_id = '0';
|
|
|
- $shipment_city_name = isset($item[23]) ? $item[23] : '';
|
|
|
+ $shipment_city_name = isset($item[22]) ? $item[22] : '';
|
|
|
if (!isset($city_id_data[$shipment_city_name])) {
|
|
|
$shipment_city_name = '';
|
|
|
} else {
|
|
|
@@ -957,7 +956,8 @@ class ViolationProduct extends Controller
|
|
|
$insert_product_data['status'] = 0; //状态0=有效=无效
|
|
|
$insert_product_data['insert_time'] = time();
|
|
|
$insert_product_data['source_id'] = 0; // 原始数据ID
|
|
|
- $insert_product_data['scrape_date'] = $item[21]; // 检索采集日期
|
|
|
+ $insert_product_data['scrape_date'] = date('Y-m-d',strtotime($item[20])); // 检索采集日期
|
|
|
+ $insert_product_data['collection_time'] = strtotime($item[20]); // 检索采集时间
|
|
|
$insert_product_data['shipment_province_id'] = $shipment_province_id; // 发货省份id
|
|
|
$insert_product_data['shipment_province_name'] = $shipment_province_name; // 发货省份
|
|
|
$insert_product_data['shipment_city_id'] = $shipment_city_id; // 发货城市id
|
|
|
@@ -1012,15 +1012,15 @@ class ViolationProduct extends Controller
|
|
|
// if (!$item[19]) {
|
|
|
// return ['code' => 'error', 'msg' => "第{$key}行城市不能为空", 'data' => $item];
|
|
|
// }
|
|
|
- if (!$item[21]) {
|
|
|
- return ['code' => 'error', 'msg' => "第{$key}行检索采集日期不能为空", 'data' => $item];
|
|
|
+ if (!$item[20]) {
|
|
|
+ return ['code' => 'error', 'msg' => "第{$key}行检索采集时间不能为空", 'data' => $item];
|
|
|
} else {
|
|
|
- //校验格式是否为Y-m-d
|
|
|
- if (!preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $item[21])) {
|
|
|
- return ['code' => 'error', 'msg' => "第{$key}行检索采集日期格式不正确", 'data' => $item];
|
|
|
+ //校验格式是否为Y-m-d H:i:s
|
|
|
+ if (!preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/', $item[20])) {
|
|
|
+ return ['code' => 'error', 'msg' => "第{$key}行检索采集时间格式不正确", 'data' => $item];
|
|
|
}
|
|
|
- if (strtotime($item[21] . ' 00:00:00') > time()) {
|
|
|
- return ['code' => 'error', 'msg' => "第{$key}行检索采集日期不能大于当前日期", 'data' => $item];
|
|
|
+ if (strtotime($item[20]) > time()) {
|
|
|
+ return ['code' => 'error', 'msg' => "第{$key}行检索采集时间不能大于当前时间", 'data' => $item];
|
|
|
}
|
|
|
}
|
|
|
}
|