예제 #1
0
 public function listSellTradesAction()
 {
     $sell_trades = array();
     $trade = new Trade();
     $temp_trades = $trade->listTrade(TradeConst::TRADE_OP_TYPE_SELL);
     if (!empty($temp_trades)) {
         foreach ($temp_trades as $tinfo) {
             array_push($sell_trades, explode('|', $tinfo));
         }
     }
     $this->assign('sell_trades', $sell_trades);
     $this->display();
 }
예제 #2
0
 /**
  * 主页
  */
 public function indexAction()
 {
     $session = session('login');
     if (empty($session)) {
         $this->redirect('Test/login');
     }
     $user_id = $session['id'];
     $account = D('Account')->where(array('user_id' => $user_id))->find();
     $this->assign('account', $account);
     $trade = new Trade();
     $order = $trade->getUserUnfinishedOrder($user_id);
     $this->assign('order', $order);
     $this->assign('user', $session);
     $buy_trades = $sell_trades = array();
     $temp_btrades = $trade->listTrade(TradeConst::TRADE_OP_TYPE_BUY);
     $temp_strades = $trade->listTrade(TradeConst::TRADE_OP_TYPE_SELL);
     if (!empty($temp_btrades)) {
         foreach ($temp_btrades as $tinfo) {
             array_push($buy_trades, explode('|', $tinfo));
         }
     }
     if (!empty($temp_strades)) {
         foreach ($temp_strades as $tinfo) {
             array_push($sell_trades, explode('|', $tinfo));
         }
     }
     $this->assign('buy_trades', $buy_trades);
     $this->assign('sell_trades', $sell_trades);
     $this->display();
 }