$params['title'], 'content' => $params['content'], 'from_uid' => $params['from_uid'], 'to_uid' => $params['to_uid'], 'read_time' => $params['read_time'], 'create_time' => $params['create_time'] ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 编辑系统消息 * @param array $params * @return bool * @author likeadmin * @date 2024/05/29 14:04 */ public static function edit(array $params): bool { Db::startTrans(); try { OaMessage::where('id', $params['id'])->update([ 'title' => $params['title'], 'content' => $params['content'], 'from_uid' => $params['from_uid'], 'to_uid' => $params['to_uid'], 'read_time' => $params['read_time'], 'create_time' => $params['create_time'] ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 删除系统消息 * @param array $params * @return bool * @author likeadmin * @date 2024/05/29 14:04 */ public static function delete(array $params): bool { return OaMessage::destroy($params['id']); } /** * @notes 获取系统消息详情 * @param $params * @return array * @author likeadmin * @date 2024/05/29 14:04 */ public static function detail($params): array { $data = OaMessage::findOrEmpty($params['id']); $data['to_user_name'] = Admin::where('id',$data['to_uid'])->value('name'); OaMessage::where('id',$params['id'])->update(['read_time'=>time()]); return $data->toArray(); } }