You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: notice.go
    path of file: ./repos/studygolang/internal/http/middleware
    
    the code of the file until where you have to start completion: // Copyright 2017 The StudyGolang Authors. All rights reserved.
// Use of this source code is gove
    
func PublishNotice() echo.MiddlewareFunc {
	return func(next echo.HandlerFunc) echo.HandlerFunc {
		return func(ctx echo.Context) error {
			if err := next(ctx); err != nil {
				return err
			}

			curUser := ctx.Get("user").(*model.Me)
			if curUser.IsRoot {
				return nil
			}

			title := ctx.FormValue("title")
			content := ctx.FormValue("content")
			if ctx.Request().Method == "POST" && (title != "" || content != "") {
				requestURI := ctx.Request().RequestURI
				go func() {
					user := logic.DefaultUser.FindOne(context.EchoContext(ctx), "is_root", 1)
					if user.Uid == 0 {
						return
					}

					content = fmt.Sprintf("URI:%s<br/><h1>标题：%s</h1><br/>内容：%s", requestURI, title, content)
					logic.DefaultEmail.SendMail("网站有新内容产生", content, []string{user.Email})
				}()
			}

			return nil
		}
	}
}