43 lines
1.0 KiB
PHP
43 lines
1.0 KiB
PHP
<?php
|
|
/**
|
|
* This service file is part of item.
|
|
*
|
|
* @author ctexthuang
|
|
* @contact ctexthuang@qq.com
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Service\ServiceTrait\Common;
|
|
|
|
use App\Cache\Redis\Common\CommonRedisKey;
|
|
use App\Cache\Redis\RedisCache;
|
|
use App\Constants\RedisCode;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
use Psr\Container\ContainerExceptionInterface;
|
|
use Psr\Container\NotFoundExceptionInterface;
|
|
|
|
trait SiteTrait
|
|
{
|
|
/**
|
|
* @var RedisCache
|
|
*/
|
|
#[Inject]
|
|
protected RedisCache $redisCache;
|
|
|
|
/**
|
|
* @param $value
|
|
* @param string $lng
|
|
* @param string $lat
|
|
* @return void
|
|
* @throws ContainerExceptionInterface
|
|
* @throws NotFoundExceptionInterface
|
|
* @throws \RedisException
|
|
*/
|
|
public function setSiteCache($value, string $lng = '0', string $lat = '0'): void
|
|
{
|
|
$key = CommonRedisKey::getActivateSiteList();
|
|
$this->redisCache->zRem($key,$value,RedisCode::SYSTEM_DB);
|
|
$this->redisCache->geoAdd($key,$lng,$lat,$value,RedisCode::SYSTEM_DB);
|
|
}
|
|
} |