This commit is contained in:
孟帅
2023-05-10 23:54:50 +08:00
parent bbe655a4d8
commit 49a96750bf
314 changed files with 15138 additions and 6244 deletions

View File

@@ -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)
}