Procházet zdrojové kódy

fohow 订单统计功能

abiao před 5 roky
rodič
revize
ae46002f16

+ 2 - 2
app/models/order_static.rb

@@ -2,11 +2,11 @@
 class OrderStatic < ActiveRecord::Base
   has_paper_trail
   self.table_name = "order_statics"
-  validates :begin_date,presence: true
-  after_update :order_static
   after_create :order_static
+  after_update :order_static
   after_destroy :del_static
 
+  validates :begin_date,presence: true
   def order_static
     Proc.new do
       #统计订单商品销售数据

+ 2 - 0
db/migrate/20201001114641_create_order_statics.rb

@@ -26,6 +26,8 @@ class CreateOrderStatics < ActiveRecord::Migration
       t.column :is_send, :boolean, :default=>1
       # 产品ID
       t.column :product_id, :integer, :limit => 8, :default => 0
+      # 汇总ID
+      t.column :static_id, :integer, :limit => 8, :default => 0
       # 商品名称
       t.column :product_name, :string,:limit => 256
       # 数量