作者 tangxuhui
... ... @@ -58,7 +58,7 @@ func (repository *LoginAccessRepository) Save(loginAccess *domain.LoginAccess) (
&loginAccess.CreatedTime,
&loginAccess.UpdatedTime,
),
fmt.Sprintf("INSERT INTO login_accesss (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
fmt.Sprintf("INSERT INTO login_access (%s) VALUES (%s) RETURNING %s", insertFieldsSnippet, insertPlaceHoldersSnippet, returningFieldsSnippet),
loginAccess.Account,
loginAccess.Platform,
loginAccess.CompanyId,
... ... @@ -86,7 +86,7 @@ func (repository *LoginAccessRepository) Save(loginAccess *domain.LoginAccess) (
&loginAccess.CreatedTime,
&loginAccess.UpdatedTime,
),
fmt.Sprintf("UPDATE login_accesss SET %s WHERE login_access_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
fmt.Sprintf("UPDATE login_access SET %s WHERE login_access_id=? RETURNING %s", updateFieldsSnippet, returningFieldsSnippet),
loginAccess.Account,
loginAccess.Platform,
loginAccess.CompanyId,
... ...
... ... @@ -32,7 +32,7 @@ func init() {
}
filters.SecureKeyMap["token"] = "x-mmm-accesstoken"
web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors())
web.InsertFilter("/*", web.BeforeExec, filters.CreateRequstLogFilter(log.Logger))
web.InsertFilter("/*", web.BeforeRouter, filters.CreateRequstLogFilter(log.Logger))
web.InsertFilter("/*", web.AfterExec, filters.CreateResponseLogFilter(log.Logger), web.WithReturnOnOutput(false))
web.InsertFilter("/v1/app11/*", web.BeforeExec, filters.SecureHandler(
filters.WithEnableCheckTimestamp(false),
... ...
package mobile_client
import (
"github.com/linmadan/egglib-go/utils/json"
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type baseController struct {
... ... @@ -39,8 +41,11 @@ func (controller *baseController) GetOrgId() int64 {
func (controller *baseController) GetOperator() domain.Operator {
token := controller.Ctx.Input.Header("X-Mmm-Accesstoken")
loginToken := &domain.LoginToken{}
loginToken.ParseToken(token)
return domain.Operator{
err := loginToken.ParseToken(token)
if err != nil {
log.Logger.Error(err.Error())
}
op := domain.Operator{
UserId: loginToken.UserId,
CompanyId: loginToken.CompanyId,
OrgId: loginToken.OrgId,
... ... @@ -48,4 +53,7 @@ func (controller *baseController) GetOperator() domain.Operator {
Phone: loginToken.Account,
Token: token,
}
// TODO:打印测试日志
log.Logger.Debug("operator " + json.MarshalToString(op))
return op
}
... ...