|
@@ -38,25 +38,25 @@ func (this *BaseAuthController) Prepare() {
|
|
|
uri := this.Ctx.Input.URI()
|
|
|
fmt.Println("Url:", uri)
|
|
|
if method != "HEAD" {
|
|
|
- //if method == "POST" {
|
|
|
- // authorization := this.Ctx.Input.Header("authorization")
|
|
|
- // if authorization == "" {
|
|
|
- // this.JSON(models.BaseResponse{Ret: 408, Msg: "请重新授权!", ErrMsg: "请重新授权:authorization is empty "}, false, false)
|
|
|
- // this.StopRun()
|
|
|
- // return
|
|
|
- // }
|
|
|
- // checkAuthorization := utils.MD5(utils.APP_NAME_EN + utils.Md5Key)
|
|
|
- // fmt.Println(checkAuthorization)
|
|
|
- // if authorization != checkAuthorization {
|
|
|
- // this.JSON(models.BaseResponse{Ret: 408, Msg: "签名错误!", ErrMsg: "签名错误:authorization is err "}, false, false)
|
|
|
- // this.StopRun()
|
|
|
- // return
|
|
|
- // }
|
|
|
- //} else {
|
|
|
- // this.JSON(models.BaseResponse{Ret: 408, Msg: "请求异常,请联系客服!", ErrMsg: "POST之外的请求,暂不支持"}, false, false)
|
|
|
- // this.StopRun()
|
|
|
- // return
|
|
|
- //}
|
|
|
+ if method == "POST" {
|
|
|
+ authorization := this.Ctx.Input.Header("authorization")
|
|
|
+ if authorization == "" {
|
|
|
+ this.JSON(models.BaseResponse{Ret: 408, Msg: "请重新授权!", ErrMsg: "请重新授权:authorization is empty "}, false, false)
|
|
|
+ this.StopRun()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ checkAuthorization := utils.MD5(utils.APP_NAME_EN + utils.Md5Key)
|
|
|
+ fmt.Println(checkAuthorization)
|
|
|
+ if authorization != checkAuthorization {
|
|
|
+ this.JSON(models.BaseResponse{Ret: 408, Msg: "签名错误!", ErrMsg: "签名错误:authorization is err "}, false, false)
|
|
|
+ this.StopRun()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.JSON(models.BaseResponse{Ret: 408, Msg: "请求异常,请联系客服!", ErrMsg: "POST之外的请求,暂不支持"}, false, false)
|
|
|
+ this.StopRun()
|
|
|
+ return
|
|
|
+ }
|
|
|
} else {
|
|
|
this.JSON(models.BaseResponse{Ret: 408, Msg: "请求异常,请联系客服!", ErrMsg: "method:" + method}, false, false)
|
|
|
this.StopRun()
|