Browse Source

product package function develop--order base detail add send

abiao 4 years ago
parent
commit
708c3cb708
1 changed files with 12 additions and 1 deletions
  1. 12 1
      app/models/wx_user.rb

+ 12 - 1
app/models/wx_user.rb

@@ -16,7 +16,18 @@ class WxUser < ActiveRecord::Base
   validates_presence_of :nickname, :unionid
   #belongs_to :channel_qrcode
   attr_accessor :invite, :v_head, :intro_user
-
+  before_save :up_wxuser_relation
+  def up_wxuser_relation
+    wxUser = WxUser.where("id = ?", self.id).first
+    if !wxUser.blank?
+      if wxUser.invite_id != self.invite_id
+        #修改下属会员推荐关系
+        url = "#{CONFIG_FILE["app_host"]}/v1/cron/comb_three_user"
+        p url
+        open(url)
+      end
+    end
+  end
   SEX_ENUM= [["未知","0"], ["男性","1"], ["女性", "2"]]
   DEPART_ENUM= [["部门1",1], ["部门2",2], ["部门3", 3], ["部门4", 4], ["部门5", 5]]