$this->mainId, 'staffId' => $this->shopAdminId], ['read' => 1]); $staffId = $this->shopAdminId; ShopAdminClass::updateById($staffId, ['notifyNum' => 0]); util::complete('操作成功'); } //通知列表 ssh 20230802 public function actionList() { $get = Yii::$app->request->get(); $staffId = $this->shopAdminId; $where = ['mainId' => $this->mainId, 'staffId' => $staffId]; $read = $get['read'] ?? ''; if (is_numeric($read)) { $where['read'] = $read; } $list = NotifyClass::getNotifyList($where); 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(); } }