二维码过期改为一个月有效期
This commit is contained in:
parent
3c36e97ff1
commit
5c0468f8fd
|
@ -495,7 +495,7 @@ class Course < ActiveRecord::Base
|
|||
def generate_qrcode
|
||||
ticket = self.qrcode
|
||||
if !ticket || ticket.size < 10
|
||||
response = Wechat.api.qrcode_create_scene(invite_code)
|
||||
response = Wechat.api.qrcode_create_scene(invite_code, 2592000)
|
||||
logger.debug "response = #{response}"
|
||||
self.qrcode = response['ticket']
|
||||
save! && reload
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
class RenewQrcode < ActiveRecord::Migration
|
||||
def up
|
||||
Course.update_all(:qrcode => '')
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160630112733) do
|
||||
ActiveRecord::Schema.define(:version => 20160708091258) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -562,9 +562,9 @@ ActiveRecord::Schema.define(:version => 20160630112733) do
|
|||
t.integer "excellent_option", :default => 0
|
||||
t.integer "is_copy", :default => 0
|
||||
t.integer "visits", :default => 0
|
||||
t.integer "syllabus_id"
|
||||
t.string "invite_code"
|
||||
t.string "qrcode"
|
||||
t.integer "syllabus_id"
|
||||
end
|
||||
|
||||
add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true
|
||||
|
|
Loading…
Reference in New Issue