簽名請看:
module aliyun
class aliyunsmsachieve < aliyunsign
def initialize
@send_url = ''.freeze
enddef send_sms(phone_numbers, service_type, code = nil)
# phonenumbers 持對多個手機號碼傳送簡訊,手機號碼之間以英文逗號(,)分隔。上限為1000個
# signname 簡訊簽名名稱
# templatecode 簡訊模板id
# action 系統規定引數。取值:sendsms
# 返回 requestid:請求id, message:狀態碼的描述,code:請求狀態碼,bizid:傳送回執id,可根據該id查詢具體的傳送狀態
param =
if code.present?
if service_type == 'orderend'
code_h = .to_json
else
code_h = .to_json
endparam[:templateparam] = code_h
endkey = @access_key_secret + '&'
options = create_sign_url("post", param, key, 'sms')
result = faraday.post(@send_url, options)
res = json.parse(result.body)
if res["code"] == 'ok'
return true
else
return false
end
end'''
phone_numbers, 逗號隔開
'''def set_phones(phone_numbers)
if phone_numbers.is_a?(array)
phones = phone_numbers.join(',')
else
phones = phone_numbers
endphones
end'''
資訊模板
'''def service_types(type)
types =
types.fetch(type)
endend
end
簡訊傳送倒計時
total_time = 60
send_cannot_click = () ->
obj = $('.account-form-body .send_code')
if total_time == 0
obj.attr('disabled', false)
obj.css('background', '#7ad4cb')
obj.html('傳送驗證碼')
total_time = 60
else
total_time--
obj.html("重新傳送(#s)")
settimeout send_cannot_click, 1000
# 傳送驗證碼
$('.account-form-body .send_code').click ->
# **必須
if $('.account-form-body #user_phone').val() == ''
$('.account-form-body #user_phone').parent().parent().addclass('active')
return false
phone = $('.account-form-body #user_phone').val()
# 需要先填寫驗證碼
if $('.account-form-body #captcha').val() == ''
$('.account-form-body #captcha').parent().parent().addclass('active')
return false
code = $('.account-form-body #captcha').val()
$.ajaxsetup(
})$.post(
'api/***',
,(data) ->
if data.status != 'success'
$('.account-form-body #captcha').next('small').html(data.status)
)$(this).attr('disabled', true)
$(this).css('background', '#2b7069')
send_cannot_click()
C 通過飛信WebService傳送免費簡訊
在上一編文章 c 非同步呼叫飛信webservice實時接收簡訊 的基礎上,再在視窗新增三個控制項如下 加textbox控制項用於輸入目標好友號 命名 tofno。加textbox控制項用於輸入簡訊內容 命名 msgtxt,設此控制項multiline true,使能輸入多行,並拖大些 加一butt...
短報文訊息傳送的模組設計實現
曾接觸到乙個報文傳送的專案,這個專案的報文傳送,雖有報文優先順序,但卻無按照報文優先順序傳送的功能。因此,我便思考了一下,將自己的設計思路發出來,與大家共享。首先明確的是,我所設想的報文傳送是基於 redis的 sortedset 資料儲存結構,之所以可以選擇這個結構是因為每個報文都有不同的id。報...
python 每天定時給女友傳送「土味情話」簡訊
前提 需要一台伺服器,一點點python基礎。目前採用的方法 伺服器定時任務 twilio的簡訊服務 天行資料的土味情話介面 twilio的服務的好處是測試賬號免費給認證號碼發簡訊,而且不需要模板,國內的簡訊服務都需要審核模板,用起來不是十分方便,同樣的 還有nexmo 1,註冊twilio賬號,建...