添加获取用户详情是否添加缓存的配置参数
Code Review By Rock Zhang
Showing
2 changed files
with
4 additions
and
3 deletions
@@ -21,16 +21,17 @@ class UserData | @@ -21,16 +21,17 @@ class UserData | ||
21 | * 个人详情数据 | 21 | * 个人详情数据 |
22 | * | 22 | * |
23 | * @param int $uid 用户ID | 23 | * @param int $uid 用户ID |
24 | + * @param int|boolean $cache 缓存时间 | ||
24 | * @return array 个人详情接口返回的数据 | 25 | * @return array 个人详情接口返回的数据 |
25 | */ | 26 | */ |
26 | - public static function userData($uid) | 27 | + public static function userData($uid, $cache = 3600) |
27 | { | 28 | { |
28 | $param = Yohobuy::param(); | 29 | $param = Yohobuy::param(); |
29 | $param['method'] = 'app.passport.profile'; | 30 | $param['method'] = 'app.passport.profile'; |
30 | $param['uid'] = $uid; | 31 | $param['uid'] = $uid; |
31 | $param['client_secret'] = Sign::getSign($param); | 32 | $param['client_secret'] = Sign::getSign($param); |
32 | 33 | ||
33 | - return Yohobuy::get(Yohobuy::API_URL, $param, 3600); // 缓存1小时 | 34 | + return Yohobuy::get(Yohobuy::API_URL, $param, $cache); // 缓存1小时 |
34 | } | 35 | } |
35 | 36 | ||
36 | /** | 37 | /** |
@@ -30,7 +30,7 @@ class YuanxiaoModel | @@ -30,7 +30,7 @@ class YuanxiaoModel | ||
30 | ); | 30 | ); |
31 | 31 | ||
32 | // 调用接口获取个人详情 | 32 | // 调用接口获取个人详情 |
33 | - $userData = UserData::userData($uid); | 33 | + $userData = UserData::userData($uid, false); |
34 | 34 | ||
35 | // 处理个人详情数 | 35 | // 处理个人详情数 |
36 | if (isset($userData['data']) && !empty($userData['data'])) { | 36 | if (isset($userData['data']) && !empty($userData['data'])) { |
-
Please register or login to post a comment