weigang 5 years ago
parent
commit
e55bcc86b2
  1. 12
      app/Service/v3/Implementations/BadgeService.php
  2. 6
      app/Service/v3/Implementations/GoodsInventoryService.php

12
app/Service/v3/Implementations/BadgeService.php

@ -77,7 +77,7 @@ class BadgeService implements BadgeServiceInterface
public function allByUserOrder($userId)
{
$redis = ApplicationContext::getContainer()->get(Redis::class);
$redisHName = 'badge_user';
$redisHName = 'badge:user';
$redisHKey = 'user_id_'.$userId;
// 取出当前用户的key的badge(key=>value json串)
@ -115,7 +115,7 @@ class BadgeService implements BadgeServiceInterface
public function allByStoreOrder($storeId)
{
$redis = ApplicationContext::getContainer()->get(Redis::class);
$redisHName = 'badge_store';
$redisHName = 'badge:store';
$redisHKey = 'store_id_'.$storeId;
// 取出当前用户的key的badge(key=>value json串)
@ -153,7 +153,7 @@ class BadgeService implements BadgeServiceInterface
public function sAddUserOrder($badge, $userId, $globalOrderId)
{
$redis = ApplicationContext::getContainer()->get(Redis::class);
$redisHName = 'badge_user';
$redisHName = 'badge:user';
$redisHKey = 'user_id_'.$userId;
// 取出当前用户的key的badge(key=>value json串)
@ -185,7 +185,7 @@ class BadgeService implements BadgeServiceInterface
public function sAddStoreOrder($badge, $storeId, $globalOrderId)
{
$redis = ApplicationContext::getContainer()->get(Redis::class);
$redisHName = 'badge_store';
$redisHName = 'badge:store';
$redisHKey = 'store_id_'.$storeId;
// 取出当前用户的key的badge(key=>value json串)
@ -217,7 +217,7 @@ class BadgeService implements BadgeServiceInterface
public function clearUserOrder($userId, $badge = 'all', $globalOrderId = '')
{
$redis = ApplicationContext::getContainer()->get(Redis::class);
$redisHName = 'badge_user';
$redisHName = 'badge:user';
$redisHKey = 'user_id_'.$userId;
// 取出当前用户的key的badge(key=>value json串)
@ -253,7 +253,7 @@ class BadgeService implements BadgeServiceInterface
public function clearStoreOrder($storeId, $badge = 'all', $globalOrderId = '')
{
$redis = ApplicationContext::getContainer()->get(Redis::class);
$redisHName = 'badge_store';
$redisHName = 'badge:store';
$redisHKey = 'store_id_'.$storeId;
// 取出当前用户的key的badge(key=>value json串)

6
app/Service/v3/Implementations/GoodsInventoryService.php

@ -15,7 +15,7 @@ class GoodsInventoryService implements GoodsInventoryServiceInterface
public function doSold($activityType, $goodsId, $num)
{
$redis = ApplicationContext::getContainer()->get(Redis::class);
$hName = 'goods_inventory_sold_' . $activityType;
$hName = 'goods:inventory_sold_' . $activityType;
$hKey = 'goods_id_' . $goodsId;
$redis->hIncrBy($hName, $hKey, $num);
@ -27,7 +27,7 @@ class GoodsInventoryService implements GoodsInventoryServiceInterface
public function undoSold($activityType, $goodsId, $num)
{
$redis = ApplicationContext::getContainer()->get(Redis::class);
$hName = 'goods_inventory_sold_' . $activityType;
$hName = 'goods:inventory_sold_' . $activityType;
$hKey = 'goods_id_' . $goodsId;
$redis->hIncrBy($hName, $hKey, -1*$num);
@ -39,7 +39,7 @@ class GoodsInventoryService implements GoodsInventoryServiceInterface
public function getSold($activityType, $goodsId)
{
$redis = ApplicationContext::getContainer()->get(Redis::class);
$hName = 'goods_inventory_sold_' . $activityType;
$hName = 'goods:inventory_sold_' . $activityType;
$hKey = 'goods_id_' . $goodsId;
return $redis->hGet($hName, $hKey);

Loading…
Cancel
Save