|
|
@@ -13,6 +13,8 @@ class Product < ActiveRecord::Base
|
|
|
after_create :after_create
|
|
|
before_save :before_save
|
|
|
after_destroy :del_picture
|
|
|
+ after_update :clear_product_cache
|
|
|
+
|
|
|
def after_create
|
|
|
#主商品默认关联商品
|
|
|
if self.show_flag
|
|
|
@@ -42,6 +44,12 @@ class Product < ActiveRecord::Base
|
|
|
end
|
|
|
end
|
|
|
|
|
|
+ def clear_product_cache
|
|
|
+ #清空商品缓存
|
|
|
+ url = "#{CONFIG_FILE["api_host"]}/railsadmin/clean_cache/product/#{self.id}"
|
|
|
+ p url
|
|
|
+ open(url)
|
|
|
+ end
|
|
|
TYPE_ENUM = [["直营","direct_sale"],["店铺专区","shop_sale"],["积分专区","cent_sale"]]
|
|
|
SIZE_ENUM = []
|
|
|
COLOR_ENUM = []
|