stanley-king vor 4 Jahren
Ursprung
Commit
c7ad166d40
1 geänderte Dateien mit 17 neuen und 6 gelöschten Zeilen
  1. 17 6
      helper/refill/util.php

+ 17 - 6
helper/refill/util.php

@@ -368,18 +368,29 @@ class util
     }
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-    public static function incr_amount_lock($mchid, $spec)
+    public static function incr_amount_lock($mchid, $card_type, $spec)
     {
-        $ins = Cache::getInstance('cacheredis');
-        $name = 'mechant_amount_lock';
-        return $ins->hIncrBy($name, "{$mchid}", intval($spec));
+        if ($card_type == mtopcard\SinopecCard || $card_type == mtopcard\PetroChinaCard) {
+            $ins = Cache::getInstance('cacheredis');
+            $name = 'mechant_amount_lock';
+            return $ins->hIncrBy($name, "{$mchid}", intval($spec));
+        }
     }
 
-    public static function decr_amount_lock($mchid, $spec)
+    public static function decr_amount_lock($mchid, $card_type, $spec)
+    {
+        if ($card_type == mtopcard\SinopecCard || $card_type == mtopcard\PetroChinaCard) {
+            $ins = Cache::getInstance('cacheredis');
+            $name = 'mechant_amount_lock';
+            return $ins->hIncrBy($name, "{$mchid}", -1 * intval($spec));
+        }
+    }
+
+    public static function set_amount_lock($mchid, $spec)
     {
         $ins = Cache::getInstance('cacheredis');
         $name = 'mechant_amount_lock';
-        return $ins->hIncrBy($name, "{$mchid}", -1 * intval($spec));
+        return $ins->hIncrBy($name, "{$mchid}", intval($spec));
     }
 
     public static function get_amount_lock($mchid)