|
|
package controllers
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"crypto/sha256"
|
|
|
"encoding/hex"
|
|
|
"fmt"
|
|
|
"github.com/astaxie/beego"
|
|
|
"github.com/astaxie/beego/context"
|
|
|
"github.com/astaxie/beego/validation"
|
|
|
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/ability/protocol"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/ability/services/auth"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/gocomm/common"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/mybeego"
|
|
|
"strconv"
|
|
|
|
|
|
//"strconv"
|
|
|
"strings"
|
|
|
"github.com/astaxie/beego"
|
|
|
"github.com/astaxie/beego/context"
|
|
|
"github.com/astaxie/beego/validation"
|
|
|
)
|
|
|
|
|
|
type BaseController struct {
|
...
|
...
|
@@ -41,7 +41,6 @@ func (this *BaseController)Valid(obj interface{})(result bool ,msg *mybeego.Mess |
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//GenMessage genarate a response message
|
|
|
func (this *BaseController)GenMessage(rsp interface{},err error)*mybeego.Message{
|
|
|
var msg *mybeego.Message
|
...
|
...
|
@@ -50,7 +49,7 @@ func (this *BaseController)GenMessage(rsp interface{},err error)*mybeego.Message |
|
|
msg.Data = rsp
|
|
|
return msg
|
|
|
}
|
|
|
log.Error(err)
|
|
|
//log.Error(err)
|
|
|
if e,ok :=err.(common.Error);ok{
|
|
|
msg = mybeego.NewMessage(e.Code)
|
|
|
msg.Data = rsp
|
...
|
...
|
@@ -59,7 +58,7 @@ func (this *BaseController)GenMessage(rsp interface{},err error)*mybeego.Message |
|
|
msg = mybeego.NewMessage(1)
|
|
|
return msg
|
|
|
}
|
|
|
|
|
|
//获取请求头信息
|
|
|
func GetRequestHeader(ctx *context.Context)*protocol.RequestHeader{
|
|
|
h :=&protocol.RequestHeader{}
|
|
|
h.AccessToken = ctx.Input.Header("x-mmm-accesstoken")
|
...
|
...
|
@@ -72,6 +71,7 @@ func GetRequestHeader(ctx *context.Context)*protocol.RequestHeader{ |
|
|
return h
|
|
|
}
|
|
|
|
|
|
//过滤器
|
|
|
func FilterComm(ctx *context.Context){
|
|
|
if strings.HasSuffix(ctx.Request.RequestURI,"login"){
|
|
|
return
|
...
|
...
|
|