Browse Source

fix: 日股价格

master
liyang 22 hours ago
parent
commit
6be9690037
  1. 14
      app/home/service/BlockStockService.php

14
app/home/service/BlockStockService.php

@ -31,7 +31,13 @@ class BlockStockService extends BaseHomeService
foreach ($list as &$v) {
$key = "Stock:" . $redisKeyArr[$v->type];
$v->current_price = $redis->hget($key . ":ClosePrice", $v->stock_code) ?? $redis->hget($key . ":CloseNewPrice", $v->stock_code);
$closeNewPrice = $redis->hget($key . ":CloseNewPrice", $v->stock_code);
if (empty($closeNewPrice) || $closeNewPrice == 0) {
$v->current_price = $redis->hget($key . ":ClosePrice", $v->stock_code);
} else {
$v->current_price = $closeNewPrice;
}
}
return $this->toData('0', 'SUCCESS', ['list' => $list, 'total' => $total,]);
} catch (\Exception $exception) {
@ -53,7 +59,9 @@ class BlockStockService extends BaseHomeService
// stock_type 3 美股 4 印尼 5 马股 6 泰股 9 新加坡股票
if (!empty($param['type']) && ($param['type'] > 2 && $param['type'] < 19)) {
$where[] = [
'type', '=', $param['type']
'type',
'=',
$param['type']
];
}
@ -65,6 +73,4 @@ class BlockStockService extends BaseHomeService
return $this->toData('0', 'The system is busy. Please try again later.', [$exception->getMessage()]);
}
}
}
Loading…
Cancel
Save