|
@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\DB;
|
|
|
use App\Models\Manager\Process\ViolationProductMember as ViolationProductMemberModel;
|
|
use App\Models\Manager\Process\ViolationProductMember as ViolationProductMemberModel;
|
|
|
use App\Facades\Servers\Logs\Log;
|
|
use App\Facades\Servers\Logs\Log;
|
|
|
use App\Models\Manager\Process\Notices as NoticesModel;
|
|
use App\Models\Manager\Process\Notices as NoticesModel;
|
|
|
|
|
+use App\Models\Manager\Personnel\Employee as EmployeeModel;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 违规处理-违规商品模型
|
|
* 违规处理-违规商品模型
|
|
@@ -193,12 +194,16 @@ class ViolationProduct extends Model
|
|
|
{
|
|
{
|
|
|
//添加通知
|
|
//添加通知
|
|
|
$NoticesModel = new NoticesModel();
|
|
$NoticesModel = new NoticesModel();
|
|
|
|
|
+ $EmployeeModel = new EmployeeModel();
|
|
|
$notices_data = [];
|
|
$notices_data = [];
|
|
|
if ($low_price_data['first_responsible_person'] != '' && $low_price_data['responsible_person'] != '') {
|
|
if ($low_price_data['first_responsible_person'] != '' && $low_price_data['responsible_person'] != '') {
|
|
|
//合并数据并去重
|
|
//合并数据并去重
|
|
|
$first_responsible_persons = array_unique(explode(',', $low_price_data['first_responsible_person']));
|
|
$first_responsible_persons = array_unique(explode(',', $low_price_data['first_responsible_person']));
|
|
|
$responsible_persons = array_unique(explode(',', $low_price_data['responsible_person']));
|
|
$responsible_persons = array_unique(explode(',', $low_price_data['responsible_person']));
|
|
|
$all_persons = array_merge($first_responsible_persons, $responsible_persons);
|
|
$all_persons = array_merge($first_responsible_persons, $responsible_persons);
|
|
|
|
|
+ //查询已已经开启通知设置的用户
|
|
|
|
|
+ // $employee_ids = $EmployeeModel->whereIn('id', $all_persons)->where('open_notice', 0)->pluck('id')->toArray();
|
|
|
|
|
+ // if (count($employee_ids) == 0) return true;
|
|
|
foreach ($all_persons as $key => $employee_id) {
|
|
foreach ($all_persons as $key => $employee_id) {
|
|
|
if ($employee_id == '' || is_null($employee_id)) continue;
|
|
if ($employee_id == '' || is_null($employee_id)) continue;
|
|
|
$notices_data[] = [
|
|
$notices_data[] = [
|
|
@@ -213,6 +218,9 @@ class ViolationProduct extends Model
|
|
|
$NoticesModel->insert($notices_data);
|
|
$NoticesModel->insert($notices_data);
|
|
|
} else if ($low_price_data['first_responsible_person'] != '') {
|
|
} else if ($low_price_data['first_responsible_person'] != '') {
|
|
|
$first_responsible_persons = array_unique(explode(',', $low_price_data['first_responsible_person']));
|
|
$first_responsible_persons = array_unique(explode(',', $low_price_data['first_responsible_person']));
|
|
|
|
|
+ //查询已已经开启通知设置的用户
|
|
|
|
|
+ // $employee_ids = $EmployeeModel->whereIn('id', $first_responsible_persons)->where('open_notice', 0)->pluck('id')->toArray();
|
|
|
|
|
+ // if (count($employee_ids) == 0) return true;
|
|
|
foreach ($first_responsible_persons as $key => $employee_id) {
|
|
foreach ($first_responsible_persons as $key => $employee_id) {
|
|
|
if ($employee_id == '' || is_null($employee_id)) continue;
|
|
if ($employee_id == '' || is_null($employee_id)) continue;
|
|
|
$notices_data[] = [
|
|
$notices_data[] = [
|
|
@@ -227,6 +235,9 @@ class ViolationProduct extends Model
|
|
|
$NoticesModel->insert($notices_data);
|
|
$NoticesModel->insert($notices_data);
|
|
|
} else if ($low_price_data['responsible_person'] != '') {
|
|
} else if ($low_price_data['responsible_person'] != '') {
|
|
|
$responsible_persons = array_unique(explode(',', $low_price_data['responsible_person']));
|
|
$responsible_persons = array_unique(explode(',', $low_price_data['responsible_person']));
|
|
|
|
|
+ //查询已已经开启通知设置的用户
|
|
|
|
|
+ // $employee_ids = $EmployeeModel->whereIn('id', $responsible_persons)->where('open_notice', 0)->pluck('id')->toArray();
|
|
|
|
|
+ // if (count($employee_ids) == 0) return true;
|
|
|
foreach ($responsible_persons as $key => $employee_id) {
|
|
foreach ($responsible_persons as $key => $employee_id) {
|
|
|
if ($employee_id == '' || is_null($employee_id)) continue;
|
|
if ($employee_id == '' || is_null($employee_id)) continue;
|
|
|
$notices_data[] = [
|
|
$notices_data[] = [
|