mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-10-13 13:33:44 +08:00
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package response
|
||||
|
||||
import (
|
||||
@@ -27,7 +26,6 @@ func JsonExit(r *ghttp.Request, code int, message string, data ...interface{}) {
|
||||
// @param code 状态码(200:成功,302跳转,和http请求状态码一至)
|
||||
// @param message 请求结果信息
|
||||
// @param data 请求结果,根据不同接口返回结果的数据结构不同
|
||||
//
|
||||
func RJson(r *ghttp.Request, code int, message string, data ...interface{}) {
|
||||
responseData := interface{}(nil)
|
||||
if len(data) > 0 {
|
||||
@@ -84,3 +82,12 @@ func Redirect(r *ghttp.Request, location string, code ...int) {
|
||||
func Download(r *ghttp.Request, location string, code ...int) {
|
||||
r.Response.ServeFileDownload("test.txt")
|
||||
}
|
||||
|
||||
// RText 返回成功文本
|
||||
func RText(r *ghttp.Request, message string) {
|
||||
// 清空响应
|
||||
r.Response.ClearBuffer()
|
||||
|
||||
// 写入响应
|
||||
r.Response.Write(message)
|
||||
}
|
||||
|
Reference in New Issue
Block a user