正在显示
1 个修改的文件
包含
10 行增加
和
4 行删除
| @@ -51,12 +51,16 @@ class ProjectAssociationController extends BaseController | @@ -51,12 +51,16 @@ class ProjectAssociationController extends BaseController | ||
| 51 | $this->response('success'); | 51 | $this->response('success'); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | + /** | ||
| 55 | + * 获取aicc用户列表 并返回绑定的数据 | ||
| 56 | + * @return array|void | ||
| 57 | + */ | ||
| 54 | public function check() | 58 | public function check() |
| 55 | { | 59 | { |
| 56 | $project_id = (int)request()->input('project_id', 0); | 60 | $project_id = (int)request()->input('project_id', 0); |
| 57 | $status = request()->input('status'); | 61 | $status = request()->input('status'); |
| 58 | // 重载redis缓存 | 62 | // 重载redis缓存 |
| 59 | - $cache = request()->input('cache'); | 63 | + $cache = request()->input('cache'); |
| 60 | if (isset($status)) { | 64 | if (isset($status)) { |
| 61 | $status = (int)$status ? ProjectAssociation::STATUS_NORMAL : ProjectAssociation::STATUS_DISABLED; | 65 | $status = (int)$status ? ProjectAssociation::STATUS_NORMAL : ProjectAssociation::STATUS_DISABLED; |
| 62 | } | 66 | } |
| @@ -87,17 +91,19 @@ class ProjectAssociationController extends BaseController | @@ -87,17 +91,19 @@ class ProjectAssociationController extends BaseController | ||
| 87 | } | 91 | } |
| 88 | } catch (\Exception $exception) { | 92 | } catch (\Exception $exception) { |
| 89 | DB::rollBack(); | 93 | DB::rollBack(); |
| 90 | - $this->response('数据错误,请重试!', Code::SERVER_ERROR); | 94 | + // 数据错误,请重试 |
| 95 | + $this->response('error'); | ||
| 91 | } | 96 | } |
| 92 | if (is_null($isRes)) { | 97 | if (is_null($isRes)) { |
| 93 | - $this->response('请开启AICC绑定!', Code::USER_ERROR, []); | 98 | + // 请开启AICC绑定 |
| 99 | + $this->response('success'); | ||
| 94 | } | 100 | } |
| 95 | $redis_key = 'aicc_friend_lists_' . (int)env('AICC_WECHAT_USER_ID'); | 101 | $redis_key = 'aicc_friend_lists_' . (int)env('AICC_WECHAT_USER_ID'); |
| 96 | $result = isset($cache) ? false : redis_get($redis_key); | 102 | $result = isset($cache) ? false : redis_get($redis_key); |
| 97 | if (empty($result)) { | 103 | if (empty($result)) { |
| 98 | $url = env('AICC_URL') . env('AICC_WECHAT_FRIEND_API_URL'); | 104 | $url = env('AICC_URL') . env('AICC_WECHAT_FRIEND_API_URL'); |
| 99 | $result = curlGet($url); | 105 | $result = curlGet($url); |
| 100 | - redis_set($redis_key, json_encode($result)); | 106 | + redis_set($redis_key, json_encode($result), 60); |
| 101 | } else { | 107 | } else { |
| 102 | $result = json_decode($result, true); | 108 | $result = json_decode($result, true); |
| 103 | } | 109 | } |
-
请 注册 或 登录 后发表评论