|
|
|
@ -28,6 +28,8 @@ module Educoder
|
|
|
|
|
def self.sendYunpian(mobile, code, send_type, name, user_name, result)
|
|
|
|
|
#修改为您的apikey.可在官网(http://www.yunpian.com)登录后用户中心首页看到
|
|
|
|
|
apikey = EduSetting.get('sms_apikey')
|
|
|
|
|
Rails.logger.info("#####apikey: #{apikey}")
|
|
|
|
|
Rails.logger.info("#####mobile: #{mobile}")
|
|
|
|
|
#指定模板发送接口HTTP地址
|
|
|
|
|
send_tpl_sms_uri = URI.parse('https://sms.yunpian.com/v2/sms/single_send.json')
|
|
|
|
|
|
|
|
|
@ -70,6 +72,7 @@ module Educoder
|
|
|
|
|
response = http.start { |http| http.request(request) }
|
|
|
|
|
ActiveSupport::JSON.decode(response.body)
|
|
|
|
|
rescue =>err
|
|
|
|
|
Rails.logger.error("#############sendYunpian_error: #{err.message}")
|
|
|
|
|
return nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|