public function vote_log() { $vote = M('Vote_recode'); // 实例化User对象 $map['user_id'] = $_REQUEST['id']; // $count = $User->where($map)->count(); // 查询满足要求的总记录数 // $Page = new \ Think \ Page($count, 10); // 实例化分页类 传入总记录数和每页显示的记录数(25) $p = getpage($vote, $map, 20); foreach ($map as $key => $val) { $Page->parameter .= "{$key}=" . urlencode($val) . "&"; } //$Page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%'); // $show = $Page->show(); // 分页显示输出 // echo $show; // 进行分页数据查询 注意limit方法的参数要使用Page类的属性 //$list = $User->where($map)->order('vote_num desc,gorder desc, id asc')->limit($Page->firstRow . ',' . $Page->listRows)->select(); $list = $vote->where($map)->order('crttime desc')->select(); foreach ($list as $k => $v) { if (check_vip($v['openid'])) { $list[$k]['ishuiyuan'] = '是'; } else { $list[$k]['ishuiyuan'] = '否'; } } $this->assign('list', $list); // 赋值数据集 $this->assign('page', $p->show()); // 赋值分页输出 $this->display(); }
function spacecp_profile_top_output() { global $_G; if ($_G['gp_op'] == 'bbs' && $_G['uid']) { //获取语言包 require './data/plugindata/dsu_amusign.lang.php'; $sgid = array(); $sgid = unserialize($_G['cache']['plugin']['dsu_amusign']['sgid']); $dayprice = $_G['cache']['plugin']['dsu_amusign']['dayprice']; $pricex = $_G['cache']['plugin']['dsu_amusign']['pricex']; $sign_vip = $_G['cache']['plugin']['dsu_amusign']['vip']; //---KK-VIP----- $kkvip_exists = file_exists("./source/plugin/dsu_kkvip/vip.func.php"); if ($kkvip_exists) { require DISCUZ_ROOT . './source/plugin/dsu_kkvip/vip.func.php'; } $uid_vip = 0; if ($kkvip_exists && $_G['vip'] && $sign_vip) { $uid_vip = check_vip($_G['uid']); } else { $uid_vip = 0; } //---KK-VIP-----; if (!in_array($_G['groupid'], $sgid) && !$uid_vip) { $query = DB::fetch_first("SELECT * FROM " . DB::table("plugin_dsuamusign") . " WHERE uid = '{$_G['uid']}'"); if (!$query) { $query['time'] = 0; } if ($query['time'] < $_G['timestamp']) { $return = '<div style="margin:10px 0;padding:8px 8px 8px 24px;border:1px dashed #FF9A9A;background:#FFC url(./static/image/common/locked.gif) no-repeat 6px 50%;font-size:12px;">' . $scriptlang['dsu_amusign']['home'] . '[<a href="javascript:;" onclick="showWindow(\'win\', \'plugin.php?id=dsu_amusign:cost&infloat=1&uid=' . $_G['uid'] . '\');return false;"><FONT COLOR="#3300FF"><B>' . $scriptlang['dsu_amusign']['cost'] . '</B></FONT></a>]' . $scriptlang['dsu_amusign']['juhao'] . '</div>'; } elseif ($query['time'] > $_G['timestamp'] || $query['time'] == $_G['timestamp']) { $showtime = date('Y-m-d H:i', $query['time']); $showdays = howlong($_G['timestamp'], $query['time']); $showday = ''; if ($showdays['0']) { $showday = $showdays['0'] . lang("plugin/dsu_amusign", "day"); } if ($showdays['1']) { $showday .= $showdays['1'] . lang("plugin/dsu_amusign", "hr"); } if (!$showday) { $showday = lang("plugin/dsu_amusign", "min"); } if (!$query['belong'] || $query['belong'] == $_G['uid']) { $showlang = lang('plugin/dsu_amusign', 'qixian', array('time' => $showtime, 'days' => $showday)); } else { $user = getuserbyuid($query['belong']); $nameurl = '<a href="home.php?mod=space&uid=' . $query['belong'] . '" target="_blank">' . $user["username"] . '</a>'; $showlang = lang('plugin/dsu_amusign', 'belong', array('name' => $nameurl, 'time' => $showtime, 'days' => $showday)); } $return = '<div style="margin:10px 0;padding:8px 8px 8px 24px;border:1px dashed #FF9A9A;background:#FFC url(./static/image/common/locked.gif) no-repeat 6px 50%;font-size:12px;">' . $showlang . '</div>'; } } elseif (in_array($_G['groupid'], $sgid) || $uid_vip) { $return = '<div style="margin:10px 0;padding:8px 8px 8px 24px;border:1px dashed #FF9A9A;background:#FFC url(./static/image/common/locked.gif) no-repeat 6px 50%;font-size:12px;">' . $scriptlang['dsu_amusign']['nocost'] . '</div>'; } return $return; } else { return ''; } }
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); }
/** * 兑换 * */ function exchange() { $json['status'] = 0; $tid = $_REQUEST['tid']; $openid = $_REQUEST['openid']; $gc = M('jiyuedu_order'); $huiyuan = check_vip($openid); $score = getCredits($huiyuan['card_no']); if (1 == $tid && $score < 100) { $json['status'] = 0; $json['info'] = "积分不足"; echo json_encode($json); exit; } $arr = array('tid' => $tid, 'tel' => $huiyuan['huiyuan_tel'], 'name' => $huiyuan['huiyuan_name'], 'openid' => $openid, 'ctime' => getSysTime()); $state = $gc->add($arr); if ($state) { if ($tid == 1) { deductCredits($huiyuan['card_no'], 100); //扣除积分 $scorearr = array('qid' => '00001', 'orderid' => $state, 'score' => 100, 'huiyuanopenid' => $openid, 'huiyuantel' => $huiyuan['huiyuan_tel'], 'ctime' => getSysTime()); M('score_scorelog')->add($scorearr); //记录扣除积分日志 } $person_m = M('jiyuedu_person'); if ($tid == 2) { $person_m->where(array('openid' => $openid))->save(array('num' => 0)); //清空阅读数 //TODO } $json['status'] = 1; $json['key'] = $state; $json['info'] = "兑换成功"; } else { $json['info'] = "兑换失败"; } echo json_encode($json); }
function doAdd1() { $data['status'] = 0; header("Content-type: text/html; charset=utf-8"); $mod = M('Score_order'); $gc = M('Score_qrcode'); $huiyuaninfo = check_vip(wx_openid()); $qrdata = $gc->where('id=' . $_REQUEST['qid'])->find(); //二维码状态 if (2 == $qrdata['status']) { if ($huiyuaninfo['open_id'] == $qrdata['openid']) { $data['info'] = '已支付'; $this->ajaxReturn($data); } else { $data['info'] = '订单已失效'; $this->ajaxReturn($data); } } else { $where['qid'] = $_REQUEST['qid']; $where['uid'] = $_REQUEST['uid']; $where['status'] = 1; $card_no = $huiyuaninfo['card_no']; //会员卡号 $huiyuan_score = getCredits($card_no); //$data['info'] = $_REQUEST['score']; // $this->ajaxReturn($data);exit; if ($huiyuan_score >= $_REQUEST['score']) { $state = $mod->where($where)->save(array('status' => 2, 'paytime' => $this->crtTime())); //更新订单状态 if ($state) { //减积分操作 $qty = deductCredits($card_no, $_REQUEST['score']); if ($qty) { $scorelog['huiyuanid'] = $huiyuaninfo['huiyuan_id']; $scorelog['score'] = $_REQUEST['score']; $scorelog['huiyuantel'] = $huiyuaninfo['huiyuan_tel']; $scorelog['huiyuanopenid'] = $huiyuaninfo['open_id']; $scorelog['ctime'] = $this->crtTime(); M('Score_scorelog')->add($scorelog); //$sql = M('Score_qrcode')->getLastSql(); // file_put_contents("./ljhasdkjahsdkjasd.txt", var_export($sql, true)); } //更新二维码状态 $udata['status'] = 2; $udata['utime'] = $this->crtTime(); M('Score_qrcode')->where('id=' . $_REQUEST['qid'])->save($udata); $data['status'] = 1; $this->ajaxReturn($data); } else { $data['info'] = '付款失败'; $this->ajaxReturn($data); } } else { $data['info'] = '积分不足'; $this->ajaxReturn($data); } } }