本文整理汇总了PHP中fans_search函数的典型用法代码示例。如果您正苦于以下问题:PHP fans_search函数的具体用法?PHP fans_search怎么用?PHP fans_search使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fans_search函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doMobileIndex
public function doMobileIndex()
{
global $_W, $_GPC;
checkauth();
$fromuser = fans_require($_W['fans']['from_user'], array('nickname', 'mobile'), '需要完善资料后才能玩.');
$rid = $_GPC['rid'];
$follow = fans_search($_W['fans']['from_user'], array('follow'));
if ($follow['follow'] == 1) {
if (intval($_GPC['id'])) {
$score = pdo_fetchcolumn("select score from" . tablename('bj_tgame_user') . "where rid =" . $rid . ".and from_user ='" . $fromuser['from_user'] . "'");
if ($score < $_GPC['score']) {
$update = array('score' => $_GPC['score'], 'realname' => $fromuser['nickname']);
$score = $_GPC['score'];
pdo_update('bj_tgame_user', $update, array('id' => $_GPC['id'], 'weid' => $_W['weid']));
}
message($score, '', 'ajax');
}
$from_user = pdo_fetch("select id from_user, rid from" . tablename('bj_tgame_user') . "where from_user ='" . $fromuser['from_user'] . "'");
if (empty($from_user['from_user'])) {
$insert = array('id' => $_GPC['id'], 'weid' => $_W['weid'], 'rid' => $rid, 'from_user' => $fromuser['from_user'], 'realname' => $fromuser['nickname'], 'score' => 0);
pdo_insert('bj_tgame_user', $insert);
}
//$from_user = pdo_fetch("select id, rid from".tablename('bj_tgame_user')."where from_user ='".$fromuser['from_user']. "'");
if ($from_user['rid'] != $rid) {
$update = array('rid' => $rid);
pdo_update('bj_tgame_user', $update, array('id' => $from_user['id']));
}
$realname = $fromuser['nickname'];
$user = pdo_fetch("select * from" . tablename('bj_tgame_user') . "where rid =" . $rid . ".and from_user ='" . $fromuser['from_user'] . "'");
}
$set = pdo_fetch("select * from" . tablename('bj_tgame_reply') . "where rid =" . $rid);
include $this->template('index');
}
示例2: doMobileLottery
public function doMobileLottery()
{
global $_GPC, $_W;
$title = '摇钱树送积分';
$useragent = addslashes($_SERVER['HTTP_USER_AGENT']);
if (strpos($useragent, 'MicroMessenger') === false && strpos($useragent, 'Windows Phone') === false) {
exit;
}
if (empty($_W['fans']['from_user'])) {
//message('非法访问,请重新发送消息进入摇钱树页面!1');
}
$fromuser = $_W['fans']['from_user'];
//$profile = fans_require($fromuser, array('realname', 'mobile', 'qq'), '需要完善资料后才能摇钱树.');
$id = intval($_GPC['id']);
$yqs = pdo_fetch("SELECT id, maxlottery, default_tips, rule FROM " . tablename('yqs_reply') . " WHERE rid = '{$id}' LIMIT 1");
if (empty($yqs)) {
message('非法访问,请重新发送消息进入摇钱树页面!2');
}
$total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('yqs_winner') . " WHERE createtime > '" . strtotime(date('Y-m-d')) . "' AND from_user = '{$fromuser}' AND award <> ''");
$member = fans_search($fromuser);
$myaward = pdo_fetchall("SELECT award, description FROM " . tablename('yqs_winner') . " WHERE from_user = '{$fromuser}' AND award <> '' AND rid = '{$id}' ORDER BY createtime DESC");
$sql = "SELECT a.award, b.realname FROM " . tablename('yqs_winner') . " AS a\n\t\t\t\tLEFT JOIN " . tablename('fans') . " AS b ON a.from_user = b.from_user WHERE b.mobile <> '' AND b.realname <> '' AND a.award <> '' AND a.rid = '{$id}' ORDER BY a.createtime DESC LIMIT 20";
$otheraward = pdo_fetchall($sql);
include $this->template('lottery');
}
示例3: respond
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')));
}
}
示例4: domobileprofile
public function domobileprofile()
{
global $_GPC, $_W;
$profile = fans_search($_W['fans']['from_user'], array('nickname', 'credit1', 'credit2', 'avatar'));
if (empty($profile['avatar'])) {
load()->func('communication');
$openid = $_W['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('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'));
}
}
}
$carttotal = $this->getCartTotal();
include $this->template('profile');
}
示例5: doMobileGuanhuai
public function doMobileGuanhuai()
{
global $_GPC, $_W;
$op = trim($_GPC['op']) ? trim($_GPC['op']) : 'index';
checkauth();
$user = fans_search($_W['fans']['from_user'], array('realname', 'mobile'));
$weid = $_W['weid'];
$car = pdo_fetch("SELECT * FROM " . tablename('we7car_care') . " WHERE weid = :weid AND from_user = :from_user LIMIT 1", array(':weid' => $_W['weid'], ':from_user' => $_W['fans']['from_user']));
if (!empty($car)) {
$car['brand_val'] = $car['brand_id'] . '=' . $car['brand_cn'];
$car['series_val'] = $car['series_id'] . '=' . $car['series_cn'];
$car['type_val'] = $car['type_id'] . '=' . $car['type_cn'];
$car_insurance_nextDate = $car['car_insurance_lastDate'] + 86400 * 90;
$car_care_nextDate = $car['car_care_nextDate'] + 86400 * 365;
$insurance_days = floor(($car_insurance_nextDate - TIMESTAMP) / 86400);
$care_days = floor(($car_insurance_nextDate - TIMESTAMP) / 86400);
$car['car_startTime'] = $car['car_startTime'] ? date('Y-m-d', $car['car_startTime']) : date('Y-m-d');
$car['car_insurance_lastDate'] = $car['car_insurance_lastDate'] ? date('Y-m-d', $car['car_insurance_lastDate']) : date('Y-m-d');
$car['car_care_lastDate'] = $car['car_care_lastDate'] ? date('Y-m-d', $car['car_care_lastDate']) : date('Y-m-d');
} else {
$car['car_startTime'] = date('Y-m-d');
$car['car_insurance_lastDate'] = date('Y-m-d');
$car['car_care_lastDate'] = date('Y-m-d');
}
if ($user) {
$car['car_userName'] = $user['realname'];
$car['car_mobile'] = $user['mobile'];
}
//获取车主关怀顶部图片
$banner = pdo_fetchcolumn("SELECT guanhuai_thumb FROM " . tablename('we7car_set') . " WHERE weid = :weid ", array(':weid' => $_W['weid']));
if ($op == 'caredit') {
$brands = pdo_fetchall("SELECT id,title FROM " . tablename('we7car_brand') . " WHERE `weid` = :weid AND `status` = 1 AND `status` = 1 ORDER BY `listorder` DESC", array(':weid' => $_W['weid']));
$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['weid'], ':bid' => $car['brand_id']));
$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['weid'], ':sid' => $car['series_id']));
if (checksubmit('submit')) {
$brand = explode('=', $_GPC['brand']);
$series = explode('=', $_GPC['serie']);
$types = explode('=', $_GPC['types']);
$insert = array('weid' => $_W['weid'], 'from_user' => $_W['fans']['from_user'], 'brand_id' => intval($brand[0]), 'brand_cn' => trim($brand[1]), 'series_id' => trim($series[0]), 'series_cn' => trim($series[1]), 'type_id' => trim($types[0]), 'type_cn' => trim($types[1]), 'car_note' => trim($_GPC['car_note']), 'car_no' => trim($_GPC['car_no']), 'car_userName' => trim($_GPC['car_userName']), 'car_mobile' => trim($_GPC['car_mobile']), 'car_startTime' => strtotime($_GPC['car_startTime']), 'car_insurance_lastDate' => strtotime($_GPC['car_insurance_lastDate']), 'car_insurance_lastCost' => trim($_GPC['car_insurance_lastCost']), 'car_care_mileage' => trim($_GPC['car_care_mileage']), 'car_care_lastDate' => strtotime($_GPC['car_care_lastDate']), 'car_care_lastCost' => trim($_GPC['car_care_lastCost']), 'car_insurance_lastDate' => strtotime($_GPC['car_insurance_lastDate']), 'createtime' => TIMESTAMP);
if (!empty($_FILES['car_photo']['tmp_name'])) {
$upload = file_upload($_FILES['car_photo']);
if (is_error($upload)) {
message($upload['message']);
}
$insert['car_photo'] = $upload['path'];
}
if (empty($car['id'])) {
$temp = pdo_insert('we7car_care', $insert);
} else {
$temp = pdo_update('we7car_care', $insert, array('id' => $car['id']));
}
if ($temp == false) {
message('抱歉,更新爱车数据失败!', create_url('mobile/module', array('do' => 'Guanhuai', 'name' => 'car', 'op' => 'caredit', 'from_user' => $_W['fans']['from_user'])), 'error');
} else {
message('更新爱车数据成功!', create_url('mobile/module', array('do' => 'Guanhuai', 'name' => 'car', 'op' => 'index', 'weid' => $weid, 'from_user' => $_W['fans']['from_user'])), 'success');
}
}
include $this->template('guanhuai_caredit');
}
if ($op == 'index') {
include $this->template('guanhuai_index');
}
}
示例6: doMobileReady
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');
}
}
示例7: tablename
$user['footer'] = $setting['otherFooterLeft'] ? $setting['otherFooterLeft'] : '立即打赏';
$user['meto'] = $setting['otherFooterRight'] ? $setting['otherFooterRight'] : '我也要参加';
$user['checkFollow'] = $_W['siteroot'] . 'app/' . $this->createMobileUrl('checkFollow');
if ($_GPC['uid'] == $_W['member']['uid']) {
$user['isMe'] = true;
} else {
$user['isMe'] = false;
}
$user['notMemessage'] = $setting['otherTopMessage'] ? $setting['otherTopMessage'] : '参加乞讨活动,需要向帮好友支付任意金额,支付完成后自动跳转自己的活动链接,请收藏!';
$user['isMemessage'] = $setting['topMessage'] ? $setting['topMessage'] : '赶紧告诉小伙伴吧,凑足了饭钱,就不会饿肚子了!';
if (empty($user['title'])) {
$user['title'] = '一分也是爱,大爷赏点吧!';
}
$sql = "SELECT * FROM " . tablename('meepo_begging_user') . " WHERE uid = :uid AND status = :status ORDER BY createtime DESC";
$params = array(':uid' => $uid, ':status' => 1);
$items = pdo_fetchall($sql, $params);
foreach ($items as $ri) {
$user2 = fans_search($ri['fopenid']);
$ri['avatar'] = $user2['avatar'];
$ri['nickname'] = $user2['nickname'];
$ri['time'] = time() - $ri['createtime'];
$res = get_timef($ri['createtime'], time());
$date = $res['day'];
$hour = $res['hour'];
$minute = $res['min'];
$second = $res['sec'];
if (!empty($ri)) {
$user['items'][] = $ri;
}
}
die(json_encode($user));
示例8: 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');
}
示例9: doWebManage
public function doWebManage()
{
global $_W, $_GPC;
$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
$rid = intval($_GPC['id']);
if ($operation == 'display') {
$pindex = max(1, intval($_GPC['page']));
$psize = 50;
if (!empty($_GPC['nickname'])) {
$openids = pdo_fetchall("SELECT * FROM " . tablename('mc_mapping_fans') . " WHERE nickname LIKE :nickname", array(':nickname' => '%' . $_GPC['nickname'] . '%'), 'openid');
if (!empty($openids)) {
$condition = " AND openid IN ('" . implode("','", array_keys($openids)) . "')";
}
}
if (!empty($condition) || empty($_GPC['nickname'])) {
$list = pdo_fetchall("SELECT * FROM " . tablename('shake_member') . " WHERE rid = :rid {$condition} ORDER BY shakecount DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize, array(':rid' => $rid), 'openid');
$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('shake_member') . " WHERE rid = :rid {$condition}", array(':rid' => $rid));
$pager = pagination($total, $pindex, $psize);
load()->model('mc');
$fans = mc_fetch(array_keys($list), array('realname', 'mobile'));
}
} elseif ($operation == 'post') {
$id = intval($_GPC['id']);
$item = pdo_fetch("SELECT * FROM " . tablename('shake_member') . " WHERE id = '{$id}'");
if (checksubmit('submit')) {
pdo_update('shake_member', array('remark' => $_GPC['remark']), array('id' => $id));
message('更新信息成功!', $this->createWebUrl('manage', array('id' => $item['rid'])), 'success');
}
$item['profile'] = fans_search($item['openid'], array('mobile', 'realname'));
}
include $this->template('manage');
}
示例10: doMobileUcount
public function doMobileUcount()
{
global $_GPC, $_W;
$effective = true;
$msg = "输送体力未成功";
$useragent = addslashes($_SERVER['HTTP_USER_AGENT']);
if (strpos($useragent, 'MicroMessenger') === false && strpos($useragent, 'Windows Phone') === false) {
$effective = false;
$msg = "只能在微信中输送哦!";
}
$id = intval($_GPC['id']);
$uid = intval($_GPC['uid']);
if (!$uid) {
$effective = false;
}
$url = $this->createMobileUrl('rank', array('id' => $id));
$user = pdo_fetch("SELECT * FROM " . tablename('zzz_user') . " WHERE id = '{$uid}' and rid=" . $id . " LIMIT 1");
if ($user) {
$member = fans_search($user['from_user']);
if ($uid && $effective) {
if (!isset($_COOKIE["hlzzzx"])) {
setcookie('hlzzzx', 1, TIMESTAMP + 86400);
$data = array('count' => $user['count'] + 1, 'friendcount' => $user['friendcount'] + 1);
pdo_update('zzz_user', $data, array('id' => $uid, 'rid' => $id));
$msg = '你已成功为' . $member['nickname'] . '输送体力!';
} else {
$msg = '一天只能输送一次体力哦!';
}
}
}
message($msg, $url);
}
示例11: setOrderCredit
public function setOrderCredit($orderid, $add = true)
{
$order = pdo_fetch("SELECT * FROM " . tablename($this->modulename . '_order') . " WHERE id=:id LIMIT 1", array(':id' => $orderid));
if (empty($order)) {
return false;
}
$ordergoods = pdo_fetchall("SELECT goodsid, total FROM " . tablename($this->modulename . '_order_goods') . " WHERE orderid = '{$orderid}'", array(), 'goodsid');
if (!empty($ordergoods)) {
$goods = pdo_fetchall("SELECT * FROM " . tablename($this->modulename . '_goods') . " WHERE id IN ('" . implode("','", array_keys($ordergoods)) . "')");
}
//增加积分
if (!empty($goods)) {
$credits = 0;
foreach ($goods as $g) {
$credits += $g['credit'] * $g['total'];
}
load()->model('mc');
load()->func('compat.biz');
$uid = mc_openid2uid($order['from_user']);
$fans = fans_search($uid, 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;
// }
// }
$uid = intval($fans['uid']);
$remark = $add == true ? '微点餐积分奖励 订单ID:' . $orderid : '微点餐积分扣除 订单ID:' . $orderid;
$log = array();
$log[0] = $uid;
$log[1] = $remark;
mc_credit_update($uid, 'credit1', $credits, $log);
//pdo_update('mc_members', array("credit1" => $new_credit), array('uid' => $uid));
}
}
return true;
}
示例12: pdo_fetchall
//找出总价格
$row = pdo_fetchall("SELECT total,price FROM " . tablename('shopping3_cart') . " WHERE from_user = :from_user AND weid = '{$weid}' ", array(':from_user' => $_W['fans']['from_user']));
$totalnum = 0;
$totalprice = 0;
foreach ($row as $v) {
$totalnum = $totalnum + intval($v['total']);
$totalprice = $totalprice + intval($v['total']) * floatval($v['price']);
}
include $this->template('wl_checkout');
} else {
$cart = pdo_fetchall("SELECT * FROM " . tablename('shopping3_cart') . " WHERE weid = '{$weid}' AND from_user = '{$_W['fans']['from_user']}'", array(), 'goodsid');
$otalprice = 0;
if (!empty($cart)) {
$goods = pdo_fetchall("SELECT id, title, thumb, marketprice, unit, total FROM " . tablename('shopping3_goods') . " WHERE id IN ('" . implode("','", array_keys($cart)) . "')");
if (!empty($goods)) {
foreach ($goods as $row) {
if (empty($cart[$row['id']]['total'])) {
continue;
}
//购物车不考虑库存
/* if ($row['total'] != -1 && $row['total'] < $cart[$row['id']]['total']) {
message('抱歉,“'.$row['title'].'”此商品库存不足!', $this->createMobileUrl('wlcart'), 'error');
} */
$price += floatval($row['marketprice']) * intval($cart[$row['id']]['total']);
}
}
}
// fans_update($_W['fans']['from_user'], $newsfans);
$fans = fans_search($from, array('nickname', 'mobile', 'gender', 'address'));
include $this->template('wl_cart');
}
示例13: doWebSpread
public function doWebSpread()
{
global $_W, $_GPC;
load()->func('tpl');
if (!$_W['ispost']) {
$this->doWebAuth();
checklogin();
}
$op = empty($_GPC['op']) ? 'leaflet' : $_GPC['op'];
$rulekeywordcount = pdo_fetchcolumn("SELECT count(id) FROM " . tablename('rule_keyword') . " WHERE uniacid=:uniacid and module='wwx_fxxt' and content='二维码'", array(":uniacid" => $_W['uniacid']));
$boolrule = false;
if ($rulekeywordcount >= 1) {
$boolrule = true;
}
if ($op == 'checkspreadrule') {
if (!empty($_GPC['boolrule'])) {
$rulekeywordcount = pdo_fetchall("SELECT rid FROM " . tablename('rule_keyword') . " WHERE uniacid=:uniacid and module='wwx_fxxt' and content='二维码'", array(":uniacid" => $_W['uniacid']));
foreach ($rulekeywordcount as $k => $v) {
pdo_delete('rule', array('id' => $v['rid'], 'uniacid' => $_W['uniacid'], 'module' => 'wwx_fxxt'));
}
pdo_delete('rule_keyword', array('module' => 'wwx_fxxt', 'uniacid' => $_W['uniacid'], 'content' => '二维码'));
$insert = array('uniacid' => $_W['uniacid'], 'name' => '二维码(系统维护)', 'module' => 'wwx_fxxt', 'displayorder' => 0, 'status' => 1);
pdo_insert('rule', $insert);
$rid = pdo_insertid();
$insert = array('uniacid' => $_W['uniacid'], 'rid' => $rid, 'module' => 'wwx_fxxt', 'content' => '二维码', 'type' => 1, 'displayorder' => 0, 'status' => 1);
pdo_insert('rule_keyword', $insert);
message('设置分销专属二维码成功,请进入自定义菜单绑定关键字\'二维码\'!', referer(), 'success');
} else {
if ($boolrule == true) {
$rulekeywordcount = pdo_fetchall("SELECT rid FROM " . tablename('rule_keyword') . " WHERE uniacid=:uniacid and module='wwx_fxxt' and content='二维码'", array(":uniacid" => $_W['uniacid']));
foreach ($rulekeywordcount as $k => $v) {
pdo_delete('rule', array('id' => $v['rid'], 'uniacid' => $_W['uniacid'], 'module' => 'wwx_fxxt'));
}
pdo_delete('rule_keyword', array('module' => 'wwx_fxxt', 'uniacid' => $_W['uniacid'], 'content' => '二维码'));
message('系统已去除分销专属\'二维码\'关键字触发', referer(), 'success');
}
}
$op = 'leaflet';
}
if ($op == 'delete') {
pdo_update('wwx_fxxt_channel', array('isdel' => 1, 'createtime' => time()), array('channel' => $_GPC['channel'], "uniacid" => $_W['uniacid']));
message("删除成功", referer(), "success");
} else {
if ($op == 'leaflet') {
$mylist = pdo_fetchall("SELECT * FROM " . tablename('wwx_fxxt_channel') . " WHERE uniacid=:uniacid and isdel=0", array(":uniacid" => $_W['uniacid']));
} else {
if ($op == 'active') {
$channel = intval($_GPC['channel']);
pdo_update('wwx_fxxt_channel', array('active' => 0), array('uniacid' => $_W['uniacid']));
pdo_update('wwx_fxxt_channel', array('createtime' => time()), array('uniacid' => $_W['uniacid'], 'channel' => $channel));
pdo_update('wwx_fxxt_channel', array('createtime' => time(), 'active' => 1), array('uniacid' => $_W['uniacid'], 'channel' => $channel));
message('设定当前活跃传单成功', referer(), 'success');
} else {
if ($op == 'post') {
$item = array();
if (!empty($_GPC['channel'])) {
$item = pdo_fetch("SELECT * FROM " . tablename('wwx_fxxt_channel') . " WHERE uniacid=:uniacid AND channel=:channel", array(":uniacid" => $_W['uniacid'], ":channel" => $_GPC['channel']));
}
$item = $this->decode_channel_param($item, $item['bgparam']);
///12.生成二维码位置信息等等
if (checksubmit('submit')) {
$tagArr = explode('.', $_GPC['bg']);
$tagArr = end($tagArr);
if (strcasecmp('jpg', $tagArr) != 0) {
message('传单背景图必须是jpg格式。不支持png等其他格式。', referer(), 'error');
}
$bgparam = $this->encode_channel_param($_GPC);
///12.1生成二维码位置信息等等
$msgtype = empty($_GPC['msgtype']) ? 1 : $_GPC['msgtype'];
if (!empty($_GPC['channel'])) {
pdo_delete('wwx_fxxt_qr', array('uniacid' => $_W['uniacid']));
pdo_update('wwx_fxxt_channel', array('title' => $_GPC['title'], 'createtime' => time(), 'bg' => $_GPC['bg'], 'msgtype' => $msgtype, 'bgparam' => $bgparam, 'notice' => $_GPC['notice']), array('channel' => $_GPC['channel'], 'uniacid' => $_W['uniacid']));
pdo_update('wwx_fxxt_qr', array('expiretime' => 1), array('channel' => $_GPC['channel']));
message('更新成功', referer(), 'success');
} else {
$list_count = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('wwx_fxxt_channel') . " WHERE uniacid=:uniacid and isdel=0", array(":uniacid" => $_W['uniacid']));
$active = $list_count == 0;
pdo_insert('wwx_fxxt_channel', array('title' => $_GPC['title'], 'createtime' => time(), 'notice' => $_GPC['notice'], 'msgtype' => $msgtype, 'bg' => $_GPC['bg'], 'bgparam' => $bgparam, 'active' => $active, 'isdel' => 0, 'uniacid' => $_W['uniacid']));
message('新建成功', $this->createWebUrl('spread', array('op' => 'leaflet')), 'success');
}
}
} else {
if ($op == 'log') {
$pindex = max(1, intval($_GPC['page']));
$psize = 100;
$my_follows_sql = "select l.createtime createtime, l.nickname, l.avatar, v.openid,v.follower_count from " . tablename('mc_members') . " l,(select a.uid, a.openid, count(b.from_user) follower_count from " . tablename('mc_mapping_fans') . " a left join " . tablename('wwx_fxxt_share_history') . " b on b.uniacid=a.uniacid and b.sharemid=(select x.id from " . tablename('wwx_fxxt_member') . " x where x.uniacid=:uniacid and x.from_user=a.openid limit 1) and b.from_user!=a.openid where a.openid in(\nselect from_user from " . tablename('mc_mapping_fans') . " where uniacid=:uniacid and follow=1 UNION (select from_user from " . tablename('wwx_fxxt_share_history') . " where uniacid=:uniacid )\nUNION (select m.from_user from " . tablename('wwx_fxxt_member') . " m where m.uniacid = :uniacid))) v where l.uid=v.uid group by v.openid ORDER BY follower_count DESC LIMIT " . ($pindex - 1) * $psize . ",{$psize}";
$mylist = pdo_fetchall($my_follows_sql, array(':uniacid' => $_W['uniacid']));
if (!empty($mylist)) {
$total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('mc_mapping_fans') . " a, " . tablename('mc_members') . " b WHERE a.uniacid=:uniacid and a.uid=b.uid", array(':uniacid' => $_W['uniacid']));
$pager = pagination($total, $pindex, $psize);
}
} else {
if ($op == 'user') {
$from_user = $_GPC['from_user'];
$fans = fans_search($from_user, array('nickname', 'createtime', 'credit1'));
$myheadimg = pdo_fetchcolumn('SELECT avatar FROM ' . tablename('mc_mapping_fans') . " a, " . tablename('mc_members') . " b WHERE a.uniacid = :uniacid AND a.openid = :openid and a.uid=b.uid LIMIT 1", array(':uniacid' => $_W['uniacid'], ':openid' => $from_user));
$fans['avatar'] = $myheadimg;
$mylist = pdo_fetchall("select d.createtime d.createtime, d.nickname, d.avatar from " . tablename('mc_members') . " d,(SELECT b.uid uid FROM " . tablename('wwx_fxxt_share_history') . " a LEFT JOIN " . tablename('mc_mapping_fans') . " b ON a.uniacid=b.uniacid and a.from_user = b.openid WHERE a.sharemid = (select id from " . tablename('wwx_fxxt_member') . " c where c.from_user=:leader and c.uniacid=:uniacid limit 1) and a.from_user!=:leader AND a.uniacid=:uniacid) e where d.uid=e.uid ", array(':leader' => $from_user, ':uniacid' => $_W['uniacid']));
} else {
message('error!', '', 'error');
//.........这里部分代码省略.........
示例14: doMobileResearch
//.........这里部分代码省略.........
}
}
if ($_FILES) {
foreach ($_FILES as $key => $file) {
if (strexists($key, 'field_')) {
$refid = intval(str_replace('field_', '', $key));
$field = $fields[$refid];
if ($refid && $field && $file['name'] && $field['type'] == 'image') {
$entry = array();
$entry['reid'] = $reid;
$entry['rerid'] = 0;
$entry['refid'] = $refid;
$ret = file_upload($file);
if (!$ret['success']) {
message('上传图片失败, 请稍后重试.');
}
$entry['data'] = trim($ret['path']);
$datas[] = $entry;
}
}
}
}
if (empty($datas)) {
message('非法访问.', '', 'error');
}
if (pdo_insert('research_rows', $row) != 1) {
message('保存失败.');
}
$rerid = pdo_insertid();
if (empty($rerid)) {
message('保存失败.');
}
foreach ($datas as &$r) {
$r['rerid'] = $rerid;
pdo_insert('research_data', $r);
}
//插入到 ims_research_booktable_details
$detailsData = array();
$detailsData['tableName'] = $_GPC['field_34'];
$detailsData['personNo'] = $_GPC['field_35'];
$detailsData['contact'] = $_GPC['field_36'];
$detailsData['phone'] = $_GPC['field_37'];
$arrivalDate = empty($_GPC['field_38']) ? TIMESTAMP : strtotime($_GPC['field_38']);
$detailsData['arrivalDate'] = $arrivalDate;
$detailsData['remark'] = $_GPC['field_39'];
$detailsData['status'] = 'P';
$detailsData['createtime'] = time();
pdo_insert('research_bookdetails', $detailsData);
if (empty($activity['starttime'])) {
$record = array();
$record['starttime'] = TIMESTAMP;
pdo_update('research', $record, array('reid' => $reid));
}
//发送预约
if (!empty($datas) && !empty($activity['noticeemail'])) {
foreach ($datas as $row) {
$body .= "{$fields[$row['refid']]['title']} : {$row['data']} <br />";
}
ihttp_email($activity['noticeemail'], $activity['title'] . '的预约提醒', $body);
}
message($activity['information'], 'refresh');
}
$initRange = false;
$initCalendar = false;
$binds = array();
foreach ($ds as &$r) {
if ($r['type'] == 'range') {
$initRange = true;
}
if ($r['type'] == 'calendar') {
$initCalendar = true;
}
if ($r['value']) {
$r['options'] = explode(',', $r['value']);
}
if ($r['bind']) {
$binds[] = $r['bind'];
}
}
if (!empty($_W['fans']['from_user']) && !empty($binds)) {
$profile = fans_search($_W['fans']['from_user'], $binds);
if ($profile['gender']) {
if ($profile['gender'] == '0') {
$profile['gender'] = '保密';
}
if ($profile['gender'] == '1') {
$profile['gender'] = '男';
}
if ($profile['gender'] == '2') {
$profile['gender'] = '女';
}
}
foreach ($ds as &$r) {
if ($profile[$r['bind']]) {
$r['default'] = $profile[$r['bind']];
}
}
}
include $this->template('submit');
}
示例15: foreach
}
foreach ($_W['modules'] as $name => $module) {
if (isset($membermodules[$module['mid']]) || !empty($module['issystem']) || in_array($module['mid'], (array) $groupsmodules['modules'])) {
$modulesimple = array('mid' => $module['mid'], 'name' => $module['name'], 'title' => $module['title']);
$_W['account']['modules'][$module['name']] = $module;
if ($accountmodules[$module['mid']]['config']) {
$_W['account']['modules'][$module['name']]['config'] = $accountmodules[$module['mid']]['config'];
}
}
}
}
unset($membermodules);
unset($_W['modules']);
$session = json_decode(base64_decode($_GPC['__msess']), true);
if (is_array($session)) {
$row = fans_search($session['openid'], array('id', 'salt', 'weid', 'from_user', 'follow', 'createtime', 'nickname', 'avatar'));
if (!empty($row) && $row['weid'] == $_W['weid']) {
$hash = substr(md5("{$session['openid']}{$row['salt']}{$_W['config']['setting']['authkey']}"), 5, 5);
if ($session['hash'] == $hash) {
unset($row['salt']);
$_W['fans'] = $row;
}
}
if (!empty($_W['account']['modules']['member'])) {
$row = pdo_fetch("SELECT * FROM " . tablename('card_members') . " WHERE from_user = :from_user AND weid = :weid", array(':from_user' => $session['openid'], ':weid' => $_W['weid']));
$row1 = pdo_fetch("SELECT * FROM " . tablename('fans') . " WHERE from_user = :from_user AND weid = :weid", array(':from_user' => $session['openid'], ':weid' => $_W['weid']));
$cardlevel = pdo_fetch("SELECT * FROM " . tablename('card') . " WHERE weid = '{$_W['weid']}'");
if (!empty($row)) {
if (!empty($row1['avatarfixed'])) {
$_W['fans']['avatar'] = $row1['avatarfixed'];
}