芝麻web文件管理V1.00
编辑当前文件:/home/elegucvf/public_html/src/actions/wincher/wincher-account-action.php
client = $client; $this->options_helper = $options_helper; } /** * Checks the account limit for tracking keyphrases. * * @return object The response object. */ public function check_limit() { // Code has already been validated at this point. No need to do that again. try { $results = $this->client->get( self::ACCOUNT_URL ); $usage = $results['limits']['keywords']['usage']; $limit = $results['limits']['keywords']['limit']; $history = $results['limits']['history_days']; return (object) [ 'canTrack' => \is_null( $limit ) || $usage < $limit, 'limit' => $limit, 'usage' => $usage, 'historyDays' => $history, 'status' => 200, ]; } catch ( Exception $e ) { return (object) [ 'status' => $e->getCode(), 'error' => $e->getMessage(), ]; } } /** * Gets the upgrade campaign. * * @return object The response object. */ public function get_upgrade_campaign() { try { $result = $this->client->get( self::UPGRADE_CAMPAIGN_URL ); $type = ( $result['type'] ?? null ); $months = ( $result['months'] ?? null ); $discount = ( $result['value'] ?? null ); // We display upgrade discount only if it's a rate discount and positive months/discount. if ( $type === 'RATE' && $months && $discount ) { return (object) [ 'discount' => $discount, 'months' => $months, 'status' => 200, ]; } return (object) [ 'discount' => null, 'months' => null, 'status' => 200, ]; } catch ( Exception $e ) { return (object) [ 'status' => $e->getCode(), 'error' => $e->getMessage(), ]; } } }