示例#1
0
文件: site.php 项目: 6662680/qday_wx
 public function doMobilePay()
 {
     global $_W, $_GPC;
     if (empty($_W['member']['uid'])) {
         checkauth();
     }
     $username = $_W['member']['email'] ? $_W['member']['email'] : $_W['member']['mobile'];
     if (empty($username)) {
         message('您的用户信息不完整,请完善用户信息后再充值', '', 'error');
     }
     if (checksubmit('submit', true) || !empty($_GPC['ajax'])) {
         $fee = floatval($_GPC['money']);
         if ($fee <= 0) {
             message('支付错误, 金额小于0');
         }
         $chargerecord = pdo_fetch("SELECT * FROM " . tablename('mc_credits_recharge') . " WHERE uniacid = :uniacid AND uid = :uid AND fee = :fee AND status = '0'", array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid'], ':fee' => $fee));
         if (empty($chargerecord)) {
             $chargerecord = array('uid' => $_W['member']['uid'], 'uniacid' => $_W['uniacid'], 'tid' => date('YmdHi') . random(10, 1), 'fee' => $fee, 'status' => 0, 'createtime' => TIMESTAMP);
             if (!pdo_insert('mc_credits_recharge', $chargerecord)) {
                 message('创建充值订单失败,请重试!', url('entry', array('m' => 'recharge', 'do' => 'pay')), 'error');
             }
         }
         $params = array('tid' => $chargerecord['tid'], 'ordersn' => $chargerecord['tid'], 'title' => '系统充值余额', 'fee' => $chargerecord['fee'], 'user' => $_W['member']['uid']);
         $this->pay($params);
     } else {
         include $this->template('recharge');
     }
 }
示例#2
0
 public function doMobileDetail()
 {
     global $_W, $_GPC;
     checkauth();
     $rid = intval($_GPC['rid']);
     $reply = pdo_fetch("SELECT * FROM " . tablename('shake_reply') . " WHERE rid = :rid", array(':rid' => $rid));
     if (empty($reply)) {
         message('抱歉,此活动不存在或是还未开始!', 'refresh', 'error');
     }
     $member = pdo_fetch("SELECT * FROM " . tablename('shake_member') . " WHERE rid = :rid AND openid = :openid", array(':rid' => $reply['rid'], ':openid' => $_W['member']['uid']));
     if (empty($member)) {
         $member = array('rid' => $rid, 'openid' => $_W['member']['uid'], 'createtime' => TIMESTAMP, 'shakecount' => 0, 'status' => 0);
         $maxjoin = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('shake_member') . " WHERE rid = '{$reply['rid']}' AND status = '1'");
         if ($maxjoin < $reply['maxjoin']) {
             mt_srand((double) microtime() * 1000000);
             $rand = mt_rand(1, 100);
             if ($rand <= $reply['joinprobability']) {
                 $member['status'] = 1;
             }
         }
         pdo_insert('shake_member', $member);
     }
     if (strexists(strtolower($_SERVER['HTTP_USER_AGENT']), 'android')) {
         $reply['speed'] = $reply['speedandroid'];
     }
     include $this->template('detail');
 }
示例#3
0
 public function doMobileLottery()
 {
     global $_GPC, $_W;
     $id = intval($_GPC['id']);
     $sql = 'SELECT * FROM ' . tablename('zzz_reply') . ' WHERE `rid` = :rid';
     $params = array(':rid' => $id);
     $zzz = pdo_fetch($sql, $params);
     if (empty($zzz)) {
         message('非法访问,请重新发送消息进入!');
     }
     checkauth();
     load()->model("mc");
     $profile = mc_require($_W['member']['uid'], array('nickname', 'mobile'), '需要完善资料后才能继续.');
     $startgame = 1;
     if ($zzz['start_time'] > TIMESTAMP) {
         $startgame = 0;
         $str = "活动没开始";
     }
     if ($zzz['end_time'] < TIMESTAMP) {
         $startgame = 0;
         $str = "活动已结束";
     }
     if (empty($_W['fans']['fanid'])) {
         $sql = 'SELECT `fanid` FROM ' . tablename('mc_mapping_fans') . ' WHERE `uid` = :uid';
         $params = array(':uid' => $_W['member']['uid']);
         $fansId = pdo_fetchcolumn($sql, $params);
         if (empty($fansId)) {
             message('必须关注公众号才可以进入游戏', $this->createMobileUrl('introduce', array('id' => $id)), 'error');
         }
         $_W['fans']['fanid'] = $fansId;
     }
     $sql = 'SELECT * FROM ' . tablename('zzz_user') . ' WHERE `rid` = :rid AND `fanid` = :fanid';
     $params = array(':rid' => $id, ':fanid' => $_W['fans']['fanid']);
     $myuser = pdo_fetch($sql, $params);
     // 用户不存在插入一条数据
     if (empty($myuser)) {
         $zzz_user = array('rid' => $id, 'count' => 0, 'points' => 0, 'fanid' => $_W['fans']['fanid'], 'createtime' => TIMESTAMP);
         pdo_insert('zzz_user', $zzz_user);
     }
     $myph = '';
     if (!empty($myuser)) {
         $sql = 'SELECT count(*) FROM ' . tablename('zzz_user') . ' WHERE `rid` = :rid AND `points` > :points';
         $params = array(':rid' => $id, ':points' => $myuser['points']);
         $ph = pdo_fetchcolumn($sql, $params);
         $myph = intval($ph) + 1;
     }
     // 分享增加体力
     $shareFid = intval($_GPC['shareuid']);
     if (!empty($shareFid)) {
         $sql = 'SELECT `id` FROM ' . tablename('zzz_share') . ' WHERE `rid` = :rid AND `fanid` = :fanid AND `sharefid` = :sharefid';
         $params = array(':rid' => $id, ':fanid' => $_W['fans']['fanid'], 'sharefid' => $shareFid);
         $shareInfo = pdo_fetchcolumn($sql, $params);
         if (empty($shareInfo)) {
             pdo_insert('zzz_share', array('rid' => $id, 'fanid' => $_W['fans']['fanid'], 'sharefid' => $shareFid));
             pdo_update('zzz_user', array('sharevalue' => $myuser['sharevalue'] + $zzz['sharevalue']), array('fanid' => $shareFid, 'rid' => $id));
         }
     }
     $energylimit = ($zzz['maxlottery'] + $zzz['prace_times']) * 10;
     include $this->template('gamex');
 }
示例#4
0
 public function doMobileIndex()
 {
     global $_W, $_GPC;
     checkauth();
     $fromuser = fans_require($_W['fans']['from_user'], array('nickname', 'mobile'), '需要完善资料后才能玩.');
     $rid = $_GPC['rid'];
     $follow = fans_search($_W['fans']['from_user'], array('follow'));
     if ($follow['follow'] == 1) {
         if (intval($_GPC['id'])) {
             $score = pdo_fetchcolumn("select score from" . tablename('bj_tgame_user') . "where rid =" . $rid . ".and from_user ='******'from_user'] . "'");
             if ($score < $_GPC['score']) {
                 $update = array('score' => $_GPC['score'], 'realname' => $fromuser['nickname']);
                 $score = $_GPC['score'];
                 pdo_update('bj_tgame_user', $update, array('id' => $_GPC['id'], 'weid' => $_W['weid']));
             }
             message($score, '', 'ajax');
         }
         $from_user = pdo_fetch("select id from_user, rid from" . tablename('bj_tgame_user') . "where from_user ='******'from_user'] . "'");
         if (empty($from_user['from_user'])) {
             $insert = array('id' => $_GPC['id'], 'weid' => $_W['weid'], 'rid' => $rid, 'from_user' => $fromuser['from_user'], 'realname' => $fromuser['nickname'], 'score' => 0);
             pdo_insert('bj_tgame_user', $insert);
         }
         //$from_user = pdo_fetch("select id, rid from".tablename('bj_tgame_user')."where from_user ='******'from_user']. "'");
         if ($from_user['rid'] != $rid) {
             $update = array('rid' => $rid);
             pdo_update('bj_tgame_user', $update, array('id' => $from_user['id']));
         }
         $realname = $fromuser['nickname'];
         $user = pdo_fetch("select * from" . tablename('bj_tgame_user') . "where rid =" . $rid . ".and from_user ='******'from_user'] . "'");
     }
     $set = pdo_fetch("select * from" . tablename('bj_tgame_reply') . "where rid =" . $rid);
     include $this->template('index');
 }
示例#5
0
 public function respond()
 {
     global $_W;
     $rid = $this->rule;
     $sql = "SELECT * FROM " . tablename($this->table_reply) . " WHERE `rid`=:rid LIMIT 1";
     $reply = pdo_fetch($sql, array(':rid' => $rid));
     if (empty($reply['id'])) {
         return array();
     }
     checkauth();
     $sql = "SELECT * FROM " . tablename($this->table_vote) . " WHERE `id`=:id LIMIT 1";
     $vote = pdo_fetch($sql, array(':id' => $reply['vid']));
     if (empty($vote['id'])) {
         return array();
     }
     //$member = $this->getMember();
     //if (empty($member['nickname']) || empty($member['avatar'])) {
     //    $message = '发表话题前请<a target="_blank" href="'.$this->buildSiteUrl($this->createMobileUrl('register')).'">登记</a>您的信息。';
     $title = $reply['title'] == '' ? '微投票' : $reply['title'];
     $description = $reply['description'] == '' ? '微投票活动' : $reply['description'];
     $picUrl = $_W['attachurl'] . $reply['picture'];
     $url = $this->createMobileUrl('Index', array('id' => $vote['id']));
     /**
      * 预定义的操作, 构造返回图文消息结构
      * @param array $news 回复的图文定义(定义为元素集合, 每个元素结构定义为 title - string: 新闻标题, description - string: 新闻描述, picurl - string: 图片链接, url - string: 原文链接)
      * @return array 返回的消息数组结构
      */
     return $this->respNews(array('title' => $title, 'description' => $description, 'picUrl' => $picUrl, 'url' => $url));
 }
示例#6
0
 public function doMobileMy()
 {
     global $_W, $_GPC;
     checkauth();
     $rid = $_GPC['rid'];
     $from_user = $_W['fans']['from_user'];
     $list = pdo_fetchall("SELECT * FROM " . tablename('weizp_album') . " WHERE rid=:rid AND from_user=:from_user", array('rid' => $rid, 'from_user' => $from_user));
     foreach ($list as $k => $v) {
         foreach ($v as $sk => $sv) {
             if ($sk == 'images') {
                 $tmp = unserialize($sv);
                 $images = array();
                 foreach ($tmp as $ssv) {
                     $images[]['id'] = $ssv;
                     $images[]['file'] = pdo_fetchcolumn("SELECT file FROM " . tablename('weizp_images') . "WHERE id='{$ssv}'");
                 }
                 $sv = $images;
             }
             $v[$sk] = $sv;
         }
         $list[$k] = $v;
     }
     //var_dump($list);
     include $this->template('my');
 }
示例#7
0
 public function doMobileEntrance()
 {
     /*  global $_W, $_GPC;
             $this->checkAuth();
             $template_name = 'dish_index'; //默认进入首页
             $weid = $_W['weid'];
             $title = '微点餐';
             $page_from_user = base64_encode(authcode($_W['fans']['from_user'], 'ENCODE'));
             $setting = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_setting') . " WHERE weid={$weid}  ORDER BY id DESC LIMIT 1");
             $store = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_stores') . "  WHERE weid={$weid}  ORDER BY id DESC LIMIT 1");
             $storeid = $store['id'];
             $title = $setting['title'];
     
             if (empty($page_from_user) || empty($storeid)) {
                 message('参数错误!');
             }
     
             $nave = pdo_fetchall("SELECT * FROM " . tablename($this->modulename . '_nave') . " WHERE weid={$weid} AND status=1 ORDER BY displayorder DESC,id DESC");
     
             include $this->template($template_name);*/
     global $_GPC, $_W;
     //$this->checkAuth();
     checkauth();
     $weid = $_W['weid'];
     $title = '全部菜品';
     $page_from_user = base64_encode(authcode($_W['fans']['from_user'], 'ENCODE'));
     $setting = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_setting') . " WHERE weid={$weid}  ORDER BY id DESC LIMIT 1");
     $store = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_stores') . "  WHERE weid={$weid}  ORDER BY id DESC LIMIT 1");
     $storeid = $store['id'];
     if (empty($page_from_user) || empty($storeid)) {
         message('参数错误!');
     }
     $pindex = max(1, intval($_GPC['page']));
     $psize = 20;
     $condition = '';
     if (!empty($_GPC['ccate'])) {
         $cid = intval($_GPC['ccate']);
         $condition .= " AND ccate = '{$cid}'";
     } elseif (!empty($_GPC['pcate'])) {
         $cid = intval($_GPC['pcate']);
         $condition .= " AND pcate = '{$cid}'";
     }
     $children = array();
     $category = pdo_fetchall("SELECT * FROM " . tablename($this->modulename . '_category') . " WHERE weid = '{$weid}' AND storeid={$storeid} ORDER BY  displayorder DESC,id DESC");
     $cid = intval($category[0]['id']);
     $category_in_cart = pdo_fetchall("SELECT goodstype,count(1) as 'goodscount' FROM " . tablename($this->modulename . '_cart') . " GROUP BY weid,storeid,goodstype,from_user  having weid = '{$weid}' AND storeid='{$storeid}' AND from_user='******'");
     $category_arr = array();
     foreach ($category_in_cart as $key => $value) {
         $category_arr[$value['goodstype']] = $value['goodscount'];
     }
     $list = pdo_fetchall("SELECT * FROM " . tablename($this->modulename . '_goods') . " WHERE weid = '{$weid}' AND storeid={$storeid} AND status = '1' AND pcate={$cid} ORDER BY displayorder DESC, subcount DESC, id DESC ");
     $dish_arr = $this->getDishCountInCart($page_from_user, $storeid, $weid);
     //智能点餐
     $intelligents = pdo_fetchall("SELECT * FROM " . tablename($this->modulename . '_intelligent') . " WHERE weid={$weid} AND storeid={$storeid} GROUP BY name ORDER by name");
     include $this->template('dish_list');
 }
示例#8
0
 public function respond()
 {
     global $_W;
     checkauth();
     if ($this->inContext) {
         return $this->post();
     } else {
         return $this->register();
     }
 }
示例#9
0
 public function respond()
 {
     checkauth();
     $sql = "SELECT * FROM " . tablename('basic_reply') . " WHERE `rid` IN ({$this->rule})  ORDER BY RAND() LIMIT 1";
     $reply = pdo_fetch($sql);
     $reply['content'] = htmlspecialchars_decode($reply['content']);
     $reply['content'] = str_replace(array('<br>', '&nbsp;'), array("\n", ' '), $reply['content']);
     $reply['content'] = strip_tags($reply['content'], '<a>');
     //替换要替换的内容
     $reply['content'] = formot_content($reply['content']);
     return $this->respText($reply['content']);
 }
示例#10
0
 public function respond()
 {
     global $_W;
     checkauth();
     if (!$this->inContext) {
         $number = pdo_fetchcolumn(" SELECT COUNT(*) FROM " . tablename('mc_mapping_fans') . " WHERE uniacid = '{$_W['uniacid']}' and follow = 1 ");
         $list = pdo_fetch("select * from " . tablename('eso_sale_share_history') . " WHERE from_user = '******'openid']}' and uniacid = '{$_W['uniacid']}'");
         if (empty($list)) {
             $reply = "欢迎关注【" . $_W['account']['name'] . "】\n你是第【" . $number . "】个会员";
             // $reply ="欢迎关注【".$_W['account']['name']."】\n你是第【854】个会员";
         } else {
             $shangji = pdo_fetch("select from_user from " . tablename('eso_sale_member') . " where id = '{$list['sharemid']}' and uniacid = '{$_W['uniacid']}'");
             $member = mc_fansinfo($shangji['from_user']);
             $reply = "欢迎关注【" . $_W['account']['name'] . "】\n你是由【" . $member['nickname'] . "】推荐的第【" . $number . "】个会员";
         }
     }
     return $this->respText($reply);
 }
示例#11
0
 public function doMobileLottery()
 {
     global $_GPC, $_W;
     $title = '活动';
     $id = intval($_GPC['id']);
     $zzz = pdo_fetch("SELECT * FROM " . tablename('zzz_reply') . " WHERE rid = '{$id}' LIMIT 1");
     if (empty($zzz)) {
         message('非法访问,请重新发送消息进入!');
     }
     $useragent = addslashes($_SERVER['HTTP_USER_AGENT']);
     if (strpos($useragent, 'MicroMessenger') === false && strpos($useragent, 'Windows Phone') === false) {
         header('Location: ' . $zzz['guzhuurl']);
         exit;
     }
     checkauth();
     $fromuser = $_W['fans']['from_user'];
     $sql = "SELECT * FROM " . tablename('zzz_user') . " WHERE  from_user = '******' and rid=" . $id;
     $myuser = pdo_fetch($sql);
     $startgame = 1;
     if ($zzz['start_time'] > TIMESTAMP) {
         $startgame = 0;
         $str = "活动没开始";
     }
     if ($zzz['end_time'] < TIMESTAMP) {
         $startgame = 0;
         $str = "活动已结束";
     }
     //用户不存在,就插入
     if (!$myuser) {
         $zzz_user = array('rid' => $id, 'count' => 0, 'points' => 0, 'from_user' => $fromuser, 'createtime' => TIMESTAMP);
         pdo_insert('zzz_user', $zzz_user);
     }
     $profile = fans_require($fromuser, array('nickname', 'mobile'), '需要完善资料后才能继续.');
     if ($myuser) {
         $sql = "SELECT count(*) FROM " . tablename('zzz_user') . " WHERE  rid = " . $id . " and points >" . $myuser['points'];
         $ph = pdo_fetchcolumn($sql);
         $myph = intval($ph) + 1;
     } else {
         $myph = '';
     }
     $energylimit = ($zzz['maxlottery'] + $zzz['prace_times']) * 10;
     include $this->template('gamex');
 }
示例#12
0
 public function doMobileLottery()
 {
     global $_GPC, $_W;
     $title = '摇骰子抽奖';
     $id = intval($_GPC['id']);
     //$useragent = addslashes($_SERVER['HTTP_USER_AGENT']);
     //if(strpos($useragent, 'MicroMessenger') === false && strpos($useragent, 'Windows Phone') === false ){
     //	echo " 404";
     //	exit;
     //}
     checkauth();
     $fromuser = $_W['fans']['from_user'];
     $sql = "SELECT COUNT(*) FROM " . tablename('bbb_user') . " WHERE  from_user = '******' and rid=" . $id;
     $isuser = pdo_fetchcolumn($sql);
     //用户不存在,就插入
     if (!$isuser) {
         $bbb_user = array('rid' => $id, 'count' => 0, 'points' => 0, 'from_user' => $fromuser, 'createtime' => TIMESTAMP);
         pdo_insert('bbb_user', $bbb_user);
     }
     $profile = fans_require($fromuser, array('nickname', 'mobile'), '需要完善资料后才能摇骰子.');
     $bbb = pdo_fetch("SELECT * FROM " . tablename('bbb_reply') . " WHERE rid = '{$id}' LIMIT 1");
     if ($bbb['start_time'] > TIMESTAMP) {
         $str = "活动于" . date('Y-m-d H:i') . " 开始!";
         message('活动没开始', $this->createMobileUrl('info', array('id' => $id)));
     }
     if ($bbb['end_time'] < TIMESTAMP) {
         message('活动已结束,稍等带你去看排名..', $this->createMobileUrl('rank', array('id' => $id)));
     }
     $bbb['descriptions'] = str_replace("\r", "", $bbb['description']);
     $bbb['descriptions'] = str_replace("\n", "", $bbb['descriptions']);
     if (empty($bbb)) {
         message('非法访问,请重新发送消息进入摇骰子页面!');
     }
     $bbb['description'] = str_replace("\n", "", $bbb['description']);
     $bbb['description'] = str_replace("\r", "", $bbb['description']);
     $sql = "SELECT COUNT(*) FROM " . tablename('bbb_winner') . " WHERE createtime > '" . strtotime(date('Y-m-d')) . "' AND from_user = '******' and rid=" . $id;
     $totals = pdo_fetchcolumn($sql);
     $myuser = pdo_fetch("SELECT id,points,count FROM " . tablename('bbb_user') . " WHERE  from_user = '******' AND rid=" . $id);
     $arr_times = $this->get_today_times($totals, $bbb['maxlottery'], $bbb['prace_times'], $myuser['count']);
     include $this->template('bbb');
 }
示例#13
0
 public function doMobilePostScroe()
 {
     global $_W, $_GPC;
     checkauth();
     if (!empty($_GPC['fen'])) {
         $user = array('realname' => $_GPC['name'], 'mobile' => $_GPC['tel']);
         $registUser = pdo_fetch("select id,score from " . tablename("eudy_ads_user") . " where weid=:weid and fid=:fid ", array(':weid' => $_W['uniacid'], ':fid' => $_W['member']['uid']));
         if (empty($registUser)) {
             $data = array('weid' => $_W['uniacid'], 'fid' => $_W['member']['uid'], 'uname' => $user['realname'], 'tel' => $user['mobile'], 'score' => $_GPC['fen'], 'createtime' => TIMESTAMP);
             pdo_insert('eudy_ads_user', $data);
             echo "1";
         } else {
             $score = intval($_GPC['fen']);
             if (intval($registUser['score']) < $score) {
                 $data = array('uname' => $user['realname'], 'tel' => $user['mobile'], 'score' => $_GPC['fen'], 'createtime' => TIMESTAMP);
                 pdo_update('eudy_ads_user', $data, array('id' => $registUser['id']));
             }
             echo "2";
         }
         die;
     }
 }
function comment()
{
    global $_SGLOBAL;
    checkauth();
    //验证登陆
    $op = req('op');
    $db = MysqliDb::getInstance();
    if ($op == 'add') {
        $setarr = array('uid' => $_SGLOBAL['uid']);
        $setarr['message'] = req('message');
        $setarr['zid'] = req('zid', 0);
        if ($setarr['message'] && $setarr['zid']) {
            $id = $db->insert('comment', $setarr);
            //插入数据
            if ($id) {
                showjson('do_success', 0, array("cid" => $id));
            }
            showjson('submit_comment_error');
        }
        showjson('zid_or_message_can_not_empty');
    } elseif ($op == 'del') {
        $cid = req('cid', 0);
        if (empty($cid)) {
            showjson('non_normal_operation');
        }
        $db->where('cid', $cid);
        if ($_SGLOBAL['usertype'] == 1) {
            //是否管理员
        } else {
            $db->where('uid', $_SGLOBAL['uid']);
        }
        $result = $db->delete('comment');
        //删除评论
        if ($result) {
            showjson('do_success', 0);
        }
        showjson('comment_not_exist');
    }
}
示例#15
0
文件: site.php 项目: randyli/redstar
 public function doMobilePay()
 {
     global $_W, $_GPC;
     //验证用户登录状态,此处测试不做验证
     checkauth();
     $params['tid'] = date('YmdH');
     $params['user'] = $_W['member']['uid'];
     $params['fee'] = floatval($_GPC['price']);
     $params['title'] = '测试支付公众号名称';
     $params['ordersn'] = random(5, 1);
     $params['virtual'] = false;
     if (checksubmit('submit')) {
         if ($_GPC['type'] == 'credit') {
             $setting = uni_setting($_W['uniacid'], array('creditbehaviors'));
             $credtis = mc_credit_fetch($_W['member']['uid']);
             //此处需要验证积分数量
             if ($credtis[$setting['creditbehaviors']['currency']] < $params['fee']) {
                 message('抱歉,您帐户的余额不够支付该订单,请充值!', '', 'error');
             }
         }
     } else {
         $this->pay($params);
     }
 }
示例#16
0
文件: site.php 项目: 6662680/qday_wx
 public function doMobileorderlist()
 {
     global $_GPC, $_W;
     $weid = $this->_weid;
     checkauth();
     $this->check_login();
     $memberid = $this->_user_info['id'];
     if (empty($memberid)) {
         $url = $this->createMobileUrl('index');
         header("Location: {$url}");
     }
     $ac = $_GPC['ac'];
     if ($ac == "getDate") {
         $pindex = max(1, intval($_GPC['page']));
         $psize = 10;
         $sql = "SELECT o.*, h.title ";
         $where = " FROM " . tablename('hotel2_order') . " AS o";
         $where .= " LEFT JOIN " . tablename('hotel2') . " AS h ON o.hotelid = h.id";
         $where .= " WHERE 1 = 1";
         $where .= " AND o.memberid = {$memberid}";
         $where .= " AND o.weid = {$weid}";
         $count_sql = "SELECT COUNT(o.id) " . $where;
         $sql .= $where;
         $sql .= " ORDER BY o.id DESC";
         if ($pindex > 0) {
             // 需要分页
             $start = ($pindex - 1) * $psize;
             $sql .= " LIMIT {$start},{$psize}";
         }
         $list = pdo_fetchall($sql);
         $total = pdo_fetchcolumn($count_sql);
         //print_r($count_sql);die();
         $page_array = get_page_array($total, $pindex, $psize);
         $data = array();
         $data['result'] = 1;
         ob_start();
         include $this->template('order_crumb');
         $data['code'] = ob_get_contents();
         ob_clean();
         $data['total'] = $total;
         $data['isshow'] = $page_array['isshow'];
         if ($page_array['isshow'] == 1) {
             $data['nindex'] = $page_array['nindex'];
         }
         die(json_encode($data));
     } else {
         include $this->template('orderlist');
     }
 }
示例#17
0
文件: site.php 项目: aspnmy/weizan
    public function doMobileGetAward()
    {
        global $_GPC, $_W;
        if (empty($_W['fans']['from_user']) || empty($_W['member']['uid'])) {
            message('非法访问,请重新发送消息进入砸蛋页面!');
        }
        checkauth();
        $fromuser = $_W['fans']['from_user'];
        $uid = intval($_W['member']['uid']);
        $id = intval($_GPC['id']);
        $sql = 'SELECT `id`, `periodlottery`, `maxlottery`, `default_tips`, `misscredit`, `hitcredit` FROM ' . tablename('egg_reply') . ' WHERE `rid` = :rid';
        $params = array(':rid' => $id);
        $egg = pdo_fetch($sql, $params);
        if (empty($egg)) {
            message('非法访问,请重新发送消息进入砸蛋页面!');
        }
        $result = array('status' => -1, 'message' => '');
        $sql = 'SELECT COUNT(*) FROM ' . tablename('egg_winner') . ' WHERE `rid` = :rid AND `uid` = :uid';
        $params[':uid'] = $uid;
        if (empty($egg['periodlottery'])) {
            $total = pdo_fetchcolumn($sql, $params);
            if ($total >= $egg['maxlottery']) {
                $result['message'] = '您已经超过最大砸蛋次数';
                message($result, '', 'ajax');
            }
        } else {
            $sql .= ' AND `createtime` > :createtime';
            $params[':createtime'] = strtotime(date('Y-m-d')) - 86400 * $egg['periodlottery'];
            $total = pdo_fetchcolumn($sql, $params);
            if ($total >= $egg['maxlottery']) {
                $sql = 'SELECT `createtime` FROM ' . tablename('egg_winner') . ' WHERE `rid` = :rid AND `uid` = :uid
						ORDER BY `createtime` DESC';
                $lastdate = pdo_fetchcolumn($sql, array(':rid' => $id, ':uid' => $uid));
                $result['message'] = '您还未到达可以再次砸蛋的时间。下次可砸时间为' . date('Y-m-d', strtotime(date('Y-m-d', $lastdate)) + $egg['periodlottery'] * 86400);
                message($result, '', 'ajax');
            }
        }
        $sql = 'SELECT * FROM ' . tablename('egg_award') . ' WHERE `rid` = :rid ORDER BY `probalilty`';
        $gifts = pdo_fetchall($sql, array(':rid' => $id));
        $awards = array();
        foreach ($gifts as $key => $gift) {
            if (empty($gift['total']) || empty($gift['probalilty'])) {
                unset($gifts[$key]);
                continue;
            }
            $gifts[$key]['random'] = mt_rand(1, 100 / $gift['probalilty']);
            if (mt_rand(1, 100 / $gift['probalilty']) == mt_rand(1, 100 / $gift['probalilty'])) {
                $awards[] = $gift;
            }
        }
        if (count($awards) > 0) {
            $randid = mt_rand(0, count($awards) - 1);
            $awardid = $awards[$randid];
        }
        $result['message'] = empty($egg['default_tips']) ? '很遗憾,您没能中奖!' : $egg['default_tips'];
        $credit = array('rid' => $id, 'uniacid' => $_W['uniacid'], 'uid' => $uid, 'from_user' => $fromuser, 'isaward' => empty($awardid) ? 0 : 1, 'award' => (empty($awardid) ? '未中' : '中') . '奖奖励积分', 'description' => empty($awardid) ? $egg['misscredit'] : $egg['hitcredit'], 'credit' => empty($awardid) ? $egg['misscredit'] : $egg['hitcredit'], 'createtime' => strtotime(date('Y-m-d H:i:s')), 'status' => 2);
        if (!empty($awardid)) {
            $sql = 'SELECT * FROM ' . tablename('egg_award') . ' WHERE `rid` = :rid AND `id` = :id';
            $params = array(':rid' => $id, ':id' => $awardid['id']);
            $gift = pdo_fetch($sql, $params);
            if ($gift['total'] > 0) {
                $credit['status'] = 0;
                $credit['award'] = $gift['title'];
                if (!empty($gift['inkind'])) {
                    $credit['description'] = $gift['description'];
                    $sql = 'UPDATE ' . tablename('egg_award') . ' SET `total` = `total` - 1 WHERE `rid` = :rid AND `id` = :id';
                    pdo_query($sql, $params);
                } else {
                    $gift['activation_code'] = (array) iunserializer($gift['activation_code']);
                    $code = array_pop($gift['activation_code']);
                    $activation_code = iserializer($gift['activation_code']);
                    $sql = 'UPDATE ' . tablename('egg_award') . " SET `total` = `total` - 1, `activation_code` = '" . $activation_code . "' WHERE `rid` = :rid AND `id` = :id";
                    pdo_query($sql, $params);
                    $credit['description'] = '兑换码:' . $code . '<br /> 兑换地址:' . $gift['activation_url'];
                }
                $result['message'] = '恭喜您,得到“' . $gift['title'] . '”!';
                $result['status'] = 0;
            } else {
                $credit['description'] = $egg['misscredit'];
                $credit['award'] = '未中奖奖励积分';
            }
        }
        !empty($credit['description']) && ($result['message'] .= '<br />' . $credit['award'] . ':' . $credit['description']);
        $credit['aid'] = $gift['id'];
        if (empty($awardid)) {
            $value = intval($egg['misscredit']);
            $uid = mc_openid2uid($fromuser);
            mc_credit_update($uid, 'credit1', $value, array(0, '使用砸蛋模块未中奖,赠送' . $value . '积分'));
        } else {
            $value = intval($egg['hitcredit']);
            $uid = mc_openid2uid($fromuser);
            mc_credit_update($uid, 'credit1', $value, array(0, '使用砸蛋模块中奖,赠送' . $value . '积分'));
        }
        pdo_insert('egg_winner', $credit);
        $result['myaward'] = pdo_fetchall("SELECT award, description FROM " . tablename('egg_winner') . " WHERE uid = '{$uid}' AND award <> '' AND rid = '{$id}' ORDER BY createtime DESC");
        message($result, '', 'ajax');
    }
示例#18
0
/**
 * Effectively logs the user in
 * @param string $login
 * @param string $passwd
 */
function user_login($login, $passwd)
{
    global $input;
    global $template_folder;
    global $error;
    global $ezplayer_url;
    // 0) Sanity checks
    if (empty($login) || empty($passwd)) {
        $error = template_get_message('empty_username_password', get_lang());
        view_login_form();
        die;
    }
    $login_parts = explode("/", $login);
    // checks if runas
    if (count($login_parts) == 2) {
        if (!file_exists('admin.inc')) {
            $error = "Not admin. runas login failed";
            view_login_form();
            die;
        }
        include 'admin.inc';
        //file containing an assoc array of admin users
        if (!isset($admin[$login_parts[0]])) {
            $error = "Not admin. runas login failed";
            view_login_form();
            die;
        }
        $_SESSION['user_is_admin'] = true;
        $_SESSION['user_runas'] = true;
    } else {
        if (file_exists('admin.inc')) {
            include 'admin.inc';
            //file containing an assoc array of admin users
            if (isset($admin[$login])) {
                $_SESSION['user_is_admin'] = true;
            }
        }
    }
    $res = checkauth(strtolower($login), $passwd);
    if (!$res) {
        $error = checkauth_last_error();
        view_login_form();
        die;
    }
    // 1) Initializing session vars
    $_SESSION['ezplayer_logged'] = "user_logged";
    // "boolean" stating that we're logged
    $_SESSION['user_login'] = $res['login'];
    $_SESSION['user_real_login'] = $res['real_login'];
    $_SESSION['user_full_name'] = $res['full_name'];
    $_SESSION['user_email'] = $res['email'];
    $_SESSION['admin_enabled'] = false;
    //check flash plugin or GET parameter no_flash
    if (!isset($_SESSION['has_flash'])) {
        //no noflash param when login
        //check flash plugin
        if ($input['has_flash'] == 'N') {
            $_SESSION['has_flash'] = false;
        } else {
            $_SESSION['has_flash'] = true;
        }
    }
    // 2) Initializing the ACLs
    acl_init($login);
    // 3) Setting correct language
    set_lang($input['lang']);
    // 4) Resetting the template path to the one of the language chosen
    template_repository_path($template_folder . get_lang());
    // 5) Logging the login operation
    log_append("login");
    log_append("user's browser : " . $_SESSION['browser_full']);
    // lvl, action, browser_name, browser_version, user_os, browser_full_info
    trace_append(array("1", "login", $_SESSION['browser_name'], $_SESSION['browser_version'], $_SESSION['user_os'], $_SESSION['browser_full'], session_id()));
    // 6) Displaying the page
    //    view_main();
    if (count($_SESSION['first_input']) > 0) {
        $ezplayer_url .= '/index.php?';
    }
    foreach ($_SESSION['first_input'] as $key => $value) {
        $ezplayer_url .= "{$key}={$value}&";
    }
    header("Location: " . $ezplayer_url);
    load_page();
}
示例#19
0
文件: site.php 项目: aspnmy/weizan
    public function doMobileMyorder()
    {
        global $_W, $_GPC;
        checkauth();
        $uid = intval($_W['member']['uid']);
        if (!$_W['isajax']) {
            $now = pdo_fetchall('SELECT a.*, b.title  FROM ' . tablename('str_order') . ' AS a LEFT JOIN ' . tablename('str_store') . ' AS b on a.sid = b.id WHERE a.uniacid = :aid AND a.uid = :uid AND (a.status = 2 OR a.status = 3 OR a.status = 4 OR a.status = 6) ORDER BY a.addtime DESC LIMIT 5', array(':aid' => $_W['uniacid'], ':uid' => $uid), 'id');
            $now_count = pdo_fetchcolumn('SELECT COUNT(*)  FROM ' . tablename('str_order') . ' WHERE uniacid = :aid AND uid = :uid AND (status = 2 OR status = 3 OR status = 4 OR status = 6)', array(':aid' => $_W['uniacid'], ':uid' => $uid));
            if (!empty($now)) {
                ksort($now);
                $now_minid = min(array_keys($now));
            } else {
                $now_minid = 0;
            }
            $history = pdo_fetchall('SELECT a.*, b.title FROM ' . tablename('str_order') . ' AS a LEFT JOIN ' . tablename('str_store') . ' AS b on a.sid = b.id WHERE a.uniacid = :aid AND a.uid = :uid AND (a.status = 1 OR a.status = 5) ORDER BY a.addtime DESC LIMIT 5', array(':aid' => $_W['uniacid'], ':uid' => $uid), 'id');
            $history_count = pdo_fetchcolumn('SELECT COUNT(*)  FROM ' . tablename('str_order') . ' WHERE uniacid = :aid AND uid = :uid AND (status = 1 OR status = 5)', array(':aid' => $_W['uniacid'], ':uid' => $uid));
            if (!empty($history)) {
                ksort($history);
                $history_minid = min(array_keys($history));
            } else {
                $history_minid = 0;
            }
        } else {
            $minid = intval($_GPC['minid']);
            $type = trim($_GPC['type']);
            if ($type == 'now') {
                $data = pdo_fetchall('SELECT a.*, b.title  FROM ' . tablename('str_order') . ' AS a LEFT JOIN ' . tablename('str_store') . ' AS b on a.sid = b.id WHERE a.id < :minid AND  a.uniacid = :aid AND a.uid = :uid AND (a.status = 2 OR a.status = 3 OR a.status = 4 OR a.status = 6) ORDER BY a.addtime DESC LIMIT 5', array(':aid' => $_W['uniacid'], ':uid' => $uid, ':minid' => $minid), 'id');
            } else {
                $data = pdo_fetchall('SELECT a.*, b.title FROM ' . tablename('str_order') . ' AS a LEFT JOIN ' . tablename('str_store') . ' AS b on a.sid = b.id WHERE  a.id < :minid AND a.uniacid = :aid AND a.uid = :uid AND (a.status = 1 OR a.status = 5) ORDER BY a.addtime DESC LIMIT 5', array(':aid' => $_W['uniacid'], ':uid' => $uid, ':minid' => $minid), 'id');
            }
            if (!empty($data)) {
                ksort($data);
                $minid = min(array_keys($data));
                $out['minid'] = $minid;
                foreach ($data as $da) {
                    $str .= '
						<li>
							<a href="' . $this->createMobileUrl('orderdetail', array('id' => $row['id'], 'sid' => $row['sid'])) . '">
								<div>';
                    if ($da['status'] == 1) {
                        $str .= '<div class="ico_status complete"><i></i>已完成</div>';
                    } elseif ($da['status'] == 2) {
                        $str .= '<div class="ico_status pending"><i></i>待付款</div>';
                    } elseif ($da['status'] == 3) {
                        $str .= '<div class="ico_status inhand"><i></i>待送餐</div>';
                    } elseif ($da['status'] == 4) {
                        $str .= '<div class="ico_status confirm"><i></i>待收餐</div>';
                    } elseif ($da['status'] == 5) {
                        $str .= '<div class="ico_status cancel"><i></i>已取消</div>';
                    } else {
                        $str .= '';
                    }
                    $str .= '</div>
								<div>
									<h3 class="highlight">' . $da['title'] . '</h3>
									<p>' . $da['num'] . '份/¥' . $da['price'] . '</p>
									<div>' . date('Y-m-d H:i', $da['addtime']) . '</div>
								</div>
							</a>
						</li>
					';
                }
                $out['str'] = $str;
            } else {
                $out['minid'] = 0;
                $out['str'] = '';
            }
            exit(json_encode($out));
        }
        include $this->template('myorder');
    }
示例#20
0
 protected function pay($params = array(), $mine = array())
 {
     global $_W;
     if (!$this->inMobile) {
         message('支付功能只能在手机上使用');
     }
     if (empty($_W['member']['uid'])) {
         checkauth();
     }
     $params['module'] = $this->module['name'];
     $pars = array();
     $pars[':uniacid'] = $_W['uniacid'];
     $pars[':module'] = $params['module'];
     $pars[':tid'] = $params['tid'];
     if ($params['fee'] <= 0) {
         $pars['from'] = 'return';
         $pars['result'] = 'success';
         $pars['type'] = 'alipay';
         $pars['tid'] = $params['tid'];
         $site = WeUtility::createModuleSite($pars[':module']);
         $method = 'payResult';
         if (method_exists($site, $method)) {
             exit($site->{$method}($pars));
         }
     }
     $sql = 'SELECT * FROM ' . tablename('core_paylog') . ' WHERE `uniacid`=:uniacid AND `module`=:module AND `tid`=:tid';
     $log = pdo_fetch($sql, $pars);
     if (!empty($log) && $log['status'] == '1') {
         message('这个订单已经支付成功, 不需要重复支付.');
     }
     $setting = uni_setting($_W['uniacid'], array('payment', 'creditbehaviors'));
     if (!is_array($setting['payment'])) {
         message('没有有效的支付方式, 请联系网站管理员.');
     }
     $pay = $setting['payment'];
     if (!empty($pay['credit']['switch'])) {
         $credtis = mc_credit_fetch($_W['member']['uid']);
     }
     $you = 0;
     if ($pay['card']['switch'] == 2) {
         if ($_W['card_permission'] == 1 && !empty($params['module'])) {
             $cards = pdo_fetchall('SELECT a.id,a.card_id,a.cid,b.type,b.title,b.extra,b.is_display,b.status,b.date_info FROM ' . tablename('coupon_modules') . ' AS a LEFT JOIN ' . tablename('coupon') . ' AS b ON a.cid = b.id WHERE a.acid = :acid AND a.module = :modu AND b.is_display = 1 AND b.status = 3 ORDER BY a.id DESC', array(':acid' => $_W['acid'], ':modu' => $params['module']));
             $flag = 0;
             if (!empty($cards)) {
                 foreach ($cards as $temp) {
                     $temp['date_info'] = iunserializer($temp['date_info']);
                     if ($temp['date_info']['time_type'] == 1) {
                         $starttime = strtotime($temp['date_info']['time_limit_start']);
                         $endtime = strtotime($temp['date_info']['time_limit_end']);
                         if (TIMESTAMP < $starttime || TIMESTAMP > $endtime) {
                             continue;
                         } else {
                             $param = array(':acid' => $_W['acid'], ':openid' => $_W['openid'], ':card_id' => $temp['card_id']);
                             $num = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('coupon_record') . ' WHERE acid = :acid AND openid = :openid AND card_id = :card_id AND status = 1', $param);
                             if ($num <= 0) {
                                 continue;
                             } else {
                                 $flag = 1;
                                 $card = $temp;
                                 break;
                             }
                         }
                     } else {
                         $deadline = intval($temp['date_info']['deadline']);
                         $limit = intval($temp['date_info']['limit']);
                         $param = array(':acid' => $_W['acid'], ':openid' => $_W['openid'], ':card_id' => $temp['card_id']);
                         $record = pdo_fetchall('SELECT addtime,id,code FROM ' . tablename('coupon_record') . ' WHERE acid = :acid AND openid = :openid AND card_id = :card_id AND status = 1', $param);
                         if (!empty($record)) {
                             foreach ($record as $li) {
                                 $time = strtotime(date('Y-m-d', $li['addtime']));
                                 $starttime = $time + $deadline * 86400;
                                 $endtime = $time + $deadline * 86400 + $limit * 86400;
                                 if (TIMESTAMP < $starttime || TIMESTAMP > $endtime) {
                                     continue;
                                 } else {
                                     $flag = 1;
                                     $card = $temp;
                                     break;
                                 }
                             }
                         }
                         if ($flag) {
                             break;
                         }
                     }
                 }
             }
             if ($flag) {
                 if ($card['type'] == 'discount') {
                     $you = 1;
                     $card['fee'] = sprintf("%.2f", $params['fee'] * ($card['extra'] / 100));
                 } elseif ($card['type'] == 'cash') {
                     $cash = iunserializer($card['extra']);
                     if ($params['fee'] >= $cash['least_cost']) {
                         $you = 1;
                         $card['fee'] = sprintf("%.2f", $params['fee'] - $cash['reduce_cost']);
                     }
                 }
                 load()->classs('coupon');
                 $acc = new coupon($_W['acid']);
                 $card_id = $card['card_id'];
                 $time = TIMESTAMP;
                 $randstr = random(8);
                 $sign = array($card_id, $time, $randstr, $acc->account['key']);
                 $signature = $acc->SignatureCard($sign);
                 if (is_error($signature)) {
                     $you = 0;
                 }
             }
         }
     }
     $we_you = 0;
     if ($pay['card']['switch'] == 3) {
         if (!empty($params['module'])) {
             $cards = pdo_fetchall('SELECT a.id,a.couponid,b.type,b.title,b.discount,b.condition,b.starttime,b.endtime FROM ' . tablename('activity_coupon_modules') . ' AS a LEFT JOIN ' . tablename('activity_coupon') . ' AS b ON a.couponid = b.couponid WHERE a.uniacid = :uniacid AND a.module = :modu AND b.starttime <= :time AND b.endtime >= :time  ORDER BY a.id DESC', array(':uniacid' => $_W['uniacid'], ':modu' => $params['module'], ':time' => TIMESTAMP));
             if (!empty($cards) && $_W['member']['uid']) {
                 foreach ($cards as $card) {
                     $has = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('activity_coupon_record') . ' WHERE uid = :uid AND uniacid = :aid AND couponid = :cid AND status = 1', array(':uid' => $_W['member']['uid'], ':aid' => $_W['uniacid'], ':cid' => $card['couponid']));
                     if ($has > 0) {
                         if ($card['type'] == '1') {
                             $we_you = 1;
                             $card['fee'] = sprintf("%.2f", $params['fee'] * $card['discount']);
                             break;
                         } elseif ($card['type'] == '2') {
                             if ($params['fee'] >= $cash['condition']) {
                                 $we_you = 1;
                                 $card['fee'] = sprintf("%.2f", $params['fee'] - $card['discount']);
                                 break;
                             }
                         }
                     }
                 }
             }
         }
     }
     include $this->template('common/paycenter');
 }
示例#21
0
 public function doMobileMessage()
 {
     global $_GPC, $_W;
     checkauth();
     $op = trim($_GPC['op']) ? trim($_GPC['op']) : 'list';
     $set = pdo_fetch("SELECT * FROM " . tablename('we7car_message_set') . " WHERE weid = :weid ORDER BY `id` DESC LIMIT 1", array(':weid' => $_W['weid']));
     if ($set == false) {
         $set = array('status' => 1, 'isshow' => 1);
     }
     if ($op == 'list') {
         if ($set['status'] == 0) {
             message('留言墙尚未开启,请耐心等待');
         }
         $total = pdo_fetchcolumn("SELECT count(*) FROM " . tablename('we7car_message_list') . " WHERE fid = 0 AND isshow = 1 AND weid = :weid", array(':weid' => $_W['weid']));
         $pindex = max(1, intval($_GPC['page']));
         $psize = 20;
         $pager = pagination($total, $pindex, $psize);
         $messagelist = pdo_fetchall("SELECT * FROM " . tablename('we7car_message_list') . " WHERE  weid = :weid and fid=0 and isshow=1  ORDER BY create_time DESC  LIMIT " . ($pindex - 1) * $psize . ',' . $psize, array(':weid' => $_W['weid']));
         foreach ($messagelist as &$v) {
             $v['reply'] = pdo_fetchall("SELECT * FROM " . tablename('we7car_message_list') . " WHERE  weid = :weid AND fid = :fid AND isshow=1  LIMIT 20", array(':weid' => $_W['weid'], ':fid' => $v['id']));
         }
         //获取fans表中的username
         $nickname = pdo_fetchcolumn("SELECT `nickname` FROM " . tablename('fans') . " WHERE weid = :weid AND `from_user` = :from_user LIMIT 1", array(':from_user' => $_W['fans']['from_user'], ':weid' => $_W['weid']));
         include $this->template('message_list');
     }
     if ($op == 'ajax') {
         if (empty($_W['fans']['from_user'])) {
             $data['msg'] = '登陆过期,请重新从微信进入!';
             $data['success'] = false;
         } else {
             $message = pdo_fetch("SELECT * FROM " . tablename('we7car_message_list') . " WHERE from_user = :from_user AND weid = :weid ORDER BY id DESC limit 1", array(':weid' => $_W['weid'], ':from_user' => $_W['fans']['from_user']));
             $insert = array('weid' => $_W['weid'], 'nickname' => trim($_GPC['nickname']), 'info' => trim($_GPC['info']), 'fid' => intval($_GPC['fid']), 'from_user' => $_W['fans']['from_user'], 'isshow' => $set['isshow'], 'create_time' => TIMESTAMP);
             if (empty($insert['nickname'])) {
                 $insert['nickname'] = pdo_fetchcolumn("SELECT nickname FROM " . tablename('fans') . " WHERE weid = :weid  AND  from_user = :from_user LIMIT 1", array(':weid' => $_W['weid'], ':from_user' => $_W['fans']['from_user']));
             }
             if (empty($message)) {
                 $id = pdo_insert('we7car_message_list', $insert);
                 $data['success'] = true;
                 $data['msg'] = '留言发表成功';
                 if ($set['isshow'] == 0) {
                     $data['msg'] = $data['msg'] . ',进入审核流程';
                 }
             } else {
                 if (TIMESTAMP - $message['create_time'] < 5) {
                     $data['msg'] = '您的留言太过频繁,请5秒后留言';
                     $data['success'] = false;
                 } else {
                     $id = pdo_insert('we7car_message_list', $insert);
                     $data['success'] = true;
                     $data['msg'] = '留言发表成功';
                     if ($set['isshow'] == 0) {
                         $data['msg'] = $data['msg'] . ',进入审核流程';
                     }
                 }
             }
         }
         echo json_encode($data);
     }
 }
示例#22
0
 public function doMobileMyCredit()
 {
     global $_W, $_GPC;
     checkauth();
     $pindex = max(1, intval($_GPC['page']));
     $psize = 20;
     $list = pdo_fetchall("SELECT * FROM " . tablename('card_log') . " WHERE weid = '{$_W['weid']}' AND from_user = '******'fans']['from_user']}' AND type = '3' ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize, array(), 'id');
     $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('card_log') . " WHERE weid = '{$_W['weid']}' AND from_user = '******'fans']['from_user']}' AND type = '3'");
     $pager = pagination($total, $pindex, $psize);
     include $this->template('mycredit');
 }
示例#23
0
 public function doMobileCheckauth()
 {
     global $_W, $_GPC;
     echo "111111111111111";
     checkauth();
     echo 'doMobileCheckauth';
     exit;
 }
示例#24
0
文件: site.php 项目: noikiy/mygit
 public function doMobilePay()
 {
     global $_W, $_GPC;
     checkauth();
     $type = trim($_GPC['type']) ? trim($_GPC['type']) : 'credit';
     if ($type == 'credit') {
         $setting = uni_setting();
         $recharge = $setting['recharge'];
         if (checksubmit()) {
             $credit = floatval($_GPC['credit']);
             $select = floatval($_GPC['select']);
             if (!$credit && !$select) {
                 message('请输入充值金额', referer(), 'error');
             }
             $fee = $credit;
             if (!$fee) {
                 $fee = $select;
             }
             $chargerecord = pdo_fetch("SELECT * FROM " . tablename('mc_credits_recharge') . " WHERE uniacid = :uniacid AND uid = :uid AND fee = :fee AND type = :type AND status = 0", array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid'], ':fee' => $fee, ':type' => 'credit'));
             if (empty($chargerecord)) {
                 $chargerecord = array('uid' => $_W['member']['uid'], 'openid' => $_W['openid'], 'uniacid' => $_W['uniacid'], 'tid' => date('YmdHi') . random(8, 1), 'fee' => $fee, 'type' => 'credit', 'status' => 0, 'createtime' => TIMESTAMP);
                 if (!pdo_insert('mc_credits_recharge', $chargerecord)) {
                     message('创建充值订单失败,请重试!', url('entry', array('m' => 'recharge', 'do' => 'pay')), 'error');
                 }
             }
             $params = array('tid' => $chargerecord['tid'], 'ordersn' => $chargerecord['tid'], 'title' => '会员余额充值', 'fee' => $chargerecord['fee'], 'user' => $_W['member']['uid']);
             $mine = array();
             if (!empty($recharge)) {
                 $back = -1;
                 foreach ($recharge as $k => $li) {
                     if ($li['recharge'] <= $fee) {
                         $back = $k;
                     }
                 }
                 if (!empty($recharge[$back])) {
                     $mine = array(array('name' => "充{$recharge[$back]['recharge']}返{$recharge[$back]['back']}", 'value' => "返¥{$recharge[$back]['back']}元"));
                 }
             }
             $this->pay($params, $mine);
             exit;
         }
         $member = mc_fetch($_W['member']['uid']);
         $name = $member['mobile'];
         if (empty($name)) {
             $name = $member['realname'];
         }
         if (empty($name)) {
             $name = $member['uid'];
         }
         include $this->template('recharge');
     } else {
         $fee = floatval($_GPC['fee']);
         if (!$fee) {
             message('充值金额不能为0', referer(), 'error');
         }
         $setting = pdo_get('mc_card', array('uniacid' => $_W['uniacid'], 'status' => 1));
         if (empty($setting)) {
             message('会员卡未开启,请联系商家', referer(), 'error');
         }
         if ($type == 'card_nums') {
             if (!$setting['nums_status']) {
                 message("会员卡未开启{$setting['nums_text']}充值,请联系商家", referer(), 'error');
             }
             $setting['nums'] = iunserializer($setting['nums']);
             if (empty($setting['nums'][$fee])) {
                 message('充值金额错误,请联系商家', referer(), 'error');
             }
             $mine = array(array('name' => "充{$fee}返{$setting['nums'][$fee]['num']}次", 'value' => "返{$setting['nums'][$fee]['num']}次"));
             $tag = $setting['nums'][$fee]['num'];
         }
         if ($type == 'card_times') {
             if (!$setting['times_status']) {
                 message("会员卡未开启{$setting['times_text']}充值,请联系商家", referer(), 'error');
             }
             $setting['times'] = iunserializer($setting['times']);
             if (empty($setting['times'][$fee])) {
                 message('充值金额错误,请联系商家', referer(), 'error');
             }
             $member_card = pdo_get('mc_card_members', array('uniacid' => $_W['uniacid'], 'uid' => $_W['member']['uid']));
             if ($member_card['endtime'] > TIMESTAMP) {
                 $endtime = $member_card['endtime'] + $setting['times'][$fee]['time'] * 86400;
             } else {
                 $endtime = strtotime($setting['times'][$fee]['time'] . 'days');
             }
             $mine = array(array('name' => "充{$fee}返{$setting['times'][$fee]['time']}天", 'value' => date('Y-m-d', $endtime) . '到期'));
             $tag = $setting['times'][$fee]['time'];
         }
         $chargerecord = pdo_fetch("SELECT * FROM " . tablename('mc_credits_recharge') . " WHERE uniacid = :uniacid AND uid = :uid AND fee = :fee AND type = :type  AND status = 0 AND tag = :tag", array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid'], ':fee' => $fee, ':type' => $type, ':tag' => $tag));
         if (empty($chargerecord)) {
             $chargerecord = array('uid' => $_W['member']['uid'], 'openid' => $_W['openid'], 'uniacid' => $_W['uniacid'], 'tid' => date('YmdHi') . random(8, 1), 'fee' => $fee, 'type' => $type, 'tag' => $tag, 'status' => 0, 'createtime' => TIMESTAMP);
             if (!pdo_insert('mc_credits_recharge', $chargerecord)) {
                 message('创建充值订单失败,请重试!', url('mc/bond/mycard'), 'error');
             }
         }
         $types = array('card_nums' => $setting['nums_text'], 'card_times' => $setting['times_text']);
         $params = array('tid' => $chargerecord['tid'], 'ordersn' => $chargerecord['tid'], 'title' => "会员卡{$types[$type]}充值", 'fee' => $chargerecord['fee'], 'user' => $_W['member']['uid']);
         $this->pay($params, $mine);
         exit;
     }
 }
示例#25
0
 protected function grant($params = array())
 {
     global $_W, $_GPC;
     if (empty($_W['member']['uid'])) {
         checkauth();
     }
     load()->model('activity');
     $params['module'] = $this->module['name'];
     if (empty($params['module'])) {
         message('模块信息错误', referer(), 'error');
     }
     $iscard = pdo_fetchcolumn('SELECT iscard FROM ' . tablename('modules') . ' WHERE name = :name', array(':name' => $params['module']));
     if (!$iscard) {
         message('模块不支持领取优惠券', referer(), 'error');
     }
     $pindex = max(1, intval($_GPC['page']));
     $psize = 5;
     $user = mc_fetch($_W['member']['uid'], array('groupid'));
     $groupid = $user['groupid'];
     $modules_limit = pdo_fetchall("SELECT couponid FROM " . tablename('activity_coupon_modules') . " WHERE uniacid = :uniacid AND module = :module", array(':uniacid' => $_W['uniacid'], ':module' => $params['module']), 'couponid');
     $groups_limit = pdo_fetchall("SELECT couponid FROM " . tablename('activity_coupon_allocation') . " WHERE uniacid = :uniacid AND groupid = :groupid", array(':uniacid' => $_W['uniacid'], ':groupid' => $groupid), 'couponid');
     $modules_limit = array_keys($modules_limit);
     $groups_limit = array_keys($groups_limit);
     $intersect = array_intersect($modules_limit, $groups_limit);
     if (empty($intersect)) {
         message('没有该模块适用的优惠券', referer(), 'error');
     }
     $intersect = implode(',', array_values($intersect));
     $par = array(':uniacid' => $_W['uniacid'], ':time' => TIMESTAMP);
     $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('activity_coupon') . " WHERE uniacid = :uniacid AND dosage < amount AND endtime >= :time AND couponid IN ({$intersect})", $par);
     $cards = pdo_fetchall('SELECT * FROM ' . tablename('activity_coupon') . " WHERE uniacid = :uniacid AND dosage < amount AND endtime >= :time AND couponid IN ({$intersect}) ORDER BY endtime ASC LIMIT " . ($pindex - 1) * $psize . ', ' . $psize, $par);
     if (!empty($cards)) {
         foreach ($cards as $key => &$card) {
             $has = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('activity_coupon_record') . ' WHERE uid = :uid AND uniacid = :aid AND couponid = :cid AND status > 0', array(':uid' => $_W['member']['uid'], ':aid' => $_W['uniacid'], ':cid' => $card['couponid']));
             $card['is_grant'] = 1;
             if ($card['limit'] <= $has) {
                 $card['is_grant'] = 0;
             }
             $card['grant_num'] = $has;
             $card['grant_url'] = base64_encode(json_encode(array('id' => $card['couponid'], 'm' => $params['module'])));
         }
         $creditnames = array();
         $unisettings = uni_setting($_W['uniacid'], array('creditnames'));
         if (!empty($unisettings) && !empty($unisettings['creditnames'])) {
             foreach ($unisettings['creditnames'] as $key => $credit) {
                 $creditnames[$key] = $credit['title'];
             }
         }
     }
     $pager = pagination($total, $pindex, $psize, '', array('before' => 0, 'after' => 0));
     include $this->template('common/grant');
 }
示例#26
0
文件: site.php 项目: 6662680/qday_wx
 public function doMobileRegister()
 {
     global $_GPC, $_W;
     $title = '微信墙登记';
     /**** 0.6 ****/
     load()->model('mc');
     load()->func('tpl');
     // 验证用户注册, 注册后方能进如活动
     checkauth();
     if (!empty($_GPC['submit'])) {
         $data = array('nickname' => $_GPC['nickname']);
         if (empty($data['nickname'])) {
             die('<script>alert("请填写您的昵称!");location.reload();</script>');
         }
         if (!empty($_FILES['avatar']['tmp_name'])) {
             /**** 0.6 ****/
             load()->func('file');
             $upload = file_upload($_FILES['avatar']);
             if (is_error($upload)) {
                 die('<script>alert("登记失败!请重试!");location.reload();</script>');
             }
             $data['avatar'] = $upload['path'];
         } else {
             $data['avatar'] = $_GPC['avatar'];
         }
         if (empty($data['avatar'])) {
             $data['avatar'] = 'images/global/noavatar_middle.gif';
         }
         mc_update($_W['member']['uid'], $data);
         message('登记成功,系统会自动跳转,如果未成功请手动退回微信界面。<script type="text/javascript">wx.ready(function(){wx.closeWindow();});</script>');
     }
     /**** 0.6 ****/
     $member = mc_fetch($_W['member']['uid'], array('nickname', 'avatar'));
     if (empty($member['avatar'])) {
         //mc_oauth_userinfo();
         $member['avatar'] = 'images/global/noavatar_middle.gif';
         include $this->template('register');
     } else {
         message('个人信息已经自动获取到,系统会自动跳转,如果未成功请手动退回微信界面。<script type="text/javascript">wx.ready(function(){wx.closeWindow();});</script>', '', 'success');
     }
 }
示例#27
0
 private function checkAuth()
 {
     global $_W;
     checkauth();
 }
示例#28
0
 public function doMobileYyyonline()
 {
     $useragent = addslashes($_SERVER['HTTP_USER_AGENT']);
     if (strpos($useragent, 'MicroMessenger') === false && strpos($useragent, 'Windows Phone') === false) {
         echo "404";
         exit;
     }
     global $_GPC, $_W;
     $title = '摇一摇抽奖';
     checkauth();
     //0.51 用下面
     /*
     if (empty($_W['fans']['from_user'])) {
     	message('非法访问,请重新发送消息进入摇一摇页面!');
     }
     */
     $fromuser = $_W['fans']['from_user'];
     $profile = fans_require($fromuser, array('nickname', 'mobile'), '需要完善资料后才能摇一摇.');
     $id = intval($_GPC['id']);
     $yyyonline = pdo_fetch("SELECT * FROM " . tablename('yyyonline_reply') . " WHERE rid = '{$id}' LIMIT 1");
     if (empty($yyyonline)) {
         message('非法访问,请重新发送消息进入摇一摇页面!');
     }
     if ($yyyonline['starttime'] > time()) {
         $yyyonline['lefttime'] = $yyyonline['starttime'] - time();
     } else {
         $yyyonline['lefttime'] = 3;
     }
     $totay = strtotime(date('y-m-d', time()));
     $sql = "SELECT count FROM " . tablename('yyyonline_winner') . " WHERE  from_user = '******'  AND rid = '{$id}' AND  createtime >{$totay} AND status=2 ";
     $isaward = pdo_fetchcolumn($sql);
     if (intval($isaward)) {
         $this->doMobileEnd();
         exit;
     }
     $sql = "SELECT * FROM " . tablename('yyyonline_winner') . " WHERE  from_user = '******' AND rid = '{$id}' ";
     $winner = pdo_fetch($sql);
     $total = intval($winner['count']);
     if ($yyyonline['shaketimes'] == $total) {
         $this->doMobileEnd();
         exit;
     }
     if ($yyyonline['endtime'] < TIMESTAMP) {
         $this->doMobileEnd();
         exit;
     }
     //$member = fans_search($fromuser);
     $ruletype = intval($yyyonline['ruletype']);
     include $this->template('yyys');
 }
示例#29
0
文件: __init.php 项目: ChainBoy/wxfx
<?php

/**
 * @FreeGo Team 智慧游
 * @url http://www.cninone.com/
 */
defined('IN_IA') or exit('Access Denied');
if ($action != 'cash') {
    checkauth();
}
load()->model('activity');
$filter = array();
$coupons = activity_coupon_owned($_W['member']['uid'], $filter);
$tokens = activity_token_owned($_W['member']['uid'], $filter);
$setting = uni_setting($_W['uniacid'], array('creditnames', 'creditbehaviors', 'uc', 'payment', 'passport'));
$behavior = $setting['creditbehaviors'];
$creditnames = $setting['creditnames'];
$credits = mc_credit_fetch($_W['member']['uid'], '*');
$sql = 'SELECT `status` FROM ' . tablename('mc_card') . " WHERE `uniacid` = :uniacid";
$cardstatus = pdo_fetch($sql, array(':uniacid' => $_W['uniacid']));
示例#30
0
文件: site.php 项目: aspnmy/weizan
 public function doMobileJoin()
 {
     global $_W, $_GPC;
     if (!$this->check_mc_follow()) {
         if (empty($_W['account']['subscribeurl'])) {
             $this->msg('error', '请关注本公众平台后再参与活动!');
         }
         $this->msg('redirect', $_W['account']['subscribeurl']);
     }
     checkauth();
     $info = pdo_fetch("SELECT l.title as goods_title,l.info,l.price,l.thumb,d.*,r.title as rule_title,r.rule FROM " . tablename('zerobuy_detail') . " d left join " . tablename('zerobuy_list') . " l on d.lid=l.id left join " . tablename('zerobuy_rule') . " r on d.rid=r.id WHERE d.id=" . $_GPC['id']);
     //参与活动
     if ($_GPC['act'] == 'join') {
         if (empty($_W['member']['mobile'])) {
             //如果未填写手机号码,跳转到会员中心
             $this->msg('uc', '<P>请先完善您的个人资料!</p><P><font color="red">注意</font>:姓名和手机号码必填。</p><P>个人资料是将来兑奖的依据。</p>');
         }
         if (empty($_W['member']['uid'])) {
             $this->msg('error', '非法访问!');
         }
         $msg = $this->make_code($_GPC['id']);
         $this->msg('success', $msg);
     }
 }