|
@@ -3,7 +3,17 @@ class LiveAward < ActiveRecord::Base
|
|
|
self.table_name = "live_awards"
|
|
self.table_name = "live_awards"
|
|
|
validates :openid, presence: true
|
|
validates :openid, presence: true
|
|
|
belongs_to :wx_user, :foreign_key => :wx_user_id
|
|
belongs_to :wx_user, :foreign_key => :wx_user_id
|
|
|
|
|
+ after_create :update_user_info
|
|
|
|
|
|
|
|
|
|
+ def update_user_info
|
|
|
|
|
+ # 找出会员
|
|
|
|
|
+ wxUser = WxUser.where("openid = ?", self.openid).first
|
|
|
|
|
+ if !wxUser.blank?
|
|
|
|
|
+ self.wx_user_id=wxUser.id
|
|
|
|
|
+ self.save
|
|
|
|
|
+ end
|
|
|
|
|
+
|
|
|
|
|
+ end
|
|
|
|
|
|
|
|
def prodcut1
|
|
def prodcut1
|
|
|
prd1 = Product.where("id = ?", self.prod1).first
|
|
prd1 = Product.where("id = ?", self.prod1).first
|