|
@@ -10,124 +10,125 @@ class rlock
|
|
|
const RETAIN = 2;
|
|
|
const ASSIGN = 3;
|
|
|
|
|
|
- const sys_storge_name = 'system_storge';
|
|
|
- const mch_storge_name = 'merchant_storge';
|
|
|
+ const sys_storage_name = 'system_storage';
|
|
|
+ const mch_storage_name = 'merchant_storage';
|
|
|
+ const locked_open_name = 'oil_amount_lock_turn';
|
|
|
|
|
|
- //system storge
|
|
|
- public static function incr_sys_storge($card_type,$spec,$count)
|
|
|
+ //system storage
|
|
|
+ public static function incr_sys_storage($card_type,$spec,$count)
|
|
|
{
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- $name = self::sys_storge_name;
|
|
|
+ $name = self::sys_storage_name;
|
|
|
$key = "{$card_type}-{$spec}";
|
|
|
|
|
|
return $ins->hIncrBy($name, $key, $spec * $count);
|
|
|
}
|
|
|
|
|
|
- public static function decr_sys_storge($card_type,$spec,$count)
|
|
|
+ public static function decr_sys_storage($card_type,$spec,$count)
|
|
|
{
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- $name = self::sys_storge_name;
|
|
|
+ $name = self::sys_storage_name;
|
|
|
$key = "{$card_type}-{$spec}";
|
|
|
return $ins->hIncrBy($name, $key, -1 * $spec * $count);
|
|
|
}
|
|
|
|
|
|
- public static function hget_sys_storge($card_type,$spec)
|
|
|
+ public static function hget_sys_storage($card_type,$spec)
|
|
|
{
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- $name = self::sys_storge_name;
|
|
|
+ $name = self::sys_storage_name;
|
|
|
$key = "{$card_type}-{$spec}";
|
|
|
$value = $ins->hget($name, '', $key);
|
|
|
return $value;
|
|
|
}
|
|
|
|
|
|
//merchant 总金额分配策略开关,及剩余金额变动和获取
|
|
|
- public static function incr_mch_total_storge($mchid,$card_type,$amount)
|
|
|
+ public static function incr_mch_total_storage($mchid,$card_type,$amount)
|
|
|
{
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- $name = self::mch_storge_name;
|
|
|
+ $name = self::mch_storage_name;
|
|
|
$key = "{$mchid}-{$card_type}-total";
|
|
|
return $ins->hIncrBy($name, $key, $amount);
|
|
|
}
|
|
|
|
|
|
- public static function decr_mch_total_storge($mchid,$card_type,$amount)
|
|
|
+ public static function decr_mch_total_storage($mchid,$card_type,$amount)
|
|
|
{
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- $name = self::mch_storge_name;
|
|
|
+ $name = self::mch_storage_name;
|
|
|
$key = "{$mchid}-{$card_type}-total";
|
|
|
|
|
|
return $ins->hIncrBy($name, $key, -1 * $amount);
|
|
|
}
|
|
|
|
|
|
- public static function hget_mch_total_storge($mchid,$card_type)
|
|
|
+ public static function hget_mch_total_storage($mchid,$card_type)
|
|
|
{
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- $name = self::mch_storge_name;
|
|
|
+ $name = self::mch_storage_name;
|
|
|
$key = "{$mchid}-{$card_type}-total";
|
|
|
|
|
|
$value = $ins->hget($name, '', $key);
|
|
|
return $value;
|
|
|
}
|
|
|
|
|
|
- public static function hset_mch_total_storge_turn($mchid,$card_type,$val)
|
|
|
+ public static function hset_mch_total_storage_turn($mchid,$card_type,$val)
|
|
|
{
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- $name = self::mch_storge_name;
|
|
|
+ $name = self::mch_storage_name;
|
|
|
$key = "{$mchid}-{$card_type}-turn";
|
|
|
|
|
|
$ins->hset($name, '', [$key => $val]);
|
|
|
}
|
|
|
|
|
|
- public static function hget_mch_total_storge_turn($mchid,$card_type)
|
|
|
+ public static function hget_mch_total_storage_turn($mchid,$card_type)
|
|
|
{
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- $name = self::mch_storge_name;
|
|
|
+ $name = self::mch_storage_name;
|
|
|
$key = "{$mchid}-{$card_type}-turn";
|
|
|
|
|
|
return $ins->hget($name, '', $key);
|
|
|
}
|
|
|
|
|
|
- //mchid storge count-lock
|
|
|
- public static function incr_mch_storge($mchid,$card_type,$spec,$count)
|
|
|
+ //mchid storage count-lock
|
|
|
+ public static function incr_mch_storage($mchid,$card_type,$spec,$count)
|
|
|
{
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- $name = self::mch_storge_name;
|
|
|
+ $name = self::mch_storage_name;
|
|
|
$key = "{$mchid}-{$card_type}-{$spec}";
|
|
|
|
|
|
return $ins->hIncrBy($name, $key, $spec * $count);
|
|
|
}
|
|
|
|
|
|
- public static function decr_mch_storge($mchid,$card_type,$spec,$count)
|
|
|
+ public static function decr_mch_storage($mchid,$card_type,$spec,$count)
|
|
|
{
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- $name = self::mch_storge_name;
|
|
|
+ $name = self::mch_storage_name;
|
|
|
$key = "{$mchid}-{$card_type}-{$spec}";
|
|
|
|
|
|
return $ins->hIncrBy($name, $key, -1 * $spec * $count);
|
|
|
}
|
|
|
|
|
|
- public static function hget_mch_storge($mchid,$card_type,$spec)
|
|
|
+ public static function hget_mch_storage($mchid,$card_type,$spec)
|
|
|
{
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- $name = self::mch_storge_name;
|
|
|
+ $name = self::mch_storage_name;
|
|
|
$key = "{$mchid}-{$card_type}-{$spec}";
|
|
|
|
|
|
$value = $ins->hget($name, '', $key);
|
|
|
return $value;
|
|
|
}
|
|
|
|
|
|
- public static function hset_mch_storge_turn($mchid,$card_type,$spec,$val)
|
|
|
+ public static function hset_mch_storage_turn($mchid,$card_type,$spec,$val)
|
|
|
{
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- $name = self::mch_storge_name;
|
|
|
+ $name = self::mch_storage_name;
|
|
|
$key = "{$mchid}-{$card_type}-{$spec}-turn";
|
|
|
|
|
|
$ins->hset($name, '', [$key => $val]);
|
|
|
}
|
|
|
|
|
|
- public static function hget_mch_storge_turn($mchid,$card_type,$spec)
|
|
|
+ public static function hget_mch_storage_turn($mchid,$card_type,$spec)
|
|
|
{
|
|
|
$ins = Cache::getInstance('cacheredis');
|
|
|
- $name = self::mch_storge_name;
|
|
|
+ $name = self::mch_storage_name;
|
|
|
$key = "{$mchid}-{$card_type}-{$spec}-turn";
|
|
|
|
|
|
return $ins->hget($name, '', $key);
|