Browse Source

remove redis connection

abiao 5 years ago
parent
commit
53e982c7d3
4 changed files with 1 additions and 38 deletions
  1. 1 1
      app/models/order.rb
  2. 0 10
      app/models/product.rb
  3. 0 10
      app/models/user.rb
  4. 0 17
      app/models/wx_user.rb

+ 1 - 1
app/models/order.rb

@@ -9,7 +9,7 @@ class Order < ActiveRecord::Base
     belongs_to :wx_user, :foreign_key => :wx_user_id
     has_many :order_details
     before_save :before_save
-    after_update :after_update
+    #after_update :after_update
 
     def before_save
         if self.express_company.length>0

+ 0 - 10
app/models/product.rb

@@ -7,7 +7,6 @@ class Product < ActiveRecord::Base
     attr_accessor :v_share_img,:get_size_enum,:gross_interest_rate
     after_find :get_size_enum
     after_create :after_create
-    after_update :after_update
     before_save :before_save
     after_destroy :del_picture
 
@@ -40,15 +39,6 @@ class Product < ActiveRecord::Base
         end
     end
 
-    def after_update
-        test_redis = Redis.new(:host=>"r-wz9dtt12y12ns2b97gpd.redis.rds.aliyuncs.com",:db=>"0",:user=>"root",:password=>"Fohow123!@#")
-        redis = Redis.new(:host=>"r-wz9dtt12y12ns2b97gpd.redis.rds.aliyuncs.com",:db=>"0",:user=>"root",:password=>"Fohow123!@#")
-
-        prdKey= format("product_model.GetProductById:%d",self.id)
-        redis.del(prdKey)
-        test_redis.del(prdKey)
-
-    end
 
     TYPE_ENUM = [["直营","direct_sale"],["店铺专区","shop_sale"]]
     SIZE_ENUM =  []

+ 0 - 10
app/models/user.rb

@@ -5,7 +5,6 @@ class User < ActiveRecord::Base
   has_paper_trail
   self.table_name = "users"
   belongs_to :parent_signup_channel, :foreign_key => :signup_channel_id
-  after_update :after_update
   after_create :after_create
   after_destroy :after_destroy
   attr_accessor :sub, :wx_user, :v_head, :getNickname, :getProvince
@@ -30,15 +29,6 @@ class User < ActiveRecord::Base
   #   end    
   # end
 
-  def after_update
-    test_redis = Redis.new(:host=>"r-wz9dtt12y12ns2b97gpd.redis.rds.aliyuncs.com",:db=>"0",:user=>"root",:password=>"Fohow123!@#")
-    redis = Redis.new(:host=>"r-wz9dtt12y12ns2b97gpd.redis.rds.aliyuncs.com",:db=>"0",:user=>"root",:password=>"Fohow123!@#")
-
-    userKey= format("user_model.GetKeyByUserId:%d",self.id)
-    redis.del(userKey)
-    test_redis.del(userKey)
-
-  end
 
   def after_create
     md5_trade_pwd = Digest::MD5.hexdigest(self.trade_pwd)

+ 0 - 17
app/models/wx_user.rb

@@ -10,7 +10,6 @@ class WxUser < ActiveRecord::Base
   validates_presence_of :nickname, :unionid
   #belongs_to :channel_qrcode
   attr_accessor :invite, :v_head, :intro_user
-  after_update :after_update
 
   SEX_ENUM= [["未知","0"], ["男性","1"], ["女性", "2"]]
   RANK_ENUM= [["普通会员","0"], ["群主","1"], ["店长", "2"]]
@@ -21,22 +20,6 @@ class WxUser < ActiveRecord::Base
 
   after_destroy :after_destroy
 
-  def after_update
-    test_redis = Redis.new(:host=>"r-wz9dtt12y12ns2b97gpd.redis.rds.aliyuncs.com",:db=>"0",:user=>"root",:password=>"Fohow123!@#")
-    redis = Redis.new(:host=>"r-wz9dtt12y12ns2b97gpd.redis.rds.aliyuncs.com",:db=>"0",:user=>"root",:password=>"Fohow123!@#")
-
-    #test_redis = Redis.new(url: "redis://root:8c!Beg9ocFag@r-wz9nmvnbdsek8yl476pd.redis.rds.aliyuncs.com:6379/102")
-    #redis = Redis.new(url: "redis://root:8c!Beg9ocFag@r-wz9nmvnbdsek8yl476pd.redis.rds.aliyuncs.com:6379/15")
-
-    userKey= format("userinfo_%d",self.id)
-    redis.del(userKey)
-    test_redis.del(userKey)
-
-    wxuserKey= format("user_model.GetWxUserById:%d",self.id)
-    redis.del(wxuserKey)
-    test_redis.del(wxuserKey)
-
-  end
 
   def invite
     wu = WxUser.where("id = ?", invite_id).first