public function doManage() { global $_GPC, $_W; include model('rule'); $pindex = max(1, intval($_GPC['page'])); $psize = 20; $sql = "weid = :weid AND `module` = :module"; $params = array(); $params[':weid'] = $_W['weid']; $params[':module'] = 'bigwheel'; if (isset($_GPC['keywords'])) { $sql .= ' AND `name` LIKE :keywords'; $params[':keywords'] = "%{$_GPC['keywords']}%"; } $list = rule_search($sql, $params, $pindex, $psize, $total); $pager = pagination($total, $pindex, $psize); if (!empty($list)) { foreach ($list as &$item) { $condition = "`rid`={$item['id']}"; $item['keywords'] = rule_keywords_search($condition); $bigwheel = pdo_fetch("SELECT fansnum, viewnum,starttime,endtime,isshow FROM " . tablename('bigwheel_reply') . " WHERE rid = :rid ", array(':rid' => $item['id'])); $item['fansnum'] = $bigwheel['fansnum']; $item['viewnum'] = $bigwheel['viewnum']; $item['starttime'] = date('Y-m-d H:i', $bigwheel['starttime']); $endtime = $bigwheel['endtime'] + 86399; $item['endtime'] = date('Y-m-d H:i', $endtime); $nowtime = time(); if ($bigwheel['starttime'] > $nowtime) { $item['status'] = '<span class="label label-red">未开始</span>'; $item['show'] = 1; } elseif ($endtime < $nowtime) { $item['status'] = '<span class="label label-blue">已结束</span>'; $item['show'] = 0; } else { if ($bigwheel['isshow'] == 1) { $item['status'] = '<span class="label label-green">已开始</span>'; $item['show'] = 2; } else { $item['status'] = '<span class="label ">已暂停</span>'; $item['show'] = 1; } } $item['isshow'] = $bigwheel['isshow']; } } include $this->template('manage'); }
if(!empty($_GPC['rule'])) { $rid = intval($_GPC['rule']); $rule = rule_single($rid); if(!isset($_GPC['page']) && !isset($_GPC['keyword'])) { $isSingle = true; } } $pindex = max(1, intval($_GPC['page'])); $psize = 10; $total = 0; $list = rule_search("weid = '{$_W['weid']}' " . (!empty($_GPC['keyword']) ? " AND `name` LIKE '%{$_GPC['keyword']}%'" : ''), $pindex, $psize, $total); if (!empty($list)) { foreach($list as &$item) { $condition = "`rid`={$item['id']}"; $item['keywords'] = rule_keywords_search($condition); } } $pager = pagination($total, $pindex, $psize, create_url('menu/search'), array('ajaxcallback'=>'ajaxpager')); $wechat = $_W['account']; $temp = iunserializer($wechat['default']); if (is_array($temp)) { $wechat['default'] = $temp; $wechat['defaultrid'] = $temp['id']; } $temp = iunserializer($wechat['welcome']); if (is_array($temp)) { $wechat['welcome'] = $temp; $wechat['welcomerid'] = $temp['id']; }
public function doUpdateCard() { global $_GPC, $_W; $rid = intval($_GPC['rid']); if (empty($rid)) { $this->message('抱歉,传递的参数错误!'); } if ($_GPC['action'] == 'update') { $id = intval($_GPC['id']); if (empty($id)) { $this->message('抱歉,传递的参数错误!'); } //计算获奖总人数 $total_num = intval($_GPC['c_num_one']) + intval($_GPC['c_num_two']) + intval($_GPC['c_num_three']) + intval($_GPC['c_num_four']) + intval($_GPC['c_num_five']) + intval($_GPC['c_num_six']); $insert = array('keyword' => $_GPC['keyword'], 'title' => $_GPC['title'], 'content' => $_GPC['content'], 'ticket_information' => $_GPC['ticket_information'], 'description' => $_GPC['description'], 'Repeat_lottery_reply' => $_GPC['Repeat_lottery_reply'], 'start_picurl' => $_GPC['start_picurl'], 'end_theme' => $_GPC['end_theme'], 'end_instruction' => $_GPC['end_instruction'], 'end_picurl' => $_GPC['end_picurl'], 'probability' => $_GPC['probability'], 'c_type_one' => $_GPC['c_type_one'], 'c_name_one' => $_GPC['c_name_one'], 'c_num_one' => $_GPC['c_num_one'], 'c_type_two' => $_GPC['c_type_two'], 'c_name_two' => $_GPC['c_name_two'], 'c_num_two' => $_GPC['c_num_two'], 'c_type_three' => $_GPC['c_type_three'], 'c_name_three' => $_GPC['c_name_three'], 'c_num_three' => $_GPC['c_num_three'], 'c_type_four' => $_GPC['c_type_four'], 'c_name_four' => $_GPC['c_name_four'], 'c_num_four' => $_GPC['c_num_four'], 'c_type_five' => $_GPC['c_type_five'], 'c_name_five' => $_GPC['c_name_five'], 'c_num_five' => $_GPC['c_num_five'], 'c_type_six' => $_GPC['c_type_six'], 'c_name_six' => $_GPC['c_name_six'], 'c_num_six' => $_GPC['c_num_six'], 'award_times' => $_GPC['award_times'], 'number_times' => $_GPC['number_times'], 'most_num_times' => $_GPC['most_num_times'], 'sn_code' => $_GPC['sn_code'], 'sn_rename' => $_GPC['sn_rename'], 'tel_rename' => $_GPC['tel_rename'], 'show_num' => $_GPC['show_num'], 'total_num' => $total_num, 'createtime' => time(), 'copyright' => $_GPC['copyright'], 'share_title' => $_GPC['share_title'], 'share_desc' => $_GPC['share_desc'], 'share_url' => $_GPC['share_url'], 'share_txt' => $_GPC['share_txt']); //处理时间 list($starttime, $endtime) = explode('-', $_GPC['time']); $insert['starttime'] = strtotime($starttime); $insert['endtime'] = strtotime($endtime); $temp = pdo_update('scratch_reply', $insert, array('id' => $id, 'rid' => $rid)); if ($temp == false) { $this->message('抱歉,刚才修改的数据失败!', '', -1); } else { $this->message('刮刮卡修改数据成功!', create_url('site/module', array('do' => 'manage', 'name' => 'scratch')), 0); } } $reply = pdo_fetch("SELECT * FROM " . tablename($this->tablename) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid)); if ($reply == false) { message('抱歉,活动已经被删除了!'); } else { include model('rule'); $keyArr = rule_keywords_search("`rid`={$rid}"); foreach ($keyArr as $k => $v) { $keyArr[$k] = $v['content']; } $keyArr = array_reverse($keyArr); $reply['keyword'] = implode(' ', $keyArr); } //获取关键字 include $this->template('updatecard'); }
public function dobusinessEd1() { global $_GPC, $_W; $id = intval($_GPC['id']); $weid = $_W['weid']; if ($_GPC['action'] == 'save') { if ($_GPC['rid'] == 0) { $rid = $this->setkeyword($_GPC['keyword']); } else { $rid = $_GPC['rid']; } $insert = array('weid' => $_W['weid'], 'rid' => $rid, 'classid' => $_GPC['classid'], 'keyword' => $_GPC['keyword'], 'title' => $_GPC['title'], 'picurl' => $_GPC['picurl'], 'infos' => $_GPC['infos'], 'outlink' => $_GPC['outlink'], 'update_time' => time()); if ($id == 0) { //添加 $temp = pdo_insert('market_business', $insert); if ($temp == false) { $this->message('抱歉,刚才添加的商户数据失败!'); } else { $this->message('商户数据添加成功!', create_url('site/module', array('do' => 'businesslist', 'name' => 'market', 'classid' => $_GPC['classid'])), 0); } } else { //更新 $temp = pdo_update('market_business', $insert, array('id' => $id, 'weid' => $weid)); if ($temp == false) { $this->message('抱歉,刚才修改的商户数据失败!'); } else { $this->message('商户数修改成功!', create_url('site/module', array('do' => 'businesslist', 'name' => 'market', 'classid' => $_GPC['classid'])), 0); } } } if ($id == 0) { //添加 $row = array('rid' => 0, 'id' => 0, 'sort' => 0, 'classid' => $_GPC['classid']); } else { $row = pdo_fetch("SELECT * FROM " . tablename('market_business') . " WHERE id = :id and weid=:weid", array(':id' => $id, ':weid' => $_W['weid'])); include model('rule'); $keyArr = rule_keywords_search("`rid`={$row['rid']}"); foreach ($keyArr as $k => $v) { $keyArr[$k] = $v['content']; } $row['keyword'] = implode(' ', $keyArr); } include $this->template('businessed1'); }
public function doWebUpdateplay($value = '') { global $_GPC, $_W; $rid = intval($_GPC['rid']); if (empty($rid)) { $this->message_2('抱歉,传递的参数错误!'); } if ($_GPC['action'] == 'update') { $id = intval($_GPC['id']); if (empty($id)) { $this->message_2('抱歉,传递的参数错误!'); } $insert = array('rid' => $rid, 'keyword' => $_GPC['keyword'], 'qutype' => $_GPC['qutype'], 'title' => $_GPC['title'], 'description' => $_GPC['description'], 'reply1' => $_GPC['reply1'], 'reply2' => $_GPC['reply2'], 'reply3' => $_GPC['reply3'], 'reply4' => $_GPC['reply4'], 'reply5' => $_GPC['reply5'], 'qnum' => $_GPC['qnum'], 'tiao' => $_GPC['tiao'], 'tgkf' => $_GPC['tgkf'], 'ad' => $_GPC['ad'], 'isad' => $_GPC['isad']); //处理时间 list($starttime, $endtime) = explode('-', $_GPC['time']); $insert['starttime'] = strtotime($starttime); $insert['endtime'] = strtotime($endtime); $temp = pdo_update('fighting_reply', $insert, array('id' => $id, 'rid' => $rid)); if ($temp == false) { $this->message_2('抱歉,刚才修改的数据失败!', '', -1); } else { $this->message_2('一战到底修改数据成功!', create_url('site/module/playlist', array('state' => '', 'name' => 'fighting')), 0); } } $reply = pdo_fetch("SELECT * FROM " . tablename($this->tablename) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid)); if ($reply == false) { message('抱歉,活动已经被删除了!'); } else { include model('rule'); $keyArr = rule_keywords_search("`rid`={$rid}"); foreach ($keyArr as $k => $v) { $keyArr[$k] = $v['content']; } $keyArr = array_reverse($keyArr); $reply['keyword'] = implode(' ', $keyArr); } //获取关键字 include $this->template('updateplay'); }
public function doWebList() { //这个操作被定义用来呈现 管理中心导航菜单 global $_GPC, $_W; include model('rule'); $pindex = max(1, intval($_GPC['page'])); $psize = 20; $sql = "weid = :weid AND `module` = :module"; $params = array(); $params[':weid'] = $_W['weid']; $params[':module'] = 'photowall'; if (isset($_GPC['keywords'])) { $sql .= ' AND `name` LIKE :keywords'; $params[':keywords'] = "%{$_GPC['keywords']}%"; } $list = rule_search($sql, $params, $pindex, $psize, $total); $pager = pagination($total, $pindex, $psize); if (!empty($list)) { foreach ($list as &$item) { $condition = "`rid`={$item['id']}"; $item['keywords'] = rule_keywords_search($condition); $photowall = pdo_fetch("SELECT sendtimes,daysendtimes,starttime,endtime,isshow,isdes,status FROM " . tablename('photowall_reply') . " WHERE rid = :rid ", array(':rid' => $item['id'])); $item['starttime'] = date('Y-m-d H:i', $photowall['starttime']); $endtime = $photowall['endtime'] + 86399; $item['endtime'] = date('Y-m-d H:i', $endtime); $nowtime = time(); if ($photowall['starttime'] > $nowtime || $photowall['status'] == '0') { $item['statuss'] = '<span class="label label-red">未开始</span>'; $item['show'] = 1; } elseif ($endtime < $nowtime || $photowall['status'] == '3') { $item['statuss'] = '<span class="label label-blue">已结束</span>'; $item['show'] = 0; } elseif ($photowall['status'] == '2') { $item['statuss'] = '<span class="label ">已暂停</span>'; } elseif ($photowall['status'] == '1') { $item['statuss'] = '<span class="label label-green">已开始</span>'; } else { $item['statuss'] = '<span class="label label-green">状态未知</span>'; } $item['sendtimes'] = $photowall['sendtimes']; $item['daysendtimes'] = $photowall['daysendtimes']; $item['isshow'] = $photowall['isshow']; $item['isdes'] = $photowall['isdes']; $item['status'] = $photowall['status']; } } include $this->template('manage'); }
$params[':module'] = $module; } $list = rule_search($condition, $params, $pindex, $psize, $total); $pager = pagination($total, $pindex, $psize); $bindings = array(); if ($module != 'all') { $bindings = pdo_fetchall('SELECT * FROM ' . tablename('modules_bindings') . ' WHERE `entry`=\'rule\' AND `module`=:module', array(':module' => $module)); } else { $bindings = pdo_fetchall('SELECT * FROM ' . tablename('modules_bindings') . ' WHERE `entry`=\'rule\''); } if (!empty($list)) { foreach ($list as &$item) { $condition = '`rid`=:rid'; $params = array(); $params[':rid'] = $item['id']; $item['keywords'] = rule_keywords_search($condition, $params); $item['options'] = array(); foreach ($bindings as $opt) { if ($opt['module'] == $item['module']) { if (!empty($opt['call'])) { $site = WeUtility::createModuleSite($item['module']); if (method_exists($site, $opt['call'])) { $ret = $site->{$opt}['call'](); if (is_array($ret)) { foreach ($ret as $et) { $et['url'] .= strexists($et['url'], '?') ? "&id={$item['id']}" : "?id={$item['id']}"; $item['options'][] = array('title' => $et['title'], 'link' => $et['url']); } } } } else {
public function matcherText($order = -1) { $pars = array(); $input = $this->message['content']; if (!isset($input)) { return $pars; } global $_W; $order = intval($order); $condition = "`status`=1 AND (`weid`='{$_W['weid']}' OR `weid`=0 " . (!empty($_W['account']['subwechats']) ? " OR `weid` IN ({$_W['account']['subwechats']})" : '') . ") AND `displayorder`>{$order}"; $condition .= " AND (((`type` = '1' OR `type` = '2') AND `content` = :c1) OR (`type` = '4') OR (`type` = '3' AND :c2 REGEXP `content`) OR (`type` = '2' AND INSTR(:c3, `content`) > 0))"; $params = array(); $params[':c1'] = $input; $params[':c2'] = $input; $params[':c3'] = $input; $keywords = rule_keywords_search($condition, $params); if (empty($keywords)) { return $pars; } foreach ($keywords as $kwd) { $params = array('module' => $kwd['module'], 'rule' => $kwd['rid'], 'priority' => $kwd['displayorder'], 'keyword' => $kwd); $pars[] = $params; } return $pars; }
public function doManage() { global $_GPC, $_W; include model('rule'); $pindex = max(1, intval($_GPC['page'])); $psize = 20; $sql = "weid = :weid AND `module` = :module"; $params = array(); $params[':weid'] = $_W['weid']; $params[':module'] = 'vote'; if (isset($_GPC['keywords'])) { $sql .= ' AND `name` LIKE :keywords'; $params[':keywords'] = "%{$_GPC['keywords']}%"; } $list = rule_search($sql, $params, $pindex, $psize, $total); $pager = pagination($total, $pindex, $psize); if (!empty($list)) { foreach ($list as &$item) { $condition = "`rid`={$item['id']}"; $item['keywords'] = rule_keywords_search($condition); $vote = pdo_fetch("SELECT title,votenum,votetimes,votelimit,votetotal,viewnum,starttime,endtime,status FROM " . tablename('vote_reply') . " WHERE rid = :rid ", array(':rid' => $item['id'])); $item['title'] = $vote['title']; $item['votenum'] = $vote['votenum']; $item['votetimes'] = $vote['votetimes']; $item['viewnum'] = $vote['viewnum']; $item['starttime'] = date('Y-m-d H:i', $vote['starttime']); $endtime = $vote['endtime'] + 86399; $item['endtime'] = date('Y-m-d H:i', $endtime); $limits = ""; if ($vote['votelimit'] == 1) { $limits = "允许投票 " . $vote['votetotal'] . " 人"; } else { $limits = "投票期限: " . date('Y-m-d H:i', $vote['starttime']) . " 至 " . date('Y-m-d H:i', $endtime); } $item['limits'] = $limits; $nowtime = time(); if ($item['votelimit'] == 1) { if ($item['votetotal'] > 0 && $item['votenum'] >= $item['votetotal']) { $item['status'] = '<span class="label label-blue">已结束</span>'; $item['show'] = 0; } else { $item['status'] = '<span class="label label-satgreen">已开始</span>'; $item['show'] = 2; } } else { if ($vote['starttime'] > $nowtime) { $item['status'] = '<span class="label label-red">未开始</span>'; $item['show'] = 1; } elseif ($vote['endtime'] + 86399 < $nowtime) { $item['status'] = '<span class="label label-blue">已结束</span>'; $item['show'] = 0; } else { if ($vote['status'] == 1) { $item['status'] = '<span class="label label-satgreen">已开始</span>'; $item['show'] = 2; } else { $item['status'] = '<span class="label ">已暂停</span>'; $item['show'] = 1; } } } } } include $this->template('manage'); }
private function matcherText() { $response = array('module' => '', 'rule' => ''); $input = $this->message['content']; if (!isset($input)) { return $response; } global $_W; /* * @TODO 需要增加缓存 */ $condition = "`weid`='{$_W['weid']}'"; $keywords = rule_keywords_search($condition . " AND `content` = '" . addslashes($input) . "' AND (`type` = '1' OR `type` = '2')"); if (empty($keywords)) { $needles = rule_keywords_search($condition . " AND `type` = '3'"); foreach($needles as $needle) { if(preg_match($needle['content'], $input, $match) !== 0) { $keywords[] = array( 'rid' => $needle['rid'], 'content' => $needle['content'], 'type' => $needle['type'], 'module' => $needle['module'], 'weid' => $needle['weid'], ); break; } } if (empty($keywords)) { $needles = rule_keywords_search($condition . " AND `type` = '2'"); $i = 1; foreach($needles as $needle) { if ($i >= 5) { break; } if(stripos($input, $needle['content']) !== false) { $keywords[] = array( 'rid' => $needle['rid'], 'content' => $needle['content'], 'type' => $needle['type'], 'module' => $needle['module'], 'weid' => $needle['weid'], ); $i++; } } } } if (empty($keywords)) { return $response; } if (count($keywords) > 1) { srand((float) microtime() * 10000000); $index = array_rand($keywords); $this->keyword = $keywords[$index]; } else { $this->keyword = $keywords[0]; } $response = array( 'module' => $this->keyword['module'], 'rule' => $this->keyword['rid'], ); return $response; }