Esempio n. 1
0
 function orderDetail($id)
 {
     $mod = M('Exchange_order');
     $data = $mod->where('id=' . $id)->find();
     $this->assign('data', $data);
     $this->assign('img', getWxBaseInfo($data['openid']));
 }
Esempio n. 2
0
 function checkExchange()
 {
     // echo getWxBaseInfo(wx_openid());exit;
     $phone = $_REQUEST['phone'];
     $where['huiyuantel'] = $phone;
     $where['status'] = 2;
     $data = M('exchange_order')->where($where)->find();
     if ($data) {
         $this->assign('show', 1);
     } else {
         $this->assign('show', 0);
     }
     $this->assign('data', $data);
     $this->assign('img', getWxBaseInfo($data['openid']));
     $this->display('phonedesc');
 }
Esempio n. 3
0
 function getOrderByKey()
 {
     $gc = M('jiyuedu_order');
     $key = intval($_REQUEST['key']);
     $where['id'] = $key;
     $rs = $gc->where($where)->find();
     //echo $gc->getLastSql();exit;
     if ($rs) {
         $rs['img'] = getWxBaseInfo($rs['openid']);
         $json['status'] = 1;
         $json['info'] = $rs;
     } else {
         $json['status'] = 0;
         $json['info'] = "key不存在";
     }
     $this->ajaxReturn($json);
 }
Esempio n. 4
0
 function requestQrcode()
 {
     header("Content-type: text/html; charset=utf-8");
     $url = I('path.2');
     //获取加密参数
     $linkurl = explode('&', $url);
     //echo count($linkurl);exit;
     if (count($linkurl) > 1) {
         $value = base64_decode($linkurl[0]);
     } else {
         $value = base64_decode($url);
     }
     // echo $value;exit;
     $key = explode('&', $value);
     $qid = str_replace("?id=", "", $key[0]);
     $uid = str_replace("uid=", "", $key[1]);
     $mod = M('Exchange_qrcode');
     $info = $mod->where('id=' . $qid)->find();
     //查询二维码基本信息
     //echo $value;exit;
     //echo exp;exit;
     $isuser = M('exchange_store')->where('id=' . $info['sid'])->getField('isuser');
     //指定用户购买
     //$huiyuaninfo = array('open_id' => 'asdasd', 'huiyuan_name' => 'asdas', 'huiyuan_tel' => '256456546', 'card_no' => '456456546546'); //check_vip(wx_openid());
     $huiyuaninfo = check_vip(wx_openid());
     if ($huiyuaninfo) {
         $this->assign('name', $huiyuaninfo['huiyuan_name']);
         $this->assign('tel', $huiyuaninfo['huiyuan_tel']);
         $this->assign('img', getWxBaseInfo($huiyuaninfo['open_id']));
         //判断是否是特定用户
         if ($isuser) {
             $map['cardno'] = $huiyuaninfo['card_no'];
             $map['tel'] = $huiyuaninfo['huiyuan_tel'];
             $deserve = M('exchange_deserve')->where($map)->find();
             //是否是特定用户
             if (!$deserve) {
                 $this->display('no');
                 exit;
             }
             $arr['isuser'] = 1;
             //特定代码
             $where['isuser'] = 1;
             //特定条件
             $this->assign('data', $this->getOrderInfo(array('status' => 2, 'isuser' => 1)));
             //特定用户订单信息
         } else {
             $arr['isuser'] = 0;
             //特定代码
             $where['isuser'] = 0;
             //特定条件
             $this->assign('data', $this->getOrderInfo(array('status' => 2, 'isuser' => 0)));
             //普通订单信息
         }
         $vm = D('QrcodeproductView');
         $data = $vm->where('Exchange_qrcode.id=' . $qid)->find();
         if ($data['issale'] == 1) {
             $score = $data['p_score'] * getSaleByCardNo($huiyuaninfo['card_no']);
         } else {
             $score = $data['p_score'];
         }
         $order = M('Exchange_order');
         $where['huiyuantel'] = $huiyuaninfo['huiyuan_tel'];
         $where['openid'] = $huiyuaninfo['open_id'];
         $where['status'] = 2;
         $rs = $order->where($where)->find();
         //查询订单信息
         if ($info['status'] == 1) {
             $arr['sid'] = $info['sid'];
             $arr['pid'] = $data['pid'];
             $arr['uid'] = $uid;
             $arr['qid'] = $qid;
             $arr['title'] = $data['title'];
             $arr['huiyuanname'] = $huiyuaninfo['huiyuan_name'];
             $arr['huiyuantel'] = $huiyuaninfo['huiyuan_tel'];
             $arr['openid'] = $huiyuaninfo['open_id'];
             $arr['price'] = 0;
             $arr['score'] = $score;
             $arr['status'] = 1;
             $arr['card_no'] = $huiyuaninfo['card_no'];
             $arr['ctime'] = $this->crtTime();
             if ($rs) {
                 //$id = $_REQUEST['id'];
                 $this->orderDetail($rs['id']);
             } else {
                 $state = $order->add($arr);
                 $this->assign('status', 1);
             }
         } else {
             if ($rs['openid'] == $huiyuaninfo['open_id']) {
                 $this->assign('info', '已支付');
             } else {
                 $this->assign('info', '二维码已失效');
             }
         }
         //$this->assign('score', $data[0]['score']); //赋值积分
         $this->assign('sid', $info['sid']);
         //赋值商户ID
         //$this->assign('uid', $info['uid']); //赋值商户ID
         $this->assign('qid', $qid);
         //赋值二维码ID
         $this->assign('url', $url);
         //赋值二维码ID
         //  echo getWxBaseInfo($huiyuaninfo['open_id']);exit;
         $this->getQrproductByQid($qid, $huiyuaninfo['card_no']);
         //获取二维码订单基本信息
         $this->assign('errorinfo', "你已经兑换过了!");
         $rs ? $this->display('Store:desc') : $this->display('index');
     } else {
         $fs['openid'] = wx_openid();
         $fsdata = M('Fsopenid')->where($fs)->find();
         if ($fsdata) {
             $redirec_url = 'http://a.forcent.cn/ldh/exchange.php/Member/requestQrcode/' . $url;
             redirect('http://a.forcent.cn/iHuiyuan/user/Integral?url=' . $redirec_url);
         } else {
             redirect('http://mp.weixin.qq.com/s?biz=MjM5ODg1MDI2OA==&mid=209800739&idx=1&sn=54b350a36b6655303eadca02c425ddb9#rd');
         }
     }
     //插入二维码扫描日志
     $arr['qid'] = $qid;
     $arr['ip'] = getcip();
     $arr['mobile'] = $_SERVER['HTTP_USER_AGENT'];
     // $arr['huiyuanname'] = $huiyuaninfo['huiyuan_name'];
     $arr['openid'] = wx_openid();
     $arr['huiyuantel'] = $huiyuaninfo['huiyuan_tel'];
     $arr['ctime'] = $this->crtTime();
     $qrsan = M('Score_qrscanlog');
     $qrsan->add($arr);
 }
Esempio n. 5
0
 function qrcodeRs()
 {
     $id = intval($_GET['qid']);
     //二维码ID
     $sid = intval($_GET['sid']);
     //商户ID
     $mod = M('Score_order');
     $gc = M('Score_qrcode');
     $where['qid'] = $id;
     $where['status'] = 2;
     $rs = $mod->where($where)->find();
     //刷新之后查询订单信息
     if ($rs) {
         $this->assign('data', $rs);
         $this->assign('img', getWxBaseInfo($rs['openid']));
         $this->getStoreNameById($sid);
         $this->display('paysuccess');
     } else {
         //查询二维码状态
         if (2 == $gc->where('id=' . $id)->getField('status')) {
             redirect('productList?sid=1');
         } else {
             redirect('qrcode?qid=' . $id . '&sid=' . $sid);
         }
     }
 }
Esempio n. 6
0
 function requestQrcode()
 {
     header("Content-type: text/html; charset=utf-8");
     $url = I('path.2');
     //获取加密参数
     $linkurl = explode('&', $url);
     //echo count($linkurl);exit;
     if (count($linkurl) > 1) {
         $value = base64_decode($linkurl[0]);
     } else {
         $value = base64_decode($url);
     }
     // echo $value;exit;
     $key = explode('&', $value);
     $qid = str_replace("?id=", "", $key[0]);
     $uid = str_replace("uid=", "", $key[1]);
     $mod = M('Score_qrcode');
     $info = $mod->where('id=' . $qid)->find();
     //查询二维码基本信息
     //echo $value;exit;
     //echo exp;exit;
     if ($uid == getwxuserid()) {
         redirect('/ldh/store.php/Store/qrcode?qid=' . $qid . '&sid=' . $info['sid']);
     } else {
         $huiyuaninfo = check_vip(wx_openid());
         // print_r($huiyuaninfo);exit;
         if ($huiyuaninfo) {
             $vm = D('QrcodeproductView');
             $data = $vm->where('Score_qrcode.id=' . $qid)->select();
             foreach ($data as $key => $value) {
                 $title .= $value['title'] . ',';
                 $pids .= $value['pid'] . ',';
             }
             $order = M('Score_order');
             $where['qid'] = $qid;
             $where['uid'] = $uid;
             //$where['status'] = 1;
             $rs = $order->where($where)->find();
             //查询订单信息
             //print_r($rs);
             if ($info['status'] == 1) {
                 $arr['sid'] = $info['sid'];
                 $arr['pid'] = rtrim($pids, ',');
                 $arr['uid'] = $uid;
                 $arr['qid'] = $qid;
                 $arr['title'] = rtrim($title, ',');
                 $arr['huiyuanname'] = $huiyuaninfo['huiyuan_name'];
                 $arr['huiyuantel'] = $huiyuaninfo['huiyuan_tel'];
                 $arr['openid'] = $huiyuaninfo['open_id'];
                 $arr['price'] = $data[0]['price'];
                 $arr['score'] = $data[0]['score'];
                 $arr['status'] = 1;
                 $arr['card_no'] = $huiyuaninfo['card_no'];
                 $arr['ctime'] = $this->crtTime();
                 if (!$rs) {
                     $state = $order->add($arr);
                     $this->assign('status', 1);
                 } else {
                     $this->assign('status', $rs['status']);
                 }
             } else {
                 if ($rs['openid'] == $huiyuaninfo['open_id']) {
                     $this->assign('info', '已支付');
                 } else {
                     $this->assign('info', '二维码已失效');
                 }
             }
             $this->assign('score', $data[0]['score']);
             //赋值积分
             $this->assign('sid', $info['sid']);
             //赋值商户ID
             $this->assign('uid', $info['uid']);
             //赋值商户ID
             $this->assign('qid', $qid);
             //赋值二维码ID
             $this->assign('name', $huiyuaninfo['huiyuan_name']);
             $this->assign('tel', $huiyuaninfo['huiyuan_tel']);
             $this->assign('img', getWxBaseInfo($huiyuaninfo['open_id']));
             $this->getQrproductByQid($qid);
             //获取二维码订单基本信息
             $this->display('index');
         } else {
             $fs['openid'] = wx_openid();
             $fsdata = M('Fsopenid')->where($fs)->find();
             if ($fsdata) {
                 $redirec_url = 'http://a.forcent.cn/ldh/store.php/PayM/requestQrcode/' . $url;
                 redirect('http://a.forcent.cn/iHuiyuan/user/Integral?url=' . $redirec_url);
             } else {
                 redirect('http://mp.weixin.qq.com/s?biz=MjM5ODg1MDI2OA==&mid=209800739&idx=1&sn=54b350a36b6655303eadca02c425ddb9#rd');
             }
         }
         //插入二维码扫描日志
         $arr['qid'] = $qid;
         $arr['ip'] = get_client_ip();
         $arr['mobile'] = $_SERVER['HTTP_USER_AGENT'];
         // $arr['huiyuanname'] = $huiyuaninfo['huiyuan_name'];
         $arr['openid'] = wx_openid();
         // $arr['huiyuantel'] = $huiyuaninfo['huiyuan_tel'];
         $arr['ctime'] = $this->crtTime();
         $qrsan = M('Score_qrscanlog');
         $qrsan->add($arr);
     }
 }