MasterWorkerMessageController.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace app\workerapi\controller;
  3. use app\workerapi\lists\MasterWorkerMessageLists;
  4. use app\workerapi\logic\MasterWorkerMessageLogic;
  5. class MasterWorkerMessageController extends BaseApiController
  6. {
  7. /**
  8. * 统计师傅未读消息数量
  9. * @return \think\response\Json
  10. * @throws \think\db\exception\DataNotFoundException
  11. * @throws \think\db\exception\DbException
  12. * @throws \think\db\exception\ModelNotFoundException
  13. * @author 林海涛
  14. * @date 2024/7/11 下午6:28
  15. */
  16. public function msgStatistics()
  17. {
  18. $data = MasterWorkerMessageLogic::msgStatistics($this->userId);
  19. return $this->success('操作成功', $data, 1, 1);
  20. }
  21. public function lists()
  22. {
  23. return $this->dataLists(new MasterWorkerMessageLists());
  24. }
  25. public function showMsg()
  26. {
  27. $validate = \think\facade\Validate::rule([
  28. 'ids' => 'require|array',
  29. ]);
  30. if (!$validate->check(request()->all())) {
  31. return $this->fail($validate->getError());
  32. }
  33. MasterWorkerMessageLogic::showMsg(request()->all(),$this->userId);
  34. return $this->success('操作成功', [], 1, 1);
  35. }
  36. }