public function pprinter() { $openid = wx_openid(); if (!$openid) { exit('打印机模块加载失败...请退出重试'); } //if(!C('POINT_URL.PRINTER')) exit('系统错误'); if (IS_POST && I('scode')) { $result = file_get_contents(C('POINT_URL.PRINTER') . '?openid=' . $openid); if ($result) { $this->ajaxReturn('ok'); } else { $this->ajaxReturn('error'); } } else { //微信转发链接配置 // 注意 URL 一定要动态获取,不能 hardcode. $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://"; $url = "{$protocol}{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; $signPackage = file_get_contents("http://a.forcent.cn/ldh/api.php/Wechatapi/signPackage?url=" . $url); $w = json_decode($signPackage, true); //print_r($w); $this->signPackage = $w; $this->display(); } }
function getOrderInfo($where = array()) { $mod = M('Exchange_order'); $where['openid'] = wx_openid(); $orderinfo = $mod->where($where)->find(); //查询订单信息 // echo $mod->getLastSql();exit; return $orderinfo; }
function index() { $id = intval($_REQUEST['id']); $openid = wx_openid(); $huiyuan = check_vip($openid); $person_m = M('jiyuedu_person'); $click_m = M('jiyuedu_click'); $person = $person_m->where('id=' . $id)->find(); //查询阅读数量 $where['openid'] = $openid; $where['pid'] = $id; $clickrs = $click_m->where($where)->find(); //检测是否点击过 //TODO // //更新阅读数 if ($id && $openid) { $arr['num'] = $person['num'] + 1; //更新阅读数条件 if (!$clickrs && $openid != $person['openid']) { //更新个人阅读书 $person_m->where('id=' . $id)->save($arr); } $click_m->add(array('openid' => $openid, 'pid' => $id, 'ctime' => getSysTime())); //添加点击记录 } $map['openid'] = $openid; $info = $person_m->where($map)->find(); $shareid = ''; if ($huiyuan) { if (!$info) { $id = $person_m->add(array('openid' => $openid, 'ctime' => getSysTime())); } $str = $info['id'] ? $info['id'] : $id; $shareid = '?id=' . $str; } $arr = array("title" => "点开我,帮TA集满5个阅读数。", "desc" => "感“蟹”有你,1元兑换螃蟹,感恩回馈会员。", "link" => 'http://a.forcent.cn/ldh/exchange.php/Jiyuedu' . $shareid, "imgUrl" => C('IMG_PATH') . 'uploads/px.jpg', 'id' => $str); $gc = M('jiyuedu_order'); $this->assign('tid1', $gc->where(array('openid' => $openid, 'tid' => 1))->find()); //查询积分兑换信息 $this->assign('tid2', $gc->where(array('openid' => $openid, 'tid' => 2))->find()); //集阅读兑换信息 $this->assign('num', $info['num']); $this->assign('huiyuan', $huiyuan); $this->assign('sharePackage', json_encode($arr)); $this->assign('signPackage', $this->signPackage()); $this->assign('openid', $openid); $this->assign('id', $id); $this->display(); }
public function pprinter() { $openid = wx_openid(); if (!$openid) { exit('打印机模块加载失败...请退出重试'); } //if(!C('POINT_URL.PRINTER')) exit('系统错误'); if (IS_POST && I('scode')) { $result = file_get_contents(C('POINT_URL.PRINTER') . '?openid=' . $openid); if ($result) { $this->ajaxReturn('ok'); } else { $this->ajaxReturn('error'); } } else { //微信转发链接配置 $this->signPackage = getSignPackage(); $this->display(); } }
public function a() { $w = wx_openid(); //print_r(session('openid',null)); print_r($w); }
function orderList() { $mod = M('Exchange_order'); $where['sid'] = $_REQUEST['sid']; // $where['paytime'] = array('like','%'.date('Y-m-d').'%'); $where['openid'] = wx_openid(); $where['status'] = 2; $data = $mod->where($where)->order('paytime desc')->select(); // echo $mod->getLastSql(); $this->assign('list', $data); $this->display('Store:order'); }