Skip to content

Commit 1d5e416

Browse files
committed
添加SendData接口
1 parent 067898e commit 1d5e416

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

http/server/common.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ func SendErrorDetail(w http.ResponseWriter, status int, data interface{}, f stri
112112
}
113113

114114
//SendRows 为bootstrap-talbe返回结果,根据条件查找,total是总记录数,rows是数据
115-
func SendRows(w http.ResponseWriter, total int64, data interface{}) {
115+
func SendRows(w http.ResponseWriter, total interface{}, data interface{}) {
116116
var resp = struct {
117-
Total int64 `json:"total"`
117+
Total interface{} `json:"total"`
118118
Rows interface{} `json:"rows"`
119119
}{total, data}
120120

@@ -123,6 +123,13 @@ func SendRows(w http.ResponseWriter, total int64, data interface{}) {
123123
w.Write(buf)
124124
}
125125

126+
//SendData 为bootstrap-talbe客户端分页返回结果.
127+
func SendData(w http.ResponseWriter, data interface{}) {
128+
w.Header().Add("Content-Type", "application/json")
129+
buf, _ := json.Marshal(data)
130+
w.Write(buf)
131+
}
132+
126133
//SendResponseOK 返回成功结果.
127134
func SendResponseOK(w http.ResponseWriter) {
128135
w.Header().Add("Content-Type", "application/json")

0 commit comments

Comments
 (0)