diff --git a/app/Http/Controllers/Api/ApproveController.php b/app/Http/Controllers/Api/ApproveController.php index b4f6319ce..c162e882d 100755 --- a/app/Http/Controllers/Api/ApproveController.php +++ b/app/Http/Controllers/Api/ApproveController.php @@ -28,6 +28,7 @@ use Hhxsv5\LaravelS\Swoole\Task\Task; class ApproveController extends AbstractController { private $flow_url = ''; + public function __construct() { $this->flow_url = env('FLOW_URL') ?: 'http://approve'; @@ -72,7 +73,7 @@ class ApproveController extends AbstractController { User::auth(); $data['name'] = Request::input('name'); - $ret = Ihttp::ihttp_post($this->flow_url.'/api/v1/workflow/procdef/findAll', json_encode($data)); + $ret = Ihttp::ihttp_post($this->flow_url . '/api/v1/workflow/procdef/findAll', json_encode($data)); $procdef = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$procdef || $procdef['status'] != 200 || $ret['ret'] == 0) { // info($ret); @@ -99,7 +100,7 @@ class ApproveController extends AbstractController { User::auth('admin'); $data['id'] = Request::input('id'); - $ret = Ihttp::ihttp_get($this->flow_url.'/api/v1/workflow/procdef/delById?'.http_build_query($data)); + $ret = Ihttp::ihttp_get($this->flow_url . '/api/v1/workflow/procdef/delById?' . http_build_query($data)); $procdef = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$procdef || $procdef['status'] != 200) { return Base::retError($procdef['message'] ?? '删除失败'); @@ -132,7 +133,7 @@ class ApproveController extends AbstractController // $var = json_decode(Request::input('var'), true); $data['var'] = $var; - $ret = Ihttp::ihttp_post($this->flow_url.'/api/v1/workflow/process/start', json_encode(Base::arrayKeyToCamel($data))); + $ret = Ihttp::ihttp_post($this->flow_url . '/api/v1/workflow/process/start', json_encode(Base::arrayKeyToCamel($data))); $process = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$process || $process['status'] != 200) { return Base::retError($process['message'] ?? '启动失败'); @@ -194,7 +195,7 @@ class ApproveController extends AbstractController $processInst = $this->getProcessById($data['proc_inst_id']); - $ret = Ihttp::ihttp_post($this->flow_url.'/api/v1/workflow/process/addGlobalComment', json_encode(Base::arrayKeyToCamel($data))); + $ret = Ihttp::ihttp_post($this->flow_url . '/api/v1/workflow/process/addGlobalComment', json_encode(Base::arrayKeyToCamel($data))); $process = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$process || $process['status'] != 200) { return Base::retError($process['message'] ?? '添加失败'); @@ -202,11 +203,11 @@ class ApproveController extends AbstractController // 推送通知 $botUser = User::botGetOrCreate('approval-alert'); - foreach ( $processInst['userids'] as $id) { - if($id != $user->userid){ + foreach ($processInst['userids'] as $id) { + if ($id != $user->userid) { $dialog = WebSocketDialog::checkUserDialog($botUser, $id); $processInst['comment_user_id'] = $user->userid; - $processInst['comment_content'] = json_decode($data['content'],true)['content']; + $processInst['comment_content'] = json_decode($data['content'], true)['content']; $this->approveMsg('approve_comment_notifier', $dialog, $botUser, $processInst, $processInst); } } @@ -238,7 +239,7 @@ class ApproveController extends AbstractController $data['task_id'] = intval(Request::input('task_id')); $data['pass'] = Request::input('pass'); $data['comment'] = Request::input('comment'); - $ret = Ihttp::ihttp_post($this->flow_url.'/api/v1/workflow/task/complete', json_encode(Base::arrayKeyToCamel($data))); + $ret = Ihttp::ihttp_post($this->flow_url . '/api/v1/workflow/task/complete', json_encode(Base::arrayKeyToCamel($data))); $task = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$task || $task['status'] != 200) { return Base::retError($task['message'] ?? '审批失败'); @@ -261,12 +262,12 @@ class ApproveController extends AbstractController $this->approveMsg('approve_reviewer', $dialog, $botUser, $val, $process, $pass); } // 发起人 - if($process['is_finished'] == true) { + if ($process['is_finished'] == true) { $dialog = WebSocketDialog::checkUserDialog($botUser, $process['start_user_id']); if (!empty($dialog)) { $this->approveMsg('approve_submitter', $dialog, $botUser, ['userid' => $data['userid']], $process, $pass); } - }else if ($process['candidate']) { + } else if ($process['candidate']) { // 下个审批人 $userid = explode(',', $process['candidate']); $toUser = User::whereIn('userid', $userid)->get()->toArray(); @@ -278,7 +279,7 @@ class ApproveController extends AbstractController if (empty($dialog)) { continue; } - $this->approveMsg('approve_reviewer', $dialog, $botUser, $val, $process,'start'); + $this->approveMsg('approve_reviewer', $dialog, $botUser, $val, $process, 'start'); } } @@ -292,7 +293,7 @@ class ApproveController extends AbstractController } } } - return Base::retSuccess( $pass == 'pass' ? '已通过' : '已拒绝', $task); + return Base::retSuccess($pass == 'pass' ? '已通过' : '已拒绝', $task); } /** @@ -316,7 +317,7 @@ class ApproveController extends AbstractController $data['userid'] = (string)$user->userid; $data['task_id'] = intval(Request::input('task_id')); $data['proc_inst_id'] = intval(Request::input('proc_inst_id')); - $ret = Ihttp::ihttp_post($this->flow_url.'/api/v1/workflow/task/withdraw', json_encode(Base::arrayKeyToCamel($data))); + $ret = Ihttp::ihttp_post($this->flow_url . '/api/v1/workflow/task/withdraw', json_encode(Base::arrayKeyToCamel($data))); $task = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$task || $task['status'] != 200) { return Base::retError($task['message'] ?? '撤回失败'); @@ -366,7 +367,7 @@ class ApproveController extends AbstractController $data['sort'] = Request::input('sort'); $data['pageIndex'] = intval(Request::input('page')); $data['pageSize'] = intval(Request::input('page_size')); - $ret = Ihttp::ihttp_post($this->flow_url.'/api/v1/workflow/process/findTask', json_encode(Base::arrayKeyToCamel($data))); + $ret = Ihttp::ihttp_post($this->flow_url . '/api/v1/workflow/process/findTask', json_encode(Base::arrayKeyToCamel($data))); $process = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$process || $process['status'] != 200) { return Base::retError($process['message'] ?? '查询失败'); @@ -380,7 +381,7 @@ class ApproveController extends AbstractController } $val['userimg'] = User::getAvatar($info->userid, $info->userimg, $info->email, $info->nickname); } - return Base::retSuccess('success',$res); + return Base::retSuccess('success', $res); } /** @@ -409,7 +410,7 @@ class ApproveController extends AbstractController $data['state'] = intval(Request::input('state')); //状态 $data['pageIndex'] = intval(Request::input('page')); $data['pageSize'] = intval(Request::input('page_size')); - $ret = Ihttp::ihttp_post($this->flow_url.'/api/v1/workflow/process/startByMyselfAll', json_encode($data)); + $ret = Ihttp::ihttp_post($this->flow_url . '/api/v1/workflow/process/startByMyselfAll', json_encode($data)); $process = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$process || $process['status'] != 200) { return Base::retError($process['message'] ?? '查询失败'); @@ -447,7 +448,7 @@ class ApproveController extends AbstractController $data['userid'] = (string)$user->userid; $data['pageIndex'] = intval(Request::input('page')); $data['pageSize'] = intval(Request::input('page_size')); - $ret = Ihttp::ihttp_post($this->flow_url.'/api/v1/workflow/process/startByMyself', json_encode($data)); + $ret = Ihttp::ihttp_post($this->flow_url . '/api/v1/workflow/process/startByMyself', json_encode($data)); $process = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$process || $process['status'] != 200) { return Base::retError($process['message'] ?? '查询失败'); @@ -491,7 +492,7 @@ class ApproveController extends AbstractController $data['pageIndex'] = intval(Request::input('page')); $data['pageSize'] = intval(Request::input('page_size')); - $ret = Ihttp::ihttp_post($this->flow_url.'/api/v1/workflow/process/findProcNotify', json_encode($data)); + $ret = Ihttp::ihttp_post($this->flow_url . '/api/v1/workflow/process/findProcNotify', json_encode($data)); $process = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$process || $process['status'] != 200) { return Base::retError($process['message'] ?? '查询失败'); @@ -526,7 +527,7 @@ class ApproveController extends AbstractController { User::auth(); $proc_inst_id = Request::input('proc_inst_id'); - $ret = Ihttp::ihttp_get($this->flow_url.'/api/v1/workflow/identitylink/findParticipant?procInstId=' . $proc_inst_id); + $ret = Ihttp::ihttp_get($this->flow_url . '/api/v1/workflow/identitylink/findParticipant?procInstId=' . $proc_inst_id); $identitylink = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$identitylink || $identitylink['status'] != 200) { return Base::retError($identitylink['message'] ?? '查询失败'); @@ -569,7 +570,7 @@ class ApproveController extends AbstractController $data['sort'] = Request::input('sort'); $data['pageIndex'] = intval(Request::input('page')); $data['pageSize'] = intval(Request::input('page_size')); - $ret = Ihttp::ihttp_post($this->flow_url.'/api/v1/workflow/procHistory/findTask', json_encode(Base::arrayKeyToCamel($data))); + $ret = Ihttp::ihttp_post($this->flow_url . '/api/v1/workflow/procHistory/findTask', json_encode(Base::arrayKeyToCamel($data))); $process = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$process || $process['status'] != 200) { return Base::retError($process['message'] ?? '查询失败'); @@ -607,7 +608,7 @@ class ApproveController extends AbstractController $data['userid'] = (string)$user->userid; $data['pageIndex'] = intval(Request::input('page')); $data['pageSize'] = intval(Request::input('page_size')); - $ret = Ihttp::ihttp_post($this->flow_url.'/api/v1/workflow/procHistory/startByMyself', json_encode($data)); + $ret = Ihttp::ihttp_post($this->flow_url . '/api/v1/workflow/procHistory/startByMyself', json_encode($data)); $process = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$process || $process['status'] != 200) { return Base::retError($process['message'] ?? '查询失败'); @@ -651,7 +652,7 @@ class ApproveController extends AbstractController $data['pageIndex'] = intval(Request::input('page')); $data['pageSize'] = intval(Request::input('page_size')); - $ret = Ihttp::ihttp_post($this->flow_url.'/api/v1/workflow/procHistory/findProcNotify', json_encode($data)); + $ret = Ihttp::ihttp_post($this->flow_url . '/api/v1/workflow/procHistory/findProcNotify', json_encode($data)); $process = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$process || $process['status'] != 200) { return Base::retError($process['message'] ?? '查询失败'); @@ -686,7 +687,7 @@ class ApproveController extends AbstractController { User::auth(); $proc_inst_id = Request::input('proc_inst_id'); - $ret = Ihttp::ihttp_get($this->flow_url.'/api/v1/workflow/identitylinkHistory/findParticipant?procInstId=' . $proc_inst_id); + $ret = Ihttp::ihttp_get($this->flow_url . '/api/v1/workflow/identitylinkHistory/findParticipant?procInstId=' . $proc_inst_id); $identitylink = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$identitylink || $identitylink['status'] != 200) { return Base::retError($identitylink['message'] ?? '查询失败'); @@ -750,7 +751,7 @@ class ApproveController extends AbstractController $data['isFinished'] = intval(Request::input('is_finished')); //是否完成 $date = Request::input('date'); $data['startTime'] = $date[0]; //开始时间 - $data['endTime'] =Carbon::parse($date[1])->addDay()->toDateString(); //结束时间 + 1天 + $data['endTime'] = Carbon::parse($date[1])->addDay()->toDateString(); //结束时间 + 1天 // if (empty($name) || empty($date)) { return Base::retError('参数错误'); @@ -762,7 +763,7 @@ class ApproveController extends AbstractController return Base::retError('日期范围限制最大35天'); } // - $ret = Ihttp::ihttp_post($this->flow_url.'/api/v1/workflow/process/findAllProcIns', json_encode($data)); + $ret = Ihttp::ihttp_post($this->flow_url . '/api/v1/workflow/process/findAllProcIns', json_encode($data)); $process = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$process || $process['status'] != 200) { return Base::retError($process['message'] ?? '查询失败'); @@ -889,7 +890,8 @@ class ApproveController extends AbstractController } } - function getStateDescription($state) { + function getStateDescription($state) + { $state_map = array( 0 => '全部', 1 => '审批中', @@ -951,13 +953,13 @@ class ApproveController extends AbstractController } // 审批记录 $name = $val['username'] . '|'; - $call = $val['step'] == 0 ? '发起审批'. '|' : '同意' . '|'; - $time =$val['step'] == 0 ? $process['start_time'] . '|' : ''; + $call = $val['step'] == 0 ? '发起审批' . '|' : '同意' . '|'; + $time = $val['step'] == 0 ? $process['start_time'] . '|' : ''; $comment = $val['step'] == 0 ? '' : ($val['comment'] ?? '') . '|'; $res['approval_record'] .= $name . $call . $time . $comment; } } - $res['historical_approver'] = trim(implode(';', $historical_approver), ';'); + $res['historical_approver'] = trim(implode(';', $historical_approver), ';'); $res['approved_node'] = $approved_node; $res['approved_num'] = $approved_num; $res['historical_agent'] = $res['historical_approver']; @@ -976,9 +978,9 @@ class ApproveController extends AbstractController 'department' => $process['department'], 'type' => $process['var']['type'], 'start_time' => $process['var']['start_time'], - 'start_day_of_week' => '周'.Base::getTimeWeek(Carbon::parse($process['var']['start_time'])->timestamp), + 'start_day_of_week' => '周' . Base::getTimeWeek(Carbon::parse($process['var']['start_time'])->timestamp), 'end_time' => $process['var']['end_time'], - 'end_day_of_week' => '周'.Base::getTimeWeek(Carbon::parse($process['var']['end_time'])->timestamp), + 'end_day_of_week' => '周' . Base::getTimeWeek(Carbon::parse($process['var']['end_time'])->timestamp), 'description' => $process['var']['description'], 'comment_nickname' => $process['comment_user_id'] ? User::userid2nickname($process['comment_user_id']) : '', 'comment_content' => $process['comment_content'] ?? '' @@ -989,11 +991,11 @@ class ApproveController extends AbstractController $msg_action = null; if ($action == 'withdraw' || $action == 'pass' || $action == 'refuse') { // 任务完成,给发起人发送消息 - if($type == 'approve_submitter' && $action != 'withdraw'){ + if ($type == 'approve_submitter' && $action != 'withdraw') { return WebSocketDialogMsg::sendMsg($msg_action, $dialog->id, 'text', ['text' => $text], $botUser->userid, false, false, true); } // 查找最后一条消息msg_id - $msg_action = 'update-'.$toUser['msg_id']; + $msg_action = 'update-' . $toUser['msg_id']; } // try { @@ -1007,9 +1009,9 @@ class ApproveController extends AbstractController $proc_msg->save(); } // 更新工作报告 未读数量 - if($type == 'approve_reviewer' && $toUser['userid']){ + if ($type == 'approve_reviewer' && $toUser['userid']) { $params = [ - 'userid' => [ $toUser['userid'], User::auth()->userid() ], + 'userid' => [$toUser['userid'], User::auth()->userid()], 'msg' => [ 'type' => 'approve', 'action' => 'unread', @@ -1028,7 +1030,7 @@ class ApproveController extends AbstractController public function getProcessById($id) { $data['id'] = intval($id); - $ret = Ihttp::ihttp_get($this->flow_url."/api/v1/workflow/process/findById?".http_build_query($data)); + $ret = Ihttp::ihttp_get($this->flow_url . "/api/v1/workflow/process/findById?" . http_build_query($data)); $process = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$process || $process['status'] != 200) { throw new ApiException($process['message'] ?? '查询失败'); @@ -1047,14 +1049,14 @@ class ApproveController extends AbstractController $val['node_user_list'][$k]['userimg'] = User::getAvatar($info->userid, $info->userimg, $info->email, $info->nickname); $res['userids'][] = $item['target_id']; } - }else if($val['aprover_id']){ + } else if ($val['aprover_id']) { $info = User::whereUserid($val['aprover_id'])->first(); $val['userimg'] = $info ? User::getAvatar($info->userid, $info->userimg, $info->email, $info->nickname) : ''; $res['userids'][] = $val['aprover_id']; } } // 全局评论 - if(isset($res['global_comments'])){ + if (isset($res['global_comments'])) { foreach ($res['global_comments'] as $k => &$globalComment) { $info = User::whereUserid($globalComment['user_id'])->first(); if (!$info) { @@ -1095,7 +1097,7 @@ class ApproveController extends AbstractController public function getUserProcessParticipantById($id) { $data['procInstId'] = intval($id); - $ret = Ihttp::ihttp_get($this->flow_url."/api/v1/workflow/identitylink/findParticipantAll?".http_build_query($data)); + $ret = Ihttp::ihttp_get($this->flow_url . "/api/v1/workflow/identitylink/findParticipantAll?" . http_build_query($data)); $process = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$process || $process['status'] != 200) { throw new ApiException($process['message'] ?? '查询失败'); @@ -1120,7 +1122,7 @@ class ApproveController extends AbstractController public function user__status() { $data['userid'] = intval(Request::input('userid')); - $ret = Ihttp::ihttp_get($this->flow_url.'/api/v1/workflow/process/getUserApprovalStatus?'.http_build_query($data)); + $ret = Ihttp::ihttp_get($this->flow_url . '/api/v1/workflow/process/getUserApprovalStatus?' . http_build_query($data)); $procdef = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (isset($procdef['status']) && $procdef['status'] == 200) { return Base::retSuccess('success', isset($procdef['data']["proc_def_name"]) ? $procdef['data']["proc_def_name"] : ''); @@ -1129,7 +1131,7 @@ class ApproveController extends AbstractController } /** - * @api {get} api/approve/process/doto 20. 查询需要我审批的流程数量 + * @api {get} api/approve/process/doto 21. 查询需要我审批的流程数量 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1143,7 +1145,7 @@ class ApproveController extends AbstractController public function process__doto() { $user = User::auth(); - $ret = Ihttp::ihttp_get($this->flow_url.'/api/v1/workflow/process/findTaskTotal?userid='.$user->userid); + $ret = Ihttp::ihttp_get($this->flow_url . '/api/v1/workflow/process/findTaskTotal?userid=' . $user->userid); $process = json_decode($ret['ret'] == 1 ? $ret['data'] : '{}', true); if (!$process || $process['status'] != 200) { return Base::retError($process['message'] ?? '查询失败'); diff --git a/app/Http/Controllers/Api/DialogController.php b/app/Http/Controllers/Api/DialogController.php index c22980fc3..42cd1893f 100755 --- a/app/Http/Controllers/Api/DialogController.php +++ b/app/Http/Controllers/Api/DialogController.php @@ -540,13 +540,13 @@ class DialogController extends AbstractController if ($reDialog) { $data['dialog'] = $dialog->formatData($user->userid, true); $data['todo'] = $data['dialog']->todo_num > 0 ? WebSocketDialogMsgTodo::whereDialogId($dialog->id)->whereUserid($user->userid)->whereDoneAt(null)->orderByDesc('id')->take(50)->get() : []; - $data['top'] = WebSocketDialogMsg::whereId($dialog->top_msg_id)->first(); + $data['top'] = $dialog->top_msg_id ? WebSocketDialogMsg::whereId($dialog->top_msg_id)->first() : null; } return Base::retSuccess('success', $data); } /** - * @api {get} api/dialog/msg/latest 11. 获取最新消息列表 + * @api {get} api/dialog/msg/latest 12. 获取最新消息列表 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -587,7 +587,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/search 12. 搜索消息位置 + * @api {get} api/dialog/msg/search 13. 搜索消息位置 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -624,7 +624,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/one 13. 获取单条消息 + * @api {get} api/dialog/msg/one 14. 获取单条消息 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -653,7 +653,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/read 14. 已读聊天消息 + * @api {get} api/dialog/msg/read 15. 已读聊天消息 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -704,7 +704,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/unread 15. 获取未读消息数据 + * @api {get} api/dialog/msg/unread 16. 获取未读消息数据 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -745,7 +745,7 @@ class DialogController extends AbstractController } /** - * @api {post} api/dialog/msg/stream 16. 通知成员监听消息 + * @api {post} api/dialog/msg/stream 17. 通知成员监听消息 * * @apiDescription 通知指定会员EventSource监听流动消息 * @apiVersion 1.0.0 @@ -784,7 +784,7 @@ class DialogController extends AbstractController } /** - * @api {post} api/dialog/msg/sendtext 17. 发送消息 + * @api {post} api/dialog/msg/sendtext 18. 发送消息 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -896,7 +896,7 @@ class DialogController extends AbstractController } /** - * @api {post} api/dialog/msg/sendrecord 18. 发送语音 + * @api {post} api/dialog/msg/sendrecord 19. 发送语音 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -943,7 +943,7 @@ class DialogController extends AbstractController } /** - * @api {post} api/dialog/msg/sendfile 19. 文件上传 + * @api {post} api/dialog/msg/sendfile 20. 文件上传 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -974,7 +974,7 @@ class DialogController extends AbstractController } /** - * @api {post} api/dialog/msg/sendfiles 20. 群发文件上传 + * @api {post} api/dialog/msg/sendfiles 21. 群发文件上传 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1029,7 +1029,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/sendfileid 21. 通过文件ID发送文件 + * @api {get} api/dialog/msg/sendfileid 22. 通过文件ID发送文件 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1099,7 +1099,7 @@ class DialogController extends AbstractController } /** - * @api {post} api/dialog/msg/sendanon 22. 发送匿名消息 + * @api {post} api/dialog/msg/sendanon 23. 发送匿名消息 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1152,7 +1152,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/readlist 23. 获取消息阅读情况 + * @api {get} api/dialog/msg/readlist 24. 获取消息阅读情况 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1181,7 +1181,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/detail 24. 消息详情 + * @api {get} api/dialog/msg/detail 25. 消息详情 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1229,7 +1229,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/download 25. 文件下载 + * @api {get} api/dialog/msg/download 26. 文件下载 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1270,7 +1270,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/withdraw 26. 聊天消息撤回 + * @api {get} api/dialog/msg/withdraw 27. 聊天消息撤回 * * @apiDescription 消息撤回限制24小时内,需要token身份 * @apiVersion 1.0.0 @@ -1296,7 +1296,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/mark 27. 消息标记操作 + * @api {get} api/dialog/msg/mark 28. 消息标记操作 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1363,7 +1363,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/silence 28. 消息免打扰 + * @api {get} api/dialog/msg/silence 29. 消息免打扰 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1426,7 +1426,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/forward 29. 转发消息给 + * @api {get} api/dialog/msg/forward 30. 转发消息给 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1467,7 +1467,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/emoji 30. emoji回复 + * @api {get} api/dialog/msg/emoji 31. emoji回复 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1502,7 +1502,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/tag 31. 标注/取消标注 + * @api {get} api/dialog/msg/tag 32. 标注/取消标注 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1531,7 +1531,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/todo 32. 设待办/取消待办 + * @api {get} api/dialog/msg/todo 33. 设待办/取消待办 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1574,7 +1574,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/todolist 33. 获取消息待办情况 + * @api {get} api/dialog/msg/todolist 34. 获取消息待办情况 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1604,7 +1604,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/done 34. 完成待办 + * @api {get} api/dialog/msg/done 35. 完成待办 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1651,7 +1651,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/color 35. 设置颜色 + * @api {get} api/dialog/msg/color 36. 设置颜色 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1692,7 +1692,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/group/add 36. 新增群组 + * @api {get} api/dialog/group/add 37. 新增群组 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1754,7 +1754,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/group/edit 37. 修改群组 + * @api {get} api/dialog/group/edit 38. 修改群组 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -1816,7 +1816,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/group/adduser 38. 添加群成员 + * @api {get} api/dialog/group/adduser 39. 添加群成员 * * @apiDescription 需要token身份 * - 有群主时:只有群主可以邀请 @@ -1852,7 +1852,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/group/deluser 39. 移出(退出)群成员 + * @api {get} api/dialog/group/deluser 40. 移出(退出)群成员 * * @apiDescription 需要token身份 * - 只有群主、邀请人可以踢人 @@ -1896,7 +1896,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/group/transfer 40. 转让群组 + * @api {get} api/dialog/group/transfer 41. 转让群组 * * @apiDescription 需要token身份 * - 只有群主且是个人类型群可以解散 @@ -1945,7 +1945,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/group/disband 41. 解散群组 + * @api {get} api/dialog/group/disband 42. 解散群组 * * @apiDescription 需要token身份 * - 只有群主且是个人类型群可以解散 @@ -1973,7 +1973,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/group/searchuser 42. 搜索个人群(仅限管理员) + * @api {get} api/dialog/group/searchuser 43. 搜索个人群(仅限管理员) * * @apiDescription 需要token身份,用于创建部门搜索个人群组 * @apiVersion 1.0.0 @@ -2002,7 +2002,7 @@ class DialogController extends AbstractController } /** - * @api {post} api/dialog/okr/add 43. 创建OKR评论会话 + * @api {post} api/dialog/okr/add 44. 创建OKR评论会话 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -2041,7 +2041,7 @@ class DialogController extends AbstractController } /** - * @api {post} api/dialog/okr/push 44. 推送OKR相关信息 + * @api {post} api/dialog/okr/push 45. 推送OKR相关信息 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -2077,7 +2077,7 @@ class DialogController extends AbstractController } /** - * @api {post} api/dialog/msg/wordchain 45. 发送接龙消息 + * @api {post} api/dialog/msg/wordchain 46. 发送接龙消息 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -2140,7 +2140,7 @@ class DialogController extends AbstractController } /** - * @api {post} api/dialog/msg/vote 46. 发起投票 + * @api {post} api/dialog/msg/vote 47. 发起投票 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -2251,7 +2251,7 @@ class DialogController extends AbstractController } /** - * @api {get} api/dialog/msg/top 47. 置顶/取消置顶 + * @api {get} api/dialog/msg/top 48. 置顶/取消置顶 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -2310,11 +2310,10 @@ class DialogController extends AbstractController } // return Base::retSuccess($dialog->top_msg_id ? '置顶成功' : '取消成功', $data); - // } /** - * @api {get} api/dialog/msg/topinfo 48. 获取置顶消息 + * @api {get} api/dialog/msg/topinfo 49. 获取置顶消息 * * @apiDescription 需要token身份 * @apiVersion 1.0.0 @@ -2339,5 +2338,4 @@ class DialogController extends AbstractController // return Base::retSuccess('success', $topMsg); } - } diff --git a/app/Models/FileLink.php b/app/Models/FileLink.php index 027b6f660..88e731769 100644 --- a/app/Models/FileLink.php +++ b/app/Models/FileLink.php @@ -8,7 +8,7 @@ use App\Module\Base; * App\Models\FileLink * * @property int $id - * @property int|null $file_id 文件ID + * @property int|null $file_id 项目ID * @property int|null $num 累计访问 * @property string|null $code 链接码 * @property int|null $userid 会员ID diff --git a/app/Models/Project.php b/app/Models/Project.php index 3a6c9fc66..7eb5c1b9a 100644 --- a/app/Models/Project.php +++ b/app/Models/Project.php @@ -24,7 +24,6 @@ use Request; * @property int|null $dialog_id 聊天会话ID * @property string|null $archived_at 归档时间 * @property int|null $archived_userid 归档会员 - * @property int|null $is_fixed 是否固定 * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at * @property \Illuminate\Support\Carbon|null $deleted_at @@ -48,7 +47,6 @@ use Request; * @method static \Illuminate\Database\Eloquent\Builder|Project whereDesc($value) * @method static \Illuminate\Database\Eloquent\Builder|Project whereDialogId($value) * @method static \Illuminate\Database\Eloquent\Builder|Project whereId($value) - * @method static \Illuminate\Database\Eloquent\Builder|Project whereIsFixed($value) * @method static \Illuminate\Database\Eloquent\Builder|Project whereName($value) * @method static \Illuminate\Database\Eloquent\Builder|Project wherePersonal($value) * @method static \Illuminate\Database\Eloquent\Builder|Project whereUpdatedAt($value) diff --git a/app/Models/ProjectFlowItem.php b/app/Models/ProjectFlowItem.php index b1992d53b..8c60aab01 100644 --- a/app/Models/ProjectFlowItem.php +++ b/app/Models/ProjectFlowItem.php @@ -13,7 +13,7 @@ use App\Module\Base; * @property string|null $name 名称 * @property string|null $status 状态 * @property array $turns 可流转 - * @property array $userids 状态负责人ID + * @property array $userids 自动负责人ID * @property string|null $usertype 流转模式 * @property int|null $userlimit 限制负责人 * @property int|null $columnid 对应的项目列表 diff --git a/app/Models/ProjectLog.php b/app/Models/ProjectLog.php index 0c62ef8d6..dca19a931 100644 --- a/app/Models/ProjectLog.php +++ b/app/Models/ProjectLog.php @@ -10,7 +10,7 @@ use App\Module\Base; * @property int $id * @property int|null $project_id 项目ID * @property int|null $column_id 列表ID - * @property int|null $task_id 任务ID + * @property int|null $task_id 项目ID * @property int|null $userid 会员ID * @property string|null $detail 详细信息 * @property array $record 记录数据 diff --git a/app/Models/ProjectPermission.php b/app/Models/ProjectPermission.php index bf372711f..81f4e5fb3 100644 --- a/app/Models/ProjectPermission.php +++ b/app/Models/ProjectPermission.php @@ -10,10 +10,9 @@ use App\Module\Base; * * @property int $id * @property int|null $project_id 项目ID - * @property string|null $permissions 权限 + * @property string $permissions 权限 * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at - * @property-read \App\Models\Project|null $project * @method static \Illuminate\Database\Eloquent\Builder|ProjectPermission newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|ProjectPermission newQuery() * @method static \Illuminate\Database\Eloquent\Builder|ProjectPermission query() diff --git a/app/Models/ProjectTask.php b/app/Models/ProjectTask.php index 5954759d4..4d41ae4cb 100644 --- a/app/Models/ProjectTask.php +++ b/app/Models/ProjectTask.php @@ -34,7 +34,6 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property string|null $complete_at 完成时间 * @property int|null $userid 创建人 * @property int|null $visibility 任务可见性:1-项目人员 2-任务人员 3-指定成员 - * @property int|null $is_default 是否默认任务 * @property int|null $p_level 优先级 * @property string|null $p_name 优先级名称 * @property string|null $p_color 优先级颜色 @@ -83,7 +82,6 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereFlowItemId($value) * @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereFlowItemName($value) * @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereId($value) - * @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereIsDefault($value) * @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereLoop($value) * @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereLoopAt($value) * @method static \Illuminate\Database\Eloquent\Builder|ProjectTask whereName($value) diff --git a/app/Models/WebSocketDialog.php b/app/Models/WebSocketDialog.php index 0ded84bfa..03cfdb8c2 100644 --- a/app/Models/WebSocketDialog.php +++ b/app/Models/WebSocketDialog.php @@ -23,6 +23,7 @@ use Illuminate\Support\Facades\DB; * @property string|null $last_at 最后消息时间 * @property int|null $owner_id 群主用户ID * @property int|null $link_id 关联id + * @property int|null $top_msg_id 置顶的消息ID * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at * @property \Illuminate\Support\Carbon|null $deleted_at @@ -41,6 +42,7 @@ use Illuminate\Support\Facades\DB; * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialog whereLinkId($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialog whereName($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialog whereOwnerId($value) + * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialog whereTopMsgId($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialog whereType($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialog whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialog withTrashed() diff --git a/app/Models/WebSocketDialogMsg.php b/app/Models/WebSocketDialogMsg.php index 952f6d4b7..7a906332e 100644 --- a/app/Models/WebSocketDialogMsg.php +++ b/app/Models/WebSocketDialogMsg.php @@ -31,9 +31,13 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property int|null $modify 是否编辑 * @property int|null $reply_num 有多少条回复 * @property int|null $reply_id 回复ID + * @property int|null $forward_id 转发ID + * @property int|null $forward_num 被转发多少次 + * @property int|null $forward_show 是否显示转发的来源 * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at * @property \Illuminate\Support\Carbon|null $deleted_at + * @property-read \App\Models\WebSocketDialogMsg|null $forward_data * @property-read int|mixed $percentage * @property-read \App\Models\WebSocketDialogMsg|null $reply_data * @property-read \App\Models\WebSocketDialog|null $webSocketDialog @@ -46,6 +50,9 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereDialogId($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereDialogType($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereEmoji($value) + * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereForwardId($value) + * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereForwardNum($value) + * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereForwardShow($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereKey($value) * @method static \Illuminate\Database\Eloquent\Builder|WebSocketDialogMsg whereLink($value) diff --git a/app/Models/WebSocketDialogUser.php b/app/Models/WebSocketDialogUser.php index 507e0d834..888011d20 100644 --- a/app/Models/WebSocketDialogUser.php +++ b/app/Models/WebSocketDialogUser.php @@ -14,7 +14,7 @@ use Carbon\Carbon; * @property int|null $mark_unread 是否标记为未读:0否,1是 * @property int|null $silence 是否免打扰:0否,1是 * @property int|null $inviter 邀请人 - * @property int|null $important 是否不可移出(项目、任务、部门人员) + * @property int|null $important 是否不可移出(项目、任务人员) * @property string|null $color 颜色 * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js index 908504ce8..58319fba5 100755 --- a/resources/assets/js/functions/web.js +++ b/resources/assets/js/functions/web.js @@ -842,7 +842,7 @@ import {MarkdownPreview} from "../store/markdown"; case 'tag': return `[${$A.L(data.msg.action === 'remove' ? '取消标注' : '标注')}] ${$A.getMsgSimpleDesc(data.msg.data)}` case 'top': - return `[${$A.L(data.msg.action === 'remove' ? '取消置顶' : '置顶*')}] ${$A.getMsgSimpleDesc(data.msg.data)}` + return `[${$A.L(data.msg.action === 'remove' ? '取消置顶' : '置顶')}] ${$A.getMsgSimpleDesc(data.msg.data)}` case 'todo': return `[${$A.L(data.msg.action === 'remove' ? '取消待办' : (data.msg.action === 'done' ? '完成' : '设待办'))}] ${$A.getMsgSimpleDesc(data.msg.data)}` case 'notice': diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue index 3c9a1aef5..1824e7ae3 100644 --- a/resources/assets/js/pages/manage/components/DialogWrapper.vue +++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue @@ -137,22 +137,22 @@ -
+

- : - {{$A.getMsgSimpleDesc(topMessage)}} + : + {{$A.getMsgSimpleDesc(topMessageInfo)}}

-

{{$L('置顶人员')}}

+

{{$L('置顶人员')}}

- - - + + +
@@ -764,7 +764,7 @@ export default { selectedTextStatus: false, // 是否选择文本 scrollToBottomAndRefresh: false, // 滚动到底部重新获取消息 - topViewPosLoad: false, + topViewPosLoad: false, // 置顶消息定位加载中 } }, @@ -962,7 +962,7 @@ export default { }, scrollerClass() { - return !this.$slots.head && !this.topMessage && this.tagShow ? 'default-header' : null + return !this.$slots.head && !this.topMessageInfo && this.tagShow ? 'default-header' : null }, pasteWrapperClass() { @@ -1110,8 +1110,8 @@ export default { return msgPreparedStatus && listPreparedStatus }, - topMessage() { - return this.dialogData?.top_msg_id && this.dialogMsgTops.filter(item => item.dialog_id == this.dialogId)[0] + topMessageInfo() { + return this.dialogData.top_msg_id && this.dialogMsgTops.find(({id}) => id == this.dialogData.top_msg_id) }, topMessageClass() { @@ -1125,7 +1125,7 @@ export default { if (name != 'manage-messenger') { return } - if (params.dialog_id && params.open && (params.open == 'word-chain' || params.open == 'vote')) { + if (params.dialog_id && params.open && ['word-chain', 'vote'].includes(params.open)) { this.$nextTick(_ => { this.$store.state[params.open == 'word-chain' ? 'dialogDroupWordChain' : 'dialogGroupVote'] = { type: 'create', @@ -2739,7 +2739,7 @@ export default { break; case "top": - this.onTop() + this.onTopOperate() break; } }) @@ -3372,18 +3372,12 @@ export default { } }, - onTop() { + onTopOperate() { if (this.operateVisible) { return } - if (this.operateItem?.top_at) { - $A.modalConfirm({ - content: "你确定取消置顶吗?", - cancelText: '取消', - okText: '确定', - loading: true, - onOk: () => this.onTopSubmit(this.operateItem) - }); + if (this.operateItem.top_at) { + this.onCancelTop(this.operateItem) } else { this.onTopSubmit(this.operateItem) } @@ -3409,7 +3403,7 @@ export default { }); // 置顶 if (data.update?.top_msg_id) { - const index = this.dialogMsgs.findIndex(({ id }) => id == data.update.top_msg_id && data.update.top_msg_id); + const index = this.dialogMsgs.findIndex(({ id }) => id == data.update.top_msg_id); if (index > -1) { this.$store.dispatch("saveDialogMsgTop", Object.assign({}, this.dialogMsgs[index])) } @@ -3423,26 +3417,25 @@ export default { }, onPosTop() { - if (!this.topMessage) { + if (!this.topMessageInfo) { return } this.topViewPosLoad = true - this.onPositionId(this.topMessage.id).finally(_ => { + this.onPositionId(this.topMessageInfo.id).finally(_ => { this.topViewPosLoad = false }) }, - onCancelTop() { + onCancelTop(info) { $A.modalConfirm({ content: "你确定取消置顶吗?", cancelText: '取消', okText: '确定', loading: true, - onOk: () => this.onTopSubmit(this.topMessage) + onOk: () => this.onTopSubmit(info) }); }, - getUserApproveStatus() { this.approvaUserStatus = '' if (this.dialogData.type !== 'user' || this.dialogData.bot) { diff --git a/resources/assets/js/pages/manage/components/TaskMove.vue b/resources/assets/js/pages/manage/components/TaskMove.vue index f188c814c..bfb061ed7 100644 --- a/resources/assets/js/pages/manage/components/TaskMove.vue +++ b/resources/assets/js/pages/manage/components/TaskMove.vue @@ -43,7 +43,7 @@
{{ $L('移动后') }}
- {{$L('状态:')}} + {{$L('状态')}}:
- {{$L('负责人:')}} + {{$L('负责人')}}:
- {{$L('协助人:')}} + {{$L('协助人')}}:
item.dialog_id != data.dialog_id) dispatch("saveDialogTodo", resData.todo) } - if (typeof resData.top !== "undefined") { + if ($A.isJson(resData.top)) { dispatch("saveDialogMsgTop", resData.top) } // @@ -3508,10 +3508,8 @@ export default { break; case 'updateTopMsg': // 更新置顶 - if (typeof data.top_msg_id !== "undefined") { - dispatch("saveDialog", { id: data.dialog_id, top_msg_id: data?.top_msg_id || 0 }) - dispatch("getDialogMsgTop", dialog_id) - } + dispatch("saveDialog", {id: data.dialog_id, top_msg_id: data.top_msg_id}) + dispatch("getDialogMsgTop", dialog_id) break; } })(msgDetail); diff --git a/resources/assets/sass/pages/components/dialog-wrapper.scss b/resources/assets/sass/pages/components/dialog-wrapper.scss index ca7081b49..a9d47a553 100644 --- a/resources/assets/sass/pages/components/dialog-wrapper.scss +++ b/resources/assets/sass/pages/components/dialog-wrapper.scss @@ -490,18 +490,20 @@ } .dialog-top-message-btn { - line-height: 42px; - text-align: center; + display: flex; + align-items: center; + justify-content: flex-end; + gap: 10px; padding:0 10px; - .taskfont{ + .taskfont { border-radius: 3px; font-size: 18px; - margin-left: 10px; padding: 4px; } - .common-loading{ - width: 20px; - height: 20px; + .common-pureing { + width: 18px; + height: 18px; + margin: 4px; } } }