Commit 24dd1692 by kevin

add oem sign name

parent d21d1c39
...@@ -18,9 +18,13 @@ def redis ...@@ -18,9 +18,13 @@ def redis
end end
end end
def load_config def load_config(oem_sign_name=nil)
if defined? ::Rails if defined? ::Rails
@sms_config ||= HashWithIndifferentAccess.new(YAML.load_file("#{::Rails.root}/config/sms.yml")[::Rails.env] || {}) @sms_config ||= HashWithIndifferentAccess.new(YAML.load_file("#{::Rails.root}/config/sms.yml")[::Rails.env] || {})
# 短信签名 根据OEM品牌名筛选
@sms_config[:taobao][:sms_free_sign_name] = oem_sign_name if oem_sign_name.present? && @sms_config.present?
@sms_config
else else
{} {}
end end
...@@ -52,9 +56,11 @@ class SmsSender ...@@ -52,9 +56,11 @@ class SmsSender
end end
def extend_attrs def extend_attrs
return unless load_config.present? _load_config = load_config(attrs[:oem_sign_name])
return unless _load_config.present?
self.source_config = load_config[attrs[:source]] self.source_config = _load_config[attrs[:source]]
return unless source_config.present? return unless source_config.present?
self.attrs = source_config.merge(attrs) self.attrs = source_config.merge(attrs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment