|
|
|
@ -6,6 +6,16 @@ import (
|
|
|
|
|
"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 {
|
|
|
|
|
Code string
|
|
|
|
|
Message string
|
|
|
|
@ -49,13 +59,15 @@ func RespList(w http.ResponseWriter, code string, data interface{}, message stri
|
|
|
|
|
w.Write(ret)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
200 OKLoginSuccessVO
|
|
|
|
|
201 Created
|
|
|
|
|
401 Unauthorized
|
|
|
|
|
403 Forbidden
|
|
|
|
|
404 Not Found
|
|
|
|
|
**/
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
func RespOK(w http.ResponseWriter, data interface{}, message string) {
|
|
|
|
|
Resp(w, "SUCCESS", data, message)
|
|
|
|
|
}
|
|
|
|
|