|
|
@ -6,6 +6,16 @@ import (
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 通过json tag 进行结构体赋值
|
|
|
|
|
|
|
|
func SwapToStruct(req, target interface{}) (err error) {
|
|
|
|
|
|
|
|
dataByte, err := json.Marshal(req)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
err = json.Unmarshal(dataByte, target)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type H struct {
|
|
|
|
type H struct {
|
|
|
|
Code string
|
|
|
|
Code string
|
|
|
|
Message string
|
|
|
|
Message string
|
|
|
@ -49,13 +59,15 @@ func RespList(w http.ResponseWriter, code string, data interface{}, message stri
|
|
|
|
w.Write(ret)
|
|
|
|
w.Write(ret)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/*
|
|
|
|
|
|
|
|
*
|
|
|
|
200 OKLoginSuccessVO
|
|
|
|
200 OKLoginSuccessVO
|
|
|
|
201 Created
|
|
|
|
201 Created
|
|
|
|
401 Unauthorized
|
|
|
|
401 Unauthorized
|
|
|
|
403 Forbidden
|
|
|
|
403 Forbidden
|
|
|
|
404 Not Found
|
|
|
|
404 Not Found
|
|
|
|
**/
|
|
|
|
*
|
|
|
|
|
|
|
|
*/
|
|
|
|
func RespOK(w http.ResponseWriter, data interface{}, message string) {
|
|
|
|
func RespOK(w http.ResponseWriter, data interface{}, message string) {
|
|
|
|
Resp(w, "SUCCESS", data, message)
|
|
|
|
Resp(w, "SUCCESS", data, message)
|
|
|
|
}
|
|
|
|
}
|
|
|
|