Exemple #1
0
 function getInfo($base64 = false, $debug = false)
 {
     global $_W, $_GPC;
     $userinfo = array();
     if (EWEI_SHOP_DEBUG) {
         $userinfo = array('openid' => 'fromUser', 'nickname' => '微赞科技', 'headimgurl' => 'http://bbs.012wz.com/static/image/common/logo.png', 'province' => '广东', 'city' => '深圳');
     } else {
         load()->model('mc');
         $userinfo = mc_oauth_userinfo();
         $need_openid = true;
         if ($_W['container'] != 'wechat') {
             if ($_GPC['do'] == 'order' && $_GPC['p'] == 'pay') {
                 $need_openid = false;
             }
             if ($_GPC['do'] == 'member' && $_GPC['p'] == 'recharge') {
                 $need_openid = false;
             }
         }
         if (empty($userinfo['openid']) && $need_openid) {
             die("<!DOCTYPE html>\r\n                <html>\r\n                    <head>\r\n                        <meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=0'>\r\n                        <title>抱歉,出错了</title><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=0'><link rel='stylesheet' type='text/css' href='https://res.wx.qq.com/connect/zh_CN/htmledition/style/wap_err1a9853.css'>\r\n                    </head>\r\n                    <body>\r\n                    <div class='page_msg'><div class='inner'><span class='msg_icon_wrp'><i class='icon80_smile'></i></span><div class='msg_content'><h4>请在微信客户端打开链接</h4></div></div></div>\r\n                    </body>\r\n                </html>");
         }
     }
     if ($base64) {
         return urlencode(base64_encode(json_encode($userinfo)));
     }
     return $userinfo;
 }
Exemple #2
0
 public function doMobileIndex()
 {
     global $_GPC, $_W;
     $tourl = true;
     load()->model('mc');
     $info = mc_oauth_userinfo($_W['acid']);
     $info2 = mc_fansinfo($info['openid'], $_W['acid']);
     if ($info2['follow'] == 1) {
         $tourl = false;
     }
     if (isset($_GPC['wd_code'])) {
         $title = '防伪测试';
         $footer_off = 1;
         $SecurityCode = $_GPC['wd_code'];
         $logs['code'] = $SecurityCode;
         $sql = "SELECT * FROM " . tablename($this->data) . " WHERE code='{$SecurityCode}' LIMIT 1";
         $member = pdo_fetch($sql);
         $states = 0;
         if (!empty($member)) {
             if ($tourl) {
                 if (empty($member['tourl'])) {
                     $member['tourl'] = "http://www.baidu.com";
                 }
                 header('Location:' . $member['tourl']);
             }
             include $this->template('index');
         } else {
             echo '您查询的防伪码不存在,请核对后重试!';
         }
     } else {
         echo '您查询的防伪码不存在,请核对后重试!';
     }
     exit;
 }
Exemple #3
0
 public function __construct()
 {
     global $_W;
     load()->func('communication');
     $openid = $_W['openid'];
     if (!empty($openid)) {
         $account = account_fetch($_W['acid']);
         //获取公众号信息
         $url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $account['access_token']['token'] . "&openid=" . $openid . "&lang=zh_CN";
         $re = ihttp_get($url);
         //ihttp_get()封装的 http GET 请求方法
         if ($re['code'] == 200) {
             $content = json_decode($re['content'], true);
             if ($content['subscribe'] == 1) {
                 //此人已关注
                 $data = array('uniacid' => $_W['uniacid'], 'from_user' => $openid, 'nickname' => $content['nickname'], 'avatar' => $content['headimgurl']);
                 $profile = pdo_fetch("SELECT id FROM " . tablename('auction_member') . " WHERE uniacid ='{$_W['uniacid']}' and from_user = '******'");
                 if (empty($profile)) {
                     pdo_insert('auction_member', $data);
                 } else {
                     pdo_update('auction_member', $data, array('id' => $profile['id']));
                 }
             } else {
                 $userinfo = mc_oauth_userinfo();
                 $data = array('uniacid' => $_W['uniacid'], 'from_user' => $userinfo['openid'], 'nickname' => $userinfo['nickname'], 'avatar' => $userinfo['avatar']);
                 $profile = pdo_fetch("SELECT id FROM " . tablename('auction_member') . " WHERE uniacid ='{$_W['uniacid']}' and from_user = '******'openid']}'");
                 if (empty($profile)) {
                     pdo_insert('auction_member', $data);
                 } else {
                     pdo_update('auction_member', $data, array('id' => $profile['id']));
                 }
             }
         }
     }
 }
Exemple #4
0
 public function doMobileWelcome()
 {
     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');
     }
     load()->model('mc');
     $profile = mc_fetch($_W['member']['uid'], array('realname', 'mobile', 'avatar'));
     if (empty($profile['avatar'])) {
         mc_oauth_userinfo();
     }
     if (empty($profile['realname']) || empty($profile['mobile'])) {
         mc_require($_W['member']['uid'], array('realname', 'mobile'));
     }
     $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)) {
         header('Location: ' . $this->createMobileUrl('detail', array('rid' => $reply['rid'])));
         exit;
     }
     $reply['rule'] = html_entity_decode($reply['rule']);
     include $this->template('welcome');
 }
Exemple #5
0
 function getInfo($base64 = false, $debug = false)
 {
     global $_W, $_GPC;
     $userinfo = array();
     if (EWEI_SHOP_DEBUG) {
         $userinfo = array('openid' => 'fromUser', 'nickname' => '狸小狐', 'headimgurl' => 'http://img01.store.sogou.com/net/a/04/link?appid=100520031&url=http://mmbiz.qpic.cn/mmbiz/rwLAa09UURnuRLPb7jSeymh90fpa4Myp0H5bEEKq8hwZ6icJdib1KicaJeR4a9LYIllvE5JhIl4e5ibYupibttiazCdg/0?wx_fmt=jpeg', 'province' => '山东', 'city' => '青岛');
     } else {
         load()->model('mc');
         $userinfo = mc_oauth_userinfo();
         $need_openid = true;
         if ($_W['container'] != 'wechat') {
             if ($_GPC['do'] == 'order' && $_GPC['p'] == 'pay') {
                 $need_openid = false;
             }
             if ($_GPC['do'] == 'member' && $_GPC['p'] == 'recharge') {
                 $need_openid = false;
             }
         }
         if (empty($userinfo['openid']) && $need_openid) {
             die("<!DOCTYPE html>\r\n                <html>\r\n                    <head>\r\n                        <meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=0'>\r\n                        <title>抱歉,出错了</title><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=0'><link rel='stylesheet' type='text/css' href='https://res.wx.qq.com/connect/zh_CN/htmledition/style/wap_err1a9853.css'>\r\n                    </head>\r\n                    <body>\r\n                    <div class='page_msg'><div class='inner'><span class='msg_icon_wrp'><i class='icon80_smile'></i></span><div class='msg_content'><h4>请在微信客户端打开链接</h4></div></div></div>\r\n                    </body>\r\n                </html>");
         }
     }
     if ($base64) {
         return urlencode(base64_encode(json_encode($userinfo)));
     }
     return $userinfo;
 }
Exemple #6
0
 /**
  * game portal
  */
 public function doMobileIndex()
 {
     //这个操作被定义用来呈现 功能封面
     load()->model('mc');
     mc_oauth_userinfo();
     $player = $this->playerService->checkPlayerRegister();
     $html = array('config' => $this->module['config']);
     $url = array('score_lottery' => $this->createMobileUrl('scoreLotteryApi'), 'gift_shop_url' => $this->module['config']['gift_shop_url'], 'config' => $this->createMobileUrl('configApi'));
     include $this->template('index');
 }
Exemple #7
0
 public function auth($uniacid, $openid)
 {
     $userlist = pdo_fetch("select * from " . tablename('enjoy_circle_fans') . " where uniacid=" . $uniacid . " and openid='" . $openid . "'");
     if (empty($userlist)) {
         $userinfo = mc_oauth_userinfo();
         $data = array('uniacid' => $uniacid, 'subscribe' => $userinfo['subscribe'], 'openid' => $userinfo['openid'], 'nickname' => $userinfo['nickname'], 'gender' => $userinfo['sex'], 'city' => $userinfo['city'], 'state' => $userinfo['province'], 'country' => $userinfo['country'], 'subscribe_time' => $userinfo['subscribe_time'], 'avatar' => $userinfo['avatar'], 'ip' => CLIENT_IP);
         pdo_insert('enjoy_circle_fans', $data);
         $userlist = pdo_fetch("select * from " . tablename('enjoy_circle_fans') . " where uniacid=" . $uniacid . " and openid='" . $openid . "'");
     }
     return $userlist;
 }
Exemple #8
0
 public function __construct()
 {
     global $_W;
     load()->model('mc');
     $profile = pdo_fetch("SELECT * FROM " . tablename('tg_member') . " WHERE uniacid ='{$_W['uniacid']}' and from_user = '******'openid']}'");
     if (empty($profile)) {
         $userinfo = mc_oauth_userinfo();
         if (!empty($userinfo['avatar'])) {
             $data = array('uniacid' => $_W['uniacid'], 'from_user' => $userinfo['openid'], 'nickname' => $userinfo['nickname'], 'avatar' => $userinfo['avatar']);
             pdo_insert('tg_member', $data);
         }
     }
 }
Exemple #9
0
 public function authFansInfo()
 {
     global $_W;
     load()->model('mc');
     $user = $this->fetchFansInfo($_W['openid']);
     if (empty($user)) {
         $user = mc_oauth_userinfo();
     }
     $user['credit'] = $this->fetchUserCredit($_W['openid']);
     $user['score'] = intval($user['credit']['credit1']);
     $user['money'] = $user['credit']['credit2'];
     return $user;
 }
Exemple #10
0
 public function __construct()
 {
     global $_W;
     load()->model('mc');
     $profile = pdo_fetch("SELECT * FROM " . tablename('beatuty_zhongchou_member') . " WHERE uniacid ='{$_W['uniacid']}' and openid = '{$_W['openid']}'");
     if (empty($profile)) {
         $userinfo = mc_oauth_userinfo();
         if (!empty($userinfo['avatar'])) {
             $data = array('uniacid' => $_W['uniacid'], 'openid' => $userinfo['openid'], 'nickname' => $userinfo['nickname'], 'avatar' => $userinfo['avatar']);
             $member = pdo_fetch("SELECT * FROM " . tablename('beatuty_zhongchou_member') . " WHERE uniacid ='{$_W['uniacid']}' and openid = '{$userinfo['openid']}'");
             if (empty($member['id'])) {
                 pdo_insert('beatuty_zhongchou_member', $data);
             } else {
                 pdo_update('beatuty_zhongchou_member', $data, array('id' => $member['id']));
             }
         }
     }
 }
Exemple #11
0
function requreSubscribe()
{
    global $_W;
    $hasSubscribe = 1;
    if (isset($_W['fans']['from_user']) && !empty($_W['fans']['from_user'])) {
        $openid = $_W['fans']['from_user'];
        $userinfo = mc_fansinfo($openid);
        if (!$userinfo || $userinfo['follow'] == 0) {
            $hasSubscribe = 0;
        }
    } else {
        $oauthAccount = $_W['oauth_account'];
        if (empty($oauthAccount)) {
            message('未指定网页授权公众号, 无法获取用户信息.', '', 'error');
        }
        $userinfo = mc_oauth_userinfo();
        $level = pdo_fetchcolumn("SELECT `level` FROM " . tablename('account_wechats') . " WHERE `uniacid`=:uniacid", array(':uniacid' => $_W['uniacid']));
        if ($level == 4) {
            if ($userinfo['subscribe'] == 0) {
                $hasSubscribe = 0;
            }
        } else {
            $unionid = isset($userinfo['unionid']) ? $userinfo['unionid'] : '';
            if (empty($unionid)) {
                message('获取unionid失败,请确认公众号已接入微信开放平台', '', 'error');
            }
            $fieldsExist = pdo_fieldexists('mc_mapping_fans', 'unionid');
            if (!$fieldsExist) {
                pdo_query("ALTER TABLE " . tablename('mc_mapping_fans') . " ADD column unionid varchar(255) default null");
            }
            $openid = pdo_fetchcolumn("SELECT `openid` FROM " . tablename('mc_mapping_fans') . " WHERE `unionid`=:unionid AND `uniacid`=:uniacid ", array(':unionid' => $unionid, ':uniacid' => $_W['account']['uniacid']));
            if (empty($openid)) {
                $hasSubscribe = 0;
            } else {
                $userinfo = mc_fansinfo($openid);
                if (!$userinfo || $userinfo['follow'] == 0) {
                    $hasSubscribe = 0;
                }
            }
        }
    }
    return array('openid' => $openid, 'subscribe' => $hasSubscribe);
}
Exemple #12
0
 public function getuserinfo()
 {
     global $_W;
     load()->model('mc');
     $profile = pdo_fetch("SELECT * FROM " . tablename('tg_member') . " WHERE uniacid ='{$_W['uniacid']}' and openid = '{$_W['openid']}'");
     if (empty($profile['nickname'])) {
         $userinfo = mc_oauth_userinfo();
         if (!empty($profile)) {
             $record = array('nickname' => stripslashes($userinfo['nickname']), 'avatar' => $userinfo['avatar'], 'tag' => base64_encode(iserializer($userinfo)));
             pdo_update('tg_member', $record, array('id' => $profile['id']));
         } elseif (!empty($_W['openid'])) {
             $record = array();
             $record['nickname'] = stripslashes($userinfo['nickname']);
             $record['tag'] = base64_encode(iserializer($userinfo));
             $record['openid'] = $_W['openid'];
             $record['avatar'] = $userinfo['avatar'];
             $record['uniacid'] = $_W['uniacid'];
             pdo_insert('tg_member', $record);
         }
     }
 }
Exemple #13
0
 public function doMobileConfirm()
 {
     global $_W, $_GPC;
     if (empty($_W['fans']['nickname'])) {
         mc_oauth_userinfo();
     }
     $id = intval($_GPC['id']);
     $project = pdo_fetch("SELECT * FROM " . tablename('hx_zhongchou_project') . " WHERE id = :id", array(':id' => $id));
     if (empty($project)) {
         message("抱歉,该项目不存在!", referer(), "error");
     }
     if ($project['status'] != 3) {
         message("抱歉,该项目尚未开始!", referer(), "error");
     }
     if (time() <= $project['starttime']) {
         message("抱歉,该项目尚未开始!", referer(), "error");
     } elseif (time() > $project['starttime'] + $project['deal_days'] * 86400) {
         message("抱歉,该项目已经结束!", referer(), "error");
     }
     $item_id = intval($_GPC['item_id']);
     $item = pdo_fetch("SELECT * FROM " . tablename('hx_zhongchou_project_item') . " WHERE id = :id", array(':id' => $item_id));
     if (empty($item)) {
         message("抱歉,该回报不存在!", referer(), "error");
     }
     if ($item['limit_num'] != 0 && $item['limit_num'] <= $item['donenum']) {
         message('该回报以筹集完毕,请选择其他回报');
     }
     $returnurl = $this->createMobileUrl("confirm", array("id" => $id, "item_id" => $item_id));
     $dispatch = pdo_fetchall("select id,dispatchname,dispatchtype,firstprice,firstweight,secondprice,secondweight from " . tablename("hx_zhongchou_dispatch") . " WHERE weid = {$_W['uniacid']} order by displayorder desc");
     foreach ($dispatch as &$d) {
         $weight = 0;
         $weight = $item['weight'];
         $price = 0;
         if ($weight <= $d['firstweight']) {
             $price = $d['firstprice'];
         } else {
             $price = $d['firstprice'];
             $secondweight = $weight - $d['firstweight'];
             if ($secondweight % $d['secondweight'] == 0) {
                 $price += (int) ($secondweight / $d['secondweight']) * $d['secondprice'];
             } else {
                 $price += (int) ($secondweight / $d['secondweight'] + 1) * $d['secondprice'];
             }
         }
         $d['price'] = $price;
     }
     unset($d);
     if (checksubmit('submit')) {
         $address = pdo_fetch("SELECT * FROM " . tablename('mc_member_address') . " WHERE id = :id", array(':id' => intval($_GPC['address'])));
         if (empty($address)) {
             message('抱歉,请您填写收货地址!', $this->createMobileUrl('address', array('from' => 'confirm', 'returnurl' => urlencode($returnurl))), 'error');
         }
         //项目回报价格
         $item_price = $item['price'];
         //运费
         $dispatchid = intval($_GPC['dispatch']);
         $dispatchprice = 0;
         foreach ($dispatch as $d) {
             if ($d['id'] == $dispatchid) {
                 $dispatchprice = $d['price'];
                 $sendtype = $d['dispatchtype'];
             }
         }
         $data = array('weid' => $_W['uniacid'], 'from_user' => $_W['fans']['from_user'], 'ordersn' => date('md') . random(4, 1), 'price' => $item_price + $dispatchprice, 'dispatchprice' => $dispatchprice, 'item_price' => $item_price, 'status' => 0, 'sendtype' => intval($sendtype), 'dispatch' => $dispatchid, 'return_type' => intval($item['return_type']), 'remark' => $_GPC['remark'], 'addressid' => $address['id'], 'pid' => $id, 'item_id' => $item_id, 'createtime' => TIMESTAMP);
         pdo_insert('hx_zhongchou_order', $data);
         $orderid = pdo_insertid();
         message('提交订单成功,现在跳转到付款页面...', $this->createMobileUrl('pay', array('orderid' => $orderid)), 'success');
     }
     $profile = fans_search($_W['fans']['from_user'], array('resideprovince', 'residecity', 'residedist', 'address', 'nickname', 'mobile'));
     $row = pdo_fetch("SELECT * FROM " . tablename('mc_member_address') . " WHERE isdefault = 1 and uid = :uid limit 1", array(':uid' => $_W['member']['uid']));
     $carttotal = $this->getCartTotal();
     $pagetitle = "结算";
     include $this->template('confirm');
 }
Exemple #14
0
 public function doMobileShow()
 {
     global $_W, $_GPC;
     $rid = trim($_GPC['rid']);
     $reply = pdo_fetch("SELECT * FROM " . tablename('bm_qrsign_reply') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
     if (time() > strtotime($reply['endtime'])) {
         if (empty($reply['memo2'])) {
             $msg = '对不起,活动已经于' . $reply['endtime'] . '结束,感谢您的参与!!!';
         } else {
             $msg = $reply['memo2'];
         }
         message($msg, $reply['url2'], 'success');
     }
     if (time() < strtotime($reply['starttime'])) {
         if (empty($reply['memo1'])) {
             $msg = '对不起,活动将于' . $reply['starttime'] . '开始,敬请期待!!!';
         } else {
             $msg = $reply['memo1'];
         }
         message($msg, $reply['url1'], 'success');
     }
     if (empty($_W['fans']['nickname'])) {
         mc_oauth_userinfo();
     }
     if ($reply['pictype'] == 1) {
         if (empty($_W['fans']['follow']) || $_W['fans']['follow'] == 0) {
             header("Location: " . $reply['urlx']);
             exit;
         }
     }
     $op = trim($_GPC['op']);
     $qrmoney = $_GPC['qrmoney'];
     $from_user = $_W['fans']['openid'];
     $qrpicurl = $_W['attachurl'] . $reply['qrcode'];
     if ($op == 'post') {
         if ($qrmoney < 0.01) {
             message('支付金额错误,请重新录入!', $this->createMobileUrl('show', array('rid' => $rid, 'from_user' => $from_user)), 'error');
         }
         $data = array('rid' => $rid, 'dateline' => TIMESTAMP, 'clientOrderId' => TIMESTAMP, 'qrmoney' => $qrmoney, 'status' => 0, 'fromuser' => $from_user, 'username' => $_W['fans']['nickname'], 'avatar' => $_W['fans']['tag']['avatar'], 'credit' => $reply['n']);
         pdo_insert('bm_qrsign_payed', $data);
         $params = array('tid' => $data['clientOrderId'], 'ordersn' => $data['clientOrderId'], 'title' => '扫码支付', 'fee' => $data['qrmoney'], 'user' => $from_user);
         $this->pay($params);
         exit;
     } else {
         if ($op == 'sign') {
             $rec = pdo_fetch("select * from " . tablename('bm_qrsign_record') . " where rid= " . $rid . " and fromuser= '******' order by sign_time desc");
             if (!empty($rec)) {
                 $Date_1 = date("Y-m-d", time());
                 $Date_2 = date("Y-m-d", $rec['sign_time']);
                 $Date_List_a1 = explode("-", $Date_1);
                 $Date_List_a2 = explode("-", $Date_2);
                 $d1 = mktime(0, 0, 0, $Date_List_a1[1], $Date_List_a1[2], $Date_List_a1[0]);
                 $d2 = mktime(0, 0, 0, $Date_List_a2[1], $Date_List_a2[2], $Date_List_a2[0]);
                 $Days = round(($d1 - $d2) / 3600 / 24);
                 if ($Days == 0) {
                     $msg = '感谢您的参与,每个人每天只可以签到一次哦!!!';
                     message($msg, $reply['urly'], 'success');
                 }
             }
             $insert = array('rid' => $rid, 'fromuser' => $from_user, 'username' => $_W['fans']['nickname'], 'avatar' => $_W['fans']['tag']['avatar'], 'sign_time' => $_W['timestamp'], 'credit' => $reply['n']);
             pdo_insert('bm_qrsign_record', $insert);
             $user = fans_search($from_user);
             $sql_member = "SELECT a.uid FROM " . tablename('mc_mapping_fans') . " a inner join " . tablename('mc_members') . " b on a.uid=b.uid WHERE a.openid='{$from_user}'";
             $uid = pdo_fetchcolumn($sql_member);
             mc_credit_update($uid, 'credit1', intval($reply['n']), array(0 => 'system', 1 => '扫码签到送积分'));
             $user = fans_search($from_user);
             $msg = '恭喜签到成功,您已获得奖励积分' . $reply['n'] . '分,您目前的总积分为' . $user['credit1'] . '分!';
             message($msg, $reply['urly'], 'success');
         }
     }
     include $this->template('show');
 }
Exemple #15
0
 public function doMobileDetail()
 {
     global $_W, $_GPC;
     $user_agent = $_SERVER['HTTP_USER_AGENT'];
     $from_user = $this->getFromUser();
     $day_cookies = 15;
     $shareid = 'eso_sale_sid07' . $_W['uniacid'];
     $share_data = $this->module['config'];
     $pro_data = pdo_fetch('SELECT id FROM ' . tablename('eso_sale_member') . " WHERE  uniacid = :uniacid  AND from_user = :from_user", array(':uniacid' => $_W['uniacid'], ':from_user' => $from_user));
     /*	
     	$carttotal = $this->getCartTotal();
     	$share = "eso_saleshareQrcode".$_W['uniacid'];
     	$gid = $_GPC['gid'];
     	$from_user =	$this->getFromUser();
     	$profile = pdo_fetch('SELECT * FROM '.tablename('eso_sale_member')." WHERE  uniacid = :uniacid  AND from_user = :from_user" , array(':uniacid' => $_W['uniacid'],':from_user' => $from_user));
     	$id = $profile['id'];
     */
     if ($_GPC['mid'] != $_COOKIE[$shareid] && !empty($_GPC['mid'])) {
         $this->shareClick($_GPC['mid']);
         setcookie($shareid, $_GPC['mid'], time() + 3600 * 24 * $day_cookies);
     }
     $fans = mc_oauth_userinfo();
     if (strpos($user_agent, 'MicroMessenger') == true) {
         load()->func('communication');
         $account = account_fetch($_W['acid']);
         //获取公众号信息
         $url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $account['access_token']['token'] . "&openid=" . $from_user . "&lang=zh_CN";
         $re = ihttp_get($url);
         //ihttp_get()封装的 http GET 请求方法
         if ($re['code'] == 200) {
             $content = json_decode($re['content'], true);
             if ($content['subscribe'] == 1) {
                 //此人已关注
                 $data = array('nickname' => $content['nickname'], 'gender' => $content['sex'], 'avatar' => $content['headimgurl'], 'resideprovince' => $content['province'], 'residecity' => $content['city'], 'nationality' => $content['country']);
                 pdo_update('mc_members', $data, array('uid' => $_W['member']['uid']));
                 pdo_update('mc_mapping_fans', array('follow' => 1), array('acid' => $_W['acid'], 'openid' => $openid));
                 $profile = fans_search($_W['fans']['from_user'], array('nickname', 'credit1', 'credit2', 'avatar'));
             }
         }
     }
     $goodsid = intval($_GPC['id']);
     $goods = pdo_fetch("SELECT * FROM " . tablename('eso_sale_goods') . " WHERE id = :id", array(':id' => $goodsid));
     $ccate = intval($goods['ccate']);
     //$commission = pdo_fetchcolumn( " SELECT commission FROM ".tablename('eso_sale_category')." WHERE id=".$ccate." " );
     $commission = pdo_fetchcolumn(" SELECT commission FROM " . tablename('eso_sale_goods') . " WHERE id=" . $goodsid . " ");
     $member = pdo_fetch(" SELECT * FROM " . tablename('eso_sale_member') . " WHERE from_user='******' AND uniacid=" . $_W['uniacid'] . " ");
     if ($commission == false || $commission == null || $commission < 0) {
         $commission = $this->module['config']['globalCommission'];
     }
     if (empty($goods)) {
         message('抱歉,商品不存在或是已经被删除!');
     }
     if ($goods['istime'] == 1) {
         if (time() < $goods['timestart']) {
             message('抱歉,还未到购买时间, 暂时无法购物哦~', referer(), "error");
         }
         if (time() > $goods['timeend']) {
             message('抱歉,商品限购时间已到,不能购买了哦~', referer(), "error");
         }
     }
     //浏览量
     pdo_query("update " . tablename('eso_sale_goods') . " set viewcount=viewcount+1 where id=:id and uniacid='{$_W['uniacid']}' ", array(":id" => $goodsid));
     $piclist1 = array(array("attachment" => $goods['thumb']));
     $piclist = array();
     if (is_array($piclist1)) {
         foreach ($piclist1 as $p) {
             $piclist[] = is_array($p) ? $p['attachment'] : $p;
         }
     }
     if ($goods['thumb_url'] != 'N;') {
         $urls = unserialize($goods['thumb_url']);
         if (is_array($urls)) {
             foreach ($urls as $p) {
                 $piclist[] = is_array($p) ? $p['attachment'] : $p;
             }
         }
     }
     $marketprice = $goods['marketprice'];
     $productprice = $goods['productprice'];
     $stock = $goods['total'];
     //规格及规格项
     $allspecs = pdo_fetchall("select * from " . tablename('eso_sale_spec') . " where goodsid=:id order by displayorder asc", array(':id' => $goodsid));
     foreach ($allspecs as &$s) {
         $s['items'] = pdo_fetchall("select * from " . tablename('eso_sale_spec_item') . " where  `show`=1 and specid=:specid order by displayorder asc", array(":specid" => $s['id']));
     }
     unset($s);
     //处理规格项
     $options = pdo_fetchall("select id,title,thumb,marketprice,productprice,costprice, stock,weight,specs from " . tablename('eso_sale_goods_option') . " where goodsid=:id order by id asc", array(':id' => $goodsid));
     //排序好的specs
     $specs = array();
     //找出数据库存储的排列顺序
     if (count($options) > 0) {
         $specitemids = explode("_", $options[0]['specs']);
         foreach ($specitemids as $itemid) {
             foreach ($allspecs as $ss) {
                 $items = $ss['items'];
                 foreach ($items as $it) {
                     if ($it['id'] == $itemid) {
                         $specs[] = $ss;
                         break;
                     }
                 }
             }
         }
     }
     if (!empty($goods['hasoption'])) {
         $options = pdo_fetchall("SELECT * FROM " . tablename('eso_sale_goods_option') . " WHERE goodsid=:goodsid order by thumb asc,displayorder asc", array(":goodsid" => $goods['id']));
         foreach ($options as $o) {
             if ($marketprice >= $o['marketprice']) {
                 $marketprice = $o['marketprice'];
             }
             if ($productprice >= $o['productprice']) {
                 $productprice = $o['productprice'];
             }
             if ($stock <= $o['stock']) {
                 $stock = $o['stock'];
             }
         }
     }
     $params = pdo_fetchall("SELECT * FROM " . tablename('eso_sale_goods_param') . " WHERE goodsid=:goodsid order by displayorder asc", array(":goodsid" => $goods['id']));
     $carttotal = $this->getCartTotal();
     $rmlist = pdo_fetchall("SELECT * FROM " . tablename('eso_sale_goods') . " WHERE uniacid = '{$_W['uniacid']}'  and deleted=0 AND status = '1' and ishot='1' ORDER BY displayorder DESC, sales DESC limit 4 ");
     $cfg = $this->module['config'];
     $ydyy = $cfg['ydyy'];
     include $this->template('detail');
 }
Exemple #16
0
 private function FM_checkoauth()
 {
     global $_GPC, $_W;
     $uniacid = !empty($_W['uniacid']) ? $_W['uniacid'] : $_W['acid'];
     load()->model('mc');
     $openid = '';
     $nickname = '';
     $avatar = '';
     $follow = '';
     if (!empty($_W['member']['uid'])) {
         $member = mc_fetch(intval($_W['member']['uid']), array('avatar', 'nickname'));
         if (!empty($member)) {
             $avatar = $member['avatar'];
             $nickname = $member['nickname'];
         }
     }
     if (empty($avatar) || empty($nickname)) {
         $fan = mc_fansinfo($_W['openid']);
         if (!empty($fan)) {
             $avatar = $fan['avatar'];
             $nickname = $fan['nickname'];
             $openid = $fan['openid'];
             $follow = $fan['follow'];
         }
     }
     if (empty($avatar) || empty($nickname) || empty($openid) || empty($follow)) {
         $userinfo = mc_oauth_userinfo();
         if (!is_error($userinfo) && !empty($userinfo) && is_array($userinfo) && !empty($userinfo['avatar'])) {
             $avatar = $userinfo['avatar'];
         }
         if (!is_error($userinfo) && !empty($userinfo) && is_array($userinfo) && !empty($userinfo['nickname'])) {
             $nickname = $userinfo['nickname'];
         }
         if (!is_error($userinfo) && !empty($userinfo) && is_array($userinfo) && !empty($userinfo['openid'])) {
             $openid = $userinfo['openid'];
         }
         if (!is_error($userinfo) && !empty($userinfo) && is_array($userinfo) && !empty($userinfo['follow'])) {
             $follow = $userinfo['follow'];
         }
     }
     if ((empty($avatar) || empty($nickname)) && !empty($_W['member']['uid'])) {
     }
     $oauthuser = array();
     $oauthuser['avatar'] = $avatar;
     $oauthuser['nickname'] = $nickname;
     $oauthuser['from_user'] = $openid;
     $oauthuser['follow'] = !empty($follow) ? $follow : $_W['fans']['follow'];
     return $oauthuser;
 }
Exemple #17
0
 public function doMobileOauthuserinfo()
 {
     global $_W, $_GPC;
     load()->model('mc');
     // 假设当前应用必需会员头像
     $avatar = '';
     // 1 如果是会员(存在 uid),从会员信息中获取
     if (!empty($_W['member']['uid'])) {
         $member = mc_fetch($_W['member']['uid']);
         if (!empty($member)) {
             $avatar = $member['avatar'];
         }
     }
     // 2 如果存在 fans 记录, 从 fans 中获取
     if (empty($avatar)) {
         $fan = mc_fansinfo($_W['openid']);
         if (!empty($fan) && !empty($fan['tag'])) {
             $avatar = $fan['tag']['avatar'];
         }
     }
     //3 最后调用网页授权, 如果有权限
     if (empty($avatar)) {
         if (!empty($_W['oauth_account'])) {
             $userinfo = mc_oauth_userinfo();
             if (is_error($userinfo)) {
                 // you code here
                 message($ret['message']);
             } else {
                 $avatar = $userinfo['tag']['avatar'];
             }
         } else {
             mc_require($_W['uid'], array('avatar'));
         }
     }
     echo "<img src='{$avatar}'>";
 }
Exemple #18
0
}
if ($_POST) {
    $heka['oid'] = getoid();
    $heka['openid'] = $_GPC['openid'];
    $heka['huayu'] = $_GPC['huayu'];
    $heka['images'] = $_GPC['images'];
    $heka['techname'] = $_GPC['techname'];
    $muban = $_GPC['sel'];
    $table_name = "xc_heka_addheka";
    $rs = pdo_insert($table_name, $heka);
    if ($rs) {
        message('生成成功!', $this->createMobileUrl('Detail', array('oid' => $heka['oid'], 'mb' => $muban)), 'success');
    } else {
    }
} else {
    $info = mc_oauth_userinfo();
    //获取粉丝资料
    $table_name = "xc_heka_heka";
    $sql = 'SELECT * FROM ' . tablename('xc_heka_heka') . ' WHERE `openid` = :openid';
    $params = array(':openid' => $_W['openid']);
    $res = pdo_fetch($sql, $params);
    if ($res) {
    } else {
        $xinxi['openid'] = $_W['openid'];
        $xinxi['uniacid'] = $_W['uniacid'];
        $xinxi['name'] = $info['nickname'];
        $xinxi['img'] = $info['avatar'];
        $xinxi['status'] = 1;
        $rs = pdo_insert($table_name, $xinxi);
        if ($rs) {
        } else {
Exemple #19
0
 public function doMobileInfo()
 {
     global $_GPC, $_W;
     $id = intval($_GPC['id']);
     $sql = 'SELECT * FROM ' . tablename('bbb_reply') . ' WHERE `rid` = :rid';
     $bbb = pdo_fetch($sql, array(':rid' => $id));
     if (empty($bbb)) {
         message('非法访问,请重新发送消息进入摇骰子页面!');
     }
     load()->model('mc');
     mc_oauth_userinfo($_W['acid']);
     $bbb['descriptions'] = str_replace(array("\r\n"), "", $bbb['description']);
     $bbb['rule'] = preg_replace('/color:\\s+\\#\\w+;/i', '', $bbb['rule']);
     $followInfo = empty($_W['fans']['openid']) ? '提示:必须关注公众号才可以进入游戏' : '';
     $sql = 'SELECT * FROM ' . tablename('bbb_user') . ' WHERE `rid` = :rid AND `from_user` = :from_user';
     $params = array(':rid' => $id, ':from_user' => $_W['fans']['openid']);
     $user = pdo_fetch($sql, $params);
     include $this->template('info');
 }
Exemple #20
0
 public function doMobilePaySuccess()
 {
     global $_W, $_GPC;
     $uniacid = $_W['uniacid'];
     $price = $_GPC['price'];
     $aid = $_GPC['aid'];
     $article = pdo_fetch('select * from ' . tablename('fineness_article') . ' where weid=:weid AND id=:id', array(':weid' => $uniacid, ':id' => $aid));
     load()->model('mc');
     $userInfo = mc_oauth_userinfo();
     if (empty($userInfo) && empty($userInfo['nickname'])) {
         //已关注过
         $res['code'] = 202;
         $res['msg'] = "您还没有关注,请关注后参与。";
         return json_encode($res);
     }
     load()->func('logging');
     if (!empty($article)) {
         $data = array('weid' => $uniacid, 'price' => $price, 'aid' => $aid, 'author' => $userInfo['nickname'], 'thumb' => $userInfo['avatar'], 'openid' => $userInfo['openid'], 'createtime' => time());
         pdo_insert('fineness_admire', $data);
         // $this->sendOrderSuccessTplMsg($oid,$meal['title']);
     }
     $res['code'] = 200;
     $res['msg'] = 'sucess';
     return json_encode($res);
 }
Exemple #21
0
 public function doMobilePtjperfect()
 {
     //这个操作被定义用户  呈现用户完善信息的页面
     global $_W, $_GPC;
     require_once 'sms.php';
     load()->model('mc');
     load()->func('tpl');
     $avatar = '';
     $openid = $_W['openid'];
     $count = 0;
     $uid = $_W['member']['uid'];
     if (!empty($_W['member']['uid'])) {
         $member = mc_fetch(intval($_W['member']['uid']), array('avatar', 'nickname'));
         if (!empty($member)) {
             $avatar = $member['avatar'];
             $nickname = $member['nickname'];
         }
     }
     if (empty($avatar)) {
         $fan = mc_fansinfo($_W['openid']);
         if (!empty($fan)) {
             $avatar = $fan['avatar'];
         }
     }
     if (empty($avatar)) {
         $userinfo = mc_oauth_userinfo();
         if (!is_error($userinfo) && !empty($userinfo) && is_array($userinfo) && !empty($userinfo['avatar'])) {
             $avatar = $userinfo['avatar'];
             $nickname = $userinfo['nickname'];
         }
     }
     if (empty($avatar) && !empty($_W['member']['uid'])) {
         $avatar = mc_require($_W['member']['uid'], array('avatar'));
     }
     if (empty($avatar)) {
         // 提示用户关注公众号。;
         //echo "最终没有获取到头像,follow: {$_W['fans']['follow']}";
     } else {
         $src = $avatar;
     }
     //////////////////////////////////////mc调用结束////////////////////////////
     $sms = json_decode($sms, true);
     if ($_GPC['tel'] and $_GPC['verify'] !== 'ing') {
         //对TEL进行动态正则匹配
         $tel = $_GPC['tel'];
         $t = preg_match('/^1[34578]\\d{9}$/', $tel);
         if ($t) {
             //给前端号码
             $tel = $_GPC['tel'];
             message('tel_success');
         } else {
             message('tel_fail');
         }
     }
     if ($_GPC['verify'] === 'ing') {
         //开始构造短信信息
         $statusStr = array("0" => "POSTED", "-1" => "参数不全", "-2" => "服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!", "30" => "密码错误", "40" => "账号不存在", "41" => "余额不足", "42" => "帐户已过期", "43" => "IP地址限制", "50" => "内容含有敏感词");
         $smsapi = "http://api.smsbao.com/";
         //$user = "******"; //短信平台帐号
         $user = $sms['sms_account'];
         //$pass = md5("wa7plus"); //短信平台密码
         $pass = md5($sms['sms_password']);
         $m_content = substr(time(), -4, 4);
         //要发送的短信内容
         $time = 1;
         $content = "【老司机】" . "您的验证码为: {$m_content}," . "在{$time}分钟内有效---{$_W['account']['name']}";
         $phone = $_GPC['tel'];
         //要发送短信的手机号码
         $sendurl = $smsapi . "sms?u=" . $user . "&p=" . $pass . "&m=" . $phone . "&c=" . urlencode($content);
         $result = file_get_contents($sendurl);
         $msg = $statusStr[$result];
         $resarr = array("msg" => $msg, "content" => $m_content);
         $res = json_encode($resarr);
         message($res);
     }
     $name = $_GPC['name'];
     $phone = $_GPC['phone'];
     $openid = $_W['openid'];
     if (isset($name) && isset($phone)) {
         pdo_insert('ptj_profile', array('name' => $name, 'phone' => $phone, 'sure' => 1, 'openid' => $openid));
     }
     include $this->template('perfect');
 }
Exemple #22
0
 private function getOpenid()
 {
     global $_W;
     $userAgent = $_SERVER['HTTP_USER_AGENT'];
     if (!strpos($userAgent, 'MicroMessenger')) {
         message('请使用微信浏览器打开!');
     }
     $openid = $_W['fans']['from_user'];
     if (empty($openid)) {
         load()->model('mc');
         $info = mc_oauth_userinfo();
         $openid = $info['openid'];
     }
     return $openid;
 }