MasterWorkerMessageController.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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, 0);
  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. 'msg_type' => 'require'
  30. ]);
  31. if (!$validate->check(request()->all())) {
  32. return $this->fail($validate->getError());
  33. }
  34. MasterWorkerMessageLogic::showMsg(request()->all(),$this->userId);
  35. return $this->success('操作成功', [], 1, 0);
  36. }
  37. }