Commit a351d2c3 authored by rlgy's avatar rlgy

search coin by name bugfixed

parent 3f4cb231
......@@ -35,7 +35,7 @@ class CoinService extends Coin implements CoinInterface
$url = Yii::$app->params['feixiaohao_domain'] . Yii::$app->params['feixiaohao_page']['currencies'] . $this->sid . '/';
$ch = new Curl();
$content = $ch->get($url, true);
$this->content = $content;
$this->content = str_replace([' ', ' '], '', $content);
}
/**
......@@ -139,9 +139,9 @@ class CoinService extends Coin implements CoinInterface
if (empty($this->content)) {
$this->init();
}
preg_match_all('/<div class=lowHeight>(.*?)<\/div><div class=sub>/is', $$this->content, $matchs);
preg_match_all('/<div class=lowHeight>(.*?)<\/div><div class=sub>/is', $this->content, $matchs);
preg_match_all('/<span class=value>(.*?)<\/span>/is', $matchs[1][0], $matchs);
$this->setHigh($matchs[1][0]);
$this->setHigh(str_replace(['$', '≈', ','], '', $matchs[1][0]));
Yii::$app->cache->set($this->cache_key_prifx . $this->sid . '_high', $this->high,
Yii::$app->params['curl_cache_time']['quotation']);
} else {
......@@ -168,9 +168,9 @@ class CoinService extends Coin implements CoinInterface
if (empty($this->content)) {
$this->init();
}
preg_match_all('/<div class=lowHeight>(.*?)<\/div><div class=sub>/is', $$this->content, $matchs);
preg_match_all('/<div class=lowHeight>(.*?)<\/div><div class=sub>/is', $this->content, $matchs);
preg_match_all('/<span class=value>(.*?)<\/span>/is', $matchs[1][0], $matchs);
$this->setLow($matchs[1][1]);
$this->setLow(str_replace(['$', '≈', ','], '', $matchs[1][1]));
Yii::$app->cache->set($this->cache_key_prifx . $this->sid . '_low', $this->low,
Yii::$app->params['curl_cache_time']['quotation']);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment