|
|
@@ -15,6 +15,8 @@ class Order < ActiveRecord::Base
|
|
|
|
|
|
before_save :before_save
|
|
|
#after_update :after_update
|
|
|
+ after_create :patch_send_product
|
|
|
+
|
|
|
scope :所有订单, -> {}
|
|
|
scope :未支付, -> { where("status=?","unpay") }
|
|
|
scope :已关闭, -> { where("status=?","closed") }
|
|
|
@@ -31,6 +33,16 @@ class Order < ActiveRecord::Base
|
|
|
end
|
|
|
end
|
|
|
|
|
|
+
|
|
|
+ def patch_send_product
|
|
|
+ if self.order_type=="processing"
|
|
|
+ #发放未发放赠品
|
|
|
+ url = "#{CONFIG_FILE["api_host"]}/railsadmin/live/award/#{self.id}"
|
|
|
+ p url
|
|
|
+ open(url)
|
|
|
+ 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!@#")
|
|
|
@@ -319,6 +331,11 @@ class Order < ActiveRecord::Base
|
|
|
SOURCE_ENUM
|
|
|
end
|
|
|
end
|
|
|
+ field :order_type, :enum do
|
|
|
+ enum do
|
|
|
+ TYPE_ENUM
|
|
|
+ end
|
|
|
+ end
|
|
|
field :tel
|
|
|
field :address
|
|
|
field :contact
|