|
|
@@ -82,9 +82,9 @@ class SubNoticeJobs implements ShouldQueue
|
|
|
$number3 = isset($this->user_data[$key]['violation_store_logids']) ? count($this->user_data[$key]['violation_store_logids']) : 0;
|
|
|
//统计总条数
|
|
|
$totle_number = $number1 + $number2 + $number3;
|
|
|
- $sms_config_data =[];
|
|
|
+ $sms_config_data = [];
|
|
|
if (trim($mobile) != '') {
|
|
|
- $sms_config_data =['parameter'=> ['totle_number' => $totle_number, 'number1' => $number1, 'number2' => $number2, 'number3' => $number3],'sms_tpl_id'=> $sms_tpl_id];
|
|
|
+ $sms_config_data = ['parameter' => ['totle_number' => $totle_number, 'number1' => $number1, 'number2' => $number2, 'number3' => $number3], 'sms_tpl_id' => $sms_tpl_id];
|
|
|
// $res_msg = Sms::sendContent($mobile, ['totle_number' => $totle_number, 'number1' => $number1, 'number2' => $number2, 'number3' => $number3], $sms_tpl_id);
|
|
|
// Log::info('job_send_sms', '订阅短信通知推送队列记录', ['email' => $mobile, 'sms_tpl_id' => $sms_tpl_id, 'msg' => $res_msg]);
|
|
|
}
|
|
|
@@ -94,17 +94,17 @@ class SubNoticeJobs implements ShouldQueue
|
|
|
if ($statistics_start_time_string == $statistics_end_time_string) {
|
|
|
$header_date = $statistics_start_time;
|
|
|
} else {
|
|
|
- $header_date = $statistics_start_time_string. '至'. $statistics_end_time_string;
|
|
|
+ $header_date = $statistics_start_time_string . '至' . $statistics_end_time_string;
|
|
|
}
|
|
|
- $email_title ='';
|
|
|
+ $email_title = '';
|
|
|
$email_content = '';
|
|
|
if (trim($email_to) != '') {
|
|
|
$email_title = '智价云违规数据通知提醒';
|
|
|
- $email_content = "智价云提醒:".$header_date."采集总数据共" . $totle_number . "条,其中低价挂网商品共" . $number1 . "条、禁止挂网商品共" . $number2 . "条、违规挂网店铺共" . $number3 . "条。";
|
|
|
+ $email_content = "智价云提醒:" . $header_date . "采集总数据共" . $totle_number . "条,其中低价挂网商品共" . $number1 . "条、禁止挂网商品共" . $number2 . "条、违规挂网店铺共" . $number3 . "条。";
|
|
|
// $res_msg = $EmailVerifyCode->sendSmtpEmail($email_to, $email_title, $email_content);
|
|
|
// Log::info('job_send_email', '订阅邮件通知推送队列记录', ['email' => $email_to, 'email_content' => $email_content, 'msg' => $res_msg]);
|
|
|
}
|
|
|
- $internal_notice_content = $header_date."采集总数据共" . $totle_number . "条,其中低价挂网商品共" . $number1 . "条、禁止挂网商品共" . $number2 . "条、违规挂网店铺共" . $number3 . "条。";
|
|
|
+ $internal_notice_content = $header_date . "采集总数据共" . $totle_number . "条,其中低价挂网商品共" . $number1 . "条、禁止挂网商品共" . $number2 . "条、违规挂网店铺共" . $number3 . "条。";
|
|
|
$ext_data = [
|
|
|
'company_id' => $company_id,
|
|
|
'lowprice_product_number' => $number1,
|
|
|
@@ -120,9 +120,9 @@ class SubNoticeJobs implements ShouldQueue
|
|
|
'internal_notice_content' => $internal_notice_content,
|
|
|
'email' => $email_to,
|
|
|
'mobile' => $mobile,
|
|
|
- 'email_content' => trim($email_to) != '' ? json_encode(['title' => $email_title, 'content' => $email_content]): '',
|
|
|
- 'mobile_content' => trim($mobile) != '' ? json_encode($sms_config_data): '',
|
|
|
- 'push_time' => strtotime(date('Y-m-d', time()) . ' '. $push_time.':00'),
|
|
|
+ 'email_content' => trim($email_to) != '' ? json_encode(['title' => $email_title, 'content' => $email_content]) : '',
|
|
|
+ 'mobile_content' => trim($mobile) != '' ? json_encode($sms_config_data) : '',
|
|
|
+ 'push_time' => strtotime(date('Y-m-d', time()) . ' ' . $push_time . ':00'),
|
|
|
'ext_data' => json_encode($ext_data),
|
|
|
'insert_time' => time(),
|
|
|
];
|
|
|
@@ -148,7 +148,7 @@ class SubNoticeJobs implements ShouldQueue
|
|
|
// $now_week = 1;//调试星期
|
|
|
$NoticeConfigModel = new NoticeConfigModel();
|
|
|
$data = $NoticeConfigModel->where(['company_id' => $company_id])->first();
|
|
|
- if (!$data) return ['now_week' => $now_week, 'statistics_day' => 0, 'statistics_start_time' => '', 'statistics_end_time' => '','push_time'=> '', 'notice_week_config' => ''];
|
|
|
+ if (!$data) return ['now_week' => $now_week, 'statistics_day' => 0, 'statistics_start_time' => '', 'statistics_end_time' => '', 'push_time' => '', 'notice_week_config' => ''];
|
|
|
|
|
|
//校验这个星期是否需要进行推送
|
|
|
$notice_week_config = json_decode($data->notice_week_config, true);
|
|
|
@@ -158,7 +158,7 @@ class SubNoticeJobs implements ShouldQueue
|
|
|
$is_open = 1;
|
|
|
}
|
|
|
if ($is_open == 0) {
|
|
|
- return ['now_week' => $now_week, 'statistics_day' => 0, 'statistics_start_time' => '', 'statistics_end_time' => '','push_time'=> '', 'notice_week_config' => $notice_week_config];
|
|
|
+ return ['now_week' => $now_week, 'statistics_day' => 0, 'statistics_start_time' => '', 'statistics_end_time' => '', 'push_time' => '', 'notice_week_config' => $notice_week_config];
|
|
|
}
|
|
|
//是否每天都推送
|
|
|
$is_day_day_push = 0;
|
|
|
@@ -221,13 +221,13 @@ class SubNoticeJobs implements ShouldQueue
|
|
|
}
|
|
|
}
|
|
|
if ($statistics_day < 1) {
|
|
|
- return ['now_week' => $now_week, 'statistics_day' => $statistics_day, 'statistics_start_time' => '', 'statistics_end_time' => '','push_time'=> '', 'notice_week_config' => $notice_week_config];
|
|
|
+ return ['now_week' => $now_week, 'statistics_day' => $statistics_day, 'statistics_start_time' => '', 'statistics_end_time' => '', 'push_time' => '', 'notice_week_config' => $notice_week_config];
|
|
|
}
|
|
|
//获取统计开始时间
|
|
|
$statistics_start_time = Carbon::today()->subDays($statistics_day)->startOfDay()->toDateTimeString();
|
|
|
//获取昨日结束时间
|
|
|
$statistics_end_time = Carbon::today()->subDays(1)->endOfDay()->toDateTimeString();
|
|
|
- return ['now_week' => $now_week, 'statistics_day' => $statistics_day, 'statistics_start_time' => $statistics_start_time, 'statistics_end_time' => $statistics_end_time,'push_time'=> $data->push_time, 'notice_week_config' => $notice_week_config];
|
|
|
+ return ['now_week' => $now_week, 'statistics_day' => $statistics_day, 'statistics_start_time' => $statistics_start_time, 'statistics_end_time' => $statistics_end_time, 'push_time' => $data->push_time, 'notice_week_config' => $notice_week_config];
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -256,7 +256,6 @@ class SubNoticeJobs implements ShouldQueue
|
|
|
->join('personnel_employee', 'process_lowprice_product_member.employee_id', '=', 'personnel_employee.id')
|
|
|
->where('personnel_employee.open_notice', 0)
|
|
|
->where('personnel_employee.company_id', $company_id)
|
|
|
- ->groupBy('lowprice_product_logid')
|
|
|
->select(['process_lowprice_product_member.*', 'personnel_employee.mobile', 'personnel_employee.email'])
|
|
|
->get()->toArray();
|
|
|
if (empty($usert_list)) return true;
|
|
|
@@ -268,8 +267,13 @@ class SubNoticeJobs implements ShouldQueue
|
|
|
$this->user_data[$user_id]['mobile'] = $value['mobile'];
|
|
|
$this->user_data[$user_id]['email'] = $value['email'];
|
|
|
$this->user_data[$user_id]['lowprice_product_logids'][] = $value['lowprice_product_logid'];
|
|
|
+ //去重
|
|
|
+ $lowprice_product_logids_list = $this->user_data[$user_id]['lowprice_product_logids'];
|
|
|
+ $this->user_data[$user_id]['lowprice_product_logids'] = array_unique($lowprice_product_logids_list);
|
|
|
} else {
|
|
|
$this->user_data[$user_id]['lowprice_product_logids'][] = $value['lowprice_product_logid'];
|
|
|
+ $lowprice_product_logids_list = $this->user_data[$user_id]['lowprice_product_logids'];
|
|
|
+ $this->user_data[$user_id]['lowprice_product_logids'] = array_unique($lowprice_product_logids_list);
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
@@ -296,7 +300,6 @@ class SubNoticeJobs implements ShouldQueue
|
|
|
->join('personnel_employee', 'process_violation_product_member.employee_id', '=', 'personnel_employee.id')
|
|
|
->where('personnel_employee.open_notice', 0)
|
|
|
->where('personnel_employee.company_id', $company_id)
|
|
|
- ->groupBy('violation_product_logid')
|
|
|
->select(['process_violation_product_member.*', 'personnel_employee.mobile', 'personnel_employee.email'])
|
|
|
->get()->toArray();
|
|
|
if (empty($usert_list)) return true;
|
|
|
@@ -308,8 +311,12 @@ class SubNoticeJobs implements ShouldQueue
|
|
|
$this->user_data[$user_id]['mobile'] = $value['mobile'];
|
|
|
$this->user_data[$user_id]['email'] = $value['email'];
|
|
|
$this->user_data[$user_id]['violation_product_logids'][] = $value['violation_product_logid'];
|
|
|
+ $iolation_product_logid_list = $this->user_data[$user_id]['lowprice_product_logids'];
|
|
|
+ $this->user_data[$user_id]['violation_product_logids'] = array_unique($iolation_product_logid_list);
|
|
|
} else {
|
|
|
$this->user_data[$user_id]['violation_product_logids'][] = $value['violation_product_logid'];
|
|
|
+ $iolation_product_logid_list = $this->user_data[$user_id]['violation_product_logids'];
|
|
|
+ $this->user_data[$user_id]['violation_product_logids'] = array_unique($iolation_product_logid_list);
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
@@ -336,31 +343,24 @@ class SubNoticeJobs implements ShouldQueue
|
|
|
->join('personnel_employee', 'process_violation_store_member.employee_id', '=', 'personnel_employee.id')
|
|
|
->where('personnel_employee.open_notice', 0)
|
|
|
->where('personnel_employee.company_id', $company_id)
|
|
|
- ->groupBy('violation_store_logid')
|
|
|
->select(['process_lowprice_product_member.*', 'personnel_employee.mobile', 'personnel_employee.email'])
|
|
|
->get()->toArray();
|
|
|
if (empty($usert_list)) return true;
|
|
|
//按用户统计待处理的商品数量
|
|
|
- foreach ($usert_list as $key => $value) {
|
|
|
- $user_id = $value['employee_id'];
|
|
|
- if (!isset($this->user_data[$user_id])) {
|
|
|
- $this->user_data[$user_id]['employee_id'] = $user_id;
|
|
|
- $this->user_data[$user_id]['mobile'] = $value['mobile'];
|
|
|
- $this->user_data[$user_id]['email'] = $value['email'];
|
|
|
- $this->user_data[$user_id]['log_ids'][] = $value['violation_store_logid'];
|
|
|
- } else {
|
|
|
- $this->user_data[$user_id]['log_ids'][] = $value['violation_store_logid'];
|
|
|
- }
|
|
|
- }
|
|
|
- //按用户统计待处理的商品数量
|
|
|
foreach ($usert_list as $key => $value) {
|
|
|
$user_id = $value['employee_id'];
|
|
|
if (!isset($this->user_data[$user_id])) {
|
|
|
$this->user_data[$user_id]['employee_id'] = $user_id;
|
|
|
$this->user_data[$user_id]['mobile'] = $value['mobile'];
|
|
|
$this->user_data[$user_id]['violation_store_logids'][] = $value['violation_store_logid'];
|
|
|
+ //去重
|
|
|
+ $violation_store_logids_list = $this->user_data[$user_id]['violation_store_logids'];
|
|
|
+ $this->user_data[$user_id]['violation_store_logids'] = array_unique($violation_store_logids_list);
|
|
|
} else {
|
|
|
+ //去重
|
|
|
$this->user_data[$user_id]['violation_store_logids'][] = $value['violation_store_logid'];
|
|
|
+ $violation_store_logids_list = $this->user_data[$user_id]['violation_store_logids'];
|
|
|
+ $this->user_data[$user_id]['violation_store_logids'] = array_unique($violation_store_logids_list);
|
|
|
}
|
|
|
}
|
|
|
return true;
|