public function chuanciquery()
 {
     if (IS_POST) {
         //注册用户
         /* 检测验证码 */
         if (!check_verify($verify)) {
             $this->error('验证码输入错误!');
         }
         /* 检测密码 */
         if ($password != $repassword) {
             $this->error('密码和重复密码不一致!');
         }
         /* 调用注册接口注册用户 */
         $User = new UserApi();
         $uid = $User->register($username, $password, $email);
         if (0 < $uid) {
             //注册成功
             //TODO: 发送验证邮件
             $this->success('注册成功!', U('login'));
         } else {
             //注册失败,显示错误信息
             $this->error($this->showRegError($uid));
         }
     } else {
         //显示注册表单
         $this->display();
     }
 }
 public function order()
 {
     if (IS_POST) {
         if (!check_verify(I('verify'))) {
             $this->error('验证码输入错误');
         }
         $Order = D('Order');
         $order_id = 'NS' . date('YmdHis') . mt_rand(1000, 9999);
         $uid = is_login();
         $site_id = I('site_id', 0, 'intval');
         if ($uid) {
             $result = $Order->inputVisa($order_id, $uid, $site_id);
             $mobile = get_userinfo($uid, 3);
         } else {
             $mobile = I('mobile', '', 'trim');
             /* 调用注册接口注册用户 */
             $User = new UserApi();
             $res = $User->checkMobile($mobile);
             if ($res == 1) {
                 $password = mt_rand(100000, 999999);
                 $uid = $User->register('', $password, '', $mobile);
                 if (0 < $uid) {
                     //注册成功
                     send_sms($mobile, array('mobile' => $mobile, 'password' => $password), 'password');
                     $result = $Order->inputVisa($order_id, $uid, $site_id);
                 }
             } else {
                 $user_info = $User->getinfo($mobile, 3);
                 $result = $Order->inputVisa($order_id, $user_info[0], $site_id);
             }
         }
         if ($result) {
             send_sms($mobile, array('orderid' => $order_id), 'onOrder');
             $this->redirect('checkOrder', array('order_id' => $order_id));
         } else {
             $this->error('订单提交失败');
         }
     } else {
         $visa_id = I('visa_id', 0, 'intval');
         if (empty($visa_id)) {
             $this->error('无效参数');
         }
         // 线路信息
         $map = array('visa_id' => $visa_id);
         $visa_info = M('Visa')->where($map)->find();
         if (empty($visa_info)) {
             $this->error('不存在');
         }
         $this->assign('visa_info', $visa_info);
         $this->display();
     }
 }