作者 yangfu

日志添加

1 package mobile_client 1 package mobile_client
2 2
3 import ( 3 import (
  4 + "github.com/linmadan/egglib-go/utils/json"
4 "github.com/linmadan/egglib-go/web/beego" 5 "github.com/linmadan/egglib-go/web/beego"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
6 ) 8 )
7 9
8 type baseController struct { 10 type baseController struct {
@@ -39,8 +41,11 @@ func (controller *baseController) GetOrgId() int64 { @@ -39,8 +41,11 @@ func (controller *baseController) GetOrgId() int64 {
39 func (controller *baseController) GetOperator() domain.Operator { 41 func (controller *baseController) GetOperator() domain.Operator {
40 token := controller.Ctx.Input.Header("X-Mmm-Accesstoken") 42 token := controller.Ctx.Input.Header("X-Mmm-Accesstoken")
41 loginToken := &domain.LoginToken{} 43 loginToken := &domain.LoginToken{}
42 - loginToken.ParseToken(token)  
43 - return domain.Operator{ 44 + err := loginToken.ParseToken(token)
  45 + if err != nil {
  46 + log.Logger.Error(err.Error())
  47 + }
  48 + op := domain.Operator{
44 UserId: loginToken.UserId, 49 UserId: loginToken.UserId,
45 CompanyId: loginToken.CompanyId, 50 CompanyId: loginToken.CompanyId,
46 OrgId: loginToken.OrgId, 51 OrgId: loginToken.OrgId,
@@ -48,4 +53,7 @@ func (controller *baseController) GetOperator() domain.Operator { @@ -48,4 +53,7 @@ func (controller *baseController) GetOperator() domain.Operator {
48 Phone: loginToken.Account, 53 Phone: loginToken.Account,
49 Token: token, 54 Token: token,
50 } 55 }
  56 + // TODO:打印测试日志
  57 + log.Logger.Debug("operator " + json.MarshalToString(op))
  58 + return op
51 } 59 }