From 4276021041b8d9b3f7f1207b383b118435b98b07 Mon Sep 17 00:00:00 2001 From: ctexthuang Date: Wed, 2 Apr 2025 10:00:54 +0800 Subject: [PATCH] feat : check --- app/Cache/Redis/Admin/PrinterCache.php | 14 +++++++------- app/Cache/Redis/Api/SiteCache.php | 2 +- app/Constants/ConfigCode.php | 8 ++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/Cache/Redis/Admin/PrinterCache.php b/app/Cache/Redis/Admin/PrinterCache.php index 806c283..8f14412 100644 --- a/app/Cache/Redis/Admin/PrinterCache.php +++ b/app/Cache/Redis/Admin/PrinterCache.php @@ -53,7 +53,7 @@ class PrinterCache private function __initPrinterListData(): void { $printerList = $this->printerModel->get(); - +var_dump($printerList->isEmpty()); if ($printerList->isEmpty()) return; $ylyPrinterList = []; @@ -67,8 +67,8 @@ class PrinterCache $this->delCache(); - $this->redisCache->set($this->ylyPrinterKey, json_encode($ylyPrinterList)); - $this->redisCache->set($this->jdPrinterKey, json_encode($jdPrinterList)); + $this->redisCache->set($this->ylyPrinterKey, json_encode($ylyPrinterList),RedisCode::SYSTEM_DB); + $this->redisCache->set($this->jdPrinterKey, json_encode($jdPrinterList),RedisCode::SYSTEM_DB); } /** @@ -78,7 +78,7 @@ class PrinterCache */ 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); if (empty($res)) return []; @@ -92,7 +92,7 @@ class PrinterCache */ 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); if (empty($res)) return []; @@ -106,7 +106,7 @@ class PrinterCache */ public function delCache(): void { - $this->redisCache->delete($this->ylyPrinterKey); - $this->redisCache->delete($this->jdPrinterKey); + $this->redisCache->delete($this->ylyPrinterKey,RedisCode::SYSTEM_DB); + $this->redisCache->delete($this->jdPrinterKey,RedisCode::SYSTEM_DB); } } \ No newline at end of file diff --git a/app/Cache/Redis/Api/SiteCache.php b/app/Cache/Redis/Api/SiteCache.php index 8cc3ff0..23ba2e0 100644 --- a/app/Cache/Redis/Api/SiteCache.php +++ b/app/Cache/Redis/Api/SiteCache.php @@ -38,7 +38,7 @@ class SiteCache $siteKey = CommonRedisKey::siteListKey(); $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(); diff --git a/app/Constants/ConfigCode.php b/app/Constants/ConfigCode.php index f26759a..be4db5c 100644 --- a/app/Constants/ConfigCode.php +++ b/app/Constants/ConfigCode.php @@ -32,6 +32,12 @@ class ConfigCode const string INVITED_PARTY_COUPON = 'InvitedPartyCoupon'; // 被邀请方优惠券 被邀请一个人所送的优惠券 const string INVITEE_COUPON_VALIDITY = 'InviteeCouponValidity'; // 被邀请方优惠券有效期(ps:从领取时间开始的第 x 天) + + /** + * @var string PointsConfiguration|积分配置 + */ + const string CONSUMPTION_RATIO = 'ConsumptionRatio'; // 消费金额转化的积分比例 1元 = x积分 (向下取整) + const array DEFAULT_VALUE = [ //BasicConfiguration self::TODAY_CUT_OFF_TIME_KEY => '10:30:00', @@ -54,5 +60,7 @@ class ConfigCode self::INVITING_PARTY_COUPON_VALIDITY => '0', self::INVITED_PARTY_COUPON => '0', self::INVITEE_COUPON_VALIDITY => '0', + //PointsConfiguration + self::CONSUMPTION_RATIO => '0', ]; } \ No newline at end of file