76 lines
1.7 KiB
PHP
76 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Cache\Redis\Api;
|
|
|
|
class ApiRedisKey
|
|
{
|
|
/**
|
|
* 注册/登录的锁
|
|
* @param string $mobile
|
|
* @return string
|
|
*/
|
|
public static function LoginAndRegisterByMobileLock(string $mobile): string
|
|
{
|
|
return 'login:or:register:mobile:'.$mobile;
|
|
}
|
|
|
|
/**
|
|
* 注册/登录的锁
|
|
* @param string $code
|
|
* @return string
|
|
*/
|
|
public static function LoginAndRegisterByCodeLock(string $code): string
|
|
{
|
|
return 'login:or:register:code:'.$code;
|
|
}
|
|
|
|
/**
|
|
* 自选商品列表
|
|
* @param int $cycleId
|
|
* @param int $kitchenId
|
|
* @return string
|
|
*/
|
|
public static function optionalGoodListKey(int $cycleId, int $kitchenId): string
|
|
{
|
|
return 'good:list:optional:cycle_id:'.$cycleId.':kitchen_id:'.$kitchenId;
|
|
}
|
|
|
|
/**
|
|
* 套餐商品列表
|
|
* @param int $cycleId
|
|
* @param int $kitchenId
|
|
* @return string
|
|
*/
|
|
public static function mealGoodListKey(int $cycleId, int $kitchenId): string
|
|
{
|
|
return 'good:list:meal:cycle_id:'.$cycleId.':kitchen_id:'.$kitchenId;
|
|
}
|
|
|
|
/**
|
|
* @param int $cycleId
|
|
* @param int $kitchenId
|
|
* @return string
|
|
*/
|
|
public static function goodStockKey(int $cycleId, int $kitchenId): string
|
|
{
|
|
return 'good:list:stock:cycle_id:'.$cycleId.':kitchen_id:'.$kitchenId;
|
|
}
|
|
|
|
/**
|
|
* @param int $userId
|
|
* @return string
|
|
*/
|
|
public static function payLock(int $userId)
|
|
{
|
|
return 'lock:pay:user_id:'. $userId;
|
|
}
|
|
|
|
/**
|
|
* @param int $userId
|
|
* @return string
|
|
*/
|
|
public static function refundLock(int $userId)
|
|
{
|
|
return 'lock:refund:user_id:'. $userId;
|
|
}
|
|
} |