Commit dbadc3ea authored by shajiaiming's avatar shajiaiming

增加标题

parent ee488ff2
......@@ -24,10 +24,10 @@ class CoinDogController extends BaseController
$signString = http_build_query($signParams);
$httpParams['sign'] = strtolower(md5($signString));
$url = $coindog['article'].'?'.http_build_query($httpParams);
$url = $coindog['article'] . '?' . http_build_query($httpParams);
$curl = new Curl();
$resp = $curl->get($url, false);
return ['code' => 200, 'data' => $resp, 'msg' => 'ok'];
return ['code' => 200, 'data' => $resp, 'msg' => 'ok'];
}
public function actionLive()
......@@ -37,7 +37,6 @@ class CoinDogController extends BaseController
$flag = Yii::$app->request->get('flag', 'down');
$coindog = Yii::$app->params['coindog'];
$accessKey = $coindog['accessKey'];
......@@ -59,20 +58,24 @@ class CoinDogController extends BaseController
'flag' => $flag
];
$url = $coindog['live'].'?'.http_build_query($httpParams);
$url = $coindog['live'] . '?' . http_build_query($httpParams);
$curl = new Curl();
$resp = $curl->get($url, false);
if(!isset($resp['list'])) {
if (!isset($resp['list'])) {
$msg = '数据不存在';
$code = -1;
$data = null;
goto doEnd;
}
$list = $resp['list'][0]['lives'];
foreach ($list as &$item) {
preg_match_all("/\【(.+?)\】/", $item['content'], $match);
$item['title'] = $match[1][0];
}
$code = 0;
$msg = 'success';
doEnd :
return ['code' => $code, 'data' => $list, 'msg' => $msg];
return ['code' => $code, 'data' => $list, 'msg' => $msg];
}
}
\ No newline at end of file
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