NotifyController.php 979 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace ghs\controllers;
  3. use bizGhs\notify\classes\NotifyClass;
  4. use bizGhs\shop\classes\ShopAdminClass;
  5. use common\components\util;
  6. use Yii;
  7. class NotifyController extends BaseController
  8. {
  9. //全部设置为已读 ssh 20230802
  10. public function actionAllRead()
  11. {
  12. NotifyClass::updateByCondition(['mainId' => $this->mainId, 'staffId' => $this->shopAdminId], ['read' => 1]);
  13. $staffId = $this->shopAdminId;
  14. ShopAdminClass::updateById($staffId, ['notifyNum' => 0]);
  15. util::complete('操作成功');
  16. }
  17. //通知列表 ssh 20230802
  18. public function actionList()
  19. {
  20. $get = Yii::$app->request->get();
  21. $staffId = $this->shopAdminId;
  22. $where = ['mainId' => $this->mainId, 'staffId' => $staffId];
  23. $read = $get['read'] ?? '';
  24. if (is_numeric($read)) {
  25. $where['read'] = $read;
  26. }
  27. $list = NotifyClass::getNotifyList($where);
  28. util::success($list);
  29. }
  30. }