feat : check

This commit is contained in:
2025-04-02 10:00:54 +08:00
parent e39d7a724b
commit 4276021041
3 changed files with 16 additions and 8 deletions

View File

@@ -53,7 +53,7 @@ class PrinterCache
private function __initPrinterListData(): void private function __initPrinterListData(): void
{ {
$printerList = $this->printerModel->get(); $printerList = $this->printerModel->get();
var_dump($printerList->isEmpty());
if ($printerList->isEmpty()) return; if ($printerList->isEmpty()) return;
$ylyPrinterList = []; $ylyPrinterList = [];
@@ -67,8 +67,8 @@ class PrinterCache
$this->delCache(); $this->delCache();
$this->redisCache->set($this->ylyPrinterKey, json_encode($ylyPrinterList)); $this->redisCache->set($this->ylyPrinterKey, json_encode($ylyPrinterList),RedisCode::SYSTEM_DB);
$this->redisCache->set($this->jdPrinterKey, json_encode($jdPrinterList)); $this->redisCache->set($this->jdPrinterKey, json_encode($jdPrinterList),RedisCode::SYSTEM_DB);
} }
/** /**
@@ -78,7 +78,7 @@ class PrinterCache
*/ */
public function getYlyPrinter(): array public function getYlyPrinter(): array
{ {
if ($this->redisCache->exists($this->ylyPrinterKey,RedisCode::SYSTEM_DB)) $this->__initPrinterListData(); if (!$this->redisCache->exists($this->ylyPrinterKey,RedisCode::SYSTEM_DB)) $this->__initPrinterListData();
$res = $this->redisCache->get($this->ylyPrinterKey, RedisCode::SYSTEM_DB); $res = $this->redisCache->get($this->ylyPrinterKey, RedisCode::SYSTEM_DB);
if (empty($res)) return []; if (empty($res)) return [];
@@ -92,7 +92,7 @@ class PrinterCache
*/ */
public function getOtherPrinter(): array public function getOtherPrinter(): array
{ {
if ($this->redisCache->exists($this->jdPrinterKey,RedisCode::SYSTEM_DB)) $this->__initPrinterListData(); if (!$this->redisCache->exists($this->jdPrinterKey,RedisCode::SYSTEM_DB)) $this->__initPrinterListData();
$res = $this->redisCache->get($this->jdPrinterKey, RedisCode::SYSTEM_DB); $res = $this->redisCache->get($this->jdPrinterKey, RedisCode::SYSTEM_DB);
if (empty($res)) return []; if (empty($res)) return [];
@@ -106,7 +106,7 @@ class PrinterCache
*/ */
public function delCache(): void public function delCache(): void
{ {
$this->redisCache->delete($this->ylyPrinterKey); $this->redisCache->delete($this->ylyPrinterKey,RedisCode::SYSTEM_DB);
$this->redisCache->delete($this->jdPrinterKey); $this->redisCache->delete($this->jdPrinterKey,RedisCode::SYSTEM_DB);
} }
} }

View File

@@ -38,7 +38,7 @@ class SiteCache
$siteKey = CommonRedisKey::siteListKey(); $siteKey = CommonRedisKey::siteListKey();
$LngLatKey = CommonRedisKey::siteLngLatKey(); $LngLatKey = CommonRedisKey::siteLngLatKey();
if ($this->redis->exists($siteKey) && $this->redis->exists($LngLatKey)) return; if ($this->redis->exists($siteKey,RedisCode::SYSTEM_DB) && $this->redis->exists($LngLatKey,RedisCode::SYSTEM_DB)) return;
$siteList = $this->siteModel->getAllSiteList(); $siteList = $this->siteModel->getAllSiteList();

View File

@@ -32,6 +32,12 @@ class ConfigCode
const string INVITED_PARTY_COUPON = 'InvitedPartyCoupon'; // 被邀请方优惠券 被邀请一个人所送的优惠券 const string INVITED_PARTY_COUPON = 'InvitedPartyCoupon'; // 被邀请方优惠券 被邀请一个人所送的优惠券
const string INVITEE_COUPON_VALIDITY = 'InviteeCouponValidity'; // 被邀请方优惠券有效期ps:从领取时间开始的第 x 天) const string INVITEE_COUPON_VALIDITY = 'InviteeCouponValidity'; // 被邀请方优惠券有效期ps:从领取时间开始的第 x 天)
/**
* @var string PointsConfiguration|积分配置
*/
const string CONSUMPTION_RATIO = 'ConsumptionRatio'; // 消费金额转化的积分比例 1元 = x积分 (向下取整)
const array DEFAULT_VALUE = [ const array DEFAULT_VALUE = [
//BasicConfiguration //BasicConfiguration
self::TODAY_CUT_OFF_TIME_KEY => '10:30:00', self::TODAY_CUT_OFF_TIME_KEY => '10:30:00',
@@ -54,5 +60,7 @@ class ConfigCode
self::INVITING_PARTY_COUPON_VALIDITY => '0', self::INVITING_PARTY_COUPON_VALIDITY => '0',
self::INVITED_PARTY_COUPON => '0', self::INVITED_PARTY_COUPON => '0',
self::INVITEE_COUPON_VALIDITY => '0', self::INVITEE_COUPON_VALIDITY => '0',
//PointsConfiguration
self::CONSUMPTION_RATIO => '0',
]; ];
} }