|
|
@@ -84,7 +84,7 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
$specify_responsible_person = $message_data['specify_responsible_person']; //指派责任人 0=开启 1=关闭
|
|
|
$limit = isset($message_data['limit']) ? $message_data['limit'] : 50;
|
|
|
$page = isset($message_data['page']) ? $message_data['page'] : 1;
|
|
|
- $company_id = isset($message_data['company_id']) ? $message_data['company_id'] : 0;//品牌方公司ID
|
|
|
+ $company_id = isset($message_data['company_id']) ? $message_data['company_id'] : 0; //品牌方公司ID
|
|
|
$product_brand = $message_data['product_brand']; //商品品牌名称
|
|
|
$product_keywords = $message_data['product_keyword']; //关键字
|
|
|
$item_totle_page = $message_data['item_totle_page']; //清洗商品总页数
|
|
|
@@ -103,8 +103,8 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
$where[] = ['scrape_date', '>=', $yesterdayStart];
|
|
|
$where[] = ['scrape_date', '<=', $yesterdayEnd];
|
|
|
$where[] = ['product_name', 'like', '%' . $product_name . '%'];
|
|
|
- if($enable_full_quantity == 1) $where[] = ['product_specs', 'like', '%' . $product_specs . '%']; //如果不是全量清洗,则查询规格
|
|
|
-
|
|
|
+ if ($enable_full_quantity == 1) $where[] = ['product_specs', 'like', '%' . $product_specs . '%']; //如果不是全量清洗,则查询规格
|
|
|
+
|
|
|
// if ($product_brand) $where[] = ['product_name', 'like', '%' . $product_brand . '%'];
|
|
|
if ($product_brand) $where[] = ['product_brand', 'like', '%' . $category_name . '%'];
|
|
|
if (!empty($product_keyword)) {
|
|
|
@@ -125,7 +125,7 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
$product_datas = $product_data_info['data'];
|
|
|
if (empty($product_datas)) {
|
|
|
if ($executeLog_id && $item_now_page >= $item_totle_page) {
|
|
|
- (new ExecuteLogModel())->where('id', $executeLog_id)->update(['status' => 0,'update_time' => time()]);
|
|
|
+ (new ExecuteLogModel())->where('id', $executeLog_id)->update(['status' => 0, 'update_time' => time()]);
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
@@ -166,13 +166,13 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
// $city_name_value = $CitysModel->where([['id', '=', $product_data['city_id']], ['level', '=', '2']])->value('name');
|
|
|
// $city_name = !empty($city_name_value) ? $city_name_value : '';
|
|
|
// }
|
|
|
- if(trim($product_data['link_url']) == '') continue;
|
|
|
+ if (trim($product_data['link_url']) == '') continue;
|
|
|
$insert_product_data = [
|
|
|
'company_id' => $company_id,
|
|
|
'source_id' => $product_data['id'],
|
|
|
'platform' => $product_data['platform_id'],
|
|
|
'company_name' => $product_data['company_name'],
|
|
|
- 'product_brand' => $product_brand !='' ? $product_brand : $product_data['product_brand'],
|
|
|
+ 'product_brand' => $product_brand != '' ? $product_brand : $product_data['product_brand'],
|
|
|
'product_name' => $product_name,
|
|
|
'product_specs' => $product_specs,
|
|
|
'inventory' => $product_data['inventory'] ? $product_data['inventory'] : '',
|
|
|
@@ -212,7 +212,7 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
$insert_product_data['company_category_name'] = $company_data->category_name ? $company_data->category_name : '';
|
|
|
}
|
|
|
//获取指定人员信息
|
|
|
- if ($specify_responsible_person == 0) {
|
|
|
+ if ($specify_responsible_person == 0) {
|
|
|
$where_query1 = [];
|
|
|
$where_query2 = [];
|
|
|
$where_query3 = [];
|
|
|
@@ -240,29 +240,33 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
$where_query3[] = ['duty_type', '=', 1]; //责任类型1=第一责任人,2=责任人
|
|
|
}
|
|
|
//并行查询第一责任人
|
|
|
- $EmployeeModel = $EmployeeModel->where(function ($q) use ($employee_id_list, $company_id) {
|
|
|
- if (!empty($employee_id_list)) {
|
|
|
- $q->where('company_id', $company_id)
|
|
|
- ->orWhereIn('id', $employee_id_list)
|
|
|
- ->where('status', 0);
|
|
|
- }
|
|
|
- })->orWhere(function ($q) use ($employee_id_area, $company_id) {
|
|
|
- if (!empty($employee_id_area)) {
|
|
|
- $q->where('company_id', $company_id)
|
|
|
- ->whereIn('id', $employee_id_area)
|
|
|
- ->where('status', 0);
|
|
|
- }
|
|
|
- })->orWhere(function ($q) use ($employee_id_platform, $company_id) {
|
|
|
- if (!empty($employee_id_platform)) {
|
|
|
- $q->where('company_id', $company_id)
|
|
|
- ->whereIn('id', $employee_id_platform)
|
|
|
- ->where('status', 0);
|
|
|
- }
|
|
|
- });
|
|
|
- $first_responsible_person = $EmployeeModel->where('duty_type', 1)->pluck('id')->implode(',');
|
|
|
+ $EmployeeModel = $EmployeeModel
|
|
|
+ ->orWhere(function ($q) use ($employee_id_list, $company_id) {
|
|
|
+ if (!empty($employee_id_list)) {
|
|
|
+ $q->where('company_id', $company_id)
|
|
|
+ ->orWhereIn('id', $employee_id_list)
|
|
|
+ ->where('duty_type', 1)
|
|
|
+ ->where('status', 0);
|
|
|
+ }
|
|
|
+ })->orWhere(function ($q) use ($employee_id_area, $company_id) {
|
|
|
+ if (!empty($employee_id_area)) {
|
|
|
+ $q->where('company_id', $company_id)
|
|
|
+ ->whereIn('id', $employee_id_area)
|
|
|
+ ->where('duty_type', 1)
|
|
|
+ ->where('status', 0);
|
|
|
+ }
|
|
|
+ })->orWhere(function ($q) use ($employee_id_platform, $company_id) {
|
|
|
+ if (!empty($employee_id_platform)) {
|
|
|
+ $q->where('company_id', $company_id)
|
|
|
+ ->whereIn('id', $employee_id_platform)
|
|
|
+ ->where('duty_type', 1)
|
|
|
+ ->where('status', 0);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $first_responsible_person = $EmployeeModel->pluck('id')->implode(',');
|
|
|
|
|
|
//当以上规则匹配不到责任人时,则去查询发货地区信息关联责任人
|
|
|
- if (trim($first_responsible_person) == '' && trim($product_data['shipment_city_id']) !='') {
|
|
|
+ if (trim($first_responsible_person) == '' && trim($product_data['shipment_city_id']) != '') {
|
|
|
$employee_id_area = $EmployeeAreaModel->where('city_id', $product_data['city_id'])->pluck('employee_id')->toarray();
|
|
|
if (!empty($employee_id_area)) {
|
|
|
$where_city[] = ['company_id', '=', $company_id];
|
|
|
@@ -304,29 +308,33 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
}
|
|
|
//并行查询责任人
|
|
|
$EmployeeModel = new EmployeeModel();
|
|
|
- $EmployeeModel = $EmployeeModel->where(function ($q) use ($employee_id_list, $company_id) {
|
|
|
- if (!empty($employee_id_list)) {
|
|
|
- $q->where('company_id', $company_id)
|
|
|
- ->orWhereIn('id', $employee_id_list)
|
|
|
- ->where('status', 0);
|
|
|
- }
|
|
|
- })->orWhere(function ($q) use ($employee_id_area, $company_id) {
|
|
|
- if (!empty($employee_id_area)) {
|
|
|
- $q->where('company_id', $company_id)
|
|
|
- ->whereIn('id', $employee_id_area)
|
|
|
- ->where('status', 0);
|
|
|
- }
|
|
|
- })->orWhere(function ($q) use ($employee_id_platform, $company_id) {
|
|
|
- if (!empty($employee_id_platform)) {
|
|
|
- $q->where('company_id', $company_id)
|
|
|
- ->whereIn('id', $employee_id_platform)
|
|
|
- ->where('status', 0);
|
|
|
- }
|
|
|
- });
|
|
|
- $responsible_person = $EmployeeModel->where('duty_type', 2)->pluck('id')->implode(',');
|
|
|
+ $EmployeeModel = $EmployeeModel
|
|
|
+ ->orWhere(function ($q) use ($employee_id_list, $company_id) {
|
|
|
+ if (!empty($employee_id_list)) {
|
|
|
+ $q->where('company_id', $company_id)
|
|
|
+ ->orWhereIn('id', $employee_id_list)
|
|
|
+ ->where('duty_type', 2)
|
|
|
+ ->where('status', 0);
|
|
|
+ }
|
|
|
+ })->orWhere(function ($q) use ($employee_id_area, $company_id) {
|
|
|
+ if (!empty($employee_id_area)) {
|
|
|
+ $q->where('company_id', $company_id)
|
|
|
+ ->whereIn('id', $employee_id_area)
|
|
|
+ ->where('duty_type', 2)
|
|
|
+ ->where('status', 0);
|
|
|
+ }
|
|
|
+ })->orWhere(function ($q) use ($employee_id_platform, $company_id) {
|
|
|
+ if (!empty($employee_id_platform)) {
|
|
|
+ $q->where('company_id', $company_id)
|
|
|
+ ->whereIn('id', $employee_id_platform)
|
|
|
+ ->where('duty_type', 2)
|
|
|
+ ->where('status', 0);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $responsible_person = $EmployeeModel->pluck('id')->implode(',');
|
|
|
|
|
|
//当以上规则匹配不到责任人时,则去查询发货地区信息关联责任人
|
|
|
- if (trim($responsible_person) == '' && trim($product_data['shipment_city_id']) !='') {
|
|
|
+ if (trim($responsible_person) == '' && trim($product_data['shipment_city_id']) != '') {
|
|
|
$employee_id_area = $EmployeeAreaModel->where('city_id', $product_data['city_id'])->pluck('employee_id')->toarray();
|
|
|
if (!empty($employee_id_area)) {
|
|
|
$where_city[] = ['company_id', '=', $company_id];
|
|
|
@@ -346,7 +354,7 @@ class ViolationProductDataJobs implements ShouldQueue
|
|
|
$first_responsible_person = explode(',', $first_responsible_person);
|
|
|
$responsible_person = explode(',', $responsible_person);
|
|
|
$source_responsible_person = array_unique(array_merge($first_responsible_person, $responsible_person));
|
|
|
- $source_responsible_person = ','.implode(',', $source_responsible_person).',';
|
|
|
+ $source_responsible_person = ',' . implode(',', $source_responsible_person) . ',';
|
|
|
} else if ($first_responsible_person) {
|
|
|
$source_responsible_person = $first_responsible_person;
|
|
|
} else if ($responsible_person) {
|