shish 2 ani în urmă
părinte
comite
17fdb6cbaa
1 a modificat fișierele cu 20 adăugiri și 0 ștergeri
  1. 20 0
      app-ghs/controllers/ProductController.php

+ 20 - 0
app-ghs/controllers/ProductController.php

@@ -12,6 +12,7 @@ use bizGhs\custom\classes\CustomClass;
 use bizGhs\item\classes\ItemClass;
 use bizGhs\item\classes\ItemClassClass;
 use bizGhs\merchant\classes\ShopClass;
+use bizGhs\notify\classes\NotifyClass;
 use bizGhs\order\classes\PurchaseOrderClass;
 use bizGhs\product\classes\ProductClass;
 use bizGhs\product\models\Product;
@@ -1102,6 +1103,25 @@ class ProductController extends BaseController
         $ptItemId = $respond['itemId'] ?? 0;
         $ptItemInfo = PtItemClass::getById($ptItemId);
         $respond['ptItemInfo'] = $ptItemInfo;
+
+        if ($respond['mainId'] == $this->mainId) {
+            $staff = $this->shopAdmin;
+            $staffId = $this->shopAdminId;
+            $notify = NotifyClass::getByCondition(['staffId' => $staffId, 'type' => 1, 'targetId' => $id], true);
+            if (!empty($notify)) {
+                if ($notify->read == 0) {
+                    $notify->read = 1;
+                    $notify->save();
+                    $notifyNum = $staff->notifyNum;
+                    if ($notifyNum > 0) {
+                        $notifyNum--;
+                        $staff->notifyNum = $notifyNum;
+                        $staff->save();
+                    }
+                }
+            }
+        }
+
         util::success($respond);
     }