You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.8 KiB
53 lines
1.8 KiB
<?php
|
|
namespace app\admin\service\setting;
|
|
|
|
use app\admin\service\AdminBaseService;
|
|
use app\model\GoldFuturesListModel;
|
|
|
|
class GoldFuturesService extends AdminBaseService
|
|
{
|
|
// 获取黄金期货交易对列表
|
|
public function getTradeNameList()
|
|
{
|
|
try {
|
|
$list = GoldFuturesListModel::where('status', 1)->order('id', 'desc')->column('name', 'id');
|
|
return $this->toData('0', 'SUCCESS', ['list' => $list]);
|
|
} catch (\Exception $e) {
|
|
return $this->toData('1', '系统繁忙', [$e->getMessage(), $e->getTrace()]);
|
|
}
|
|
}
|
|
|
|
// 黄金期货列表
|
|
public function inrStockIndexList($param): array
|
|
{
|
|
try {
|
|
if (empty($param['page']) || empty($param['limit'])) {
|
|
return $this->toData('400', '缺少必要参数');
|
|
}
|
|
|
|
$where = [];
|
|
if (!empty($param['trade_name'])) {
|
|
$where[] = ['trade_name', 'like', '%' . $param['trade_name'] . '%'];
|
|
}
|
|
$list = GoldFuturesListModel::where($where)->order('id', 'desc')->paginate([
|
|
'page' => $param['page'],
|
|
'list_rows' => $param['limit'],
|
|
]);
|
|
|
|
$tapeList = (new IPOService())->getStockTape(20);
|
|
|
|
return $this->toData('0', 'SUCCESS', [
|
|
'list' => $list->items(),
|
|
'total' => $list->total(),
|
|
'page' => $list->currentPage(),
|
|
'last_page' => $list->lastPage(),
|
|
'extend' => [
|
|
'tape_list' => $tapeList['tape'],
|
|
'source_list' => $tapeList['source'] ?? [],
|
|
]
|
|
]);
|
|
} catch (\Exception $e) {
|
|
return $this->toData('500', '系统繁忙', [$e->getMessage(), $e->getTrace()]);
|
|
}
|
|
}
|
|
}
|