1
0

MasterWorkerMessageController.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. /**
  38. * 工程师接单提示
  39. * @return \think\response\Json
  40. */
  41. public function orderPrompt()
  42. {
  43. $result = MasterWorkerMessageLogic::orderPrompt($this->userId);
  44. if ($result) {
  45. $result = ['confirm_code'=>101,'msg'=>'您有新的工单未领取,请点击领取'];
  46. }else{
  47. $result = ['confirm_code'=>0,'msg'=>'无'];
  48. }
  49. return $this->success('操作成功', $result, 1, 0);
  50. }
  51. }