正在显示
1 个修改的文件
包含
10 行增加
和
0 行删除
| @@ -55,6 +55,8 @@ class ProjectAssociationController extends BaseController | @@ -55,6 +55,8 @@ class ProjectAssociationController extends BaseController | ||
| 55 | { | 55 | { |
| 56 | $project_id = (int)request()->input('project_id', 0); | 56 | $project_id = (int)request()->input('project_id', 0); |
| 57 | $status = request()->input('status'); | 57 | $status = request()->input('status'); |
| 58 | + // 重载redis缓存 | ||
| 59 | + $cache = request()->input('cache'); | ||
| 58 | if (isset($status)) { | 60 | if (isset($status)) { |
| 59 | $status = (int)$status ? ProjectAssociation::STATUS_NORMAL : ProjectAssociation::STATUS_DISABLED; | 61 | $status = (int)$status ? ProjectAssociation::STATUS_NORMAL : ProjectAssociation::STATUS_DISABLED; |
| 60 | } | 62 | } |
| @@ -90,8 +92,16 @@ class ProjectAssociationController extends BaseController | @@ -90,8 +92,16 @@ class ProjectAssociationController extends BaseController | ||
| 90 | if (is_null($isRes)) { | 92 | if (is_null($isRes)) { |
| 91 | $this->response('请开启AICC绑定!', Code::USER_ERROR, []); | 93 | $this->response('请开启AICC绑定!', Code::USER_ERROR, []); |
| 92 | } | 94 | } |
| 95 | + $redis_key = 'aicc_friend_lists_' . (int)env('AICC_WECHAT_USER_ID'); | ||
| 96 | + $result = isset($cache) ? false : redis_get($redis_key); | ||
| 97 | + if (empty($result)) { | ||
| 93 | $url = env('AICC_URL') . env('AICC_WECHAT_FRIEND_API_URL'); | 98 | $url = env('AICC_URL') . env('AICC_WECHAT_FRIEND_API_URL'); |
| 94 | $result = curlGet($url); | 99 | $result = curlGet($url); |
| 100 | + redis_set($redis_key, json_encode($result)); | ||
| 101 | + } else { | ||
| 102 | + $result = json_decode($result, true); | ||
| 103 | + } | ||
| 104 | + | ||
| 95 | $result['info'] = [ | 105 | $result['info'] = [ |
| 96 | 'friend_id' => $isRes->friend_id ?? 0, | 106 | 'friend_id' => $isRes->friend_id ?? 0, |
| 97 | 'nickname' => $isRes->nickname ?? '', | 107 | 'nickname' => $isRes->nickname ?? '', |
-
请 注册 或 登录 后发表评论