MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / Pass

Method Pass

module/subscribe/iml.go:413–453  ·  view source on GitHub ↗
(ctx context.Context, pid string, id string, approveInfo *subscribe_dto.Approve)

Source from the content-addressed store, hash-verified

411}
412
413func (i *imlSubscribeApprovalModule) Pass(ctx context.Context, pid string, id string, approveInfo *subscribe_dto.Approve) error {
414 applyInfo, err := i.subscribeApplyService.Get(ctx, id)
415 if err != nil {
416 return err
417 }
418
419 return i.transaction.Transaction(ctx, func(ctx context.Context) error {
420 userID := utils.UserId(ctx)
421 status := subscribe.ApplyStatusSubscribe
422 err = i.subscribeApplyService.Save(ctx, id, &subscribe.EditApply{
423 Opinion: &approveInfo.Opinion,
424 Status: &status,
425 Approver: &userID,
426 })
427 if err != nil {
428 return err
429 }
430 err = i.subscribeService.UpdateSubscribeStatus(ctx, applyInfo.Application, applyInfo.Service, status)
431 if err != nil {
432 return err
433 }
434 cs, err := i.clusterService.List(ctx)
435 if err != nil {
436 return err
437 }
438 for _, c := range cs {
439
440 err := i.onlineSubscriber(ctx, c.Uuid, &gateway.SubscribeRelease{
441 Service: applyInfo.Service,
442 Application: applyInfo.Application,
443 Expired: "0",
444 })
445
446 if err != nil {
447 log.Warnf("online subscriber for cluster[%s] %v", c.Uuid, err)
448
449 }
450 }
451 return nil
452 })
453}
454func (i *imlSubscribeApprovalModule) onlineSubscriber(ctx context.Context, clusterId string, sub *gateway.SubscribeRelease) error {
455 client, err := i.clusterService.GatewayClient(ctx, clusterId)
456 if err != nil {

Callers

nothing calls this directly

Calls 5

onlineSubscriberMethod · 0.95
GetMethod · 0.65
SaveMethod · 0.65
UpdateSubscribeStatusMethod · 0.65
ListMethod · 0.65

Tested by

no test coverage detected