96 lines
2.2 KiB
PHP
96 lines
2.2 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;
|
|
}
|
|
|
|
/**
|
|
* @param int $cityId
|
|
* @param int $type
|
|
* @param int $timeKey
|
|
* @return string
|
|
*/
|
|
public static function getLeaderboardByCityIdAndType(int $cityId, int $type, int $timeKey): string
|
|
{
|
|
return 'chef:leaderboard:city_id:'.$cityId.':type:'.$type.':time_key:'.$timeKey;
|
|
}
|
|
|
|
/**
|
|
* @param int $chefId
|
|
* @return string
|
|
*/
|
|
public static function chefEvaluationKey(int $chefId): string
|
|
{
|
|
return 'evaluation:chef:id:'.$chefId;
|
|
}
|
|
} |