Просмотр исходного кода

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

abiao лет назад: 5
Родитель
Сommit
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