getAccount($uniacid); } public function getAccessToken() { global $_W; $cachekey = cache_system_key('accesstoken', array('uniacid' => $this->account['uniacid'])); $cache = cache_load($cachekey); if (!empty($cache) && !empty($cache['token'])) { $this->account['access_token'] = $cache; return $cache['token']; } if (empty($this->account['link'])) { return error(-1, '参数错误!'); } load()->library('sdk-module'); $link_config = iunserializer($this->account['link_config']); try { $api = new \W7\Sdk\Module\Api($_W['setting']['site']['key'], $_W['setting']['site']['token'], $link_config['app_id'], 6, CLOUD_V3API_DOMAIN_PRE); $token = $api->app()->getAccessToken()->toArray(); } catch (Exception $e) { return error('-1', $e->getMessage()); } $record = array(); $record['token'] = $token['access_token']; $record_expire = $token['expires_in'] - 200; $this->account['access_token'] = $record; cache_write($cachekey, $record, $record_expire); return $record['token']; } }