Module: Wireway::Spark

Defined in:
app/models/wireway/spark.rb

Class Method Summary collapse

Class Method Details

.method_missing(method_name, local: true, **args) ⇒ Object

Wireway::Spark.dashboard(api_code: :publish_other_request_assets, rely_assets: ["bootstrap_4", "jQuery_3_5_1", "chart_js"]) Wireway::Spark.satcom(api_code: :finance_fund_base_info, code: '161725') Wireway::BusinessLogic::Restful::node_addresses Wireway::Spark.wireway(platform: :satcom, api_code: :finance_fund_base_info, code: '161725')



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/models/wireway/spark.rb', line 8

def self.method_missing(method_name, local: true, **args)
  begin
    target = Wireway::BusinessLogic::Restful
    return [false, '未找到相关定义方法'] unless target.respond_to?(method_name)
    res = target.send(method_name, args)
  rescue
    error_msg = [false, '请求异常', {errors: {message: $!.to_s, path: $@}}]
    return error_msg unless [true, 'true', 1, '1', 'yes'].include?(local)
    # 当以Gem形式的组件无法处理请求时,尝试请求线上版组件是否可以正常处理请求
    # 即当gem出现问题时会请求线上服务 有利于断点排查
    args.merge!(platform: method_name)
    res = target.wireway(args)
  end
end