Commit 3314982f authored by wuxiaoli's avatar wuxiaoli

完善实时获取股票信息

parent 51342211
......@@ -242,10 +242,17 @@ if (!function_exists('getEndDay')) {
}
if (!function_exists('z_market')) {
function z_market($code)
function z_market($code,$market="HK")
{
$res = \think\Db::name('admin_config')->where(array('name' => 'market_data_in'))->value('value');
//判断股票前缀
if(toMarket($code)){
$market = toMarket($code);
};
$code=strtolower($market).$code;
//判断股票是否
switch ($res) {
case 1:
$res = qq_market($code);
......
......@@ -87,7 +87,7 @@ class Index extends Common
if ($code === null) {
return json(['data' => null, 'status' => 0, 'message' => '缺少参数code,操作失败']);
}
$data = z_market(strtolower($market).$code);
$data = z_market($code,$market);
if (!$data) {
return json(['data' => $data, 'status' => 0, 'message' => '操作失败']);
}
......
This diff is collapsed.
......@@ -320,7 +320,7 @@ class Trust extends Model{
public function trustBuy($data,$bs_res)
{
//查询股票最新行情
$Qdata = z_market($data['code']);
$Qdata = z_market($data['code'],$data['market']);
$price = $data['price'] <= 0 ? $Qdata['Price'] : $data['price'];
//判断股票价格是否符号购买条件
if (config('stock_buy_price') > 0) {
......@@ -373,7 +373,7 @@ class Trust extends Model{
public function trustSell($data)
{
//查询股票最新行情
$Qdata = z_market($data['code']);
$Qdata = z_market($data['code'],$data['market']);
$price = $data['price'] <= 0 ? $Qdata['Price'] : $data['price'];
if(config('site_trade_sell') == 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