Przeglądaj źródła

[智价云] 增加违规处理通知推送

tangyuanwang 13 godzin temu
rodzic
commit
9ff89b285c

+ 65 - 0
app/Models/Manager/Process/LowPriceGoods.php

@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Support\Facades\DB;
 use App\Models\Manager\Process\LowPriceGoodsMember as LowPriceGoodsMemberModel;
 use App\Facades\Servers\Logs\Log;
+use App\Models\manager\Process\Notices as NoticesModel;
 
 /**
  * 违规处理-低价商品模型
@@ -173,6 +174,8 @@ class LowPriceGoods extends Model
                 }
             }
             $LowPriceGoodsMemberModel->insert($source_responsible_person_data);
+            //添加通知
+            $this->addNotices($insert_data, $LowPriceGoods_id);
             DB::commit();
             return true;
             // 成功处理...
@@ -185,6 +188,68 @@ class LowPriceGoods extends Model
     }
 
 
+    /**
+     * 处理通知消息
+     * @author 唐远望
+     * @version 1.0
+     * @date 2026-03-21
+     * @param $data
+     * @return bool
+     */
+    public function addNotices($low_price_data, $data_logid)
+    {
+        //添加通知
+        $NoticesModel = new NoticesModel();
+        $notices_data = [];
+        if ($low_price_data['first_responsible_person'] != '' &&  $low_price_data['responsible_person'] != '') {
+            //合并数据并去重
+            $first_responsible_persons = array_unique(explode(',', $low_price_data['first_responsible_person']));
+            $responsible_persons = array_unique(explode(',', $low_price_data['responsible_person']));
+            $all_persons = array_merge($first_responsible_persons, $responsible_persons);
+            foreach ($all_persons as $key => $employee_id) {
+                $notices_data[] = [
+                    'company_id' => $low_price_data['company_id'],
+                    'custom_uid' => $employee_id,
+                    'title' => '您有一条新的低价商品待处理,请及时查看。',
+                    'content_type' => '1', //内容类型1=低价挂网2=禁止挂网3=违规店铺
+                    'data_logid' => $data_logid,
+                    'insert_time' => time()
+                ];
+            }
+            $NoticesModel->insert($notices_data);
+        } else if ($low_price_data['first_responsible_person'] != '') {
+            $first_responsible_persons = array_unique(explode(',', $low_price_data['first_responsible_person']));
+            foreach ($first_responsible_persons as $key => $employee_id) {
+                $notices_data[] = [
+                    'company_id' => $low_price_data['company_id'],
+                    'custom_uid' => $employee_id,
+                    'title' => '您有一条新的低价商品待处理,请及时查看。',
+                    'content_type' => '1', //内容类型1=低价挂网2=禁止挂网3=违规店铺
+                    'data_logid' => $data_logid,
+                    'insert_time' => time()
+                ];
+            }
+            $NoticesModel->insert($notices_data);
+        } else if ($low_price_data['responsible_person'] != '') {
+            $responsible_persons = array_unique(explode(',', $low_price_data['responsible_person']));
+            foreach ($responsible_persons as $key => $employee_id) {
+                $notices_data[] = [
+                    'company_id' => $low_price_data['company_id'],
+                    'custom_uid' => $employee_id,
+                    'title' => '您有一条新的低价商品待处理,请及时查看。',
+                    'content_type' => '1', //内容类型1=低价挂网2=禁止挂网3=违规店铺
+                    'data_logid' => $data_logid,
+                    'insert_time' => time()
+                ];
+            }
+            $NoticesModel->insert($notices_data);
+        }
+        return true;
+    }
+
+
+
+
     /**
      * 编辑内容
      * @author 唐远望

+ 63 - 0
app/Models/Manager/Process/ViolationProduct.php

@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Support\Facades\DB;
 use App\Models\Manager\Process\ViolationProductMember as ViolationProductMemberModel;
 use App\Facades\Servers\Logs\Log;
+use App\Models\manager\Process\Notices as NoticesModel;
 
 /**
  * 违规处理-违规商品模型
@@ -166,6 +167,8 @@ class ViolationProduct extends Model
                 }
             }
             $ViolationProductMemberModel->insert($source_responsible_person_data);
+            //添加通知
+            $this->addNotices($insert_data, $ViolationProduct_id);
             DB::commit();
             return true;
             // 成功处理...
@@ -178,6 +181,66 @@ class ViolationProduct extends Model
     }
 
 
+    /**
+     * 处理通知消息
+     * @author 唐远望
+     * @version 1.0
+     * @date 2026-03-21
+     * @param $data
+     * @return bool
+     */
+    public function addNotices($low_price_data, $data_logid)
+    {
+        //添加通知
+        $NoticesModel = new NoticesModel();
+        $notices_data = [];
+        if ($low_price_data['first_responsible_person'] != '' &&  $low_price_data['responsible_person'] != '') {
+            //合并数据并去重
+            $first_responsible_persons = array_unique(explode(',', $low_price_data['first_responsible_person']));
+            $responsible_persons = array_unique(explode(',', $low_price_data['responsible_person']));
+            $all_persons = array_merge($first_responsible_persons, $responsible_persons);
+            foreach ($all_persons as $key => $employee_id) {
+                $notices_data[] = [
+                    'company_id' => $low_price_data['company_id'],
+                    'custom_uid' => $employee_id,
+                    'title' => '您有一条新的低价商品待处理,请及时查看。',
+                    'content_type' => '1', //内容类型1=低价挂网2=禁止挂网3=违规店铺
+                    'data_logid' => $data_logid,
+                    'insert_time' => time()
+                ];
+            }
+            $NoticesModel->insert($notices_data);
+        } else if ($low_price_data['first_responsible_person'] != '') {
+            $first_responsible_persons = array_unique(explode(',', $low_price_data['first_responsible_person']));
+            foreach ($first_responsible_persons as $key => $employee_id) {
+                $notices_data[] = [
+                    'company_id' => $low_price_data['company_id'],
+                    'custom_uid' => $employee_id,
+                    'title' => '您有一条新的低价商品待处理,请及时查看。',
+                    'content_type' => '1', //内容类型1=低价挂网2=禁止挂网3=违规店铺
+                    'data_logid' => $data_logid,
+                    'insert_time' => time()
+                ];
+            }
+            $NoticesModel->insert($notices_data);
+        } else if ($low_price_data['responsible_person'] != '') {
+            $responsible_persons = array_unique(explode(',', $low_price_data['responsible_person']));
+            foreach ($responsible_persons as $key => $employee_id) {
+                $notices_data[] = [
+                    'company_id' => $low_price_data['company_id'],
+                    'custom_uid' => $employee_id,
+                    'title' => '您有一条新的低价商品待处理,请及时查看。',
+                    'content_type' => '1', //内容类型1=低价挂网2=禁止挂网3=违规店铺
+                    'data_logid' => $data_logid,
+                    'insert_time' => time()
+                ];
+            }
+            $NoticesModel->insert($notices_data);
+        }
+        return true;
+    }
+
+
     /**
      * 编辑内容
      * @author 唐远望

+ 63 - 0
app/Models/Manager/Process/ViolationStore.php

@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Support\Facades\DB;
 use App\Models\Manager\Process\ViolationStoreMember as ViolationStoreMemberModel;
 use App\Facades\Servers\Logs\Log;
+use App\Models\manager\Process\Notices as NoticesModel;
 
 /**
  * 违规处理-违规店铺模型
@@ -138,6 +139,8 @@ class ViolationStore extends Model
                 }
             }
             $ViolationStoreMemberModel->insert($source_responsible_person_data);
+            //添加通知
+            $this->addNotices($insert_data, $ViolationStore_id);
             DB::commit();
             return true;
             // 成功处理...
@@ -150,6 +153,66 @@ class ViolationStore extends Model
     }
 
 
+    /**
+     * 处理通知消息
+     * @author 唐远望
+     * @version 1.0
+     * @date 2026-03-21
+     * @param $data
+     * @return bool
+     */
+    public function addNotices($low_price_data, $data_logid)
+    {
+        //添加通知
+        $NoticesModel = new NoticesModel();
+        $notices_data = [];
+        if ($low_price_data['first_responsible_person'] != '' &&  $low_price_data['responsible_person'] != '') {
+            //合并数据并去重
+            $first_responsible_persons = array_unique(explode(',', $low_price_data['first_responsible_person']));
+            $responsible_persons = array_unique(explode(',', $low_price_data['responsible_person']));
+            $all_persons = array_merge($first_responsible_persons, $responsible_persons);
+            foreach ($all_persons as $key => $employee_id) {
+                $notices_data[] = [
+                    'company_id' => $low_price_data['company_id'],
+                    'custom_uid' => $employee_id,
+                    'title' => '您有一条新的低价商品待处理,请及时查看。',
+                    'content_type' => '1', //内容类型1=低价挂网2=禁止挂网3=违规店铺
+                    'data_logid' => $data_logid,
+                    'insert_time' => time()
+                ];
+            }
+            $NoticesModel->insert($notices_data);
+        } else if ($low_price_data['first_responsible_person'] != '') {
+            $first_responsible_persons = array_unique(explode(',', $low_price_data['first_responsible_person']));
+            foreach ($first_responsible_persons as $key => $employee_id) {
+                $notices_data[] = [
+                    'company_id' => $low_price_data['company_id'],
+                    'custom_uid' => $employee_id,
+                    'title' => '您有一条新的低价商品待处理,请及时查看。',
+                    'content_type' => '1', //内容类型1=低价挂网2=禁止挂网3=违规店铺
+                    'data_logid' => $data_logid,
+                    'insert_time' => time()
+                ];
+            }
+            $NoticesModel->insert($notices_data);
+        } else if ($low_price_data['responsible_person'] != '') {
+            $responsible_persons = array_unique(explode(',', $low_price_data['responsible_person']));
+            foreach ($responsible_persons as $key => $employee_id) {
+                $notices_data[] = [
+                    'company_id' => $low_price_data['company_id'],
+                    'custom_uid' => $employee_id,
+                    'title' => '您有一条新的低价商品待处理,请及时查看。',
+                    'content_type' => '1', //内容类型1=低价挂网2=禁止挂网3=违规店铺
+                    'data_logid' => $data_logid,
+                    'insert_time' => time()
+                ];
+            }
+            $NoticesModel->insert($notices_data);
+        }
+        return true;
+    }
+
+
     /**
      * 编辑内容
      * @author 唐远望