Ver Fonte

wesmiler

wesmiler há 1 ano atrás
pai
commit
cf791b900c
1 ficheiros alterados com 7 adições e 10 exclusões
  1. 7 10
      app/Services/Api/MemberCollectService.php

+ 7 - 10
app/Services/Api/MemberCollectService.php

@@ -131,7 +131,7 @@ class MemberCollectService extends BaseService
      */
     public function getCollectUsers($where, $field='user_id')
     {
-        $cacheKey = "caches:members:collect:users_".md5(json_encode($where).$field);
+        $cacheKey = "caches:m_collect:u_".md5(json_encode($where).$field);
         $datas = RedisService::get($cacheKey);
         if($datas || RedisService::exists($cacheKey)){
             return $datas;
@@ -154,7 +154,7 @@ class MemberCollectService extends BaseService
      */
     public function checkCollect($userId, $collectUid, $type=1)
     {
-        $cacheKey = "caches:member:collect:u{$userId}_c{$collectUid}_{$type}";
+        $cacheKey = "caches:m_collect:{$userId}_c{$collectUid}_{$type}";
         $data = RedisService::get($cacheKey);
         if($data){
             return $data? 1: 2;
@@ -214,11 +214,8 @@ class MemberCollectService extends BaseService
         }
 
         $this->error = 1002;
-        $sourceType = $liveId? 2 : 1;
-        $sourceId = $liveId? $liveId : $videoId;
-        RedisService::clear("caches:member:collect:u{$userId}_c{$collectUid}_{$type}");
-        RedisService::clear("caches:member:fans:{$userId}_{$sourceId}_{$sourceType}");
-        RedisService::keyDel("caches:member:collect:{$userId}_*");
+        RedisService::keyDel("caches:m_fans:*");
+        RedisService::keyDel("caches:m_collect:*");
 
         $this->model->where(['user_id'=> $collectUid,'collect_uid'=> $userId])->update(['is_return'=> $data['is_return'],'update_time'=>time()]);
 
@@ -234,7 +231,7 @@ class MemberCollectService extends BaseService
      */
     public function getViewFansCountByType($userId, $sourceId, $sourceType=1)
     {
-        $cacheKey = "caches:member:fans:{$userId}_{$sourceId}_{$sourceType}";
+        $cacheKey = "caches:m_fans:{$userId}_{$sourceId}_{$sourceType}";
         $count = RedisService::get($cacheKey);
         if($count || RedisService::exists($cacheKey)){
             return $count;
@@ -265,7 +262,7 @@ class MemberCollectService extends BaseService
      */
     public function getNewFansCount($userId, $sourceId, $sourceType=1, $time=0)
     {
-        $cacheKey = "caches:member:newFans:{$userId}_{$sourceId}_{$sourceType}_{$time}";
+        $cacheKey = "caches:m_newFans:{$userId}_{$sourceId}_{$sourceType}_{$time}";
         $count = RedisService::get($cacheKey);
         if($count || RedisService::exists($cacheKey)){
             return $count;
@@ -300,7 +297,7 @@ class MemberCollectService extends BaseService
      */
     public function getCount($userId, $type=1, $ctype=1)
     {
-        $cacheKey = "caches:member:collect:{$userId}_{$type}_{$ctype}";
+        $cacheKey = "caches:m_collect:{$userId}_{$type}_{$ctype}";
         $data = RedisService::get($cacheKey);
         if($data){
             return $data;