|
@@ -172,12 +172,12 @@ class ViolationProduct extends Controller
|
|
|
$city_ids = explode(',', $city_ids);
|
|
$city_ids = explode(',', $city_ids);
|
|
|
$ViolationProductModel = $ViolationProductModel->whereIn('city_id', $city_ids);
|
|
$ViolationProductModel = $ViolationProductModel->whereIn('city_id', $city_ids);
|
|
|
}
|
|
}
|
|
|
- //多选发货省份
|
|
|
|
|
|
|
+ //多选店铺省
|
|
|
if ($shipment_province_ids && is_string($shipment_province_ids)) {
|
|
if ($shipment_province_ids && is_string($shipment_province_ids)) {
|
|
|
$shipment_province_ids = explode(',', $shipment_province_ids);
|
|
$shipment_province_ids = explode(',', $shipment_province_ids);
|
|
|
$ViolationProductModel = $ViolationProductModel->whereIn('shipment_province_id', $shipment_province_ids);
|
|
$ViolationProductModel = $ViolationProductModel->whereIn('shipment_province_id', $shipment_province_ids);
|
|
|
}
|
|
}
|
|
|
- //多选发货城市
|
|
|
|
|
|
|
+ //多选店铺市
|
|
|
if ($shipment_city_ids && is_string($shipment_city_ids)) {
|
|
if ($shipment_city_ids && is_string($shipment_city_ids)) {
|
|
|
$shipment_city_ids = explode(',', $shipment_city_ids);
|
|
$shipment_city_ids = explode(',', $shipment_city_ids);
|
|
|
$ViolationProductModel = $ViolationProductModel->whereIn('shipment_city_id', $shipment_city_ids);
|
|
$ViolationProductModel = $ViolationProductModel->whereIn('shipment_city_id', $shipment_city_ids);
|
|
@@ -409,12 +409,12 @@ class ViolationProduct extends Controller
|
|
|
$city_ids = explode(',', $city_ids);
|
|
$city_ids = explode(',', $city_ids);
|
|
|
$ViolationProductModel = $ViolationProductModel->whereIn('city_id', $city_ids);
|
|
$ViolationProductModel = $ViolationProductModel->whereIn('city_id', $city_ids);
|
|
|
}
|
|
}
|
|
|
- //多选发货省份
|
|
|
|
|
|
|
+ //多选店铺省
|
|
|
if ($shipment_province_ids && is_string($shipment_province_ids)) {
|
|
if ($shipment_province_ids && is_string($shipment_province_ids)) {
|
|
|
$shipment_province_ids = explode(',', $shipment_province_ids);
|
|
$shipment_province_ids = explode(',', $shipment_province_ids);
|
|
|
$ViolationProductModel = $ViolationProductModel->whereIn('shipment_province_id', $shipment_province_ids);
|
|
$ViolationProductModel = $ViolationProductModel->whereIn('shipment_province_id', $shipment_province_ids);
|
|
|
}
|
|
}
|
|
|
- //多选发货城市
|
|
|
|
|
|
|
+ //多选店铺市
|
|
|
if ($shipment_city_ids && is_string($shipment_city_ids)) {
|
|
if ($shipment_city_ids && is_string($shipment_city_ids)) {
|
|
|
$shipment_city_ids = explode(',', $shipment_city_ids);
|
|
$shipment_city_ids = explode(',', $shipment_city_ids);
|
|
|
$ViolationProductModel = $ViolationProductModel->whereIn('shipment_city_id', $shipment_city_ids);
|
|
$ViolationProductModel = $ViolationProductModel->whereIn('shipment_city_id', $shipment_city_ids);
|
|
@@ -721,7 +721,7 @@ class ViolationProduct extends Controller
|
|
|
$sheet = $spreadsheet->getActiveSheet();
|
|
$sheet = $spreadsheet->getActiveSheet();
|
|
|
|
|
|
|
|
//合并单元格
|
|
//合并单元格
|
|
|
- $sheet->mergeCells('A1:P1');
|
|
|
|
|
|
|
+ $sheet->mergeCells('A1:W1');
|
|
|
$sheet->setCellValue('A1', '禁止挂网商品导入模板'); // 设置合并后的单元格内容
|
|
$sheet->setCellValue('A1', '禁止挂网商品导入模板'); // 设置合并后的单元格内容
|
|
|
// 获取合并后的单元格样式对象
|
|
// 获取合并后的单元格样式对象
|
|
|
$style = $sheet->getStyle('A1');
|
|
$style = $sheet->getStyle('A1');
|
|
@@ -750,9 +750,9 @@ class ViolationProduct extends Controller
|
|
|
$sheet->setCellValue('R2', '信用代码');
|
|
$sheet->setCellValue('R2', '信用代码');
|
|
|
$sheet->setCellValue('S2', '公司省');
|
|
$sheet->setCellValue('S2', '公司省');
|
|
|
$sheet->setCellValue('T2', '公司市');
|
|
$sheet->setCellValue('T2', '公司市');
|
|
|
- $sheet->setCellValue('U2', '检索采集时间(Y-m-d H:i:s)*');
|
|
|
|
|
- $sheet->setCellValue('V2', '店铺省');
|
|
|
|
|
- $sheet->setCellValue('W2', '店铺市');
|
|
|
|
|
|
|
+ $sheet->setCellValue('U2', '店铺省');
|
|
|
|
|
+ $sheet->setCellValue('V2', '店铺市');
|
|
|
|
|
+ $sheet->setCellValue('W2', '检索采集时间(Y-m-d H:i:s)*');
|
|
|
// 生成 Excel 文件
|
|
// 生成 Excel 文件
|
|
|
$writer = new Xlsx($spreadsheet);
|
|
$writer = new Xlsx($spreadsheet);
|
|
|
|
|
|
|
@@ -876,7 +876,7 @@ class ViolationProduct extends Controller
|
|
|
$city_name = $item[19];
|
|
$city_name = $item[19];
|
|
|
if (!empty($city_name) && !isset($city_id_data[$city_name])) return json_send(['code' => 'error', 'msg' => "第{$key_num}行城市信息不完整", 'data' => $item]);
|
|
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[21]) ? $item[21] : '';
|
|
|
|
|
|
|
+ $shipment_province_name = isset($item[20]) ? $item[20] : '';
|
|
|
//特殊地区1级移除市
|
|
//特殊地区1级移除市
|
|
|
if ($shipment_province_name && in_array($province_name, ['北京市', '天津市', '上海市', '重庆市'])) {
|
|
if ($shipment_province_name && in_array($province_name, ['北京市', '天津市', '上海市', '重庆市'])) {
|
|
|
//移除市这个字符
|
|
//移除市这个字符
|
|
@@ -914,7 +914,7 @@ class ViolationProduct extends Controller
|
|
|
$shipment_province_id = $province_id_data[$shipment_province_name]['id'];
|
|
$shipment_province_id = $province_id_data[$shipment_province_name]['id'];
|
|
|
}
|
|
}
|
|
|
$shipment_city_id = '0';
|
|
$shipment_city_id = '0';
|
|
|
- $shipment_city_name = isset($item[22]) ? $item[22] : '';
|
|
|
|
|
|
|
+ $shipment_city_name = isset($item[21]) ? $item[21] : '';
|
|
|
if (!isset($city_id_data[$shipment_city_name])) {
|
|
if (!isset($city_id_data[$shipment_city_name])) {
|
|
|
$shipment_city_name = '';
|
|
$shipment_city_name = '';
|
|
|
} else {
|
|
} else {
|
|
@@ -958,12 +958,12 @@ class ViolationProduct extends Controller
|
|
|
$insert_product_data['status'] = 0; //状态0=有效=无效
|
|
$insert_product_data['status'] = 0; //状态0=有效=无效
|
|
|
$insert_product_data['insert_time'] = time();
|
|
$insert_product_data['insert_time'] = time();
|
|
|
$insert_product_data['source_id'] = 0; // 原始数据ID
|
|
$insert_product_data['source_id'] = 0; // 原始数据ID
|
|
|
- $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
|
|
|
|
|
- $insert_product_data['shipment_city_name'] = $shipment_city_name; // 发货城市
|
|
|
|
|
|
|
+ $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
|
|
|
|
|
+ $insert_product_data['shipment_city_name'] = $shipment_city_name; // 店铺市
|
|
|
|
|
+ $insert_product_data['scrape_date'] = date('Y-m-d',strtotime($item[22])); // 检索采集日期
|
|
|
|
|
+ $insert_product_data['collection_time'] = strtotime($item[22]); // 检索采集时间
|
|
|
//插入数据
|
|
//插入数据
|
|
|
$ViolationProductModel->addViolationProduct($insert_product_data, true);
|
|
$ViolationProductModel->addViolationProduct($insert_product_data, true);
|
|
|
}
|
|
}
|
|
@@ -1014,14 +1014,14 @@ class ViolationProduct extends Controller
|
|
|
// if (!$item[19]) {
|
|
// if (!$item[19]) {
|
|
|
// return ['code' => 'error', 'msg' => "第{$key}行城市不能为空", 'data' => $item];
|
|
// return ['code' => 'error', 'msg' => "第{$key}行城市不能为空", 'data' => $item];
|
|
|
// }
|
|
// }
|
|
|
- if (!$item[20]) {
|
|
|
|
|
|
|
+ if (!$item[22]) {
|
|
|
return ['code' => 'error', 'msg' => "第{$key}行检索采集时间不能为空", 'data' => $item];
|
|
return ['code' => 'error', 'msg' => "第{$key}行检索采集时间不能为空", 'data' => $item];
|
|
|
} else {
|
|
} else {
|
|
|
//校验格式是否为Y-m-d H:i:s
|
|
//校验格式是否为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])) {
|
|
|
|
|
|
|
+ if (!preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/', $item[22])) {
|
|
|
return ['code' => 'error', 'msg' => "第{$key}行检索采集时间格式不正确", 'data' => $item];
|
|
return ['code' => 'error', 'msg' => "第{$key}行检索采集时间格式不正确", 'data' => $item];
|
|
|
}
|
|
}
|
|
|
- if (strtotime($item[20]) > time()) {
|
|
|
|
|
|
|
+ if (strtotime($item[22]) > time()) {
|
|
|
return ['code' => 'error', 'msg' => "第{$key}行检索采集时间不能大于当前时间", 'data' => $item];
|
|
return ['code' => 'error', 'msg' => "第{$key}行检索采集时间不能大于当前时间", 'data' => $item];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|