当前位置: 首页>>代码示例>>PHP>>正文


PHP mc_oauth_userinfo函数代码示例

本文整理汇总了PHP中mc_oauth_userinfo函数的典型用法代码示例。如果您正苦于以下问题:PHP mc_oauth_userinfo函数的具体用法?PHP mc_oauth_userinfo怎么用?PHP mc_oauth_userinfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mc_oauth_userinfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInfo

 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;
 }
开发者ID:ChainBoy,项目名称:wxfx,代码行数:27,代码来源:user.php

示例2: doMobileIndex

 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;
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:34,代码来源:site.php

示例3: __construct

 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 = '{$openid}'");
                 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 = '{$userinfo['openid']}'");
                 if (empty($profile)) {
                     pdo_insert('auction_member', $data);
                 } else {
                     pdo_update('auction_member', $data, array('id' => $profile['id']));
                 }
             }
         }
     }
 }
开发者ID:wisemyth,项目名称:weizan,代码行数:35,代码来源:site.php

示例4: doMobileWelcome

 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');
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:25,代码来源:site.php

示例5: auth

 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;
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:11,代码来源:site.php

示例6: __construct

 public function __construct()
 {
     global $_W;
     load()->model('mc');
     $profile = pdo_fetch("SELECT * FROM " . tablename('tg_member') . " WHERE uniacid ='{$_W['uniacid']}' and from_user = '{$_W['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);
         }
     }
 }
开发者ID:ChainBoy,项目名称:wxfx,代码行数:13,代码来源:site.php

示例7: authFansInfo

 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;
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:13,代码来源:FlashUserService.php

示例8: __construct

 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']));
             }
         }
     }
 }
开发者ID:noikiy,项目名称:mygit,代码行数:18,代码来源:site.php

示例9: requreSubscribe

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);
}
开发者ID:eduNeusoft,项目名称:weixin,代码行数:43,代码来源:zqgame.inc.php

示例10: getuserinfo

 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);
         }
     }
 }
开发者ID:noikiy,项目名称:mygit,代码行数:21,代码来源:site.php

示例11: doMobileConfirm

 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');
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:74,代码来源:site.php

示例12: doMobileShow

 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= '{$from_user}' 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');
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:72,代码来源:site.php

示例13: doMobileDetail

 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='" . $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;
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:mygit,代码行数:101,代码来源:site.php

示例14: FM_checkoauth

 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;
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:49,代码来源:site.php

示例15: doMobileOauthuserinfo

 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}'>";
 }
开发者ID:lrf1999,项目名称:we7_store,代码行数:36,代码来源:site.php


注:本文中的mc_oauth_userinfo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。