我想将用户直接重定向到选择了计划的计划订阅页面,所以我该怎么做。
如果您能告诉我如何从 sso 读取参数计划 ID,他也会有所帮助。
要读取计划 ID,您可以使用以下 Liquid 标签:{{ plan | to_param }}
当您已经可以从Application对象访问计划属性时。如果您直接从计划订阅页面进行注册,则使用此选项。或者,application[plan_id]={{plan.id}}
如果您只想在重定向时在查询参数中维护计划 ID,则可以使用。
如果您想要来自外部站点的计划 ID,那么您将需要使用 3scale API 来检索此数据,以便可以在重定向中将plan.system_name
orplan.id
传递到 3scale 开发人员门户。同样,如果这些计划是相当静态的,那么您可以将它们硬编码到 HTML 中。
当用户登陆 Developer Portal 页面时,将需要一些自定义 Liquid 来读取查询参数,然后过滤可用的计划:
{% assign params = request.request_uri | split: 'plan_id=' %}
{% param = params[1] %}
{% for service in provider.services %}
{% for plan in service.application_plan %}
{% case plan.id %}
{% when param %}
Some HTML here that renders the subscription form to that plan.
{% endcase %}
{% endfor %}
{% endfor %}
Liquid 非常灵活,因此您可以通过多种方式来做同样的事情。
查看Liquid Reference 文档以获取有关Application Plan Drop的更多信息。