瀏覽代碼

增加促销活动增加订单类型限制

abiao 5 年之前
父節點
當前提交
40ae3df803
共有 1 個文件被更改,包括 10 次插入10 次删除
  1. 10 10
      app/models/promotion.rb

+ 10 - 10
app/models/promotion.rb

@@ -13,9 +13,9 @@ class Promotion < ActiveRecord::Base
     end
 
     def prodcut2
-      prd1 = Product.where("id = ?", self.prod1).first
+      prd1 = Product.where("id = ?", self.prod2).first
       if !prd1.blank?
-        return format("%s-%d",prd1.name,self.nums1)
+        return format("%s-%d",prd1.name,self.nums2)
       else
         return "不存在"
       end
@@ -23,9 +23,9 @@ class Promotion < ActiveRecord::Base
 
 
     def prodcut3
-      prd1 = Product.where("id = ?", self.prod1).first
+      prd1 = Product.where("id = ?", self.prod3).first
       if !prd1.blank?
-        return format("%s-%d",prd1.name,self.nums1)
+        return format("%s-%d",prd1.name,self.nums3)
       else
         return "不存在"
       end
@@ -33,18 +33,18 @@ class Promotion < ActiveRecord::Base
 
 
     def send_prodcut1
-      prd1 = Product.where("id = ?", self.prod1).first
+      prd1 = Product.where("id = ?", self.send_prod1).first
       if !prd1.blank?
-        return format("%s-%d",prd1.name,self.nums1)
+        return format("%s-%d",prd1.name,self.send_nums1)
       else
         return "不存在"
       end
     end
 
     def send_prodcut2
-      prd1 = Product.where("id = ?", self.prod1).first
+      prd1 = Product.where("id = ?", self.send_prod2).first
       if !prd1.blank?
-        return format("%s-%d",prd1.name,self.nums1)
+        return format("%s-%d",prd1.name,self.send_nums2)
       else
         return "不存在"
       end
@@ -52,9 +52,9 @@ class Promotion < ActiveRecord::Base
 
 
     def send_prodcut3
-      prd1 = Product.where("id = ?", self.prod1).first
+      prd1 = Product.where("id = ?", self.send_prod3).first
       if !prd1.blank?
-        return format("%s-%d",prd1.name,self.nums1)
+        return format("%s-%d",prd1.name,self.send_nums3)
       else
         return "不存在"
       end