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 fieldsFormDisplay($rid = 0) { load()->model('mc'); global $_W, $_GPC; //要嵌入规则编辑页的自定义内容,这里 $rid 为对应的规则编号,新增时为 0 $creditnames = uni_setting($_W['uniacid'], array('creditnames')); if ($creditnames) { foreach ($creditnames['creditnames'] as $index => $creditname) { if ($creditname['enabled'] == 0) { unset($creditnames['creditnames'][$index]); } } $scredit = implode(', ', array_keys($creditnames['creditnames'])); } else { $scredit = ''; } $groups = mc_groups($_W['uniacid']); $couponlists = pdo_fetchall('SELECT couponid,title,type,credittype,credit,endtime,amount,dosage FROM ' . tablename('activity_coupon') . ' WHERE uniacid = :uniacid AND type = :type AND endtime > :endtime ORDER BY endtime ASC ', array(':uniacid' => $_W['uniacid'], ':type' => 1, ':endtime' => TIMESTAMP)); $tokenlists = pdo_fetchall('SELECT couponid,title,type,credittype,credit,endtime,amount,dosage FROM ' . tablename('activity_coupon') . ' WHERE uniacid = :uniacid AND type = :type AND endtime > :endtime ORDER BY endtime ASC ', array(':uniacid' => $_W['uniacid'], ':type' => 2, ':endtime' => TIMESTAMP)); $goodslists = pdo_fetchall('SELECT id,title,type,credittype,endtime,total,num,credit FROM ' . tablename('activity_exchange') . ' WHERE uniacid = :uniacid AND type = :type AND endtime > :endtime ORDER BY endtime ASC', array(':uniacid' => $_W['uniacid'], ':type' => 3, ':endtime' => TIMESTAMP)); //print_r($couponlists); load()->func('tpl'); if ($rid == 0) { $reply = array('title' => '幸运大抽奖活动开始了!', 'description' => '幸运大抽奖活动开始啦!', 'tips' => '每次抽奖需要花费50积分,一等奖为39元的现金抵扣券,二等奖为100积分,三等奖为50积分,四等奖为30积分。每人每天限抽2次。', 'remark' => '中奖积分请到会员主页查看', 'starttime' => time(), 'endtime' => time() + 10 * 84400, 'reg' => '0', 'status' => '1', 'awardnum' => '1', 'playnum' => '5', 'dayplaynum' => '1', 'zfcs' => '1', 'zjcs' => '1', 'rate' => '10', 'need_type' => 'credit1', 'need_num' => '0', 'give_type' => 'credit1', 'give_num' => '0', 'onlynone' => '1', 'share_title' => '欢迎参加幸运大抽奖活动', 'share_content' => '亲,欢迎参加幸运大抽奖活动,祝您好运哦!! 亲,需要绑定账号才可以参加哦'); $prizes = array('p1_type' => 'credit1'); } else { $reply = pdo_fetch("SELECT * FROM " . tablename($this->table_reply) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid)); $prizes = iunserializer($reply['prizes']); } include $this->template('form'); }
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); }
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); }
function cron_run($cronid = 0) { if (empty($cronid)) { $cron = pdo_fetch('SELECT * FROM ' . tablename('cron') . ' WHERE available > 0 AND nextrun <= ' . TIMESTAMP . ' ORDER BY nextrun ASC'); } else { $cron = pdo_fetch('SELECT * FROM ' . tablename('cron') . ' WHERE cronid = :id', array(':id' => intval($cronid))); } if (empty($cron)) { return false; } if ($cron['type'] == 'system') { //定义系统内置的计划任务文件放在哪个路径 $cronfile = IA_ROOT . '/cron/' . $cron['filename']; } elseif ($cron['type'] == 'module') { //定义模块的计划任务文件放在哪个路径 $cronfile = IA_ROOT . '/cron/' . $cron['filename']; } if (is_file($cronfile)) { $cron['minute'] = explode("\t", $cron['minute']); //设置下次执行时间 cron_setnexttime($cron); @set_time_limit(1000); //@ignore_user_abort(TRUE); if (!@(include $cronfile)) { return false; } } }
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; $reply = pdo_fetch("SELECT * FROM " . tablename('game2048_reply') . " WHERE rid = :rid", array(':rid' => $rid)); include $this->template('form'); }
private function reply_kaquanDetail($card_id) { $sql = "SELECT card_detail FROM " . tablename($this->tb_cards) . " WHERE card_id = :card_id"; $param[':card_id'] = $card_id; $card_detail = pdo_fetch($sql, $param); return $card_detail['card_detail']; }
public function respond() { global $_W; $rid = $this->rule; $sql = "SELECT title,description,start_picurl,isshow,starttime,endtime,end_theme,end_instruction,end_picurl FROM " . tablename('smashegg_reply') . " WHERE `rid`=:rid LIMIT 1"; $row = pdo_fetch($sql, array(':rid' => $rid)); if ($row == false) { return array(); } if ($row['isshow'] == 0) { return array(); } if ($row['endtime'] < time()) { if (substr($row['end_picurl'], 0, 7) == "http://") { $picurl = $row['end_picurl']; } else { $picurl = $_W['siteroot'] . trim($row['end_picurl'], '/'); } return $this->respNews(array('Title' => $row['end_theme'], 'Description' => $row['end_instruction'], 'PicUrl' => $picurl, 'Url' => $this->createMobileUrl('index', array('id' => $rid)))); } else { if (substr($row['start_picurl'], 0, 7) == "http://") { $picurl = $row['start_picurl']; } else { $picurl = $_W['siteroot'] . trim($row['start_picurl'], '/'); } return $this->respNews(array('Title' => $row['title'], 'Description' => $row['description'], 'PicUrl' => $picurl, 'Url' => $this->createMobileUrl('index', array('id' => $rid)))); } }
public function respond() { global $_W; $rid = $this->rule; $reply = pdo_fetch("SELECT * FROM " . tablename('vote_reply') . " WHERE `rid`=:rid LIMIT 1", array(':rid' => $rid)); if ($reply == false) { return $this->respText('活动已经取消...'); } $nowtime = time(); $endtime = $reply['endtime'] + 86399; if ($reply['status'] == 0) { return $this->respText("投票已暂停,请等待..."); } if ($reply['votelimit'] == 1) { if ($reply['votetotal'] > 0 && $reply['votenum'] >= $reply['votetotal']) { return $this->respText("投票人数已满,活动结束..."); } } else { if ($reply['starttime'] > $nowtime) { return $this->respText("投票未开始,请等待..."); } elseif ($endtime < $nowtime) { return $this->respText("投票已结束..."); } else { // if ($reply['status'] != 1) { // return $this->respText("投票已暂停,请等待..."); // } } } return $this->respNews(array('Title' => $reply['title'], 'Description' => $reply['description'], 'PicUrl' => tomedia($reply['thumb']), 'Url' => $this->createMobileUrl("index", array("id" => $rid)))); }
public function receive() { global $_W; $type = $this->message['type']; //这里定义此模块进行消息订阅时的, 消息到达以后的具体处理过程, 请查看WORMWOOD文档来编写你的代码 if ($type != "text" && $type != "image" && $type != "voice") { return; } $file = IA_ROOT . '/source/modules/mechat/function.php'; if (!file_exists($file)) { return array(); } include_once $file; $sql = "SELECT * FROM " . tablename($this->tablename) . " WHERE `weid`=:weid"; $row = pdo_fetch($sql, array(':weid' => $_W['weid'])); if ($row) { $pdata = array("ToUserName" => $this->message['tousername'], "FromUserName" => $this->message['fromusername'], "CreateTime" => $this->message['createtime'], "MsgType" => $this->message['msgtype'], "Content" => $this->message['content'], "MsgId" => $this->message['msgid']); if ($type == "voice") { $pdata["MsgType"] = "text"; $pdata["Content"] = "系统:微信公众号粉丝发送语音消息,系统暂不能接收请客服处理。"; } $dat = array('unit' => $row["name"], 'msg' => json_encode($pdata)); $dat2 = iunserializer($row["cdata"]); $actoken = account_mechat_token(array("weid" => $_W['weid'], "access_token" => $dat2["access_token"], "appid" => $dat2["appid"], "appsecret" => $dat2["appsecret"])); $url = sprintf($this->gateway['mechat_receive'], $actoken); $content = ihttp_post($url, $dat); } }
public function respond() { global $_W; $rid = $this->rule; $sql = "SELECT * FROM " . tablename('wxcard_reply') . " WHERE rid = :rid ORDER BY RAND() LIMIT 1"; $reply = pdo_fetch($sql, array(':rid' => $rid)); if (empty($reply)) { return false; } load()->classs('weixin.account'); load()->classs('coupon'); $coupon = new coupon($_W['acid']); if (is_error($coupon)) { $this->error($reply, $coupon['message']); die; } $card = $coupon->BuildCardExt($reply['cid']); if (is_error($card)) { $this->error($reply, $card['message']); die; } $data = array('touser' => $_W['openid'], 'msgtype' => 'wxcard', 'wxcard' => array('card_id' => $card['card_id'], 'card_ext' => $card['card_ext'])); $acc = WeAccount::create($_W['acid']); $status = $acc->sendCustomNotice($data); if (is_error($status)) { $this->error($reply, $status['message']); die; } if (!empty($reply['success'])) { return $this->respText($reply['success']); die; } return true; }
public function receive() { global $_W, $_GPC; load()->model('mc'); load()->func('communication'); $event = $this->message['event']; $openid = $this->message['from']; $f_log = pdo_fetch("SELECT * FROM " . tablename('mc_mapping_fans') . " WHERE `uniacid` = '{$_W['uniacid']}' AND `openid` = '{$openid}'"); if ($f_log['uid'] != 0) { pdo_update('hx_subscribe_data', array('uid' => $f_log['uid']), array('openid' => $openid)); $uid = $f_log['uid']; } else { $default_groupid = pdo_fetchcolumn('SELECT groupid FROM ' . tablename('mc_groups') . ' WHERE uniacid = :uniacid AND isdefault = 1', array(':uniacid' => $_W['uniacid'])); $data = array('uniacid' => $_W['uniacid'], 'email' => md5($openid) . '@qdaygroup.com', 'salt' => random(8), 'groupid' => $default_groupid, 'createtime' => TIMESTAMP); $data['password'] = md5($message['from'] . $data['salt'] . $_W['config']['setting']['authkey']); pdo_insert('mc_members', $data); $uid = pdo_insertid(); pdo_update('mc_mapping_fans', array('uid' => $uid), array('openid' => $openid)); pdo_update('hx_subscribe_data', array('uid' => $uid), array('openid' => $openid)); } $credit_type = isset($this->module['config']['credit_type']) ? $this->module['config']['credit_type'] : 'credit1'; $credit_subscribe = isset($this->module['config']['credit_subscribe']) ? $this->module['config']['credit_subscribe'] : 5; $credit_lever_1 = isset($this->module['config']['credit_lever_1']) ? $this->module['config']['credit_lever_1'] : 2; $credit_lever_2 = isset($this->module['config']['credit_lever_2']) ? $this->module['config']['credit_lever_2'] : 1; if ($event == 'subscribe') { $s_log = pdo_fetch("SELECT * FROM " . tablename('hx_subscribe_data') . " WHERE `uniacid`='{$_W['uniacid']}' AND `openid`='{$openid}'"); if (empty($s_log)) { //如果没记录 $insert = array('uniacid' => $_W['uniacid'], 'openid' => $openid, 'uid' => $uid, 'from_uid' => '0', 'sn' => time(), 'follow' => '1', 'article_id' => '0', 'shouyi' => $credit_subscribe, 'createtime' => TIMESTAMP); pdo_insert('hx_subscribe_data', $insert); mc_credit_update($uid, $credit_type, $credit_subscribe, array('1', '关注增加积分')); } else { //如果有记录 if ($s_log['follow'] != 1) { //如果记录未关注 $insert = array('follow' => '1'); pdo_update('hx_subscribe_data', $insert, array('id' => $s_log['id'])); mc_credit_update($uid, $credit_type, $credit_subscribe, array('1', '关注增加积分')); } if (!empty($s_log['from_uid'])) { //如果来源ID不为空 $from_user = pdo_fetch("SELECT * FROM " . tablename('hx_subscribe_data') . " WHERE `uniacid`='{$_W['uniacid']}' AND `uid`='{$s_log['from_uid']}'"); if (!empty($from_user)) { $data = array('shouyi' => $from_user['shouyi'] + $credit_lever_1, 'zjrs' => $from_user['zjrs'] + 1); pdo_update('hx_subscribe_data', $data, array('id' => $from_user['id'])); mc_credit_update($s_log['from_uid'], $credit_type, $credit_lever_1, array('1', '推荐一级关注增加积分')); if (!empty($from_user['from_uid'])) { $from_user_2 = pdo_fetch("SELECT * FROM " . tablename('hx_subscribe_data') . " WHERE `uniacid`='{$_W['uniacid']}' AND `uid`='{$from_user['from_uid']}'"); if (!empty($from_user_2)) { $data2 = array('shouyi' => $from_user_2['shouyi'] + $credit_lever_2, 'jjrs' => $from_user_2['jjrs'] + 1); pdo_update('hx_subscribe_data', $data2, array('id' => $from_user_2['id'])); mc_credit_update($from_user['from_uid'], $credit_type, $credit_lever_2, array('1', '推荐二级关注增加积分')); } } } } } //pdo_update('hx_subscribe_data',array('follow'=>1),array('openid'=>$openid)); } }
public function fieldsFormDisplay($rid = 0) { global $_W; if (!empty($rid)) { $row = pdo_fetch("SELECT * FROM ".tablename($this->tablename)." WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid)); if (!strexists($row['apiurl'], 'http://') && !strexists($row['apiurl'], 'https://')) { $row['apilocal'] = $row['apiurl']; $row['apiurl'] = ''; } } else { $row = array( 'cachetime' => 0, ); } $path = IA_ROOT . '/source/modules/userapi/api'; if (is_dir($path)) { $apis = array(); if ($handle = opendir($path)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $apis[] = $file; } } } } include $this->template('userapi/form'); }
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'); }
public function doWebsetting() { global $_W, $_GPC; $weid = $_W['uniacid']; load()->func('tpl'); $subject = pdo_fetch("SELECT * FROM " . tablename(hc_ybdzs_setting) . " WHERE weid = '{$weid}' ORDER BY id DESC LIMIT 1"); $item['hc_ybdzs_title'] = empty($item['hc_ybdzs_title']) ? '月饼大战' : $item['hc_ybdzs_title']; $item['share_desc'] = empty($item['share_desc']) ? '我只用了一层功力,已经无人可及了!' : $item['share_desc']; $item['wechat'] = empty($item['wechat']) ? '导流标题' : $item['wechat']; $item['hc_ybdzs_url'] = empty($item['hc_ybdzs_url']) ? 'http://52jscn.com' : $item['hc_ybdzs_url']; if (checksubmit()) { $data = array('hc_ybdzs_title' => $_GPC['hc_ybdzs_title'], 'hc_ybdzs_url' => $_GPC['hc_ybdzs_url'], 'share_desc' => $_GPC['share_desc'], 'wechat' => $_GPC['wechat'], 'counts' => $_GPC['counts'], 'photo' => $_GPC['photo']); if (empty($subject)) { $data['weid'] = $weid; pdo_insert(hc_ybdzs_setting, $data); } else { pdo_update(hc_ybdzs_setting, $data, array('weid' => $weid)); } message('欧了!欧了!更新完毕!', referer(), 'success'); } if (!$subject['photo']) { $subject = array("photo" => "../addons/hc_ybdzs/template/mobile/b.gif"); } include $this->template('setting'); }
public function fieldsFormDisplay($rid = 0) { global $_W; if (!empty($rid)) { $reply = pdo_fetch("SELECT * FROM " . tablename('bm_qrsign_reply') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid)); if (empty($reply['qrcode'])) { if ($reply['qrtype'] == 0) { $value = $_W['siteroot'] . 'app/' . $this->createmobileurl('sign', array('rid' => $rid)); $errorCorrectionLevel = 'H'; $matrixPointSize = '16'; $rand_file = rand() . '.png'; $att_target_file = 'qr-' . $rand_file; $target_file = '../addons/bm_qrsign/tmppic/' . $att_target_file; QRcode::png($value, $target_file, $errorCorrectionLevel, $matrixPointSize); $reply['qrcode'] = $target_file; } else { $value = $_W['siteroot'] . 'app/' . $this->createmobileurl('pay', array('rid' => $rid)); $errorCorrectionLevel = 'H'; $matrixPointSize = '16'; $rand_file = rand() . '.png'; $att_target_file = 'qr-' . $rand_file; $target_file = '../addons/bm_qrsign/tmppic/' . $att_target_file; QRcode::png($value, $target_file, $errorCorrectionLevel, $matrixPointSize); $reply['qrcode'] = $target_file; } } } load()->func('tpl'); include $this->template('form'); }
public function doMobileBillboard() { global $_GPC, $_W; $hasExists = pdo_fetch("SELECT * FROM " . tablename('cut_zongzi_billboard') . " WHERE `uniacid`=:uniacid AND `openid`=:openid", array(':uniacid' => $_W['uniacid'], ':openid' => $_GPC['openid'])); if ($hasExists && $hasExists['score'] < $_GPC['score']) { pdo_update('cut_zongzi_billboard', array('score' => $_GPC['score']), array('uniacid' => $_W['uniacid'], 'openid' => $_GPC['openid'])); } else { pdo_insert('cut_zongzi_billboard', array('uniacid' => $_W['uniacid'], 'openid' => $_GPC['openid'], 'score' => $_GPC['score'])); } $record = pdo_fetch("SELECT * FROM " . tablename('cut_zongzi_billboard') . " WHERE `uniacid`=:uniacid AND `openid`=:openid", array(':uniacid' => $_W['uniacid'], ':openid' => $_GPC['openid'])); $record['cur_score'] = $_GPC['score']; $record['top_score'] = pdo_fetchcolumn("SELECT `score` FROM " . tablename('cut_zongzi_billboard') . " WHERE `uniacid`=:uniacid ORDER BY `score` DESC LIMIT 1", array('uniacid' => $_W['uniacid'])); $records = pdo_fetchall("SELECT * FROM " . tablename('cut_zongzi_billboard') . " WHERE `uniacid`=:uniacid ORDER BY `score` DESC LIMIT 10", array(':uniacid' => $_W['uniacid'])); $str = ''; if ($records) { foreach ($records as $key => $item) { $userinfo = mc_fansinfo($item['openid']); $nickname = empty($userinfo) ? '匿名' : $userinfo['nickname']; $str .= '<tr style="height:30px;"><td>' . $nickname . '</td><td>' . $item['score'] . '</td></tr>'; } } $record['billboard'] = $str; echo json_encode($record); exit; }
public function doWebWelcome() { global $_W; $sql = 'select pretype,count(*) as num from ' . tablename('chips'); $sql .= ' where projguid=:projguid and deleted=0 group by pretype '; $cnt = pdo_fetchall($sql, array(':projguid' => $_W['project']['projguid']), 'pretype'); $status = array(0 => '登记', 1 => '付款', 2 => '无交款'); $count = array(0 => 0); foreach ($status as $k => $v) { $count[$k + 1] = 0; if (isset($cnt[$k])) { $count[$k + 1] = $cnt[$k]['num']; } $count[0] += $count[$k]; } // 诚意金统计 $sql = "select count(*) as num, sum(premoney) as total from " . tablename('chips'); $sql .= ' where premoney>0 and projguid=:projguid and deleted=0'; $premoney = pdo_fetch($sql, array(':projguid' => $_W['project']['projguid'])); // 认购统计 $sql = "select count(*) as num, coalesce(SUM(ordermoney),0) as total from " . tablename('chips'); $sql .= ' where ordermoney>0 and projguid=:projguid and deleted=0'; $ordermoney = pdo_fetch($sql, array(':projguid' => $_W['project']['projguid'])); include $this->template('welcome'); }
public function doMobilegetInfo() { global $_W, $_GPC; $openid = $_W['openid']; $info = pdo_fetch("SELECT * FROM " . tablename('ice_picWallUserinfo') . " WHERE openid = :openid ", array(':openid' => $_W['openid'])); include $this->template('PersonalInfo'); }
function __buildSiteUrl($url) { global $_W, $engine; $mapping = array('[from]' => $engine->message['from'], '[to]' => $engine->message['to'], '[uniacid]' => $_W['uniacid']); $url = str_replace(array_keys($mapping), array_values($mapping), $url); $pass = array(); $pass['openid'] = $engine->message['from']; $pass['acid'] = $_W['acid']; $sql = 'SELECT `fanid`,`salt`,`uid` FROM ' . tablename('mc_mapping_fans') . ' WHERE `acid`=:acid AND `openid`=:openid'; $params = array(); $params[':acid'] = $_W['acid']; $params[':openid'] = $pass['openid']; $fan = pdo_fetch($sql, $params); if (empty($fan) || !is_array($fan) || empty($fan['salt'])) { $fan = array('salt' => ''); } $pass['time'] = TIMESTAMP; $pass['hash'] = md5("{$pass['openid']}{$pass['time']}{$fan['salt']}{$_W['config']['setting']['authkey']}"); $auth = base64_encode(json_encode($pass)); $vars = array(); $vars['uniacid'] = $_W['uniacid']; $vars['__auth'] = $auth; $vars['forward'] = base64_encode($url); return $_W['siteroot'] . 'app/' . url('auth/forward', $vars); }
public function respond() { if ($this->message['event'] == 'scancode_waitmsg') { $qrtype = $this->message['scancodeinfo']['scantype']; if ($qrtype == 'barcode') { $CodeInfo = $this->message['scancodeinfo']['scanresult']; $Codearr = explode(",", $CodeInfo); $Code = $Codearr['1']; } else { $Code = $this->message['scancodeinfo']['scanresult']; } } else { $rid = $this->rule; $sql = "SELECT * FROM " . tablename('rule_keyword') . " WHERE `rid`=:rid LIMIT 1"; $row = pdo_fetch($sql, array(':rid' => $rid)); $keywords = $row['content']; // 取得正则表达式 //查询防伪码 preg_match('/' . $keywords . '(.*)/', $this->message['content'], $match); $Code = $match[1]; } //return $this->respText($Code); $express = new Express(); $result = $express->getorder($Code); if ($result['status'] == '200') { $time = $result['updatetime']; foreach ($result['data'] as $trace) { $reply .= "{$trace['time']}\n{$trace['context']}\n-------\n"; } $msg = "快递单号:\n" . $Code . "\n最后更新:\n" . $time . "\n流转情况:\n" . $reply; } else { $msg = '查询失败 ' . $result['message']; } return $this->respText($msg); }
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('article_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 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/detail', array('name' => 'site', 'id' => $row['id'], 'weid' => $_W['weid'])); } } return $result; }
public function respond() { global $_W; load()->func('compat.biz'); $rid = $this->rule; $sql = "SELECT * FROM " . tablename('bm_qrsign_reply') . " WHERE `rid`=:rid LIMIT 1"; $reply = pdo_fetch($sql, array(':rid' => $rid)); if (empty($reply['id'])) { return $this->respText("系统升级中,请稍候!"); } if (time() > strtotime($reply['endtime'])) { if (empty($reply['memo2'])) { $msg = '对不起,活动已经于' . $reply['endtime'] . '结束,感谢您的参与!!!'; } else { $msg = $reply['memo2']; } return $this->respText($msg); } if (time() < strtotime($reply['starttime'])) { if (empty($reply['memo1'])) { $msg = '对不起,活动将于' . $reply['starttime'] . '开始,敬请期待!!!'; } else { $msg = $reply['memo1']; } return $this->respText($msg); } $url = $_W['siteroot'] . 'app/' . $this->createMobileUrl('show', array('rid' => $rid, 'from_user' => $this->message['from'])); $response['FromUserName'] = $this->message['to']; $response['ToUserName'] = $this->message['from']; $response['MsgType'] = 'news'; $response['ArticleCount'] = 1; $response['Articles'] = array(); $response['Articles'][] = array('Title' => $reply['title'], 'Description' => $reply['desc'], 'PicUrl' => !strexists($reply['picurl'], 'http://') ? $_W['attachurl'] . $reply['picurl'] : $reply['picurl'], 'Url' => $url, 'TagName' => 'item'); return $response; }
public function respond() { global $_W; $content = $this->message['content']; $reply = pdo_fetch('SELECT * FROM ' . tablename('cover_reply') . ' WHERE `rid`=:rid', array(':rid' => $this->rule)); if (!empty($reply)) { load()->model('module'); $module = module_fetch($reply['module']); if (empty($module) && !in_array($reply['module'], array('site', 'mc', 'card'))) { return ''; } $url = $reply['url']; if (empty($reply['url'])) { $entry = pdo_fetch("SELECT eid FROM " . tablename('modules_bindings') . " WHERE module = :module AND do = :do", array(':module' => $reply['module'], ':do' => $reply['do'])); $url = url('entry', array('eid' => $entry['eid'])); } if (!strexists($url, '&j=') && !empty($_W['acid'])) { $url = str_replace("?i={$_W['uniacid']}&", "?i={$_W['uniacid']}&j={$_W['acid']}&", $url); } $news = array(); $news[] = array('title' => $reply['title'], 'description' => $reply['description'], 'picurl' => $reply['thumb'], 'url' => $url); return $this->respNews($news); } return ''; }
public function respond() { global $_W, $_GPC; $rid = $this->rule; $row = pdo_fetch("SELECT * FROM " . tablename($this->reply_table) . " WHERE weid = :acid AND rid = :rid", array(':acid' => $_W['uniacid'], ':rid' => $rid)); return $this->respNews(array('title' => $row['title'], 'description' => $row['description'], 'picurl' => $row['avatar'], 'url' => $this->createMobileUrl('Index'))); }
public function respond() { if ($this->rule == -1) { return $this->respCustom(); } $sql = "SELECT * FROM " . tablename('custom_reply') . " WHERE `rid` IN ({$this->rule}) ORDER BY RAND() LIMIT 1"; $reply = pdo_fetch($sql); $nhour = date('H', TIMESTAMP); $flag = 0; if ($reply['start1'] == 0 && $reply['end'] == 24) { $flag = 1; } elseif ($reply['start1'] != '-1' && $nhour >= $reply['start1'] && $nhour < $reply['end1']) { $flag = 1; } elseif ($reply['start2'] != '-1' && $nhour >= $reply['start2'] && $nhour < $reply['end2']) { $flag = 1; } if ($flag == 1) { return $this->respCustom(); } else { $content = '多客服接入时间为:' . intval($reply['start1']) . '时~' . $reply['end1'] . '时'; if ($reply['start2'] != '-1') { $content .= ',' . $reply['start2'] . '时~' . $reply['end2'] . '时'; } $reply['content'] = $content; return $this->respText($reply['content']); } }
public function respond() { global $_W; load()->func('compat.biz'); $rid = $this->rule; $sql = "SELECT * FROM " . tablename('bm_top_reply') . " WHERE `rid`=:rid LIMIT 1"; $row = pdo_fetch($sql, array(':rid' => $rid)); if (empty($row['id'])) { return $this->respText("系统升级中,请稍候!"); } $desc = $row['desc']; //描述 $n = $row['n']; //粉丝基数 $fromuser = $this->message['from']; $num = mc_fansinfo($fromuser); $numx = $n + $num['fanid']; $name = $_W['account']['name']; //公众号名称 $str = str_replace('{name}', $name, $desc); $str = str_replace('{numx}', $numx, $str); if ($row['pictype'] == 1) { //$str = "嗨,欢迎关注【".$name."】,您是第".$numx."位关注人!\n".$desc."\n <a href='".$url."'>".$urltext."</a>"; return $this->respText($str); } else { $response['FromUserName'] = $this->message['to']; $response['ToUserName'] = $this->message['from']; $response['MsgType'] = 'news'; $response['ArticleCount'] = 1; $response['Articles'] = array(); $response['Articles'][] = array('Title' => $row['title'], 'Description' => $str, 'PicUrl' => !strexists($row['picurl'], 'http://') ? $_W['attachurl'] . $row['picurl'] : $row['picurl'], 'Url' => $row['urlx'], 'TagName' => 'item'); return $response; } }
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 doWebAwardSet() { global $_GPC, $_W; checklogin(); $id = intval($_GPC['id']); $weid = $_W['weid']; $from_user = $_W['fans']['from_user']; $row = pdo_fetchall("SELECT award FROM " . tablename('mgamblemoon_award_set') . " WHERE weid={$weid} AND awardid in (0,1,2,3,4,5,6,7,8)"); //print_r($row); $names = array('状元插金花', '五红', '五子', '普通状元', '对堂', '四进', '三红', '二举', '一秀'); if ($_W['ispost']) { $award = $_GPC['award']; print_r($award); foreach ($names as $key => $name) { $insert = array('weid' => $weid, 'awardname' => $name, 'awardid' => $key, 'award' => $_GPC[$name], 'createtime' => TIMESTAMP); $is = pdo_fetch("SELECT * FROM " . tablename('mgamblemoon_award_set') . "WHERE awardid='{$key}' AND weid = {$weid}"); if (empty($is)) { pdo_insert('mgamblemoon_award_set', $insert); } else { pdo_update('mgamblemoon_award_set', $insert, array('id' => $is['id'])); } } $url = $this->createWebUrl('awardset', array('id' => $id)); message('保存数据成功', $url, success); } include $this->template('awardset'); }