예제 #1
0
파일: site.php 프로젝트: eduNeusoft/weixin
 public function doMobileMregister()
 {
     global $_GPC, $_W;
     $fid = intval($_GPC['fid']);
     $flight_setting = pdo_fetch("SELECT * FROM " . tablename('fighting_setting') . " WHERE rid = '{$fid}' LIMIT 1");
     if (empty($flight_setting)) {
         message('非法访问,请重新发送消息进入页面!');
     }
     $fromuser = $_W['fans']['from_user'];
     if (empty($fromuser)) {
         $fromuser = $_GPC['openid'];
     }
     $data = array('nickname' => $_GPC['nickname'], 'mobile' => $_GPC['mobile']);
     if (empty($data['nickname'])) {
         return $this->fightJson(-1, '请填写您的昵称!');
         exit;
     }
     if (empty($data['mobile'])) {
         return $this->fightJson(-1, '请填写您的手机号码!');
         exit;
     }
     fans_update($fromuser, array('nickname' => $_GPC['nickname'], 'mobile' => $_GPC['mobile']));
     $p = pdo_fetch("SELECT * FROM " . tablename('fighting_user') . " WHERE openid='" . $fromuser . "' AND fid=" . $fid);
     $insert1 = array('weid' => $_W['uniacid'], 'fid' => $fid, 'openid' => $fromuser, 'nickname' => $_GPC['nickname'], 'mobile' => $_GPC['mobile']);
     if (!empty($p['id'])) {
         $insert1['id'] = $p['id'];
         pdo_update('fighting_user', $insert1, array('id' => $p['id']));
     } else {
         $add = pdo_insert('fighting_user', $insert1);
     }
     return $this->fightJson(1, '');
     exit;
 }
예제 #2
0
 public function respond()
 {
     global $_W;
     $rid = $this->rule;
     $sql = "SELECT * FROM " . tablename('signin_reply') . " WHERE `rid`=:rid LIMIT 1";
     $row = pdo_fetch($sql, array(':rid' => $rid));
     if (empty($row['id'])) {
         return array();
     }
     $now = time();
     $start_time = $this->module['config']['start_time'];
     $start_time = strtotime($start_time);
     $end_time = $this->module['config']['end_time'];
     $end_time = strtotime($end_time);
     $date = date('Y-m-d');
     $date = strtotime($date);
     $times = $this->module['config']['times'];
     $credit = $this->module['config']['credit'];
     $limit = $this->module['config']['rank'];
     $message = $this->message;
     $from = $message['from'];
     $todaytotal = pdo_fetchall("SELECT * FROM " . tablename('signin_record') . " WHERE `time` >= :date ", array(':date' => $date));
     $totalnum = count($todaytotal);
     $userrank = $totalnum + 1;
     $todaysignin = pdo_fetchall("SELECT * FROM " . tablename('signin_record') . " WHERE `from_user` = :from_user and `time` >= :date ", array(':from_user' => $from, ':date' => $date));
     $signinednum = count($todaysignin);
     $signinnum = $signinednum + 1;
     $profile = fans_search($from);
     if (!empty($profile['realname'])) {
         if ($now >= $start_time && $now <= $end_time) {
             if ($signinednum < $times) {
                 $insert = array('id' => null, 'weid' => $_W['weid'], 'from_user' => $from, 'name' => $profile['realname'], 'time' => $now, 'rank' => $userrank);
                 pdo_insert('signin_record', $insert);
                 $data = array('credit1' => $credit + $profile['credit1']);
                 fans_update($from, $data);
                 $top = "SELECT * FROM " . tablename('signin_record') . " WHERE `time` >= :date order by rank asc limit {$limit}";
                 $rs = pdo_fetchall($top, array(':date' => $date));
                 $value = array();
                 foreach ($rs as $value) {
                     $record .= 'NO.' . $value['rank'] . '      ' . $value['name'] . '      ' . date('H:i', $value['time']) . "\n";
                 }
                 $nowcredite = fans_search($from);
                 return $this->respText('这是您今天第' . $signinnum . '次签到' . "\n\n" . '排名第' . $userrank . "\n\n" . '本次获取' . $credit . '个积分' . "\n\n" . '累计拥有' . $nowcredite['credit1'] . '个积分' . "\n\n" . '今日签到排行榜:' . "\n\n" . $record);
             } else {
                 $top = "SELECT * FROM " . tablename('signin_record') . " WHERE `from_user` = :from_user and `time` >= :date order by rank asc limit 10";
                 $rs = pdo_fetchall($top, array(':from_user' => $from, ':date' => $date));
                 $value = array();
                 foreach ($rs as $value) {
                     $record .= 'NO.' . $value['rank'] . '      ' . date('m-d H:i:s', $value['time']) . "\n";
                 }
                 return $this->respText($row['overnum'] . "\n\n" . '您的签到记录为' . "\n" . $record);
             }
         } else {
             return $this->respText($row['overtime']);
         }
     } else {
         return $this->respNews(array('Title' => "请先登记", 'Description' => "点击进入登记", 'PicUrl' => "", 'Url' => $this->createMobileUrl('register')));
     }
 }
예제 #3
0
파일: receiver.php 프로젝트: yunsite/my-we7
 public function receive()
 {
     $type = $this->message['type'];
     //这里定义此模块进行消息订阅时的, 消息到达以后的具体处理过程, 请查看微擎文档来编写你的代码
     //退订
     if ($this->message['event'] == 'unsubscribe') {
         pdo_update('fans', array('follow' => 0, 'createtime' => TIMESTAMP), array('from_user' => $this->message['fromusername'], 'weid' => $GLOBALS['_W']['weid']));
     } else {
         fans_update($this->message['fromusername'], array('weid' => $GLOBALS['_W']['weid'], 'follow' => 1, 'from_user' => $this->message['fromusername'], 'createtime' => TIMESTAMP));
     }
 }
예제 #4
0
 public function doMobileRegister()
 {
     global $_GPC, $_W;
     if (!empty($_GPC['submit'])) {
         if (empty($_W['fans']['from_user'])) {
             message('非法访问,请重新发送消息进入砸蛋页面!');
         }
         $data = array('realname' => $_GPC['realname'], 'mobile' => $_GPC['mobile'], 'gender' => $_GPC['gender']);
         fans_update($_W['fans']['from_user'], $data);
         die('<script>location.href = "' . $this->createMobileUrl('success') . '";</script>');
     }
     include $this->template('register');
 }
예제 #5
0
 public function doMobileRegister()
 {
     global $_GPC, $_W;
     $title = '茶叶蛋登记个人信息';
     if (!empty($_GPC['submit'])) {
         $data = array('realname' => $_GPC['realname'], 'mobile' => $_GPC['mobile'], 'qq' => $_GPC['qq']);
         if (empty($data['realname'])) {
             die('<script>alert("请填写您的真实姓名!");location.reload();</script>');
         }
         if (empty($data['mobile'])) {
             die('<script>alert("请填写您的手机号码!");location.reload();</script>');
         }
         fans_update($_W['fans']['from_user'], $data);
         die('<script>alert("登记成功!");location.href = "' . $this->createMobileUrl('lottery', array('id' => $_GPC['id'])) . '";</script>');
     }
     include $this->template('register');
 }
예제 #6
0
 public function doMobileIndex()
 {
     global $_GPC, $_W;
     $from = $_W['fans']['from_user'];
     $rid = intval($_GPC['rid']);
     $weid = intval($_GPC['weid']);
     $date = date('Y-m-d');
     $date = strtotime($date);
     $now = time();
     $profile = fans_search($from);
     $sql = "SELECT * FROM " . tablename('exchange_reply') . " WHERE `rid`=:rid";
     $row = pdo_fetch($sql, array(':rid' => $rid));
     $row['picture'] = $_W['attachurl'] . trim($row['picture'], '/');
     $title = $row['title'];
     //$newcredit = $profile['credit1'] - $row['price'];
     $numax = floor($profile['credit1'] / $row['price']);
     $exchanged = pdo_fetchall("SELECT sum(nums) as enum FROM " . tablename('exchange_record') . " WHERE rid = :rid ", array(':rid' => $rid));
     $userexchangeinfo = pdo_fetchall("SELECT nums, cprice, time FROM " . tablename('exchange_record') . " WHERE rid = :rid AND openid = :openid ", array(':rid' => $rid, ':openid' => $from));
     $usertodayexchang = pdo_fetchall("SELECT * FROM " . tablename('exchange_record') . " WHERE rid = :rid AND openid = :openid AND `time` >= :date ", array(':rid' => $rid, ':openid' => $from, ':date' => $date));
     $usertodaynum = count($usertodayexchang);
     $allowexchange = $row['amount'] - $exchanged['0']['enum'];
     if ($numax >= 1) {
         for ($i = 1; $i <= $numax; $i++) {
             $n = $i;
             $nn[] = $n;
         }
     }
     if (!empty($_GPC['submit'])) {
         if ($usertodaynum >= $row['times']) {
             message('每天只能兑换' . $row['times'] . '次哟~~', 'refresh', 'error');
         }
         if ($_GPC['nums'] <= $allowexchange) {
             $data = array('realname' => $_GPC['realname'], 'mobile' => $_GPC['mobile'], 'credit1' => $profile['credit1'] - $_GPC['cprice']);
             fans_update($from, $data);
             $insert = array('weid' => $weid, 'rid' => $rid, 'openid' => $from, 'name' => $_GPC['realname'], 'mobile' => $_GPC['mobile'], 'nums' => $_GPC['nums'], 'cprice' => $_GPC['cprice'], 'time' => $now);
             if (pdo_insert('exchange_record', $insert)) {
                 $id = pdo_insertid();
             }
         } else {
             die('<script>location.href = "' . $this->createMobileUrl('error', array('rid' => $_GPC['rid'], 'id' => $id)) . '";</script>');
         }
         die('<script>location.href = "' . $this->createMobileUrl('success', array('rid' => $_GPC['rid'], 'id' => $id)) . '";</script>');
     }
     include $this->template('index');
 }
예제 #7
0
 public function receive()
 {
     global $_W, $_GPC;
     $type = $this->message['type'];
     //这里定义此模块进行消息订阅时的, 消息到达以后的具体处理过程, 请查看WORMWOOD文档来编写你的代码
     $set = $this->module['config'];
     if (!isset($set['guanzhupp'])) {
         $set['guanzhupp'] = '0';
     }
     if (!isset($set['huoyuepp'])) {
         $set['huoyuepp'] = '0';
     }
     if ($set['guanzhupp'] != '0' || $set['huoyuepp'] != '0') {
         $openid = $this->message['fromusername'];
         $atype = 'weixin';
         $account_token = "account_{$atype}_token";
         $account_code = "account_weixin_code";
         $token = $account_token($_W['account']);
         $url = sprintf("https://api.weixin.qq.com/cgi-bin/user/info?access_token=%s&openid=%s&lang=zh_CN", $token, $openid);
         $content = ihttp_get($url);
         $dat = $content['content'];
         $re = @json_decode($dat, true);
         $dataoi['openid'] = $openid;
         $content3 = ihttp_post(sprintf("https://api.weixin.qq.com/cgi-bin/groups/getid?access_token=%s", $token), json_encode($dataoi));
         $groupid = @json_decode($content3['content'], true);
     }
     //退订
     if ($this->message['event'] == 'unsubscribe') {
         pdo_update('fans', array('follow' => 0, 'createtime' => TIMESTAMP), array('from_user' => $this->message['fromusername'], 'weid' => $GLOBALS['_W']['weid']));
     } elseif ($this->message['event'] == 'subscribe' && $set['guanzhupp'] == '0') {
         fans_update($this->message['fromusername'], array('weid' => $GLOBALS['_W']['weid'], 'follow' => 1, 'from_user' => $this->message['fromusername'], 'createtime' => TIMESTAMP));
     } elseif ($set['huoyuepp'] == '0') {
         fans_update($this->message['fromusername'], array('weid' => $GLOBALS['_W']['weid'], 'follow' => 1, 'from_user' => $this->message['fromusername'], 'createtime' => TIMESTAMP));
     } else {
         fans_update($this->message['fromusername'], array('weid' => $GLOBALS['_W']['weid'], 'follow' => 1, 'from_user' => $this->message['fromusername'], 'nickname' => $re['nickname'], 'gender' => $re['sex'], 'groupid' => $groupid['groupid'], 'residecity' => $re['city'], 'resideprovince' => $re['province'], 'nationality' => $re['country'], 'avatar' => $re['headimgurl'], 'createtime' => TIMESTAMP));
     }
 }
예제 #8
0
파일: treg.php 프로젝트: eduNeusoft/weixin
            fans_update($from_user, array('nickname' => $mynickname));
        }
        if ($reply['isrealname']) {
            fans_update($from_user, array('realname' => $realname));
        }
        if ($reply['ismobile']) {
            fans_update($from_user, array('mobile' => $mobile));
        }
        if ($reply['isqqhao']) {
            fans_update($from_user, array('qq' => $qqhao));
        }
        if ($reply['isemail']) {
            fans_update($from_user, array('email' => $email));
        }
        if ($reply['isaddress']) {
            fans_update($from_user, array('address' => $address));
        }
    }
    if ($_W['account']['level'] == 4) {
        $this->sendMobileRegMsg($from_user, $rid, $uniacid);
    }
    if ($reply['tpsh'] == 1) {
        $msg = '恭喜你报名成功,现在进入审核';
    } else {
        $msg = '恭喜你报名成功!';
    }
    $linkurl = $_W['siteroot'] . 'app/' . $this->createMobileUrl('tuser', array('rid' => $rid, 'tfrom_user' => $from_user));
    $fmdata = array("success" => 1, "msg" => $msg, "linkurl" => $linkurl);
    echo json_encode($fmdata);
    exit;
}
예제 #9
0
파일: site.php 프로젝트: noikiy/mygit
 public function doMobileXoauth()
 {
     global $_W, $_GPC;
     $uniacid = $_W['uniacid'];
     //当前公众号ID
     //用户不授权返回提示说明
     if ($_GPC['code'] == "authdeny") {
         exit;
     }
     //高级接口取未关注用户Openid
     if (isset($_GPC['code'])) {
         //第二步:获得到了OpenID
         $appid = $_W['account']['key'];
         $secret = $_W['account']['secret'];
         $serverapp = $_W['account']['level'];
         if ($serverapp == 2) {
             if (empty($appid) || empty($secret)) {
                 return;
             }
         }
         $state = $_GPC['state'];
         //1为关注用户, 0为未关注用户
         //查询活动时间
         $code = $_GPC['code'];
         $oauth2_code = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $appid . "&secret=" . $secret . "&code=" . $code . "&grant_type=authorization_code";
         $content = ihttp_get($oauth2_code);
         $token = @json_decode($content['content'], true);
         if (empty($token) || !is_array($token) || empty($token['access_token']) || empty($token['openid'])) {
             echo '<h1>获取微信公众号授权' . $code . '失败[无法取得token以及openid], 请稍后重试! 公众平台返回原始数据为: <br />' . $content['meta'] . '<h1>';
             exit;
         }
         $from_user = $token['openid'];
         //再次查询是否为关注用户
         $profile = fans_search($from_user, array('follow'));
         //关注用户直接获取信息
         if ($profile['follow'] == 1) {
             $state = 1;
         }
         //未关注用户和关注用户取全局access_token值的方式不一样
         if ($state == 1 && $serverapp == 2) {
             $access_token = $this->get_weixin_token();
             $oauth2_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $access_token . "&openid=" . $from_user . "&lang=zh_CN";
         } else {
             $access_token = $token['access_token'];
             $oauth2_url = "https://api.weixin.qq.com/sns/userinfo?access_token=" . $access_token . "&openid=" . $from_user . "&lang=zh_CN";
         }
         //使用全局ACCESS_TOKEN获取OpenID的详细信息
         $content = ihttp_get($oauth2_url);
         $info = @json_decode($content['content'], true);
         if (empty($info) || !is_array($info) || empty($info['openid']) || empty($info['nickname'])) {
             echo '<h1>获取微信公众号授权失败[无法取得info], 请稍后重试!<h1>';
             exit;
         }
         //		if (!empty($info["headimgurl"])) {
         //$info['avatar']='resource/attachment/avatar/'.$info["openid"].'.jpg';
         //$imgfile=$info['avatar'];
         //	$this->GrabImage($info['headimgurl'],$imgfile);
         //file_write($info['avatar'], $filedata);
         //	}else{
         //$info['headimgurl']='avatar_11.jpg';
         //}
         if ($serverapp == 2) {
             //普通号
             $row = array('uniacid' => $_W['uniacid'], 'nickname' => $info["nickname"], 'realname' => $info["nickname"], 'gender' => $info['sex']);
             if (!empty($info["country"])) {
                 $row['country'] = $info["country"];
             }
             if (!empty($info["province"])) {
                 $row['province'] = $info["province"];
             }
             if (!empty($info["city"])) {
                 $row['city'] = $info["city"];
             }
             fans_update($from_user, $row);
             /*if(!empty($info["headimgurl"])){
             			pdo_update('fans', array('avatar'=>$info["headimgurl"]), array('from_user' => $from_user));
             		}*/
         }
         if ($serverapp != 2 && !empty($from_user)) {
             //普通号
             $row = array('nickname' => $info["nickname"], 'realname' => $info["nickname"], 'gender' => $info['sex']);
             if (!empty($info["country"])) {
                 $row['country'] = $info["country"];
             }
             if (!empty($info["province"])) {
                 $row['province'] = $info["province"];
             }
             if (!empty($info["city"])) {
                 $row['city'] = $info["city"];
             }
             fans_update($from_user, $row);
             /*if(!empty($info["headimgurl"])){
             			pdo_update('fans', array('avatar'=>$info["headimgurl"]), array('from_user' => $from_user));
             		}*/
         }
         $oauth_openid = "eso_sale_t150122" . $_W['uniacid'];
         setcookie($oauth_openid, $from_user, time() + 3600 * (24 * 5));
         //	$url=$this->mturl('index',array('id'=>$id));
         $url = $_COOKIE["xoauthURL"];
         //die('<script>location.href = "'.$url.'";</script>');
         header("location:{$url}");
         exit;
     } else {
         echo '<h1>网页授权域名设置出错!</h1>';
         exit;
     }
 }
예제 #10
0
 public function doWebeditusr()
 {
     global $_W, $_GPC;
     $id = intval($_GPC['id']);
     include_once model('fans');
     if (checksubmit('submit')) {
         if (!empty($_GPC)) {
             $from_user = $_GPC['from'];
             foreach ($_GPC as $field => $value) {
                 if (empty($value) || in_array($field, array('from_user', 'act', 'name', 'token', 'submit'))) {
                     unset($_GPC[$field]);
                     continue;
                 }
             }
             fans_update($from_user, $_GPC);
         }
         message('更新资料成功!', referer(), 'success');
     }
     if (checksubmit('tb')) {
         if (!empty($_GPC)) {
             $from_user = $_GPC['from'];
         } else {
             message('请确定OID有填写!', referer(), 'success');
             exit;
         }
         $user = gjgetuserinfo($from_user, $_GPC['gxtou']);
         if (!empty($user['from_user']) && is_array($user)) {
             pdo_update('fans', $user, array('from_user' => $from_user));
             //fans_update($from_user, $user);
             //pdo_debug();exit;
         }
         message('同步资料成功!', referer(), 'success');
     }
     $profile = fans_search($_GPC['from']);
     $form = array('birthday' => array('year' => array(date('Y'), '1914')), 'bloodtype' => array('A', 'B', 'AB', 'O', '其它'), 'education' => array('博士', '硕士', '本科', '专科', '中学', '小学', '其它'), 'constellation' => array('水瓶座', '双鱼座', '白羊座', '金牛座', '双子座', '巨蟹座', '狮子座', '处女座', '天秤座', '天蝎座', '射手座', '摩羯座'), 'zodiac' => array('鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪'));
     $gname = $this->doWebGroupdata($member['groupid']);
     $groupname = $gname ? '未分组' : $gname['groupname'];
     $grouplist = $this->doWebGroupdata();
     include $this->template('usr');
 }
예제 #11
0
 public function doMobileuserinfosave()
 {
     //分享页面显示。
     global $_GPC, $_W;
     $weid = $_W['uniacid'];
     //当前公众号ID
     $rid = $_GPC['rid'];
     //当前规则ID
     $uid = $_GPC['uid'];
     //礼盒ID
     $fromuser = authcode(base64_decode($_GPC['fromuser']), 'DECODE');
     $page_fromuser = $_GPC['fromuser'];
     //活动规则
     if (!empty($rid)) {
         $reply = pdo_fetch("SELECT * FROM " . tablename($this->table_reply) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
     }
     //同时更新到官方FANS表中
     if ($reply['isrealname'] && !empty($_GPC['info-name'])) {
         if ($reply['isfans']) {
             fans_update($fromuser, array('realname' => $_GPC['info-name']));
         }
         pdo_update($this->table_list, array('realname' => $_GPC['info-name']), array('from_user' => $fromuser, 'weid' => $weid));
     }
     if ($reply['ismobile'] && !empty($_GPC['info-tel'])) {
         if ($reply['isfans']) {
             fans_update($fromuser, array('mobile' => $_GPC['info-tel']));
         }
         pdo_update($this->table_list, array('mobile' => $_GPC['info-tel']), array('from_user' => $fromuser, 'weid' => $weid));
     }
     if ($reply['isqq'] && !empty($_GPC['info-qqhao'])) {
         if ($reply['isfans']) {
             fans_update($fromuser, array('qq' => $_GPC['info-qqhao']));
         }
         pdo_update($this->table_list, array('qq' => $_GPC['info-qqhao']), array('from_user' => $fromuser, 'weid' => $weid));
     }
     if ($reply['isemail'] && !empty($_GPC['info-email'])) {
         if ($reply['isfans']) {
             fans_update($fromuser, array('email' => $_GPC['info-email']));
         }
         pdo_update($this->table_list, array('email' => $_GPC['info-email']), array('from_user' => $fromuser, 'weid' => $weid));
     }
     if ($reply['isaddress'] && !empty($_GPC['info-address'])) {
         if ($reply['isfans']) {
             fans_update($fromuser, array('address' => $_GPC['info-address']));
         }
         pdo_update($this->table_list, array('address' => $_GPC['info-address']), array('from_user' => $fromuser, 'weid' => $weid));
     }
     //跳转到自己的礼盒信息处
     $mylihe = $_W['siteroot'] . "app/" . substr($this->createMobileUrl('viewlihe', array('rid' => $rid, 'info-prize2' => $uid, 'fromuser' => $page_fromuser), true), 2);
     header("location:{$mylihe}");
     exit;
 }
예제 #12
0
파일: site.php 프로젝트: nsoff/wdlcms
 public function doMobileYuyue()
 {
     global $_GPC, $_W;
     //checkauth();
     $op = trim($_GPC['op']);
     //获取select下的option
     $brands = pdo_fetchall('SELECT * FROM ' . tablename('we7car_brand') . " WHERE `weid` = :weid AND `status` = 1 ORDER BY listorder DESC", array(':weid' => $_W['uniacid']));
     if ($op == 'getseries') {
         $bid = intval($_GPC['bid']);
         $ty = trim($_GPC['ty']);
         if ($bid) {
             if ($ty == 'series') {
                 $datas = pdo_fetchall("SELECT id,bid,title FROM " . tablename('we7car_series') . " WHERE `weid` = :weid AND `status` = 1 AND `bid` = :bid ORDER BY `listorder` DESC", array(':weid' => $_W['uniacid'], ':bid' => $bid));
                 $html = "<option value='0'>请选择车系</option>";
                 foreach ($datas as $val) {
                     $val['val'] = $val['id'] . '=' . $val['title'];
                     $html .= "<option value='{$val['val']}'>{$val['title']}</option>";
                 }
             } elseif ($ty == 'types') {
                 $datas = pdo_fetchall("SELECT id,title FROM " . tablename('we7car_type') . " WHERE `weid` = :weid AND `status` = 1 AND `sid` = :bid ORDER BY `listorder` DESC", array(':weid' => $_W['uniacid'], ':bid' => $bid));
                 $html = "<option value='0'>请选择车型</option>";
                 foreach ($datas as $val) {
                     $val['val'] = $val['id'] . '=' . $val['title'];
                     $html .= "<option value='{$val['val']}'>{$val['title']}</option>";
                 }
             }
         }
         exit($html);
     }
     $lid = intval($_GPC['id']);
     //订单id
     $yytype = intval($_GPC['yytype']) ? intval($_GPC['yytype']) : intval($_GPC['__state']);
     //预约类型
     //获取预约信息
     $reply = pdo_fetch("SELECT * FROM " . tablename('we7car_order_set') . " WHERE `weid` = :weid AND `yytype` = :yytype AND `isshow` = 1 ORDER BY `id` DESC LIMIT 1", array(':weid' => $_W['uniacid'], ':yytype' => $yytype));
     if (!$reply) {
         message('抱歉,暂无预约信息.');
     }
     if ($reply['start_time'] > TIMESTAMP) {
         message('当前预约活动还未开始!');
     }
     if ($reply['end_time'] < TIMESTAMP) {
         message('当前预约活动已经结束!');
     }
     //获取预约的自定义字段
     if (!empty($reply)) {
         $sql = 'SELECT * FROM ' . tablename('we7car_order_fields') . ' WHERE `sid` = :sid ORDER BY fid ASC';
         $params = array();
         $params[':sid'] = $reply['id'];
         $ds = pdo_fetchall($sql, $params);
     }
     if (!empty($ds)) {
         foreach ($ds as &$d) {
             if ($d['type'] == 'select') {
                 $d['option'] = explode('|', $d['value']);
             }
         }
         foreach ($ds as $r) {
             $fields[$r['fid']] = $r;
         }
     }
     //获取某用户的预约次数
     $pertotal = 0;
     $pertotal = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('we7car_order_list') . " WHERE sid = :sid AND from_user = :openid AND yytype = :yytype", array(':sid' => $reply['id'], ':openid' => $_W['fans']['from_user'], ':yytype' => $yytype));
     if ($pertotal >= $reply['pertotal'] && $reply['pertotal'] != 0) {
         $pererror = 1;
     }
     if ($lid) {
         //得到某个订单
         $order = pdo_fetch("SELECT * FROM " . tablename('we7car_order_list') . " WHERE `id` = :id  AND `yytype` = :yytype LIMIT 1", array(':id' => $lid, ':yytype' => $yytype));
         $order['brand_val'] = $order['brand'] . '=' . $order['brand_cn'];
         $order['series_val'] = $order['serie'] . '=' . $order['serie_cn'];
         $order['type_val'] = $order['type'] . '=' . $order['type_cn'];
         $order['dateline'] = $order['dateline'] ? date('Y-m-d', $order['dateline']) : date('Y-m-d');
         //初始化车系和车型
         $eseries = pdo_fetchall('SELECT id,title FROM ' . tablename('we7car_series') . " WHERE `weid` = :weid AND `bid` = :bid AND `status` = 1 ORDER BY listorder DESC", array(':weid' => $_W['uniacid'], ':bid' => $order['brand']));
         $etypes = pdo_fetchall('SELECT id,title FROM ' . tablename('we7car_type') . " WHERE `weid` = :weid AND `sid` = :sid AND `status` = 1 ORDER BY listorder DESC", array(':weid' => $_W['uniacid'], ':sid' => $order['serie']));
         if (!empty($ds)) {
             //如果有自定义字段
             $fieldsdata = pdo_fetchall("SELECT * FROM " . tablename('we7car_order_data') . " WHERE `srid` = :srid ", array(':srid' => $lid));
             if ($fieldsdata) {
                 foreach ($fieldsdata as $fielddata) {
                     $order['data'][$fielddata['sfid']] = $fielddata['data'];
                 }
             }
         }
     } else {
         $order['dateline'] = date('Y-m-d');
     }
     if (checksubmit('submit')) {
         $sid = intval($reply['id']);
         //某条预约的id
         if ($pererror == 1 && !$lid) {
             message("没人可预约{$reply['pertotal']}次.");
         }
         if (!$sid) {
             message('预约信息获取失败.');
         }
         //更新粉丝的手机号和姓名
         if ($userinfo == '0') {
             fans_update($_W['fans']['from_user'], array('realname' => trim($_GPC['realname']), 'mobile' => trim($_GPC['tel'])));
         }
         $barr = explode('=', trim($_GPC['brand']));
         $sarr = explode('=', trim($_GPC['serie']));
         $tarr = explode('=', trim($_GPC['types']));
         $insert = array('sid' => $sid, 'from_user' => $_W['fans']['from_user'], 'username' => trim($_GPC['realname']), 'mobile' => trim($_GPC['tel']), 'dateline' => strtotime($_GPC['dateline']), 'yytype' => intval($_GPC['yytype']), 'brand' => $barr[0], 'brand_cn' => $barr[1], 'serie' => $sarr[0], 'serie_cn' => $sarr[1], 'type' => $tarr[0], 'type_cn' => $tarr[1], 'note' => trim($_GPC['note']), 'createtime' => TIMESTAMP);
         foreach ($_GPC as $key => $value) {
             if (strexists($key, 'field_')) {
                 $sfid = intval(str_replace('field_', '', $key));
                 $field = $fields[$sfid];
                 if ($sfid && $field) {
                     $entry = array();
                     $entry['sid'] = $sid;
                     $entry['srid'] = 0;
                     $entry['sfid'] = $sfid;
                     $entry['createtime'] = TIMESTAMP;
                     $entry['data'] = strval($value);
                     $datas[] = $entry;
                 }
             }
         }
         if (!$lid) {
             if (pdo_insert('we7car_order_list', $insert) != 1) {
                 message('保存失败.');
             }
             $rid = pdo_insertid();
             if (empty($rid)) {
                 message('保存失败.');
             }
             if (!empty($datas)) {
                 foreach ($datas as &$r) {
                     $r['srid'] = $rid;
                     pdo_insert('we7car_order_data', $r);
                 }
             }
         } else {
             if (pdo_update('we7car_order_list', $insert, array('id' => $lid)) != 1) {
                 message('更新订单失败.');
             }
             if (!empty($datas)) {
                 foreach ($datas as &$r) {
                     $r['srid'] = $lid;
                     pdo_update('we7car_order_data', $r, array('sfid' => $r['sfid'], 'srid' => $lid));
                 }
             }
         }
         message('成功', $this->createMobileUrl('mybook', array('yytype' => $insert['yytype'])), 'success');
     }
     include $this->template('yuyue');
 }
예제 #13
0
 public function setOrderCredit($orderid, $add = true)
 {
     $order = pdo_fetch("SELECT * FROM " . tablename('shopping_order') . " WHERE id = :id limit 1", array(':id' => $orderid));
     if (empty($order)) {
         return;
     }
     $ordergoods = pdo_fetchall("SELECT goodsid, total FROM " . tablename('shopping_order_goods') . " WHERE orderid = '{$orderid}'", array(), 'goodsid');
     if (!empty($ordergoods)) {
         $goods = pdo_fetchall("SELECT id, title, thumb, marketprice, unit, total,credit FROM " . tablename('shopping_goods') . " WHERE id IN ('" . implode("','", array_keys($ordergoods)) . "')");
     }
     //增加积分
     if (!empty($goods)) {
         $credits = 0;
         foreach ($goods as $g) {
             $credits += $g['credit'];
         }
         $fans = fans_search($order['from_user'], array("credit1"));
         if (!empty($fans)) {
             if ($add) {
                 $new_credit = $credits + $fans['credit1'];
             } else {
                 $new_credit = $fans['credit1'] - $credits;
                 if ($new_credit <= 0) {
                     $new_credit = 0;
                 }
             }
             fans_update($order['from_user'], array("credit1" => $new_credit));
         }
     }
 }
예제 #14
0
 public function doMobileOrder()
 {
     global $_GPC, $_W;
     $this->check_login();
     $isauto = $this->_user_info['isauto'];
     $hid = $_GPC['hid'];
     $id = $_GPC['id'];
     $weid = $this->_weid;
     $price = $_GPC['price'];
     //$total_price = $_GPC['total_price'];
     if (empty($hid) || empty($id)) {
         message("参数错误1!");
     }
     $search_array = $this->getSearchArray();
     if (!$search_array || empty($search_array['btime']) || empty($search_array['day'])) {
         $url = $this->createMobileUrl('index');
         header("Location: {$url}");
     }
     $is_submit = checksubmit();
     $reply = pdo_fetch("SELECT title,mail FROM " . tablename('hotel2') . " WHERE id = :id ", array(':id' => $hid));
     if (empty($reply)) {
         if ($is_submit) {
             die(json_encode(array("result" => 0, "error" => "酒店未找到!")));
         } else {
             message("酒店未找到, 请联系管理员!");
         }
     }
     $pricefield = $this->_user_info['isauto'] == 1 ? "cprice" : "mprice";
     $room = pdo_fetch("SELECT *, {$pricefield} as roomprice FROM " . tablename('hotel2_room') . " WHERE id = :id AND hotelid = :hotelid ", array(':id' => $id, ':hotelid' => $hid));
     if (empty($room)) {
         if ($is_submit) {
             die(json_encode(array("result" => 0, "error" => "房型未找到!")));
         } else {
             message("房型未找到, 请联系管理员!");
         }
     }
     //入住
     $btime = $search_array['btime'];
     $bdate = $search_array['bdate'];
     //住几天
     $days = intval($search_array['day']);
     //离店
     $etime = $search_array['etime'];
     $edate = $search_array['edate'];
     $date_array = array();
     $date_array[0]['date'] = $bdate;
     $date_array[0]['day'] = date('j', $btime);
     $date_array[0]['time'] = $btime;
     $date_array[0]['month'] = date('m', $btime);
     if ($days > 1) {
         for ($i = 1; $i < $days; $i++) {
             $date_array[$i]['time'] = $date_array[$i - 1]['time'] + 86400;
             $date_array[$i]['date'] = date('Y-m-d', $date_array[$i]['time']);
             $date_array[$i]['day'] = date('j', $date_array[$i]['time']);
             $date_array[$i]['month'] = date('m', $date_array[$i]['time']);
         }
     }
     $sql = "SELECT id, roomdate, num, status FROM " . tablename('hotel2_room_price');
     $sql .= " WHERE 1 = 1";
     $sql .= " AND roomid = :roomid";
     $sql .= " AND roomdate >= :btime AND roomdate < :etime";
     $sql .= " AND status = 1";
     $params[':roomid'] = $id;
     $params[':btime'] = $btime;
     $params[':etime'] = $etime;
     $room_date_list = pdo_fetchall($sql, $params);
     //print_r($room_date_list);exit;
     if ($room_date_list) {
         $flag = 1;
     } else {
         $flag = 0;
     }
     $list = array();
     $max_room = 8;
     $is_order = 1;
     if ($flag == 1) {
         for ($i = 0; $i < $days; $i++) {
             $k = $date_array[$i]['time'];
             foreach ($room_date_list as $p_key => $p_value) {
                 //判断价格表中是否有当天的数据
                 if ($p_value['roomdate'] == $k) {
                     $room_num = $p_value['num'];
                     if (empty($room_num)) {
                         $is_order = 0;
                         $max_room = 0;
                         $list['num'] = 0;
                         $list['date'] = $date_array[$i]['date'];
                     } else {
                         if ($room_num > 0 && $room_num < $max_room) {
                             $max_room = $room_num;
                             $list['num'] = $room_num;
                             $list['date'] = $date_array[$i]['date'];
                         }
                     }
                     break;
                 }
             }
         }
     }
     if ($max_room == 0) {
         $msg = $list['date'] . '当天没有空房间了,请选择其他房型。';
         $url = $this->createMobileUrl('error', array('msg' => $msg));
         header("Location: {$url}");
         exit;
     }
     $user_info = hotel_get_userinfo();
     if (empty($user_info['id'])) {
         $memberid = 0;
     } else {
         $memberid = $user_info['id'];
     }
     //显示会员价还是普通价
     $pricefield = $isauto == 1 ? "cprice" : "mprice";
     $params = array(":weid" => $weid, ":hotelid" => $hid);
     $r_sql = "SELECT roomdate, num, status, " . $pricefield . " as m_price FROM " . tablename('hotel2_room_price');
     $r_sql .= " WHERE 1 = 1";
     $r_sql .= " AND roomid = " . $id;
     $r_sql .= " AND weid = :weid";
     $r_sql .= " AND hotelid = :hotelid";
     $r_sql .= " AND roomdate >=" . $btime . " AND roomdate <" . $etime;
     $price_list = pdo_fetchall($r_sql, $params);
     $this_price = $old_price = $room['roomprice'];
     $totalprice = $old_price * $days;
     if ($price_list) {
         //价格表中存在
         $check_date = array();
         foreach ($price_list as $k => $v) {
             $new_price = $v['m_price'];
             $roomdate = $v['roomdate'];
             if ($v['status'] == 0 || $v['num'] == 0) {
                 $has = 0;
             } else {
                 if ($new_price && $roomdate) {
                     if (!in_array($roomdate, $check_date)) {
                         $check_date[] = $roomdate;
                         if ($old_price != $new_price) {
                             $totalprice = $totalprice - $old_price + $new_price;
                         }
                     }
                 }
             }
         }
         $this_price = round($totalprice / $days);
     }
     //print_r($this_price);exit;
     if ($is_submit) {
         $from_user = $this->_from_user;
         $name = $_GPC['uname'];
         $contact_name = $_GPC['contact_name'];
         $mobile = $_GPC['mobile'];
         if (empty($name)) {
             die(json_encode(array("result" => 0, "error" => "入住人不能为空!")));
         }
         if (empty($contact_name)) {
             die(json_encode(array("result" => 0, "error" => "联系人不能为空!")));
         }
         if (empty($mobile)) {
             die(json_encode(array("result" => 0, "error" => "手机号不能为空!")));
         }
         if ($_GPC['nums'] > $max_room) {
             die(json_encode(array("result" => 0, "error" => "您的预定数量超过最大限制!")));
         }
         $data = array('realname' => $name, 'mobile' => $mobile);
         fans_update($from_user, $data);
         pdo_update("hotel2_member", $data, array("from_user" => $from_user));
         $insert = array('weid' => $weid, 'ordersn' => date('md') . sprintf("%04d", $_W['fans']['id']) . random(4, 1), 'hotelid' => $hid, 'openid' => $from_user, 'roomid' => $id, 'memberid' => $memberid, 'name' => $name, 'contact_name' => $contact_name, 'mobile' => $mobile, 'btime' => $search_array['btime'], 'etime' => $search_array['etime'], 'day' => $search_array['day'], 'style' => $room['title'], 'nums' => intval($_GPC['nums']), 'oprice' => $room['oprice'], 'cprice' => $room['cprice'], 'mprice' => $room['mprice'], 'time' => time(), 'paytype' => $_GPC['paytype']);
         $insert[$pricefield] = $this_price;
         $insert['sum_price'] = $totalprice * $insert['nums'];
         //            $is_repeat = check_orderinfo($insert);
         //            if ($is_repeat == 1){
         //                die(json_encode(array("result" => 0, "error" => "您已经预定成功,请不要重复提交")));
         //            }
         pdo_insert('hotel2_order', $insert);
         $order_id = pdo_insertid();
         //如果有接受订单的邮件,
         if (!empty($reply['mail'])) {
             $subject = "微信公共帐号 [" . $_W['account']['name'] . "] 微酒店订单提醒.";
             $body = "您后台有一个预定订单: <br/><br/>";
             $body .= "预定酒店: " . $reply['title'] . "<br/>";
             $body .= "预定房型: " . $room['title'] . "<br/>";
             $body .= "预定数量: " . $insert['nums'] . "<br/>";
             $body .= "预定价格: " . $insert['sum_price'] . "<br/>";
             $body .= "预定人: " . $insert['name'] . "<br/>";
             $body .= "预定电话: " . $insert['mobile'] . "<br/>";
             $body .= "到店时间: " . $bdate . "<br/>";
             $body .= "离店时间: " . $edate . "<br/><br/>";
             //$body .= "到店时间: " . $_GPC['btime'] . "<br/>";
             //$body .= "离店时间: " . $_GPC['btime'] . "<br/><br/>";
             $body .= "请您到管理后台仔细查看. <a href='" . $_W['siteroot'] . create_url('member/login') . "' target='_blank'>立即登录后台</a>";
             $result = ihttp_email($reply['mail'], $subject, $body);
         }
         //$url = $this->createMobileUrl('index');
         $url = $this->createMobileUrl('orderdetail', array('id' => $order_id));
         die(json_encode(array("result" => 1, "url" => $url)));
     } else {
         $price = $totalprice;
         $member = array();
         $member['from_user'] = $this->_from_user;
         $record = hotel_member_single($member);
         if ($record) {
             $realname = $record['realname'];
             $mobile = $record['mobile'];
         } else {
             $fans = pdo_fetch("SELECT id, realname, mobile FROM " . tablename('fans') . " WHERE from_user = :from_user limit 1", array(':from_user' => $this->_from_user));
             if (!empty($fans)) {
                 $realname = $fans['realname'];
                 $mobile = $fans['mobile'];
             }
         }
         include $this->template('order');
     }
 }
예제 #15
0
 public function doMobileFeedback()
 {
     global $_GPC, $_W;
     $storeid = intval($_GPC['storeid']);
     $nickname = trim($_GPC['nick']);
     $content = trim($_GPC['content']);
     $fromuser = trim($_GPC['fromuser']);
     if (isset($_COOKIE[$this->_auth2_openid])) {
         $fromuser = $_COOKIE[$this->_auth2_openid];
     }
     if (isset($_COOKIE[$this->_auth2_nickname])) {
         $nickname = $_COOKIE[$this->_auth2_nickname];
     }
     $result = array('status' => 0, 'msg' => '留言失败,请稍后重试...');
     $data = array('weid' => $_W['uniacid'], 'storeid' => $storeid, 'from_user' => $fromuser, 'nickname' => $nickname, 'content' => $content, 'dateline' => TIMESTAMP);
     $setting = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_setting') . " WHERE weid = :weid ", array(':weid' => $_W['uniacid']));
     if (!empty($setting)) {
         if ($setting['feedback_check_enable'] == 1) {
             $data['status'] = 0;
         } else {
             $data['status'] = 1;
         }
     } else {
         $data['status'] = 1;
     }
     if (empty($data['from_user'])) {
         $result['msg'] = '会话已过期,请从微信界面重新发送关键字进入.';
         die(json_encode($result));
     }
     if (empty($data['nickname'])) {
         $result['msg'] = '请输入昵称.';
         die(json_encode($result));
     }
     if (empty($data['content'])) {
         $result['msg'] = '请输入留言内容.';
         die(json_encode($result));
     }
     $rowcount = pdo_insert('weisrc_businesscenter_feedback', $data);
     if ($rowcount > 0) {
         fans_update($data['from_user'], array('nickname' => $nickname));
         $result['status'] = 1;
         $result['msg'] = '操作成功!';
     }
     echo json_encode($result);
 }
예제 #16
0
 public function doMobileScoreSubmit()
 {
     global $_W, $_GPC;
     // 检查人数是否超过上限
     $this->checkAuth();
     $this->checkPaperState();
     $usermark = $this->calcUserMark($_GPC['choice']);
     $scoreRecord = array('from_user' => $_W['fans']['from_user'], 'paper_id' => $_GPC['paper_id'], 'paper_title' => $_GPC['paper_title'], 'choice_ids' => iserializer($_GPC['answer']), 'user_choices' => iserializer($_GPC['choice']), 'usermark' => $usermark, 'createtime' => time(), 'weid' => $_W['weid']);
     pdo_insert($this->table_score, $scoreRecord);
     // URL自动获取逻辑参考~/weixin/source/controller/site/nav.ctrl.php +145
     $paper = $this->getPaper($_GPC['paper_id']);
     if ($paper['redirect_cond'] <= $usermark) {
         if ($paper['credit_award'] > 0) {
             $msg = "本卷得分{$usermark}分<br> 获得{$paper['credit_award']}积分的奖励。";
             $fans = fans_search($_W['fans']['from_user'], array('credit1'));
             fans_update($_W['fans']['from_user'], array('credit1' => $fans['credit1'] + $paper['credit_award']));
         } else {
             $msg = "本卷得分{$usermark}分";
         }
     } else {
         message("您的得分是{$usermark},没有达到{$paper['redirect_cond']}分的及格线。将自动跳转到试题解析页面...", $this->createMobileUrl('MyPaper'), 'error');
     }
     include $this->template('result');
 }
예제 #17
0
 public function doMobileReady()
 {
     global $_GPC, $_W;
     $this->check_member();
     $id = intval($_GPC['id']);
     if (empty($id)) {
         exit;
     }
     $weid = $_W['weid'];
     $member_info = $this->getMemberInfo();
     $paper_info = $this->getPaperInfo($id);
     //print_r($paper_info);exit;
     if (checksubmit()) {
         $username = trim($_GPC['username']);
         $mobile = trim($_GPC['mobile']);
         $email = trim($_GPC['email']);
         $data = array();
         $data['realname'] = $username;
         $data['mobile'] = $mobile;
         fans_update($this->_from_user, $data);
         //更新用户信息
         $array = array();
         $array['username'] = $username;
         $array['mobile'] = $mobile;
         $array['email'] = $email;
         $params = array();
         $params['from_user'] = $this->_from_user;
         $params['weid'] = $weid;
         pdo_update('ewei_exam_member', $array, $params);
         //更新考试人数记录
         $this->updatePaperMemberNum($id, 1);
         //插入学员考试记录
         $data = array();
         $data['weid'] = $weid;
         $data['paperid'] = $id;
         $data['memberid'] = $member_info['id'];
         $data['times'] = 0;
         $data['countdown'] = $paper_info['times'] * 60;
         $data['score'] = 0;
         $data['did'] = 0;
         $data['createtime'] = time();
         pdo_insert('ewei_exam_paper_member_record', $data);
         $recordid = pdo_insertid();
         $url = $this->createMobileUrl('start', array('paperid' => $id, 'recordid' => $recordid, 'page' => 1));
         die(json_encode(array("result" => 1, "url" => $url)));
     } else {
         //更新访问人数记录
         $fans = fans_search($_W['fans']['from_user'], array('nickname', 'email', 'mobile'));
         $this->updatePaperMemberNum($id, 0);
         include $this->template('ready');
     }
 }
예제 #18
0
파일: site.php 프로젝트: eduNeusoft/weixin
 public function doMobileUserinfo()
 {
     global $_GPC, $_W;
     $weid = $_W['uniacid'];
     //当前公众号ID
     load()->func('communication');
     //用户不授权返回提示说明
     if ($_GPC['code'] == "authdeny") {
         $url = $this->createMobileUrl('index', array(), true);
         $url2 = $_W['siteroot'] . "app/" . substr($url, 2);
         header("location:{$url2}");
         exit('authdeny');
     }
     //高级接口取未关注用户Openid
     if (isset($_GPC['code'])) {
         //第二步:获得到了OpenID
         $serverapp = $_W['account']['level'];
         $setting = $this->get_sysset($weid);
         if (!empty($setting) && !empty($setting['appid']) && !empty($setting['appsecret'])) {
             // 判断是否是借用设置
             $appid = $setting['appid'];
             $secret = $setting['appsecret'];
         }
         $state = $_GPC['state'];
         //1为关注用户, 0为未关注用户
         $rid = $_GPC['id'];
         //查询活动时间
         $code = $_GPC['code'];
         $oauth2_code = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $appid . "&secret=" . $secret . "&code=" . $code . "&grant_type=authorization_code";
         $content = ihttp_get($oauth2_code);
         $token = @json_decode($content['content'], true);
         if (empty($token) || !is_array($token) || empty($token['access_token']) || empty($token['openid'])) {
             echo '<h1>获取微信公众号授权' . $code . '失败[无法取得token以及openid], 请稍后重试! 公众平台返回原始数据为: <br />' . $content['meta'] . '<h1>';
             exit;
         }
         $from_user = $token['openid'];
         //未关注用户和关注用户取全局access_token值的方式不一样
         if ($state == 1) {
             $oauth2_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret . "";
             $content = ihttp_get($oauth2_url);
             $token_all = @json_decode($content['content'], true);
             if (empty($token_all) || !is_array($token_all) || empty($token_all['access_token'])) {
                 echo '<h1>获取微信公众号授权失败[无法取得access_token], 请稍后重试! 公众平台返回原始数据为: <br />' . $content['meta'] . '<h1>';
                 exit;
             }
             $access_token = $token_all['access_token'];
             $oauth2_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $access_token . "&openid=" . $from_user . "&lang=zh_CN";
         } else {
             $access_token = $token['access_token'];
             $oauth2_url = "https://api.weixin.qq.com/sns/userinfo?access_token=" . $access_token . "&openid=" . $from_user . "&lang=zh_CN";
         }
         //使用全局ACCESS_TOKEN获取OpenID的详细信息
         $content = ihttp_get($oauth2_url);
         $info = @json_decode($content['content'], true);
         if (empty($info) || !is_array($info) || empty($info['openid']) || empty($info['nickname'])) {
             echo '<h1>获取微信公众号授权失败[无法取得info], 请稍后重试!<h1>';
             exit;
         }
         $row = array('nickname' => $info["nickname"], 'realname' => $info["nickname"], 'gender' => $info['sex']);
         if (!empty($info["country"])) {
             $row['nationality'] = $info["country"];
         }
         if (!empty($info["province"])) {
             $row['resideprovince'] = $info["province"];
         }
         if (!empty($info["city"])) {
             $row['residecity'] = $info["city"];
         }
         if (!empty($info["headimgurl"])) {
             $row['avatar'] = $info["headimgurl"];
         }
         fans_update($info['openid'], $row);
         $oauth_openid = "amouse_house_zombie_" . $_W['uniacid'];
         setcookie($oauth_openid, $info['openid'], time() + 3600 * 240);
         $url = $_W['siteroot'] . "app/" . substr($this->createMobileUrl('index', array()), 2);
         header("location:{$url}");
         exit;
     } else {
         echo '<h1>网页授权域名设置出错!</h1>';
         exit;
     }
 }
예제 #19
0
 public function doMobileAwardinfoget()
 {
     //分享页面显示。
     global $_GPC, $_W;
     $weid = $_W['weid'];
     //当前公众号ID
     $rid = $_GPC['rid'];
     $giftid = $_GPC['giftid'];
     $from_user_oauth2 = $_COOKIE["user_oauth2_openid"];
     $page_from_user_oauth2 = base64_encode(authcode($_COOKIE["user_oauth2_openid"], 'ENCODE'));
     $from_user_putonghao = $_COOKIE["user_putonghao_openid"];
     $this->checkoauth2($rid, $from_user_oauth2);
     //查询是否有cookie信息
     //$shouquan = $_GPC['shouquan'];
     $realname = $_GPC['realname'];
     $mobile = $_GPC['mobile'];
     $weixin = $_GPC['weixin'];
     $qqhao = $_GPC['qqhao'];
     $email = $_GPC['email'];
     $address = $_GPC['address'];
     // if($shouquan==base64_encode($_SERVER ['HTTP_HOST'].'anquan_ma_grabgifts')){
     $userinfo = pdo_fetch('SELECT * FROM ' . tablename($this->table_list) . ' WHERE from_user=:from_user', array(':from_user' => $from_user_oauth2));
     if (!empty($userinfo)) {
         pdo_update($this->table_list, array('realname' => $realname, 'mobile' => $mobile, 'weixin' => $weixin, 'qqhao' => $qqhao, 'email' => $email, 'address' => $address), array('id' => $userinfo['id']));
     }
     if (!empty($rid)) {
         $reply = pdo_fetch("SELECT * FROM " . tablename($this->table_reply) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
         //同时更新到官方FANS表中
         if (!empty($from_user_putonghao)) {
             //借用号信息保存本公众号下。而不是借用的。
             $from_user_oauth2 = $from_user_putonghao;
         }
         if ($reply['isfans']) {
             if ($reply['isrealname']) {
                 fans_update($from_user_oauth2, array('realname' => $realname));
             }
             if ($reply['ismobile']) {
                 fans_update($from_user_oauth2, array('mobile' => $mobile));
             }
             if ($reply['isqqhao']) {
                 fans_update($from_user_oauth2, array('qq' => $qqhao));
             }
             if ($reply['isemail']) {
                 fans_update($from_user_oauth2, array('email' => $email));
             }
             if ($reply['isaddress']) {
                 fans_update($from_user_oauth2, array('address' => $address));
             }
         }
     }
     //查询奖品数量
     $gift = pdo_fetch("SELECT total,total_winning FROM " . tablename($this->table_gift) . " WHERE id = :id", array(':id' => $giftid));
     if ($gift['total'] > $gift['total_winning']) {
         pdo_update($this->table_gift, array('total_winning' => $gift['total_winning'] + 1), array('id' => $giftid));
         message('恭喜您!您的领奖资料已保存成功!', $_W['siteroot'] . $this->createMobileUrl('lingjiang', array('rid' => $rid)), 'success');
         exit;
     } else {
         message('您来晚了,奖品刚刚被领完了!', $_W['siteroot'] . $this->createMobileUrl('lingjiang', array('rid' => $rid)), 'error');
         exit;
     }
     //查询奖品数量
     //}
 }
예제 #20
0
 public function doMobileScoreSubmit()
 {
     global $_W, $_GPC;
     // 检查人数是否超过上限
     $this->checkAuth();
     $this->checkPaperState();
     // 用户必须输入个人信息后方可继续
     // $fans = fans_require($_W['fans']['from_user'], array('realname', 'mobile'));
     $user_choices = $this->parseUserChoice($_GPC['choice']);
     $scoreRecord = array('from_user' => $_W['fans']['from_user'], 'paper_id' => $_GPC['paper_id'], 'paper_title' => $_GPC['paper_title'], 'choice_ids' => iserializer($_GPC['answer']), 'user_choices' => iserializer($user_choices), 'usermark' => $_GPC['usermark'], 'createtime' => time(), 'weid' => $_W['weid']);
     pdo_insert($this->table_score, $scoreRecord);
     // URL自动获取逻辑参考~/weixin/source/controller/site/nav.ctrl.php +145
     $paper = $this->getPaper($_GPC['paper_id']);
     if ($paper['redirect_cond'] <= intval($_GPC['usermark'])) {
         $msg = "恭喜过关";
         if ($paper['credit_award'] > 0) {
             $fans = fans_search($_W['fans']['from_user'], array('credit1'));
             fans_update($_W['fans']['from_user'], array('credit1' => $fans['credit1'] + $paper['credit_award']));
         } else {
             if (empty($paper['redirect_url'])) {
                 message('您已经过关,但管理员没有设置任何奖励', '', 'success');
             }
         }
     } else {
         message("对不起,您的得分是{$_GPC['usermark']},低于标准,不能获得奖励", '', 'error');
     }
     include $this->template('result');
 }
예제 #21
0
 public function doMobileAddToOrder()
 {
     global $_W, $_GPC;
     $weid = $this->_weid;
     $from_user = $_GPC['from_user'];
     $this->_fromuser = $from_user;
     $storeid = intval($_GPC['storeid']);
     if (empty($from_user)) {
         $this->showMessageAjax('请重新发送关键字进入系统!', $this->msg_status_bad);
     }
     if (empty($storeid)) {
         $this->showMessageAjax('请先选择门店!', $this->msg_status_bad);
     }
     //查询购物车
     $cart = pdo_fetchall("SELECT * FROM " . tablename($this->modulename . '_cart') . " WHERE weid = :weid AND from_user = :from_user AND storeid=:storeid", array(':weid' => $weid, ':from_user' => $from_user, ':storeid' => $storeid), 'goodsid');
     if (empty($cart)) {
         //购物车为空
         $this->showMessageAjax('请先添加菜品!', $this->msg_status_bad);
     } else {
         $goods = pdo_fetchall("SELECT id, title, thumb, marketprice, unitname FROM " . tablename($this->modulename . '_goods') . " WHERE id IN ('" . implode("','", array_keys($cart)) . "')");
     }
     //1.判断提交信息
     $guest_name = trim($_GPC['guest_name']);
     //用户名
     $tel = trim($_GPC['tel']);
     //电话
     $sex = trim($_GPC['sex']);
     //性别
     $sdate = trim($_GPC['meal_time']);
     //订餐时间
     $counts = intval($_GPC['counts']);
     //预订人数
     $seat_type = intval($_GPC['seat_type']);
     //就餐形式
     $carports = intval($_GPC['carports']);
     //预订车位
     $remark = trim($_GPC['remark']);
     //备注
     $address = trim($_GPC['address']);
     //地址
     $tables = intval($_GPC['tables']);
     //桌号
     $setting = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_setting') . " WHERE weid={$weid} LIMIT 1");
     $ordertype = intval($_GPC['ordertype']) == 0 ? 1 : intval($_GPC['ordertype']);
     //更新粉丝信息
     fans_update($from_user, array('realname' => $guest_name, 'mobile' => $tel, 'address' => $address));
     //用户信息判断
     if (empty($guest_name)) {
         $this->showMessageAjax('请输入姓名!', $this->msg_status_bad);
     }
     if (empty($tel)) {
         $this->showMessageAjax('请输入联系电话!', $this->msg_status_bad);
     }
     if ($ordertype == 1) {
         //店内
         if ($counts <= 0) {
             $this->showMessageAjax('预订人数必须大于0!', $this->msg_status_bad);
         }
         if ($seat_type == 0) {
             $this->showMessageAjax('请选择就餐形式!', $this->msg_status_bad);
         }
         if ($tables == 0) {
             $this->showMessageAjax('请输入桌号!', $this->msg_status_bad);
         }
     } else {
         if ($ordertype == 2) {
             //外卖
             if (empty($address)) {
                 $this->showMessageAjax('请输入联系地址!', $this->msg_status_bad);
             }
         }
     }
     $sdate = $sdate . trim($_GPC['time_hour']) . trim($_GPC['time_second']);
     //2.购物车 //a.添加订单、订单产品
     //保存新订单 //提交、确认、付款、取消
     $totalnum = 0;
     $totalprice = 0;
     foreach ($cart as $value) {
         $totalnum = $totalnum + intval($value['total']);
         $totalprice = $totalprice + intval($value['total']) * floatval($value['price']);
     }
     $fansid = $_W['fans']['id'];
     $data = array('weid' => $weid, 'from_user' => $from_user, 'storeid' => $storeid, 'ordersn' => date('md') . sprintf("%04d", $fansid) . random(4, 1), 'totalnum' => $totalnum, 'totalprice' => $totalprice, 'paytype' => 0, 'username' => $guest_name, 'tel' => $tel, 'meal_time' => $sdate, 'counts' => $counts, 'seat_type' => $seat_type, 'tables' => $tables, 'carports' => $carports, 'dining_mode' => $ordertype, 'remark' => $remark, 'address' => $address, 'status' => 0, 'dateline' => TIMESTAMP);
     //保存订单
     pdo_insert($this->modulename . '_order', $data);
     $orderid = pdo_insertid();
     $prints = pdo_fetchall("SELECT * FROM " . tablename($this->modulename . '_print_setting') . " WHERE storeid = :storeid AND print_status=1", array(':storeid' => $storeid));
     foreach ($prints as $key => $value) {
         $print_order_data = array('weid' => $weid, 'orderid' => $orderid, 'print_usr' => $value['print_usr'], 'print_status' => -1, 'dateline' => TIMESTAMP);
         $print_order = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_print_order') . " WHERE orderid=:orderid AND print_usr=:usr LIMIT 1", array(':orderid' => $orderid, ':usr' => $value['print_usr']));
         if (empty($print_order)) {
             pdo_insert('weisrc_dish_print_order', $print_order_data);
         }
     }
     //保存新订单商品
     foreach ($cart as $row) {
         if (empty($row) || empty($row['total'])) {
             continue;
         }
         pdo_insert($this->modulename . '_order_goods', array('weid' => $_W['uniacid'], 'storeid' => $row['storeid'], 'goodsid' => $row['goodsid'], 'orderid' => $orderid, 'price' => $row['price'], 'total' => $row['total'], 'dateline' => TIMESTAMP));
     }
     //清空购物车
     pdo_delete($this->modulename . '_cart', array('weid' => $weid, 'from_user' => $from_user, 'storeid' => $storeid));
     $result['orderid'] = $orderid;
     $result['code'] = $this->msg_status_success;
     $result['msg'] = '操作成功';
     message($result, '', 'ajax');
 }
예제 #22
0
 public function doMobileRegister()
 {
     global $_GPC, $_W;
     $title = '微信墙登记';
     $member = fans_search($_W['fans']['from_user'], array('nickname', 'avatar'));
     if (!empty($_GPC['submit'])) {
         $data = array('weid' => $_W['weid'], 'nickname' => $_GPC['nickname']);
         if (empty($data['nickname'])) {
             die('<script>alert("请填写您的昵称!");location.reload();</script>');
         }
         if (!empty($_FILES['avatar']['tmp_name'])) {
             $data['avatar'] = '';
         } else {
             $data['avatar'] = $_GPC['avatar_radio'];
         }
         fans_update($_W['fans']['from_user'], $data);
         die('<script>alert("登记成功!现在进入话题发表内容!");location.href = "' . $this->createMobileUrl('register') . '";</script>');
     }
     include $this->template('register');
 }
예제 #23
0
/**
 * [WDL] Copyright (c) 2013 wormwood.com
 * $sn: origins/source/controller/mobile/oauth.ctrl.php : v 69b7bd20a924 : 2014/12/26 10:05:07 : Gorden $
 */
defined('IN_IA') or exit('Access Denied');
$account = $_W['account'];
$code = $_GPC['code'];
$scope = $_GPC['scope'];
if (!empty($code)) {
    $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$account['key']}&secret={$account['secret']}&code={$code}&grant_type=authorization_code";
    $ret = ihttp_get($url);
    if (!is_error($ret)) {
        $auth = @json_decode($ret['content'], true);
        if (is_array($auth) && !empty($auth['openid'])) {
            $row = array('weid' => $_W['weid'], 'follow' => 0, 'salt' => random(8), 'from_user' => $auth['openid'], 'createtime' => TIMESTAMP);
            fans_update($auth['openid'], $row);
            if ($scope == 'userinfo') {
                $url = "https://api.weixin.qq.com/sns/userinfo?access_token={$auth['access_token']}&openid={$auth['openid']}&lang=zh_CN";
                $response = ihttp_get($url);
                if (!is_error($response)) {
                    $userinfo = json_decode($response['content'], true);
                    $data = array('nickname' => $userinfo['nickname'], 'gender' => $userinfo['sex'], 'avatar' => $userinfo['headimgurl'], 'resideprovince' => $userinfo['province'], 'residecity' => $userinfo['city'], 'nationality' => $userinfo['country']);
                    pdo_update('fans', $data, array('from_user' => $auth['openid'], 'weid' => $_W['weid']));
                }
                $forward = base64_decode($_GPC['__state']);
                header('location: ' . $_W['siteroot'] . 'mobile.php?' . $forward . '&wxref=mp.weixin.qq.com#wechat_redirect');
                exit;
            }
            $cookie = array();
            $cookie['openid'] = $auth['openid'];
            $cookie['hash'] = substr(md5("{$auth['openid']}{$row['salt']}{$_W['config']['setting']['authkey']}"), 5, 5);
예제 #24
0
            //print_r($code);exit;
            $data['code'] = $code;
            $number = $prize['number'] - 1;
            //更新奖品卡密
            pdo_update('weilive_prize', array('number' => $number, 'activation_code' => iserializer($activation_code)), array('id' => $id));
            //pdo_query("UPDATE ".tablename('weilive_prize')."SET number = ".$number." and activation_code= '".iserializer($activation_code)."' WHERE id = '$id' AND weid = '{$weid}'");
        } else {
            $data['status'] = 0;
            $number = $prize['number'] - 1;
            //更新实物数量
            pdo_query("UPDATE " . tablename('weilive_prize') . "SET number= " . $number . " WHERE id = '{$id}' AND weid = '{$weid}'");
        }
        $data['url'] = $prize['activation_url'];
        pdo_insert('weilive_prizecode', $data);
        $data = array('credit1' => $profile['credit1'] - $prize['integral']);
        fans_update($fromuser, $data);
        if ($prize['inkind'] == 1) {
            $result = '兑换码:' . $code . (empty($prize['activation_url']) ? '' : '<br>兑换方式:' . $prize['activation_url'] . '<br>请妥善保存好兑换码和兑换地址!');
            message($result, '', 'success');
        } else {
            message('兑换成功,等待我们联系您!', $this->createMobileUrl('home'), 'success');
        }
    } else {
        message('兑换失败,积分不足!', $this->createMobileUrl('home'), 'error');
    }
}
if ($op == 'myaward') {
    $award_list = pdo_fetchall("select * from " . tablename('weilive_prizecode') . " where weid = " . $weid . " and openid = '" . $_W['openid'] . "' order by createtime desc LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
    $total = pdo_fetchcolumn("select count(id) from " . tablename('weilive_prizecode') . " where weid = " . $weid . " and openid = '" . $_W['openid'] . "'");
    $awards = array();
    foreach ($award_list as $a) {
예제 #25
0
$_W['setting']['authmode'] = empty($_W['setting']['authmode']) ? 1 : $_W['setting']['authmode'];
if ($_GPC['__auth']) {
    $pass = @base64_decode($_GPC['__auth']);
    $pass = @json_decode($pass, true);
    if (is_array($pass) && !empty($pass['fans']) && !empty($pass['time']) && !empty($pass['hash'])) {
        if ($_W['setting']['authmode'] == 2 && abs($pass['time'] - TIMESTAMP) < 180 || $_W['setting']['authmode'] == 1) {
            $row = fans_search($pass['fans'], array('salt'));
            if (!is_array($row) || empty($row['salt'])) {
                $row = array('from_user' => $pass['fans'], 'salt' => '');
            }
            $hash = md5("{$pass['fans']}{$pass['time']}{$row['salt']}{$_W['config']['setting']['authkey']}");
            if ($pass['hash'] == $hash) {
                if ($_W['setting']['authmode'] == 2) {
                    $row = array();
                    $row['salt'] = random(8);
                    fans_update($pass['fans'], $row);
                }
                $cookie = array();
                $cookie['openid'] = $pass['fans'];
                $cookie['hash'] = substr(md5("{$pass['fans']}{$row['salt']}{$_W['config']['setting']['authkey']}"), 5, 5);
                $session = base64_encode(json_encode($cookie));
                isetcookie('__msess', $session, 30 * 86400);
            }
        }
    }
}
$forward = @base64_decode($_GPC['forward']);
if (empty($forward)) {
    $forward = create_url('mobile/channel', array('name' => 'index', 'weid' => $weid));
} else {
    $forward = strexists($forward, 'http://') ? $forward : $_W['siteroot'] . $forward;
예제 #26
0
파일: site.php 프로젝트: eduNeusoft/weixin
 public function doMobilelogin()
 {
     global $_GPC, $_W;
     if (checksubmit()) {
         $member = array();
         $username = trim($_GPC['username']);
         $userid = $_GPC['userid'];
         if (empty($username)) {
             die(json_encode(array("result" => 2, "error" => "请输入姓名")));
         }
         if (empty($userid)) {
             die(json_encode(array("result" => 2, "error" => "请输入用户名")));
         }
         $member['username'] = $username;
         $member['userid'] = $userid;
         $params = array();
         $params[':username'] = $member['username'];
         $params[':userid'] = $member['userid'];
         $params[':weid'] = $this->_weid;
         $sql = "SELECT * FROM " . tablename('ewei_exam_member') . " WHERE weid = :weid AND username = :username AND userid = :userid LIMIT 1";
         $item = pdo_fetch($sql, $params);
         if ($item['id']) {
             if ($item['status'] == 0) {
                 die(json_encode(array("result" => 2, "error" => "抱歉,你的姓名和用户名被禁用,无法使用")));
             }
             $data = array();
             $data['realname'] = $username;
             fans_update($this->_from_user, $data);
             pdo_update('ewei_exam_member', array('from_user' => $this->_from_user), array('id' => $item['id']));
             $url = $this->createMobileUrl('index');
             exam_set_userinfo(1, $item);
             die(json_encode(array("result" => 1, "url" => $url)));
         } else {
             die(json_encode(array("result" => 2, "error" => "抱歉,你输入的姓名和用户名不在本系统中,无法使用")));
         }
     } else {
         include $this->template('login');
     }
 }
예제 #27
0
 public function doMobileCard()
 {
     global $_W, $_GPC;
     checkauth();
     $card = pdo_fetch("SELECT * FROM " . tablename('card') . " WHERE weid = '{$_W['weid']}'");
     if (!empty($card)) {
         $card['color'] = iunserializer($card['color']);
         $card['background'] = iunserializer($card['background']);
         $card['fields'] = iunserializer($card['fields']);
     } else {
         message('此商家暂不开启会员卡功能!');
     }
     $member = pdo_fetch("SELECT id, cardsn FROM " . tablename('card_members') . " WHERE from_user = :from_user AND weid = '{$_W['weid']}'", array(':from_user' => $_W['fans']['from_user']));
     if (!empty($member)) {
         header('Location: ' . $this->createMobileUrl('mycard'));
         exit;
     }
     if (checksubmit('submit')) {
         if (!empty($member['cardsn'])) {
             message('您已经领取过会员卡!');
         }
         $cardsn = $card['format'];
         preg_match_all('/(\\*+)/', $card['format'], $matchs);
         if (!empty($matchs)) {
             foreach ($matchs[1] as $row) {
                 $cardsn = str_replace($row, random(strlen($row), 1), $cardsn);
             }
         }
         preg_match('/(\\#+)/', $card['format'], $matchs);
         $length = strlen($matchs[1]);
         $pos = strpos($card['format'], '#');
         $cardsn = str_replace($matchs[1], str_pad($card['snpos']++, $length - strlen($number), '0', STR_PAD_LEFT), $cardsn);
         //更新卡号位数
         pdo_update('card', array('snpos' => $card['snpos']), array('weid' => $_W['weid']));
         //写入会员卡
         $data = array('weid' => $_W['weid'], 'from_user' => $_W['fans']['from_user'], 'cardsn' => $cardsn, 'credit1' => 0, 'credit2' => 0, 'status' => 1, 'createtime' => TIMESTAMP);
         pdo_insert('card_members', $data);
         //更新粉丝资料
         $data = array();
         if (!empty($card['fields'])) {
             foreach ($card['fields'] as $row) {
                 if (!empty($row['require']) && empty($_GPC[$row['bind']])) {
                     message('请输入' . $row['title'] . '!');
                 }
                 $data[$row['bind']] = $_GPC[$row['bind']];
             }
         }
         fans_update($_W['fans']['from_user'], $data);
         message('会员卡领取成功!', $this->createMobileUrl('mycard'), 'success');
     }
     $card['background']['image'] = $card['background']['background'] == 'user' ? $_W['attachurl'] . $card['background']['image'] : $_W['siteroot'] . 'source/modules/member/images/card/' . $card['background']['image'] . '.png';
     include $this->template('card');
 }
예제 #28
0
 public function doMobileOrderdetail()
 {
     global $_GPC, $_W;
     $weid = $_W['account']['weid'];
     $rid = intval($_GPC['rid']);
     $id = intval($_GPC['id']);
     $fromuser = $_W['fans']['from_user'];
     $orderinfo = pdo_fetchall("SELECT * FROM " . tablename('hotel_order') . " WHERE rid = :rid AND openid = :openid ORDER BY time DESC", array(':rid' => $rid, ':openid' => $fromuser));
     $ordernum = count($orderinfo);
     $profile = fans_search($fromuser);
     $detail = pdo_fetch("SELECT * FROM " . tablename('hotel_order') . " WHERE rid = :rid AND id = :id ", array(':rid' => $rid, ':id' => $id));
     $shopinfo = pdo_fetch("SELECT * FROM " . tablename('hotel_shop') . " WHERE rid = :rid AND id = :id ", array(':rid' => $rid, ':id' => $detail['sid']));
     $shopinfo['thumb'] = $_W['attachurl'] . $shopinfo['thumb'];
     $save = $shopinfo['oprice'] - $shopinfo['cprice'];
     $reply = pdo_fetch("SELECT * FROM " . tablename('hotel_reply') . " WHERE rid = :rid ", array(':rid' => $rid));
     for ($i = 1; $i <= $reply['daymax']; $i++) {
         $d = time() + 86400 * $i;
         $dd[] = $d;
     }
     for ($i = 1; $i <= $reply['numsmax']; $i++) {
         $n = $i;
         $nn[] = $n;
     }
     if (!empty($_GPC['submit'])) {
         $data = array('realname' => $_GPC['realname'], 'mobile' => $_GPC['mobile']);
         fans_update($fromuser, $data);
         $insert = array('name' => $_GPC['realname'], 'mobile' => $_GPC['mobile'], 'btime' => $_GPC['btime'], 'etime' => $_GPC['etime'], 'style' => $_GPC['style'], 'nums' => $_GPC['nums'], 'oprice' => $_GPC['oprice'], 'cprice' => $_GPC['cprice'], 'info' => $_GPC['info'], 'time' => time());
         pdo_update('hotel_order', $insert, array('id' => $id));
         die('<script>location.href = "' . $this->createMobileUrl('record', array('rid' => $_GPC['rid'])) . '";</script>');
     }
     if (!empty($_GPC['delete'])) {
         pdo_delete('hotel_order', array('id' => $id));
         die('<script>location.href = "' . $this->createMobileUrl('record', array('rid' => $_GPC['rid'])) . '";</script>');
     }
     include $this->template('orderdetail');
 }
예제 #29
0
 public function doMobileRegister()
 {
     global $_GPC, $_W;
     $title = '信息登记';
     $id = $_GPC['id'];
     //$profile = pdo_fetch("SELECT realname,nickname,avatar,mobile FROM " . tablename('fans') . " WHERE from_user = '******'fans']['from_user']}' AND weid=" . $_W['uniacid'] . "  LIMIT 1");
     load()->model('mc');
     $profile = mc_fetch($_W['member']['uid'], array('realname', 'nickname', 'avatar', 'mobile'));
     $member = fans_require($_W['fans']['from_user'], array('realname', 'mobile', 'nickname'));
     if (!empty($_GPC['submit'])) {
         $data = array('realname' => $_GPC['realname'], 'mobile' => $_GPC['mobile'], 'nickname' => $_GPC['nickname']);
         if (empty($data['realname'])) {
             die('<script>alert("请填写您的真实姓名!");location.reload();</script>');
         }
         if (empty($data['mobile'])) {
             die('<script>alert("请填写您的手机号码!");location.reload();</script>');
         }
         fans_update($_W['fans']['from_user'], $data);
         die('<script>alert("登记成功!");location.href = "' . $this->createMobileUrl('index', array('id' => $_GPC['id'])) . '";</script>');
     }
     load()->func('tpl');
     include $this->template('register');
 }
예제 #30
0
파일: site.php 프로젝트: yunsite/my-we7
 public function doMobileRequire($fields = array(), $forward = '')
 {
     global $_W, $_GPC;
     if (empty($_W['fans']['from_user'])) {
         message('非法访问,请重新点击链接进入个人中心!');
     }
     $title = '完善资料';
     if (checksubmit('submit')) {
         $from_user = $_W['fans']['from_user'];
         $record = array_elements($fields, $_GPC);
         foreach ($record as $field => $value) {
             if (in_array($field, array('from_user', 'act', 'name', 'token', 'submit', 'session'))) {
                 unset($record[$field]);
             }
             if (empty($value)) {
                 message('请填写完整所有资料.', referer(), 'error');
             }
         }
         fans_update($from_user, $record);
     } else {
         $profile = fans_search($_W['fans']['from_user'], $fields);
         $form = array('birthday' => array('year' => array(date('Y'), '1914')), 'bloodtype' => array('A', 'B', 'AB', 'O', '其它'), 'education' => array('博士', '硕士', '本科', '专科', '中学', '小学', '其它'), 'constellation' => array('水瓶座', '双鱼座', '白羊座', '金牛座', '双子座', '巨蟹座', '狮子座', '处女座', '天秤座', '天蝎座', '射手座', '摩羯座'), 'zodiac' => array('鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪'));
         include $this->template('require');
         exit;
     }
 }