短信发送测试通过

This commit is contained in:
guange 2017-03-13 11:40:07 +08:00
parent 606e431396
commit 981a191b05
2 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,7 @@ module Trustie
def self.sendYunpian(mobile, code)
#修改为您的apikey.可在官网http://www.yunpian.com)登录后用户中心首页看到
apikey = '21fe1680cb994616fd86f678a7022402'
apikey = '2affbf2ff83f9810512622ec83bccd4f'
#指定模板发送接口HTTP地址
send_tpl_sms_uri = URI.parse('https://sms.yunpian.com/v2/sms/tpl_single_send.json')
@ -32,8 +32,8 @@ module Trustie
#设置模板ID如使用1号模板:【#company#】您的验证码是#code#
#设置对应的模板变量值
params['tpl_id'] = 1733172
params['tpl_value'] = URI::escape('#code#')+'='+URI::escape(code)+'&'+URI::escape('#app#')+'='+URI::escape('确实')
params['tpl_id'] = 1733594
params['tpl_value'] = URI::escape('#code#')+'='+URI::escape(code)
response = Net::HTTP.post_form(send_tpl_sms_uri,params)
ActiveSupport::JSON.decode(response.body)
end

View File

@ -6,7 +6,7 @@ require 'rails_helper'
describe "短信发送" do
it "可以成功发送,当参数正确时" do
status = Trustie::Sms.send(mobile: "15607313800", code: '1234')
status = Trustie::Sms.send(mobile: "15388083362", code: '1234')
expect(status).to be true
end