stanley-king преди 8 години
родител
ревизия
29a5ae952b
променени са 3 файла, в които са добавени 5 реда и са изтрити 5 реда
  1. 2 2
      data/model/bonus_type.model.php
  2. 1 1
      helper/bonus/manager.php
  3. 2 2
      helper/bonus/type.php

+ 2 - 2
data/model/bonus_type.model.php

@@ -19,9 +19,9 @@ class bonus_typeModel extends Model
         return $this->select();
     }
 
-    public function get_one($condition,$field='*')
+    public function get_one($condition,$field='*',$master = false)
     {
-        return $this->where($condition)->field($field)->find();
+        return $this->where($condition)->field($field)->lock($master)->find();
     }
     public function get($condition,$field='*')
     {

+ 1 - 1
helper/bonus/manager.php

@@ -57,7 +57,7 @@ class manager
         $bonus_info = rcache($type_sn, self::type_prefix, '*');
         if (empty($bonus_info))
         {
-            $type = type::create_by_sn($type_sn);
+            $type = type::create_by_sn($type_sn,true);
             $user_bonus = Model('user_bonus');
             $bonus_ex= $user_bonus->getTypeBinded(array('type_id' => $type->getType_id()));
             $type_info = $type->get_param();

+ 2 - 2
helper/bonus/type.php

@@ -425,10 +425,10 @@ class type
         return new type($paramer,self::load_type);
     }
 
-    static public function create_by_sn($type_sn)
+    static public function create_by_sn($type_sn,$master = false)
     {
         $bonus_type = Model('bonus_type');
-        $type_info = $bonus_type->get_one(array('type_sn' => $type_sn));
+        $type_info = $bonus_type->get_one(array('type_sn' => $type_sn),'*',$master);
         if(empty($type_info)) {
             throw new Exception("错误的红包序列号.",errcode::ErrBonusType);
         }