public function doWebList() { global $_W, $_GPC; $table = 'p_room'; $Room = trim($_GPC['Room']); $status = trim($_GPC['status']); $sel_build = trim($_GPC['build']); $project = biz_unserializer($_W['project'], 'builds'); $build = db_getBuilds($_W['project']['projguid'], '', !empty($project)); //$default = 0; $condition = " WHERE ProjGUID=:ProjGUID "; $param = array(":ProjGUID" => $_W['project']['projguid']); if (!empty($Room)) { $condition .= " AND Room LIKE '%{$Room}%' "; $_GET['Room'] = $_GPC['Room']; } if (!empty($status)) { $condition .= " AND Status LIKE '%{$status}%' "; $_GET['status'] = $_GPC['status']; } if (!empty($sel_build)) { $condition .= " AND BldGUID=:BldGUID "; $param[':BldGUID'] = $sel_build; $_GET['build'] = $sel_build; } $pindex = max(1, intval($_GPC['page'])); $psize = 20; $sql = "SELECT * FROM " . tablename($table) . $condition; $sql .= " order by RoomCode limit " . ($pindex - 1) * $psize . "," . $psize; $list = pdo_fetchall($sql, $param); $total = pdo_fetchcolumn(" select count(*) from " . tablename($table) . $condition, $param); $pager = pagination($total, $pindex, $psize); include $this->template('build_list'); }
public function respond() { global $_W; $content = $this->message['content']; //这里定义此模块进行消息处理时的具体过程, 请查看WORMWOOD文档来编写你的代码 $isfill = pdo_fetchcolumn("SELECT isfill FROM " . tablename('feng_testingreply') . " WHERE rid =:rid AND testingid = '0'", array(':rid' => $this->rule)); $reply = pdo_fetchall("SELECT * FROM " . tablename('feng_testingreply') . " WHERE rid = :rid", array(':rid' => $this->rule)); if (!empty($reply)) { foreach ($reply as $row) { $ids[$row['testingid']] = $row['testingid']; } $article = pdo_fetchall("SELECT id,title,photo,smalltext FROM " . tablename('feng_testing') . " WHERE id IN (" . implode(',', $ids) . ")", array(), 'id'); } if ($isfill && ($count = 8 - count($reply)) > 0) { $articlefill = pdo_fetchall("SELECT id,title,photo,smalltext FROM " . tablename('feng_testing') . " WHERE weid = '{$_W['weid']}' AND id NOT IN (" . implode(',', $ids) . ") ORDER BY id DESC LIMIT {$count}", array(), 'id'); if (!empty($articlefill)) { foreach ($articlefill as $row) { $article[$row['id']] = $row; $reply[]['testingid'] = $row['id']; } unset($articlefill); } } if (!empty($reply)) { $response = array(); foreach ($reply as $row) { $row = $article[$row['testingid']]; if (!empty($row)) { $response[] = array('title' => $row['title'], 'description' => $row['description'], 'picurl' => $row['thumb'], 'url' => $this->buildSiteUrl($this->createMobileUrl('detail', array('id' => $row['id'])))); } } } return $this->respNews($response); }
public function getCategory() { global $_W; $shopset = m('common')->getSysset('shop'); $allcategory = array(); $category = pdo_fetchall("SELECT * FROM " . tablename('ewei_shop_category') . " WHERE uniacid=:uniacid and enabled=1 ORDER BY parentid ASC, displayorder DESC", array(':uniacid' => $_W['uniacid'])); $category = set_medias($category, array('thumb', 'advimg')); foreach ($category as $c) { if (empty($c['parentid'])) { $children = array(); foreach ($category as $c1) { if ($c1['parentid'] == $c['id']) { if (intval($shopset['catlevel']) == 3) { $children2 = array(); foreach ($category as $c2) { if ($c2['parentid'] == $c1['id']) { $children2[] = $c2; } } $c1['children'] = $children2; } $children[] = $c1; } } $c['children'] = $children; $allcategory[] = $c; } } return $allcategory; }
public function doMobileprivilege() { global $_GPC, $_W; $id = intval($_GPC['id']); $volist = pdo_fetchall("SELECT * FROM " . tablename('market_privilege') . " WHERE weid=:weid and id=:id", array(':id' => $id, ':weid' => $_W['weid'])); include $this->template('privilege'); }
public function doWebCategory() { global $_GPC, $_W; $op = !empty($_GPC['op']) ? $_GPC['op'] : 'display'; $id = intval($_GPC['id']); if ($op == 'post') { if (!empty($id)) { $item = pdo_fetch("SELECT * FROM" . tablename('xfmarket_category') . "WHERE id='{$id}'"); } if ($_W['ispost']) { $data = array('weid' => $_W['weid'], 'name' => $_GPC['cname'], 'enabled' => $_GPC['enabled']); if (empty($id)) { pdo_insert('xfmarket_category', $data); } else { pdo_update('xfmarket_category', $data, array('id' => $id)); } message('更新成功', referer(), 'success'); } } elseif ($op == 'display') { $row = pdo_fetchall("SELECT * FROM" . tablename('xfmarket_category') . "WHERE weid='{$_W['weid']}'"); } if (checksubmit('delete')) { pdo_delete('xfmarket_category', " id IN ('" . implode("','", $_GPC['select']) . "')"); message('删除成功', referer(), 'success'); } include $this->template('category'); }
public function doMobileshow() { global $_W, $_GPC; $rid = $_GPC['id']; $sql = "SELECT * FROM " . tablename($this->tablename_log) . " WHERE `rid`=:rid"; $info = pdo_fetchall($sql, array(':rid' => $rid)); $sql = "SELECT * FROM " . tablename($this->tablename) . " WHERE `rid`=:rid LIMIT 1"; $quiz = pdo_fetch($sql, array(':rid' => $rid)); $sql = "SELECT * FROM " . tablename($this->tablename_question) . " WHERE `id`=:id"; $q = pdo_fetch($sql, array(':id' => $quiz['qid'])); //var_dump($q); $arr = array(); foreach ($info as $key => $value) { $arr[] = $info[$key]['chk_answer']; } $per = array_count_values($arr); ksort($per); //var_dump($per); $total_count = sizeof($info); $config = $this->get_config($q); //foreach($per as $key => $value){ //$str .= '选项'.$key.'次数'.$value; //} //var_dump($str); //var_dump($per); include $this->template('show'); }
function site_article($params = array()) { global $_GPC, $_W; extract($params); $pindex = max(1, intval($_GPC['page'])); $psize = 20; $result = array(); $condition = " WHERE weid = '{$_W['weid']}'"; if (!empty($cid)) { $category = pdo_fetch("SELECT parentid FROM " . tablename('category') . " WHERE id = '{$cid}'"); if (!empty($category['parentid'])) { $condition .= " AND ccate = '{$cid}'"; } else { $condition .= " AND pcate = '{$cid}'"; } } if ($iscommend == 'true') { $condition .= " AND iscommend = '1'"; } if ($ishot == 'true') { $condition .= " AND ishot = '1'"; } $sql = "SELECT * FROM " . tablename('article') . $condition . ' ORDER BY displayorder DESC, id DESC'; $result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('article') . $condition); $result['pager'] = pagination($total, $pindex, $psize); if (!empty($result['list'])) { foreach ($result['list'] as &$row) { $row['url'] = create_url('mobile/module/hdetail', array('name' => 'shouse', 'id' => $row['id'], 'weid' => $_W['weid'])); } } return $result; }
public function doWebList() { global $_GPC, $_W; checklogin(); $weid = $_W['account']['weid']; //当前公众号ID $id = intval($_GPC['id']); $condition = ''; if (!empty($_GPC['name'])) { $condition .= " AND ( grabername LIKE '%{$_GPC['realname']}%' OR fitername LIKE '%{$_GPC['realname']}%' )"; } if (!empty($_GPC['mobile'])) { $condition .= " AND ( grabermobile = '{$_GPC['mobile']}' OR fitermobile = '{$_GPC['mobile']}' )"; } if (checksubmit('delete')) { pdo_delete('grabseat_record', " id IN ('" . implode("','", $_GPC['select']) . "')"); message('删除成功!', $this->createWebUrl('list', array('id' => $id, 'page' => $_GPC['page']))); } if (!empty($_GPC['wid'])) { $wid = intval($_GPC['wid']); pdo_update('grabseat_record', array('status' => intval($_GPC['status'])), array('id' => $wid)); message('标识领奖成功!', $this->createWebUrl('list', array('id' => $id, 'page' => $_GPC['page']))); } $pindex = max(1, intval($_GPC['page'])); $psize = 25; $list = pdo_fetchall("SELECT * FROM " . tablename('grabseat_record') . " WHERE weid = '{$_W['weid']}' {$condition} ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize); $listtotal = pdo_fetchall("SELECT * FROM " . tablename('grabseat_record') . " WHERE weid = '{$_W['weid']}' {$condition} "); $total = count($listtotal); $pager = pagination($total, $pindex, $psize); include $this->template('list'); }
public function receive() { global $_W, $_GPC; load()->func('communication'); $type = $this->message['type']; $uniacid = $GLOBALS['_W']['uniacid']; $acid = $GLOBALS['_W']['acid']; //$uniacid = $_W['acid']; $rid = intval($this->params['rule']); $rid = $this->rule; $openid = $this->message['fromusername']; $cfg = $this->module['config']; //file_put_contents(IA_ROOT.'/receive.txt', iserializer($cfg)); if ($this->message['event'] == 'unsubscribe' && $cfg['isopenjsps']) { $record = array('updatetime' => TIMESTAMP, 'follow' => '0', 'followtime' => TIMESTAMP); pdo_update('mc_mapping_fans', $record, array('openid' => $openid, 'acid' => $acid, 'uniacid' => $uniacid)); $fmvotelog = pdo_fetchall("SELECT * FROM " . tablename('fm_photosvote_votelog') . " WHERE from_user = :from_user and uniacid = :uniacid LIMIT 1", array(':from_user' => $openid, ':uniacid' => $uniacid)); foreach ($fmvotelog as $log) { $fmprovevote = pdo_fetch("SELECT * FROM " . tablename('fm_photosvote_provevote') . " WHERE from_user = :from_user and uniacid = :uniacid LIMIT 1", array(':from_user' => $log['tfrom_user'], ':uniacid' => $uniacid)); pdo_update('fm_photosvote_provevote', array('lasttime' => TIMESTAMP, 'photosnum' => $fmprovevote['photosnum'] - 1, 'hits' => $fmprovevote['hits'] - 1), array('from_user' => $log['tfrom_user'], 'uniacid' => $uniacid)); } pdo_delete('fm_photosvote_votelog', array('from_user' => $openid)); pdo_delete('fm_photosvote_bbsreply', array('from_user' => $openid)); } }
public function dolist() { global $_GPC, $_W; checklogin(); $weid = intval($_W['weid']); if (checksubmit('verify') && !empty($_GPC['select'])) { pdo_update('message_list', array('isshow' => 1, 'create_time' => TIMESTAMP), " id IN ('" . implode("','", $_GPC['select']) . "')"); message('审核成功!', create_url('site/module', array('do' => 'list', 'name' => 'message', 'weid' => $weid, 'page' => $_GPC['page']))); } if (checksubmit('delete') && !empty($_GPC['select'])) { pdo_delete('message_list', " id IN ('" . implode("','", $_GPC['select']) . "')"); message('删除成功!', create_url('site/module', array('do' => 'list', 'name' => 'message', 'weid' => $weid, 'page' => $_GPC['page']))); } $isshow = isset($_GPC['isshow']) ? intval($_GPC['isshow']) : 0; $pindex = max(1, intval($_GPC['page'])); $psize = 20; $message = pdo_fetch("SELECT id, isshow, weid FROM " . tablename('message_reply') . " WHERE weid = '{$weid}' LIMIT 1"); $list = pdo_fetchall("SELECT * FROM " . tablename('message_list') . " WHERE weid = '{$message['weid']}' AND isshow = '{$isshow}' ORDER BY create_time DESC LIMIT " . ($pindex - 1) * $psize . ",{$psize}"); if (!empty($list)) { $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('message_list') . " WHERE weid = '{$message['weid']}' AND isshow = '{$isshow}'"); $pager = pagination($total, $pindex, $psize); foreach ($list as &$row) { $row['content'] = emotion($row['content']); $userids[] = $row['from_user']; } unset($row); } include $this->template('list'); }
public function respond() { global $_W; $content = $this->message['content']; $from_user = $this->message['from']; $isfill = pdo_fetchcolumn("SELECT isfill FROM " . tablename('xc_article_article_reply') . " WHERE rid =:rid AND articleid = '0'", array(':rid' => $this->rule)); $reply = pdo_fetchall("SELECT * FROM " . tablename('xc_article_article_reply') . " WHERE rid = :rid", array(':rid' => $this->rule)); if (!empty($reply)) { foreach ($reply as $row) { $ids[$row['articleid']] = $row['articleid']; } $article = pdo_fetchall("SELECT id, title, thumb, content, description, linkurl FROM " . tablename('xc_article_article') . " WHERE id IN (" . implode(',', $ids) . ")", array(), 'id'); } if ($isfill && ($count = 8 - count($reply)) > 0) { $articlefill = pdo_fetchall("SELECT id, title, thumb, content, description, linkurl FROM " . tablename('xc_article_article') . " WHERE weid = '{$_W['weid']}' AND id NOT IN (" . implode(',', $ids) . ") ORDER BY id DESC LIMIT {$count}", array(), 'id'); if (!empty($articlefill)) { foreach ($articlefill as $row) { $article[$row['id']] = $row; $reply[]['articleid'] = $row['id']; } unset($articlefill); } } if (!empty($reply)) { $response = array(); foreach ($reply as $row) { $row = $article[$row['articleid']]; if (!empty($row)) { $response[] = array('title' => htmlspecialchars_decode($row['title']), 'description' => htmlspecialchars_decode($row['description']), 'picurl' => $row['thumb'], 'url' => $this->buildSiteUrl($this->createMobileUrl('detail', array('id' => $row['id'], 'shareby' => $from_user, 'track_type' => 'click', 'linkurl' => $row['linkurl'])))); } } } return $this->respNews($response); }
public function doMobilelist() { global $_GPC, $_W; $weid = intval($_W['weid']); //录入bigwheel_fans数据 if (empty($weid)) { message('抱歉,参数错误!', '', 'error'); } $reply = pdo_fetch("SELECT * FROM " . tablename($this->tablename) . " WHERE weid = :weid ORDER BY `id` DESC", array(':weid' => $weid)); if ($reply == false) { $reply = array('status' => 1, 'isshow' => 1); } $messagecount = pdo_fetchcolumn("SELECT count(id) FROM " . tablename('message_list') . " WHERE isshow=1 and weid=" . $weid); $p = isset($_GET['p']) ? $_GET['p'] : 1; $pagenum = 10; $totalpage = floor($messagecount / $pagenum) + 1; $prow = ($p - 1) * $pagenum; $messagelist = pdo_fetchall("SELECT * FROM " . tablename('message_list') . " WHERE weid=" . $weid . " and fid=0 and isshow=1 order by create_time desc limit {$prow},{$pagenum}"); foreach ($messagelist as $k => $v) { $messagelist[$k]['reply'] = pdo_fetchall("SELECT * FROM " . tablename('message_list') . " WHERE weid=" . $weid . " and fid=" . $v['id'] . " and isshow=1 limit 20"); } //获取fans表中的username $nickname = pdo_fetchcolumn("Select nickname from " . tablename('fans') . " where weid=" . $weid . " and from_user='******'fans']['from_user'] . "' limit 1"); include $this->template('list'); }
public function selectAllOrderBy($where = '', $order_by = '') { global $_W; $uniacid = $_W['uniacid']; $data_list = pdo_fetchall("SELECT " . $this->columns . " FROM " . tablename($this->table_name) . " WHERE 1=1 AND uniacid={$uniacid} {$where} ORDER BY {$order_by}id ASC"); return $data_list; }
public function doMobileIndex() { global $_GPC, $_W; $sql = "select * from" . tablename($this->manage) . "where weid='{$_W['weid']}'"; $list = pdo_fetchall($sql); include $this->template('index'); }
public function all_list($params = array()) { global $_GPC, $_W; extract($params); $result = array(); $pindex = max(1, intval($_GPC['page'])); $psize = $psize ? $psize : '20'; $where = "WHERE `uniacid` = :uniacid AND ischeck=:ischeck"; $paras = array(); $paras[':uniacid'] = $_W['uniacid']; $paras[':ischeck'] = intval($ischeck); $sql = "SELECT * FROM " . tablename('qiyue_canvas') . $where . ' ORDER BY createtime DESC, id DESC'; $result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize, $paras); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('qiyue_canvas') . $where, $paras); if ($_W['isajax']) { $context['ajaxcallback'] = 1; $result['pager'] = pagination($total, $pindex, $psize, '', $context); } else { $result['pager'] = pagination($total, $pindex, $psize); } if (!empty($result['list'])) { foreach ($result['list'] as &$row) { $row['url'] = url('mobile/module/index', array('name' => 'site', 'id' => $row['id'], 'weid' => $_W['weid'])); } } return $result; }
function travel_article_search($cid, $type = '', $psize = 20, $orderby = 'id DESC') { global $_GPC, $_W; $pindex = max(1, intval($_GPC['page'])); $result = array(); $condition = " WHERE weid = '{$_W['weid']}' AND "; if (!empty($cid)) { $category = pdo_fetch("SELECT parentid FROM " . tablename('article_category') . " WHERE id = '{$cid}'"); if (!empty($category['parentid'])) { $condition .= "ccate = '{$cid}'"; } else { $condition .= "pcate = '{$cid}'"; } } if (!empty($cid) && !empty($type)) { $condition .= " OR "; } if (!empty($type)) { $type = explode(',', $type); foreach ($type as $item) { $condition .= "type LIKE '%{$item},%'"; } } $sql = "SELECT * FROM " . tablename('travel') . $condition . ' ORDER BY ' . $orderby; $result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('travel') . $condition); $result['pager'] = pagination($total, $pindex, $psize); return $result; }
public function doMobileIndex() { global $_W, $_GPC; $sql = "select * from" . tablename('chax') . "where weid='{$_W['weid']}' and status =1"; $navs = pdo_fetchall($sql); include $this->template('index'); }
public function doWebShare() { global $_W, $_GPC; $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display-log'; if ($operation == 'post') { $goodsid = $_GPC['goodsid']; $item = pdo_fetch("SELECT * FROM " . tablename($this->table_event) . " WHERE goodsid=:goodsid", array(":goodsid" => $goodsid)); $goods = pdo_fetch("SELECT * FROM " . tablename($this->table_goods) . " WHERE id=:goodsid", array(":goodsid" => $goodsid)); if (checksubmit()) { $share_title = $_GPC['share_title']; $share_content = $_GPC['share_content']; $discount = $_GPC['discount']; $discount_limit = $_GPC['discount_limit']; if (false == $item) { pdo_insert($this->table_event, array('weid' => $_W['weid'], 'share_title' => $share_title, 'share_content' => $share_content, 'goodsid' => $goodsid, 'discount' => $discount, 'discount_limit' => $discount_limit)); } else { pdo_update($this->table_event, array('weid' => $_W['weid'], 'share_title' => $share_title, 'share_content' => $share_content, 'discount' => $discount, 'discount_limit' => $discount_limit), array('goodsid' => $goodsid)); } message("更新成功", $this->createWebUrl("Share", array("op" => "display-event")), "success"); } } if ($operation == 'display-event') { $list = pdo_fetchall("SELECT * FROM " . tablename($this->table_goods) . " WHERE weid=:weid AND istime=1", array(":weid" => $_W['weid'])); } if ($operation == 'display-log') { $list = pdo_fetchall("SELECT COUNT(goodsid) as click, goodsid, orderid, title FROM " . tablename($this->table_iptable) . " WHERE weid=:weid GROUP BY orderid", array(":weid" => $_W['weid'])); } include $this->template('share'); }
public function respond() { global $_W; $rid = $this->rule; $sql = "SELECT id FROM " . tablename('news_reply') . " WHERE `rid`=:rid AND parentid = 0 ORDER BY RAND()"; $main = pdo_fetch($sql, array(':rid' => $rid)); if (empty($main['id'])) { return array(); } $sql = "SELECT * FROM " . tablename('news_reply') . " WHERE id = :id OR parentid = :parentid ORDER BY parentid ASC, id ASC LIMIT 8"; $commends = pdo_fetchall($sql, array(':id'=>$main['id'], ':parentid'=>$main['id'])); $news = array(); foreach($commends as $c) { $row = array(); $row['title'] = $c['title']; $row['description'] = $c['description']; !empty($c['thumb']) && $row['picurl'] = $_W['attachurl'] . trim($c['thumb'], '/'); $row['url'] = empty($c['url']) ? $_W['siteroot'] . create_url('index/module', array('do' => 'detail', 'name' => 'news', 'id' => $c['id'])) : $c['url']; $news[] = $row; } $r['FromUserName'] = $this->message['to']; $r['ToUserName'] = $this->message['from']; $r['MsgType'] = 'news'; $r['ArticleCount'] = count($news); $r['Articles'] = array(); foreach ($news as $row) { $r['Articles'][] = array( 'Title' => $row['title'], 'Description' => $row['description'], 'PicUrl' => $row['picurl'], 'Url' => $row['url'], 'TagName' => 'item', ); } return $r; }
public function fieldsFormDisplay($rid = 0) { //要嵌入规则编辑页的自定义内容,这里 $rid 为对应的规则编号,新增时为 0 global $_W; load()->func('tpl'); $reply = pdo_fetch("SELECT * FROM " . tablename('eso_runman_reply') . " WHERE rid = :rid", array(':rid' => $rid)); if (empty($reply)) { $reply['starttime'] = time(); $reply['endtime'] = time() + 2592000; $reply['setting'] = array(); } else { $reply['setting'] = string2array($reply['setting']); } $sql = "SELECT * FROM " . tablename('uni_account'); $uniaccounts = pdo_fetchall($sql); $accounts = array(); if (!empty($uniaccounts)) { foreach ($uniaccounts as $uniaccount) { $accountlist = uni_accounts($uniaccount['uniacid']); if (!empty($accountlist)) { foreach ($accountlist as $account) { if (!empty($account['key']) && !empty($account['secret']) && in_array($account['level'], array(3, 4))) { $accounts[$account['acid']] = $account['name']; } } } } } include $this->template('form'); }
public function doMobileMy() { global $_W, $_GPC; checkauth(); $rid = $_GPC['rid']; $from_user = $_W['fans']['from_user']; $list = pdo_fetchall("SELECT * FROM " . tablename('weizp_album') . " WHERE rid=:rid AND from_user=:from_user", array('rid' => $rid, 'from_user' => $from_user)); foreach ($list as $k => $v) { foreach ($v as $sk => $sv) { if ($sk == 'images') { $tmp = unserialize($sv); $images = array(); foreach ($tmp as $ssv) { $images[]['id'] = $ssv; $images[]['file'] = pdo_fetchcolumn("SELECT file FROM " . tablename('weizp_images') . "WHERE id='{$ssv}'"); } $sv = $images; } $v[$sk] = $sv; } $list[$k] = $v; } //var_dump($list); include $this->template('my'); }
public function respond() { global $_W; $content = $this->message['content']; $foods = pdo_fetchall("SELECT * FROM " . tablename('jufeng_wcy_foods') . " WHERE weid = '{$_W['uniacid']}' AND title LIKE '%{$content}%' "); $pcate = pdo_fetchall("SELECT * FROM " . tablename('jufeng_wcy_category') . " WHERE weid = '{$_W['uniacid']}' AND parentid = '0' AND name LIKE '%{$content}%' "); $news[] = array('title' => '在线订餐', 'description' => '方便快捷,价格优惠', 'picurl' => '../addons/jufeng_wcy/images/dc.jpg', 'url' => $this->createMobileUrl('dianjia')); $foodsnum = count($foods); $pcatenum = count($pcate); if ($foodsnum == 0 && $pcatenum == 0) { $news[] = array('title' => '直接回复你想吃的,可搜索菜品和餐馆哦'); $news[] = array('title' => '没有关于【' . $content . '】的菜品或餐馆'); } if ($pcatenum < 9) { $printnum = $pcatenum; } else { $printnum = 9; } for ($i = 0; $i < $printnum; $i++) { $news[] = array('title' => "【" . $pcate[$i]['name'] . "】——" . "热度:" . $pcate[$i]['total'], 'description' => "", 'picurl' => $_W['attachurl'] . $pcate[$i]['thumb'], 'url' => $this->createMobileUrl('list', array('pcate' => $pcate[$i]['id']))); } $printnum = 9 - $printnum; if ($foodsnum < $printnum) { $printnum = $foodsnum; } for ($i = 0; $i < $printnum; $i++) { $dianjia = pdo_fetch("SELECT * FROM " . tablename('jufeng_wcy_category') . " WHERE weid = '{$_W['uniacid']}' AND id = '{$foods[$i]['pcate']}'"); $news[] = array('title' => "【" . $foods[$i]['title'] . "】——" . $dianjia['name'], 'description' => "菜品热度:" . $foods[$i]['hits'], 'picurl' => $_W['attachurl'] . $foods[$i]['thumb'], 'url' => $this->createMobileUrl('list', array('pcate' => $foods[$i]['pcate']))); } return $this->respNews($news); }
function site_category($params = array()) { global $_GPC, $_W; extract($params); if (!isset($parentid)) { $condition = ""; } else { $condition = " AND parentid = '{$parentid}'"; } $category = array(); $result = pdo_fetchall("SELECT * FROM " . tablename('article_category') . " WHERE weid = '{$_W['weid']}' {$condition} ORDER BY parentid ASC, displayorder ASC, id ASC "); if (!isset($parentid)) { if (!empty($result)) { foreach ($result as $row) { if (empty($row['parentid'])) { $category[$row['id']] = $row; } else { $category[$row['parentid']]['children'][$row['id']] = $row; } } } } else { $category = $result; } return $category; }
public function doWebList() { global $_GPC, $_W; $uniacid = $_W["uniacid"]; $pindex = max(1, intval($_GPC['page'])); $psize = 20; $where = ""; $mark = $_GPC['mark']; $keyword = $_GPC['keyword']; if (!empty($mark)) { $where .= " AND mark = '{$mark}'"; } if (!empty($keyword)) { $where .= " AND title like '%{$keyword}%'"; } if (!empty($_GPC['Deleteall']) && !empty($_GPC['select'])) { foreach ($_GPC['select'] as $k => $v) { pdo_delete('hx_dialect_questions', array('id' => $v, 'uniacid' => $_W['uniacid'])); } message('成功删除选中的防伪码!', referer(), 'success'); } if (!empty($_GPC['Frozenall']) && !empty($_GPC['select'])) { foreach ($_GPC['select'] as $k => $v) { pdo_update('securitys_data', array('status' => 0), array('id' => $v, 'uniacid' => $_W['uniacid'])); } message('成功冻结选中的防伪码!', referer(), 'success'); } $list = pdo_fetchall("SELECT * from " . tablename('hx_dialect_questions') . " where uniacid='{$uniacid}' {$where} order by id asc LIMIT " . ($pindex - 1) * $psize . ',' . $psize); $total = pdo_fetchcolumn("SELECT COUNT(*) from " . tablename('hx_dialect_questions') . " where uniacid='{$uniacid}' {$where} order by id asc"); $pager = pagination($total, $pindex, $psize); load()->func('tpl'); include $this->template('list'); }
public function getAllHelps($filters = array(), $pindex = 0, $psize = 15, &$total = 0) { global $_W; $condition = '`uniacid`=:uniacid AND `activity`=:activity'; $pars = array(); $pars[':uniacid'] = $_W['uniacid']; $pars[':activity'] = $this->activity['actid']; if (!empty($filters['owner'])) { $condition .= ' AND `owner`=:owner'; $pars[':owner'] = $filters['owner']; } if (!empty($filters['helper'])) { $condition .= ' AND `helper`=:helper'; $pars[':helper'] = $filters['helper']; } $sql = 'FROM ' . tablename('wwx_fxxt_red_helps') . "WHERE {$condition}"; if ($pindex > 0) { $total = pdo_fetchcolumn("SELECT COUNT(*) {$sql}", $pars); $start = ($pindex - 1) * $psize; $sql .= " ORDER BY `id` DESC LIMIT {$start},{$psize}"; $ds = pdo_fetchall("SELECT * {$sql}", $pars); } else { $ds = pdo_fetchall("SELECT * {$sql}", $pars); } return $ds; }
public function respond() { global $_W; $rid = $this->rule; $sql = "SELECT * FROM " . tablename('news_reply') . " WHERE rid = :id AND parent_id = -1 ORDER BY displayorder DESC, id ASC LIMIT 8"; $commends = pdo_fetchall($sql, array(':id' => $rid)); if (empty($commends)) { $sql = "SELECT * FROM " . tablename('news_reply') . " WHERE rid = :id AND parent_id = 0 ORDER BY RAND()"; $main = pdo_fetch($sql, array(':id' => $rid)); if (empty($main['id'])) { return false; } $sql = "SELECT * FROM " . tablename('news_reply') . " WHERE id = :id OR parent_id = :parent_id ORDER BY parent_id ASC, displayorder DESC, id ASC LIMIT 8"; $commends = pdo_fetchall($sql, array(':id' => $main['id'], ':parent_id' => $main['id'])); } if (empty($commends)) { return false; } $news = array(); foreach ($commends as $c) { $row = array(); $row['title'] = $c['title']; $row['description'] = $c['description']; !empty($c['thumb']) && ($row['picurl'] = tomedia($c['thumb'])); $row['url'] = empty($c['url']) ? $this->createMobileUrl('detail', array('id' => $c['id'])) : $c['url']; $news[] = $row; } return $this->respNews($news); }
public function doWebDisplay() { global $_W, $_GPC; if (empty($_GPC['do'])) { $_GPC['do'] = 'display'; } $pindex = max(1, intval($_GPC['page'])); $psize = 20; $condition = ''; if (!empty($_GPC['keyword'])) { $condition .= " AND title LIKE '%{$_GPC['keyword']}%'"; } if (is_array($_GPC['industry'])) { if (!empty($_GPC['industry']['parent'])) { $condition .= " AND industry1 = '{$_GPC['industry']['parent']}'"; } if (!empty($_GPC['industry']['child'])) { $condition .= " AND industry2 = '{$_GPC['industry']['child']}'"; } } $list = pdo_fetchall("SELECT * FROM " . tablename('business') . " WHERE weid = '{$_W['weid']}' {$condition} ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('business') . " WHERE weid = '{$_W['weid']}' {$condition}"); $pager = pagination($total, $pindex, $psize); include $this->template('display'); }
public function receive() { global $_W, $_GPC; $type = $this->message['type']; $uniacid = $_W['uniacid']; $acid = $_W['acid']; $openid = $this->message['from']; $event = $this->message['event']; $cfg = $this->module['config']; file_put_contents(IA_ROOT . '/addons/fm_photosvote/test/fm_test.txt', iserializer($event)); if ($event == 'unsubscribe') { $record = array('updatetime' => TIMESTAMP, 'follow' => '0', 'unfollowtime' => TIMESTAMP); pdo_update('mc_mapping_fans', $record, array('openid' => $openid, 'acid' => $acid, 'uniacid' => $uniacid)); if ($cfg['isopenjsps']) { $fmvotelog = pdo_fetchall("SELECT tfrom_user FROM " . tablename('fm_photosvote_votelog') . " WHERE from_user = :from_user and uniacid = :uniacid LIMIT 1", array(':from_user' => $openid, ':uniacid' => $uniacid)); foreach ($fmvotelog as $log) { $fmprovevote = pdo_fetch("SELECT photosnum,hits FROM " . tablename('fm_photosvote_provevote') . " WHERE from_user = :from_user and uniacid = :uniacid LIMIT 1", array(':from_user' => $log['tfrom_user'], ':uniacid' => $uniacid)); pdo_update('fm_photosvote_provevote', array('lasttime' => TIMESTAMP, 'photosnum' => $fmprovevote['photosnum'] - 1, 'hits' => $fmprovevote['hits'] - 1), array('from_user' => $log['tfrom_user'], 'uniacid' => $uniacid)); } pdo_delete('fm_photosvote_votelog', array('from_user' => $openid)); pdo_delete('fm_photosvote_bbsreply', array('from_user' => $openid)); } } elseif ($event == 'subscribe') { if ($cfg['oauthtype'] == 2) { $wechats = pdo_fetch("SELECT * FROM " . tablename('account_wechats') . " WHERE uniacid = :uniacid ", array(':uniacid' => $_W['uniacid'])); $token = iunserializer($wechats['access_token']); $arrlog = pdo_fetch("SELECT * FROM " . tablename('mc_mapping_fans') . " WHERE uniacid = :uniacid AND openid = :openid", array(':uniacid' => $_W['uniacid'], ':openid' => $openid)); $access_token = $token['token']; $expire = $token['expire']; if (time() >= $expire || empty($access_token)) { $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $wechats['key'] . "&secret=" . $wechats['secret']; $html = file_get_contents($url); $arr = json_decode($html, true); $access_token = $arr['access_token']; $record = array(); $record['token'] = $access_token; $record['expire'] = time() + 3600; $row = array(); $row['access_token'] = iserializer($record); pdo_update('account_wechats', $row, array('uniacid' => $_W['uniacid'])); } $url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $access_token . "&openid=" . $openid . "&lang=zh_CN"; $html = file_get_contents($url); $re = @json_decode($html, true); if (!empty($arrlog)) { $data = array('nickname' => $re['nickname'], 'unionid' => $re['unionid']); pdo_update('mc_mapping_fans', $data, array('openid' => $openid)); } else { $default_groupid = pdo_fetchcolumn('SELECT groupid FROM ' . tablename('mc_groups') . ' WHERE uniacid = :uniacid AND isdefault = 1', array(':uniacid' => $_W['uniacid'])); $nickname = $re['nickname']; $data = array('uniacid' => $_W['uniacid'], 'nickname' => $re['nickname'], 'avatar' => $re['headimgurl'], 'groupid' => $default_groupid, 'createtime' => TIMESTAMP); pdo_insert('mc_members', $data); $id = pdo_insertid(); $data = array('nickname' => $re['nickname'], 'unionid' => $re['unionid'], 'uid' => $id); pdo_update('mc_mapping_fans', $data, array('openid' => $openid)); } } } }
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'))); } }
public function doMobileIndex() { global $_W, $_GPC; $weid = $_W['uniacid']; $rid = intval($_GPC['rid']); $list = pdo_fetchall('select * from ' . tablename('weisrc_pano_reply') . ' where weid=:weid', array(':weid' => $weid)); include $this->template('index'); }