コード例 #1
0
 public function show()
 {
     $table = I('get.table');
     $Model = new \Think\Model();
     $sql = 'show columns from ' . $table . ';';
     $tabel_info = $Model->query($sql);
     $data = $Model->table($table)->select();
     $this->assign('table', $table);
     $this->assign('data', $data);
     $this->assign('tabel_info', $tabel_info);
     $this->display();
 }
コード例 #2
0
 public function index_trans()
 {
     $line_items = array("0" => "line 1", "1" => "line 2", "2" => "line 3");
     if (IS_POST) {
         $transDB = new \Think\Model();
         $transDB->startTrans();
         $title = array('title' => $_POST['title']);
         $header_result = $transDB->table('t_header')->add($title);
         if ($header_result) {
             $id = $transDB->table('t_header')->getLastInsID();
             $line = array('line' => $_POST['selectedText'], 'header_id' => $id);
             $line_result = $transDB->table('t_detail')->add($line);
             if ($line_result) {
                 $transDB->commit();
             } else {
                 $transDB->rollback();
             }
         } else {
             $transDB->rollback();
         }
     }
     $this->assign('line_items', $line_items);
     $this->display('transDemo');
 }
コード例 #3
0
 public function index()
 {
     session_start();
     header('Content-Type:text/html; charset=UTF-8');
     //防止出现乱码
     $uid = $_SESSION['uid'];
     $username = $_SESSION['username'];
     $this->assign('username', $username);
     //用户抵押物品信息
     $goods = new \Think\Model();
     $condition['f_uid'] = $uid;
     $goodsarr = $goods->table('t_user_stock a')->field('a.f_uid uid,a.f_sid sid,a.f_shares shares,f_shares_frozen frozenshares,b.f_id id,b.f_stockcode stockcode,b.f_stockname stockname,b.f_price price')->join('t_stockinfo b on a.f_sid = b.f_id')->where($condition)->select();
     $this->assign('goodsarr', $goodsarr);
     //投资列表
     $Model = new \Think\Model();
     $investarr = $Model->query("select a.f_uid userid,a.f_username username,b.f_id vid,round(b.f_yield*100,2) yield,round(b.f_money) money,round(b.f_danbaomoney,2) danbaomoney,b.f_horizon horizon,b.f_state state,DATE_FORMAT(b.f_addtime,'%Y-%m-%d') addtime from t_userinfo a,t_invest b where a.f_uid=b.f_userid and b.f_state=200 order by b.f_addtime desc limit 20");
     $this->assign('investlist', $investarr);
     $this->display();
 }
コード例 #4
0
ファイル: StockController.class.php プロジェクト: zydj333/p2p
 public function index()
 {
     session_start();
     header('Content-Type:text/html; charset=UTF-8');
     //防止出现乱码
     $username = session('username');
     $uid = session('uid');
     $isLogin = $uid ? true : false;
     $this->assign('username', $username);
     $this->assign('islogin', $isLogin);
     //股票列表
     $Stock = M("stockinfo");
     $stocklist = $Stock->field('f_id sid,f_stockcode stockcode,f_stockname stockname,round(f_openprice,2) openprice,round(f_price,2) price,f_state state')->select();
     $this->assign('stocklist', $stocklist);
     //我的股票
     if ($isLogin) {
         $Stock = new \Think\Model();
         $mystockinfo = $Stock->table('t_stockinfo a,t_user_stock b')->where('a.f_id = b.f_sid and b.f_uid =' . $uid . ' and b.f_shares>0')->field('a.f_id sid,a.f_stockcode stockcode,a.f_stockname stockname,round(a.f_price,2) price,round(f_openprice,2) openprice,b.f_shares shares,b.f_state state')->order('b.f_uptime desc')->limit(20)->select();
         $this->assign('mystockinfo', $mystockinfo);
     }
     $this->display();
 }