shish 3 роки тому
батько
коміт
fa74fd2ac3

+ 0 - 27
app-ghs/controllers/NotifyController.php

@@ -33,31 +33,4 @@ class NotifyController extends BaseController
         util::success($list);
     }
 
-    //已读操作 ssh 20230802
-    public function actionRead()
-    {
-        $get = Yii::$app->request->get();
-        $id = $get['id'] ?? 0;
-        $notify = NotifyClass::getById($id, true);
-        if (empty($notify)) {
-            util::fail('没有找到消息');
-        }
-        if ($notify->mainId != $this->mainId || $notify->staffId != $this->shopAdminId) {
-            util::fail('没有权限');
-        }
-        if ($notify->read == 1) {
-            util::complete();
-        }
-        $notify->read = 1;
-        $notify->save();
-        $staff = $this->shopAdmin;
-        $notifyNum = $staff->notifyNum ?? 0;
-        if ($notifyNum > 0) {
-            $notifyNum--;
-        }
-        $staff->notifyNum = $notifyNum;
-        $staff->save();
-        util::complete();
-    }
-
 }

+ 18 - 0
app-ghs/controllers/RefundController.php

@@ -2,6 +2,7 @@
 //退款退货
 namespace ghs\controllers;
 
+use bizGhs\notify\classes\NotifyClass;
 use bizGhs\order\classes\RefundOrderItemClass;
 use bizGhs\order\services\RefundOrderService;
 use bizGhs\shop\classes\ShopClass;
@@ -211,6 +212,23 @@ class RefundController extends BaseController
         }
         $orderSn = $refund['orderSn'] ?? '';
         $itemList = RefundOrderItemClass::getOrderItemDetail($orderSn);
+
+        $staff = $this->shopAdmin;
+        $staffId = $this->shopAdminId;
+        $notify = NotifyClass::getByCondition(['staffId' => $staffId, 'type' => 0, '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(['info' => $refund, 'itemList' => $itemList]);
     }