|
@@ -27,12 +27,12 @@ var R = &r{}
|
|
|
type M map[string]interface{}
|
|
|
type r struct{}
|
|
|
|
|
|
-//校验是否缺少请求参数
|
|
|
+// 校验是否缺少请求参数
|
|
|
func (r *r) CheckReqParam(w http.ResponseWriter, req *http.Request, keys ...string) bool {
|
|
|
msg := Error_msg_1002
|
|
|
array := []string{}
|
|
|
for _, v := range keys {
|
|
|
- if len(req.Form[v]) > 0 {
|
|
|
+ if len(req.FormValue(v)) > 0 {
|
|
|
continue
|
|
|
}
|
|
|
array = append(array, v)
|
|
@@ -49,7 +49,7 @@ func (r *r) CheckReqParam(w http.ResponseWriter, req *http.Request, keys ...stri
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
-//无效参数
|
|
|
+// 无效参数
|
|
|
func (r *r) InvalidReqParam(w http.ResponseWriter, req *http.Request, args ...string) string {
|
|
|
msg := Error_msg_1003 + strings.Join(args, ",")
|
|
|
r.ServeJson(w, req, &Result{
|
|
@@ -60,7 +60,7 @@ func (r *r) InvalidReqParam(w http.ResponseWriter, req *http.Request, args ...st
|
|
|
return msg
|
|
|
}
|
|
|
|
|
|
-//没有权限
|
|
|
+// 没有权限
|
|
|
func (r *r) NoPermissionReq(w http.ResponseWriter, req *http.Request, args ...string) string {
|
|
|
msg := Error_msg_1004
|
|
|
if len(args) >= 0 {
|
|
@@ -100,7 +100,7 @@ func NewResult(data interface{}, err error) Result {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//接口统一返回值
|
|
|
+// 接口统一返回值
|
|
|
type Result struct {
|
|
|
Error_code int `json:"error_code"`
|
|
|
Error_msg string `json:"error_msg"`
|