Commit 5a4d7c8e authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into develop

parents edde675c 70c11105
...@@ -125,6 +125,16 @@ class ExchangeBusiness ...@@ -125,6 +125,16 @@ class ExchangeBusiness
goto doEnd; goto doEnd;
} }
if (strtoupper($tag) == 'POKE') {
$quotation = [
'low' => 0.15,
'high' => 0.15,
'last' => 0.15,
'rmb' => 0.15,
];
goto doEnd;
}
if (strtoupper($tag) == 'GST' || strtoupper($tag) == 'JNTK' || strtoupper($tag) == 'SPT' || strtoupper($tag) == 'STO' || strtoupper($tag) == 'GM' || strtoupper($tag) == 'BSTC' || strtoupper($tag) == 'RYH' || strtoupper($tag) == 'CNDT' || strtoupper($tag) == 'WL' || strtoupper($tag) == 'ETS' || strtoupper($tag) == 'LIMS' || strtoupper($tag) == 'AT' || strtoupper($tag) == 'BTJ') { if (strtoupper($tag) == 'GST' || strtoupper($tag) == 'JNTK' || strtoupper($tag) == 'SPT' || strtoupper($tag) == 'STO' || strtoupper($tag) == 'GM' || strtoupper($tag) == 'BSTC' || strtoupper($tag) == 'RYH' || strtoupper($tag) == 'CNDT' || strtoupper($tag) == 'WL' || strtoupper($tag) == 'ETS' || strtoupper($tag) == 'LIMS' || strtoupper($tag) == 'AT' || strtoupper($tag) == 'BTJ') {
$quotation = [ $quotation = [
'low' => 0, 'low' => 0,
......
<?php
namespace console\controllers;
use Yii;
use yii\console\Controller;
use linslin\yii2\curl\Curl;
use common\components\Tools;
use common\models\pwallet\Article;
class ArticleController extends Controller
{
public function actionIndex()
{
$coindog = Yii::$app->params['coindog'];
$accessKey = $coindog['accessKey'];
$secretKey = $coindog['secretKey'];
$httpParams = array(
'access_key' => $accessKey,
'date' => time()
);
$signParams = array_merge($httpParams, array('secret_key' => $secretKey));
ksort($signParams);
$signString = http_build_query($signParams);
$httpParams = [
'sign' => strtolower(md5($signString)),
];
$url = $coindog['live'] . '?' . http_build_query($httpParams);
$curl = new Curl();
$resp = $curl->get($url, false);
if (!isset($resp['list'])) {
return 0;
}
$list = $resp['list'][0]['lives'];
$list = Tools::arraySort($list, 'created_at', SORT_ASC);
$create_time = Article::find()->where(['source' => 1])->max('create_time');
$article = new Article();
foreach ($list as &$item) {
go(function () use ($item, $article, $create_time) {
\Co::sleep(0.5);
if ($item['created_at'] > $create_time) {
preg_match_all("/\【(.+?)\】/", $item['content'], $match);
$title = $match[1][0];
$content = str_replace('【' . $title . '】', '', $item['content']);
$article->setIsNewRecord(true);
$article->title = $title;
$article->content = $content;
$article->platform_id = 0;
$article->create_time = $item['created_at'];
$article->source = 1;
$article->save() && $article->id = 0;;
}
});
}
return 0;
}
}
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