3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/models/wireway/spark.rb', line 3
def self.method_missing(method_name, local: true, **args)
begin
target = Wireway::BusinessLogic::Restful
unless [true, 'true', 1, '1', 'yes'].include?(local)
return [false, "未找到名称为:#{method_name}的方法定义."] unless target.respond_to?(method_name)
end
res = target.send(method_name, args)
rescue
error_msg = [false, '[Wireway]请求异常', {errors: {message: $!.to_s, path: $@}}]
return error_msg unless [true, 'true', 1, '1', 'yes'].include?(local)
args.merge!(platform: method_name)
res = target.wireway(args)
end
end
|