作者 yangfu

修改:用户token校验

1 package event 1 package event
2 2
  3 +import (
  4 + "github.com/tiptok/gocomm/xa/eda"
  5 + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/event/subscriber"
  6 + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain/event"
  7 +)
  8 +
3 func InitEventCenter() { 9 func InitEventCenter() {
4 - //eda.RegisterSubscribe(&devent.AccessTokenEvent{}, &subscriber.AuthCacheSubscribe{})  
5 - //eda.RegisterSubscribe(&devent.RefreshTokenEvent{}, &subscriber.AuthCacheSubscribe{}) 10 + eda.RegisterSubscribe(&event.AccessTokenEvent{}, &subscriber.AuthCacheSubscribe{})
  11 + eda.RegisterSubscribe(&event.RefreshTokenEvent{}, &subscriber.AuthCacheSubscribe{})
6 } 12 }
@@ -295,9 +295,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques @@ -295,9 +295,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques
295 } 295 }
296 296
297 func CreateUserAuthService(adminType int, transactionContext *transaction.TransactionContext) domain_service_i.UserAuthService { 297 func CreateUserAuthService(adminType int, transactionContext *transaction.TransactionContext) domain_service_i.UserAuthService {
298 - //if adminType==0{  
299 return domain_service.NewPgAuthService(transactionContext) 298 return domain_service.NewPgAuthService(transactionContext)
300 - //}  
301 //if adminType == int(protocolx.AdminTypeManager) { 299 //if adminType == int(protocolx.AdminTypeManager) {
302 // return domain_service.NewPgManagerAuthService(transactionContext) 300 // return domain_service.NewPgManagerAuthService(transactionContext)
303 //} 301 //}
@@ -248,23 +248,6 @@ func (svr *PgLoginService) GetJoinWays(partnerCategory []*domain.PartnerCategory @@ -248,23 +248,6 @@ func (svr *PgLoginService) GetJoinWays(partnerCategory []*domain.PartnerCategory
248 } 248 }
249 return nil 249 return nil
250 } 250 }
251 - //var (  
252 - // totalBonus float64  
253 - // businessBonus float64  
254 - // BusinessBonusRepository, _ = repository.NewBusinessBonusRepository(svr.transactionContext)  
255 - //)  
256 - //for i := range partnerInfo.PartnerCategoryInfos {  
257 - // c := partnerInfo.PartnerCategoryInfos[i]  
258 - // switch c.Id {  
259 - // case 1:  
260 - // totalBonus += bonus  
261 - // case 2:  
262 - // if one, e := BusinessBonusRepository.FindOne(map[string]interface{}{"partner_id": partnerInfo.Id}); e == nil {  
263 - // businessBonus = one.Bonus  
264 - // totalBonus += businessBonus  
265 - // }  
266 - // }  
267 - //}  
268 var joinWays []joinWay 251 var joinWays []joinWay
269 for i := range partnerCategory { 252 for i := range partnerCategory {
270 c := partnerCategory[i] 253 c := partnerCategory[i]
@@ -274,11 +257,6 @@ func (svr *PgLoginService) GetJoinWays(partnerCategory []*domain.PartnerCategory @@ -274,11 +257,6 @@ func (svr *PgLoginService) GetJoinWays(partnerCategory []*domain.PartnerCategory
274 Type: int(c.Id), 257 Type: int(c.Id),
275 Name: c.Name, 258 Name: c.Name,
276 } 259 }
277 - //if c.Id == 1 {  
278 - // item.Percent = computeBonusPercent(totalBonus, bonus) * 100  
279 - //} else if c.Id == 2 {  
280 - // item.Percent = computeBonusPercent(totalBonus, businessBonus) * 100  
281 - //}  
282 joinWays = append(joinWays, item) 260 joinWays = append(joinWays, item)
283 } 261 }
284 } 262 }
@@ -12,6 +12,6 @@ func init() { @@ -12,6 +12,6 @@ func init() {
12 beego.InsertFilter("/*", beego.BeforeExec, middleware.CreateRequstLogFilter(Logger)) 12 beego.InsertFilter("/*", beego.BeforeExec, middleware.CreateRequstLogFilter(Logger))
13 beego.InsertFilter("/*", beego.AfterExec, middleware.CreateResponseLogFilter(Logger), false) 13 beego.InsertFilter("/*", beego.AfterExec, middleware.CreateResponseLogFilter(Logger), false)
14 14
15 - //beego.InsertFilter("/v1/*", beego.BeforeExec, middleware.CheckJWTToken)  
16 - //beego.InsertFilter("/v2/*", beego.BeforeExec, middleware.CheckJWTToken) 15 + beego.InsertFilter("/v1/*", beego.BeforeExec, middleware.CheckJWTToken)
  16 + beego.InsertFilter("/v2/*", beego.BeforeExec, middleware.CheckJWTToken)
17 } 17 }