作者 yangfu

修改:用户token校验

package event
import (
"github.com/tiptok/gocomm/xa/eda"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/event/subscriber"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain/event"
)
func InitEventCenter() {
//eda.RegisterSubscribe(&devent.AccessTokenEvent{}, &subscriber.AuthCacheSubscribe{})
//eda.RegisterSubscribe(&devent.RefreshTokenEvent{}, &subscriber.AuthCacheSubscribe{})
eda.RegisterSubscribe(&event.AccessTokenEvent{}, &subscriber.AuthCacheSubscribe{})
eda.RegisterSubscribe(&event.RefreshTokenEvent{}, &subscriber.AuthCacheSubscribe{})
}
... ...
... ... @@ -295,9 +295,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques
}
func CreateUserAuthService(adminType int, transactionContext *transaction.TransactionContext) domain_service_i.UserAuthService {
//if adminType==0{
return domain_service.NewPgAuthService(transactionContext)
//}
//if adminType == int(protocolx.AdminTypeManager) {
// return domain_service.NewPgManagerAuthService(transactionContext)
//}
... ...
... ... @@ -248,23 +248,6 @@ func (svr *PgLoginService) GetJoinWays(partnerCategory []*domain.PartnerCategory
}
return nil
}
//var (
// totalBonus float64
// businessBonus float64
// BusinessBonusRepository, _ = repository.NewBusinessBonusRepository(svr.transactionContext)
//)
//for i := range partnerInfo.PartnerCategoryInfos {
// c := partnerInfo.PartnerCategoryInfos[i]
// switch c.Id {
// case 1:
// totalBonus += bonus
// case 2:
// if one, e := BusinessBonusRepository.FindOne(map[string]interface{}{"partner_id": partnerInfo.Id}); e == nil {
// businessBonus = one.Bonus
// totalBonus += businessBonus
// }
// }
//}
var joinWays []joinWay
for i := range partnerCategory {
c := partnerCategory[i]
... ... @@ -274,11 +257,6 @@ func (svr *PgLoginService) GetJoinWays(partnerCategory []*domain.PartnerCategory
Type: int(c.Id),
Name: c.Name,
}
//if c.Id == 1 {
// item.Percent = computeBonusPercent(totalBonus, bonus) * 100
//} else if c.Id == 2 {
// item.Percent = computeBonusPercent(totalBonus, businessBonus) * 100
//}
joinWays = append(joinWays, item)
}
}
... ...
... ... @@ -12,6 +12,6 @@ func init() {
beego.InsertFilter("/*", beego.BeforeExec, middleware.CreateRequstLogFilter(Logger))
beego.InsertFilter("/*", beego.AfterExec, middleware.CreateResponseLogFilter(Logger), false)
//beego.InsertFilter("/v1/*", beego.BeforeExec, middleware.CheckJWTToken)
//beego.InsertFilter("/v2/*", beego.BeforeExec, middleware.CheckJWTToken)
beego.InsertFilter("/v1/*", beego.BeforeExec, middleware.CheckJWTToken)
beego.InsertFilter("/v2/*", beego.BeforeExec, middleware.CheckJWTToken)
}
... ...