toData('1', 'Params error'); } $server = new IPOService(); return $server->index($param['market_type'], $param); } catch (\Exception $exception) { return $this->toData('0', 'The system is busy. Please try again later.', [$exception->getMessage(),$exception->getTrace()]); } } // 列表 public function stockDetail($param) { try { // stock_type 3 美股 4 印尼 5 马股 6 泰股 if (empty($param['market_type'])) { return $this->toData('1', 'Params error'); } $server = new IPOService(); return $server->stockDetail($param['market_type'], $param); } catch (\Exception $exception) { return $this->toData('0', 'The system is busy. Please try again later.', [$exception->getMessage()]); } } // 下单 public function order($param, $userId) { try { if (empty($userId)) { return $this->toData('1', 'Login fail'); } // 需要完成实名认证之后才能下单 $user = UserModel::where('user_id', $userId)->find(); if (empty($user) || $user->is_real != 1) { return $this->toData('405', 'Only after completing real-name authentication can you place an order.'); } // stock_type 3 美股 4 印尼 5 马股 6 泰股 if (empty($param['market_type'])) { return $this->toData('1', 'Params error'); } $server = new IPOService(); return $server->order($param['market_type'], $param, $userId); } catch (\Exception $exception) { return $this->toData('0', 'The system is busy. Please try again later.', [$exception->getMessage()]); } } // 后支付-付款 /* 支付金额(先支付)= 申购数量*申购价格+手续费 申购开始时间-公布中签时间 支付金额(后支付)=申购数量*申购价格+手续费 公布中签时间-申购截止时间 支付金额(后支付)=分配数量*申购价格+手续费 */ public function postPay($param, $userId) { try { if (empty($userId)) { return $this->toData('1', 'Login fail'); } // 需要完成实名认证之后才能下单 $user = UserModel::where('user_id', $userId)->find(); if (empty($user) || $user->is_real != 1) { return $this->toData('405', 'Only after completing real-name authentication can you place an order.'); } // stock_type 3 美股 4 印尼 5 马股 6 泰股 if (empty($param['market_type'])) { return $this->toData('1', 'Params error'); } $server = new IPOService(); return $server->postPay($param['market_type'], $param, $userId); } catch (\Exception $exception) { return $this->toData('0', 'The system is busy. Please try again later.', [$exception->getMessage()]); } } // 申购记录 public function list($param, $userId) { try { // stock_type 3 美股 4 印尼 5 马股 6 泰股 if (empty($param['market_type'])) { return $this->toData('1', 'Params error'); } if (empty($userId)) { return $this->toData('1', 'Login fail'); } $server = new IPOService(); return $server->list($param['market_type'], $param, $userId); } catch (\Exception $exception) { return $this->toData('0', 'The system is busy. Please try again later.', [$exception->getMessage()]); } } // 申购订单详情 public function detail($param, $userId) { try { // stock_type 3 美股 4 印尼 5 马股 6 泰股 if (empty($param['market_type'])) { return $this->toData('1', 'Params error'); } if (empty($userId)) { return $this->toData('1', 'Login fail'); } $server = new IPOService(); return $server->detail($param['market_type'], $param, $userId); } catch (\Exception $exception) { return $this->toData('0', 'The system is busy. Please try again later.', [$exception->getMessage()]); } } }