|
@@ -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)
|