總結一下用到的學到的東西
瞭解了一下接口文檔
post數據格式
{"touser":["openid",.....]
"msgtype":"text"
"text":{"content":"hello"}
}
返回數據
{"errcode":0
"errmsg":"錯誤消息"
"msg_id":34128
}
ACTIVE_PUSH_MP_MESSAGE = "https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token=%s"
url = ACTIVE_PUSH_MP_MESSAGE % access_token
通過%access_token 來替換%s
不同的接口對應不同的url,這個url由微信公衆平臺提供。
action中的對象active_push_message = ActivePushMessages.new
result = active_push_message.send_message(open_ids)調用model中的方法send_message
這個時候保存active_push_message時直接在model中save一下即可保存
User.create(:name => name) 與 User.create(name :name)功能相同
indexOf() 方法可返回某個指定的字符串值在字符串中首次出現的位置。
例如a = ["123","345","456"]
a.indexOf("345") = 1, 此處爲數組的下標
.tooltip()方法(算是鼠標到那個區域頁面懸浮顯示一個提示信息欄)
1. $("#myform :input").tooltip()//該方法能採用默認方法顯示提示信息欄
2. $("#myform :input").tooltip({config object}) //該方法通過配置對象將來靈活組織提示信息欄的顯示。
.tooltip方法詳解連接
http://www.jb51.net/article/19368.htm
jQuary.inArroy()方法用來查找數組中是否包含某個元素,若最終判斷是否存在即布爾值可用_.some方法代替,若查找具體數據可用find或filter代替