我想将用户直接重定向到计划订阅页面,选择计划,那么我如何做到这一点。
如果你能告诉我如何从sso中读取参数plan id,这也会有所帮助。
发布于 2018-02-09 16:20:34
要读取计划ID,当您已经可以从应用程序对象访问计划属性时,可以使用以下液体标记:{{ plan | to_param }}。如果您直接从计划订阅页面进行注册,则使用此选项。或者,如果您只想在重定向时维护查询参数中的计划ID,则可以使用application[plan_id]={{plan.id}}。
如果要从外部站点获取计划ID,则需要使用3scale API检索此数据,以便将plan.system_name或plan.id重定向传递到3scale开发人员门户。同样,如果这些计划是相当静态的,那么您可以将它们硬编码到HTML中。
当用户登录到开发人员门户页面时,需要一些自定义的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 Reference documentation,了解有关应用计划删除的更多信息。
https://stackoverflow.com/questions/47056352
复制相似问题