| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace app\workerapi\controller;
- use app\adminapi\logic\works\ServiceWorkLogic;
- use app\workerapi\lists\MasterWorkerMessageLists;
- use app\workerapi\logic\MasterWorkerMessageLogic;
- class MasterWorkerMessageController extends BaseApiController
- {
- /**
- * 统计工程师未读消息数量
- * @return \think\response\Json
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- * @author 林海涛
- * @date 2024/7/11 下午6:28
- */
- public function msgStatistics()
- {
- $data = MasterWorkerMessageLogic::msgStatistics($this->userId);
- return $this->success('操作成功', $data, 1, 0);
- }
- public function lists()
- {
- return $this->dataLists(new MasterWorkerMessageLists());
- }
- public function showMsg()
- {
- $validate = \think\facade\Validate::rule([
- 'ids' => 'require|array',
- 'msg_type' => 'require'
- ]);
- if (!$validate->check(request()->all())) {
- return $this->fail($validate->getError());
- }
- MasterWorkerMessageLogic::showMsg(request()->all(),$this->userId);
- return $this->success('操作成功', [], 1, 0);
- }
- /**
- * 工程师接单提示
- * @return \think\response\Json
- */
- public function orderPrompt()
- {
- $result = ['confirm_code'=>0,'msg'=>'无'];
- $prompt_result = MasterWorkerMessageLogic::orderPrompt($this->userId);
- //新工单领取
- if(!empty($prompt_result)){
- $result = ['confirm_code'=>101,'msg'=>'您有新的工单未领取,请点击领取','data'=>$prompt_result];
- return $this->success('操作成功', $result, 1, 0);
- }
- //预约时间更新确认
- $appoint_result = ServiceWorkLogic::getAppointmentNotice($this->userId);
- if(!empty($appoint_result) and $appoint_result['work_status']>1 and $appoint_result['work_status']<7){
- $result = ['confirm_code'=>102,'msg'=>'您有工单更改了预约时间,请注意查看','data'=>$appoint_result];
- return $this->success('操作成功', $result, 1, 0);
- }
- return $this->success('操作成功', $result, 1, 0);
- }
- }
|