public function index() { if (isset($_REQUEST['tid'])) { $tid = intval($_REQUEST['tid']); } else { $tid = intval($_SESSION['forum_post_tid']); } $_SESSION['forum_post_tid'] = $tid; $where = 'WHERE fp.tid = ' . $tid; $parameter = array(); $uname = trim($_REQUEST['uname']); if (!empty($uname)) { $this->assign("uname", $uname); $parameter['uname'] = $uname; $match_key = segmentToUnicodeA($uname, '+'); $where .= " AND match(u.user_name_match) against('" . $match_key . "' IN BOOLEAN MODE) "; } $model = M(); $sql = 'SELECT COUNT(DISTINCT fp.pid) AS pcount FROM ' . C("DB_PREFIX") . 'forum_post AS fp LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = fp.uid ' . $where; $count = $model->query($sql); $count = $count[0]['pcount']; $sql = 'SELECT fp.pid,LEFT(fp.content,80) AS content,u.user_name,fp.create_time,fp.share_id FROM ' . C("DB_PREFIX") . 'forum_post AS fp LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = fp.uid ' . $where . ' GROUP BY fp.pid'; $this->_sqlList($model, $sql, $count, $parameter, 'fp.pid', false, 'returnUrl1'); $this->display(); return; }
public function index() { $where = ''; $parameter = array(); $keyword = trim($_REQUEST['keyword']); $uname = trim($_REQUEST['uname']); $sid = intval($_REQUEST['sid']); $city_id = intval($_REQUEST['city_id']); if (!empty($keyword)) { $this->assign("keyword", $keyword); $parameter['keyword'] = $keyword; $where .= " AND sg.name LIKE '%" . mysqlLikeQuote($keyword) . "%' "; } if (!empty($uname)) { $this->assign("uname", $uname); $parameter['uname'] = $uname; $match_key = segmentToUnicodeA($uname, '+'); $where .= " AND match(u.user_name_match) against('" . $match_key . "' IN BOOLEAN MODE) "; $like_name = mysqlLikeQuote($uname); $where .= ' AND u.user_name LIKE \'%' . $like_name . '%\''; } if ($sid > 0) { $this->assign("sid", $sid); $parameter['sid'] = $sid; $where .= " AND sg.sid = {$sid}"; } if ($city_id > 0) { $this->assign("city_id", $city_id); $parameter['city_id'] = $city_id; $where .= " AND sg.city_id = {$city_id}"; } $model = M(); if (!empty($where)) { $where = 'WHERE 1' . $where; } $sql = 'SELECT COUNT(DISTINCT sg.gid) AS tcount FROM ' . C("DB_PREFIX") . 'second_goods AS sg LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = sg.uid ' . $where; $count = $model->query($sql); $count = $count[0]['tcount']; $sql = 'SELECT sg.*,s.name AS sname,u.user_name FROM ' . C("DB_PREFIX") . 'second_goods AS sg LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = sg.uid LEFT JOIN ' . C("DB_PREFIX") . 'second AS s ON s.sid = sg.sid ' . $where . ' GROUP BY sg.gid'; $this->_sqlList($model, $sql, $count, $parameter, 'sg.gid'); $second_list = D("Second")->order('sort asc,sid asc')->findAll(); $this->assign("second_list", $second_list); $city_list = D("Region")->where('parent_id = 0')->order('sort asc,id asc')->findAll(); $this->assign("city_list", $city_list); $this->display(); return; }
public function index() { $where = ''; $parameter = array(); $uname = trim($_REQUEST['uname']); $begin_time_str = trim($_REQUEST['begin_time']); $end_time_str = trim($_REQUEST['end_time']); $begin_time = !empty($begin_time_str) ? strZTime($begin_time_str) : 0; $end_time = !empty($end_time_str) ? strZTime($end_time_str) : 0; if (!empty($uname)) { $this->assign("uname", $uname); $parameter['uname'] = $uname; $match_key = segmentToUnicodeA($uname, '+'); $where .= " AND match(u.user_name_match) against('" . $match_key . "' IN BOOLEAN MODE) "; $like_name = mysqlLikeQuote($uname); $where .= ' AND u.user_name LIKE \'%' . $like_name . '%\''; } if ($begin_time > 0) { $this->assign("begin_time", $begin_time_str); $parameter['begin_time'] = $begin_time_str; $where .= " AND usl.create_day >= '" . $begin_time . "'"; } if ($end_time > 0) { $this->assign("end_time", $end_time_str); $parameter['end_time'] = $end_time_str; $where .= " AND usl.create_day < '" . ($end_time + 86400) . "'"; } $model = M(); if (!empty($where)) { $where = 'WHERE 1' . $where; } $sql = 'SELECT COUNT(DISTINCT usl.id) AS tcount FROM ' . C("DB_PREFIX") . 'user_score_log AS usl LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = usl.uid ' . $where; $count = $model->query($sql); $count = $count[0]['tcount']; $sql = 'SELECT usl.*,u.user_name FROM ' . C("DB_PREFIX") . 'user_score_log AS usl LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = usl.uid ' . $where . ' GROUP BY usl.id'; $this->_sqlList($model, $sql, $count, $parameter, 'usl.id'); $list = $this->get('list'); foreach ($list as $k => $v) { if ($v['score'] >= 0) { $list[$k]['inc_score'] = abs($v['score']); } else { $list[$k]['dec_score'] = abs($v['score']); } } $this->assign('list', $list); $this->display(); return; }
public function index() { $where = ''; $parameter = array(); $uname = trim($_REQUEST['uname']); $begin_time_str = trim($_REQUEST['begin_time']); $end_time_str = trim($_REQUEST['end_time']); $begin_time = !empty($begin_time_str) ? strZTime($begin_time_str) : 0; $end_time = !empty($end_time_str) ? strZTime($end_time_str) : 0; if (!empty($uname)) { $this->assign("uname", $uname); $parameter['uname'] = $uname; $match_key = segmentToUnicodeA($uname, '+'); $where .= " AND match(u.user_name_match) against('" . $match_key . "' IN BOOLEAN MODE) "; $like_name = mysqlLikeQuote($uname); $where .= ' AND u.user_name LIKE \'%' . $like_name . '%\''; } if ($begin_time > 0) { $this->assign("begin_time", $begin_time_str); $parameter['begin_time'] = $begin_time_str; $where .= " AND r.create_day >= '" . $begin_time . "'"; } if ($end_time > 0) { $this->assign("end_time", $end_time_str); $parameter['end_time'] = $end_time_str; $where .= " AND r.create_day < '" . ($end_time + 86400) . "'"; } $model = M(); if (!empty($where)) { $where = 'WHERE 1' . $where; } $sql = 'SELECT COUNT(DISTINCT r.id) AS tcount FROM ' . C("DB_PREFIX") . 'referrals AS r LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = r.rid ' . $where; $count = $model->query($sql); $count = $count[0]['tcount']; $sql = 'SELECT r.*,CONCAT(u.user_name,\':\',us.reg_ip) as ruser_name,CONCAT(u1.user_name,\':\',us1.reg_ip) as user_name FROM ' . C("DB_PREFIX") . 'referrals AS r LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = r.rid LEFT JOIN ' . C("DB_PREFIX") . 'user_status AS us ON us.uid = r.rid LEFT JOIN ' . C("DB_PREFIX") . 'user AS u1 ON u1.uid = r.uid LEFT JOIN ' . C("DB_PREFIX") . 'user_status AS us1 ON us1.uid = r.uid ' . $where . ' GROUP BY r.id'; $this->_sqlList($model, $sql, $count, $parameter, 'r.id'); $this->display(); return; }
public function index() { $where = ''; $parameter = array(); $keyword = trim($_REQUEST['keyword']); $uname = trim($_REQUEST['uname']); $cid = (int) $_REQUEST['cid']; if (!empty($keyword)) { $this->assign("keyword", $keyword); $parameter['keyword'] = $keyword; $where .= " AND a.title LIKE '%" . mysqlLikeQuote($keyword) . "%' "; } if (!empty($uname)) { $this->assign("uname", $uname); $parameter['uname'] = $uname; $match_key = segmentToUnicodeA($uname, '+'); $where .= " AND match(u.user_name_match) against('" . $match_key . "' IN BOOLEAN MODE) "; $like_name = mysqlLikeQuote($uname); $where .= ' AND u.user_name LIKE \'%' . $like_name . '%\''; } if ($cid > 0) { $this->assign("cid", $cid); $parameter['cid'] = $cid; $where .= " AND a.cid = {$cid}"; } $model = M(); if (!empty($where)) { $where = 'WHERE' . $where; $where = str_replace('WHERE AND', 'WHERE', $where); } $sql = 'SELECT COUNT(DISTINCT a.id) AS tcount FROM ' . C("DB_PREFIX") . 'album AS a LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = a.uid ' . $where; $count = $model->query($sql); $count = $count[0]['tcount']; $sql = 'SELECT a.*,ac.name AS cname,u.user_name FROM ' . C("DB_PREFIX") . 'album AS a LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = a.uid LEFT JOIN ' . C("DB_PREFIX") . 'album_category AS ac ON ac.id = a.cid ' . $where . ' GROUP BY a.id'; $this->_sqlList($model, $sql, $count, $parameter, 'a.id'); $category_list = D("AlbumCategory")->order('sort asc,id asc')->findAll(); $this->assign("category_list", $category_list); $this->display(); return; }
public function index() { $where = ''; $parameter = array(); $keyword = trim($_REQUEST['keyword']); $uname = trim($_REQUEST['uname']); $fid = intval($_REQUEST['fid']); if (!empty($keyword)) { $this->assign("keyword", $keyword); $parameter['keyword'] = $keyword; $where .= " AND ft.title LIKE '%" . mysqlLikeQuote($keyword) . "%' "; } if (!empty($uname)) { $this->assign("uname", $uname); $parameter['uname'] = $uname; $match_key = segmentToUnicodeA($uname, '+'); $where .= " AND match(u.user_name_match) against('" . $match_key . "' IN BOOLEAN MODE) "; } if ($fid > 0) { $this->assign("fid", $fid); $parameter['fid'] = $fid; $where .= " AND ft.fid = {$fid}"; } $model = M(); if (!empty($where)) { $where = 'WHERE 1' . $where; } $sql = 'SELECT COUNT(DISTINCT ft.tid) AS tcount FROM ' . C("DB_PREFIX") . 'forum_thread AS ft LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = ft.uid ' . $where; $count = $model->query($sql); $count = $count[0]['tcount']; $sql = 'SELECT ft.tid,LEFT(ft.title,80) AS title,u.user_name,ft.create_time,ft.post_count,ft.is_top,ft.is_best, ft.is_event,f.name AS fname,ft.share_id FROM ' . C("DB_PREFIX") . 'forum_thread AS ft LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = ft.uid LEFT JOIN ' . C("DB_PREFIX") . 'forum AS f ON f.fid = ft.fid ' . $where . ' GROUP BY ft.tid'; $this->_sqlList($model, $sql, $count, $parameter, 'ft.tid'); $cate_tree = M("Forum")->findAll(); $cate_tree = D("Forum")->toFormatTree($cate_tree, 'name', 'fid', 'parent_id'); $this->assign("cate_tree", $cate_tree); $this->display(); return; }
public function index() { $where = ''; $parameter = array(); $keyword = trim($_REQUEST['keyword']); $uname = trim($_REQUEST['uname']); $aid = intval($_REQUEST['aid']); if (!empty($keyword)) { $this->assign("keyword", $keyword); $parameter['keyword'] = $keyword; $where .= " AND at.title LIKE '%" . mysqlLikeQuote($keyword) . "%' "; } if (!empty($uname)) { $this->assign("uname", $uname); $parameter['uname'] = $uname; $match_key = segmentToUnicodeA($uname, '+'); $where .= " AND match(u.user_name_match) against('" . $match_key . "' IN BOOLEAN MODE) "; } if ($aid > 0) { $this->assign("aid", $aid); $parameter['aid'] = $aid; $where .= " AND at.aid = {$aid}"; } $model = M(); if (!empty($where)) { $where = 'WHERE 1' . $where; } $sql = 'SELECT COUNT(DISTINCT at.tid) AS tcount FROM ' . C("DB_PREFIX") . 'ask_thread AS at LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = at.uid ' . $where; $count = $model->query($sql); $count = $count[0]['tcount']; $sql = 'SELECT at.tid,LEFT(at.title,80) AS title,u.user_name,at.create_time,at.post_count,at.is_top,at.is_best, a.name AS aname,at.share_id FROM ' . C("DB_PREFIX") . 'ask_thread AS at LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = at.uid LEFT JOIN ' . C("DB_PREFIX") . 'ask AS a ON a.aid = at.aid ' . $where . ' GROUP BY at.tid'; $this->_sqlList($model, $sql, $count, $parameter, 'at.tid'); $cate_tree = M("Ask")->order('sort asc,aid asc')->findAll(); $this->assign("cate_tree", $cate_tree); $this->display(); return; }
public function index() { $where = ''; $parameter = array(); $user_name = trim($_REQUEST['user_name']); $day_time = trim($_REQUEST['day_time']); $status = !isset($_REQUEST['status']) ? -1 : intval($_REQUEST['status']); if (!empty($user_name)) { $this->assign("user_name", $user_name); $parameter['user_name'] = $user_name; $match_key = segmentToUnicodeA($user_name, '+'); $where .= " AND match(u.user_name_match) against('" . $match_key . "' IN BOOLEAN MODE) "; } if (!empty($day_time)) { $this->assign("day_time", $day_time); $parameter['day_time'] = $day_time; $day_time = strZTime($day_time); $where .= " AND ud.day_time = '{$day_time}'"; } if ($status > -1) { $this->assign("status", $status); $parameter['status'] = $status; $where .= " AND ud.status = {$status}"; } else { $this->assign("status", -1); } $model = M(); if (!empty($where)) { $where = 'WHERE 1' . $where; } $sql = 'SELECT COUNT(ud.id) AS tcount FROM ' . C("DB_PREFIX") . 'user_daren AS ud INNER JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = ud.uid ' . $where; $count = $model->query($sql); $count = $count[0]['tcount']; $sql = 'SELECT ud.*,u.user_name FROM ' . C("DB_PREFIX") . 'user_daren AS ud INNER JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = ud.uid ' . $where; $this->_sqlList($model, $sql, $count, $parameter); $this->display(); }
public function getUserList() { $key = trim($_REQUEST['key']); $where = ''; if (!empty($key)) { $match_key = segmentToUnicodeA($key, '+'); $where .= " AND match(user_name_match) against('" . $match_key . "' IN BOOLEAN MODE) "; $like_name = mysqlLikeQuote($key); $where .= ' AND user_name LIKE \'%' . $like_name . '%\''; } $sql = 'SELECT uid,user_name FROM ' . C("DB_PREFIX") . 'user WHERE status = 1 ' . $where . ' ORDER BY uid DESC limit 0,30'; $userList = M()->query($sql); echo json_encode($userList); }
public function look() { $where = ''; $parameter = array(); $keyword = trim($_REQUEST['keyword']); $uname = trim($_REQUEST['uname']); $type = trim($_REQUEST['type']); $share_data = !isset($_REQUEST['share_data']) ? 'img' : trim($_REQUEST['share_data']); $cate_id = intval($_REQUEST['cate_id']); $status = !isset($_REQUEST['status']) ? 0 : intval($_REQUEST['status']); $inner_sql = ''; $where .= " WHERE sp.type = 'look'"; if (!empty($keyword)) { $this->assign("keyword", $keyword); $parameter['keyword'] = $keyword; $match_key = segmentToUnicodeA($keyword, '+'); $where .= " AND match(sm.content_match) against('" . $match_key . "' IN BOOLEAN MODE) "; $inner_sql .= 'INNER JOIN ' . C("DB_PREFIX") . 'share_match AS sm ON sm.share_id = s.share_id '; } if (!empty($uname)) { $this->assign("uname", $uname); $parameter['uname'] = $uname; $match_key = segmentToUnicodeA($uname, '+'); $where .= " AND match(u.user_name_match) against('" . $match_key . "' IN BOOLEAN MODE) "; $like_name = mysqlLikeQuote($uname); $where .= ' AND u.user_name LIKE \'%' . $like_name . '%\''; } $model = M(); $sql = 'SELECT COUNT(DISTINCT s.share_id) AS scount FROM ' . C("DB_PREFIX") . 'share_photo AS sp INNER JOIN ' . C("DB_PREFIX") . 'share AS s ON s.share_id = sp.share_id LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = s.uid ' . $inner_sql . $where; $count = $model->query($sql); $count = $count[0]['scount']; $sql = 'SELECT s.share_id,LEFT(s.content,80) AS content,u.user_name,s.create_time,s.collect_count,s.relay_count, s.comment_count,s.type,s.share_data,s.status,s.is_best FROM ' . C("DB_PREFIX") . 'share_photo AS sp INNER JOIN ' . C("DB_PREFIX") . 'share AS s ON s.share_id = sp.share_id LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = s.uid ' . $inner_sql . $where . ' GROUP BY s.share_id'; $this->_sqlList($model, $sql, $count, $parameter, 's.share_id'); $this->display(); }
public function check() { $where = ''; $parameter = array(); $uname = trim($_REQUEST['uname']); $mid = intval($_REQUEST['mid']); if (!empty($uname)) { $this->assign("uname", $uname); $parameter['uname'] = $uname; $match_key = segmentToUnicodeA($uname, '+'); $where .= " AND match(u.user_name_match) against('" . $match_key . "' IN BOOLEAN MODE) "; $like_name = mysqlLikeQuote($uname); $where .= ' AND u.user_name LIKE \'%' . $like_name . '%\''; } if ($mid > 0) { $this->assign("mid", $mid); $parameter['mid'] = $mid; $where .= " AND ma.mid = {$mid}"; } if (!empty($where)) { $where = ' WHERE' . $where; $where = str_replace('WHERE AND', 'WHERE', $where); } $model = M(); $sql = 'SELECT COUNT(DISTINCT ma.id) AS scount FROM ' . C("DB_PREFIX") . 'medal_apply AS ma LEFT JOIN ' . C("DB_PREFIX") . 'medal AS m ON m.mid = ma.mid LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = ma.uid ' . $where; $count = $model->query($sql); $count = $count[0]['scount']; $sql = 'SELECT ma.id,ma.reason,ma.create_time,u.user_name,m.name,m.image,m.give_type FROM ' . C("DB_PREFIX") . 'medal_apply AS ma LEFT JOIN ' . C("DB_PREFIX") . 'medal AS m ON m.mid = ma.mid LEFT JOIN ' . C("DB_PREFIX") . 'user AS u ON u.uid = ma.uid ' . $where; $this->_sqlList($model, $sql, $count, $parameter, 'ma.id'); $medal_list = D('Medal')->where('status = 1 AND give_type = 1')->order('sort asc')->findAll(); $this->assign("medal_list", $medal_list); $this->display(); }