function allmember_advancesearch_old() { $member_list = array(); $page_links = ''; $arr = array('ismok' => 'smoking', 'idrink' => 'drinking', 'child' => 'children', 'wantchildren' => 'wantchildren', 'height1' => '', 'height2' => '', 'weight1' => '', 'weight2' => '', 'body' => 'body', 'education' => 'education', 'occupation' => 'occupation', 'house' => 'house', 'vehicle' => 'vehicle', 'corptp' => 'corptype', 'family' => 'family'); foreach ($arr as $k => $v) { $k != $v && (${$v} = ''); ${$k} = empty($_GET[$k]) ? '' : $_GET[$k]; // $$v = ''; if (!empty(${$k}) && is_array(${$k})) { ${$v} = implode(',', ${$k}); } } $adminid = $GLOBALS['adminid']; $admingroup = $GLOBALS['groupid']; $page1 = MooGetGPC('page', 'integer', 'G'); //分页 $page_per = 50; $page = get_page(); $limit = 50; $offset = ($page - 1) * $limit; //note 消除记忆功能 if (!$page1) { $offset = 0; $page = 1; } $members_condition = $member_admininfo_condition = $memberfield_condition = array(); if ($_GET['uid']) { $uid = MooGetGPC('uid', 'integer', 'G'); $members_condition[] = " m.uid='{$uid}'"; } if ($_GET['grade'] != '') { $effect_grade = MooGetGPC('grade', 'integer', 'G'); //$member_backinfo_sql .= " effect_grad='{$effect_grade}'"; $member_admininfo_condition[] = " ma.effect_grade='{$effect_grade}'"; } if ($_GET['usertype']) { $usertype = MooGetGPC('usertype', 'integer', 'G'); $members_condition[] = " m.usertype='{$usertype}'"; } if ($_GET['marriage']) { $marriage = MooGetGPC('marriage', 'integer', 'G'); $members_condition[] = " m.marriage='{$marriage}'"; } if ($_GET['allotdate1']) { $allodate1 = strtotime(MooGetGPC('allotdate1', 'string', 'G')); $members_condition[] = " b.allotdate>='{$allodate1}'"; } if ($_GET['allotdate2']) { $allodate2 = strtotime(MooGetGPC('allotdate2', 'string', 'G')); $members_condition[] = " b.allotdate<='{$allodate2}'"; } //note 搜索上传照片数目条件 if (!empty($_GET['uploadpicnum'])) { $uploadpicnum = MooGetGPC('uploadpicnum', 'integer', 'G'); switch ($uploadpicnum) { case 6: $members_condition[] = " b.mainimg = '' "; break; case 1: $members_condition[] = " m.pic_num >= 1 and m.pic_num <= 5 "; break; case 2: $members_condition[] = " m.pic_num >= 6 and m.pic_num <= 10 "; break; case 3: $members_condition[] = " m.pic_num >= 11 and m.pic_num <= 15 "; break; case 4: $members_condition[] = " m.pic_num >= 16 and m.pic_num <= 20 "; break; case 5: $members_condition[] = " m.pic_num > 20 "; break; } } //note 超过几天没有联系的 if ($_GET['nocontactdays']) { $nocontactdays = MooGetGPC('nocontactdays', 'integer', 'G'); $nowtime = time(); $oneday = $nowtime - 86400; $twoday = $nowtime - 2 * 86400; $threeday = $nowtime - 3 * 86400; $fourday = $nowtime - 4 * 86400; switch ($nocontactdays) { case 1: $member_admininfo_condition[] = " ma.dateline < '{$oneday}' and ma.dateline >= '{$twoday}' "; break; case 2: $member_admininfo_condition[] = " ma.dateline < '{$twoday}' and ma.dateline >= '{$threeday}' "; break; case 3: $member_admininfo_condition[] = " ma.dateline < '{$threeday}' and ma.dateline >= '{$fourday}' "; break; } } //note 登录次数 + 最后登录时间 (3天)= 最近登录次数 if ($_GET['recentloginnum']) { $recentloginnum = MooGetGPC('recentloginnum', 'integer', 'G'); $nowtime = time(); $threeday = $nowtime - 3 * 86400; switch ($recentloginnum) { case 1: $members_condition[] = " l.login_meb <= 10 and l.login_meb >=1 and l.last_login_time > '{$threeday}' "; break; case 2: $members_condition[] = " l.login_meb <= 20 and l.login_meb >=11 and l.last_login_time > '{$threeday}' "; break; case 3: $members_condition[] = " l.login_meb <= 21 and l.login_meb >=30 and l.last_login_time > '{$threeday}' "; break; case 4: $members_condition[] = " l.login_meb >=30 and l.last_login_time > '{$threeday}' "; break; } } if ($_GET['gender'] != '') { $gender = MooGetGPC('gender', 'integer', 'G'); if ($gender == '1') { $gender = 0; } if ($gender == '2') { $gender = 1; } $members_condition[] = " m.gender='{$gender}'"; } if ($_GET['regdate1']) { $regdate1 = strtotime(MooGetGPC('regdate1', 'string', 'G')); $members_condition[] = " m.regdate>='{$regdate1}'"; } if ($_GET['regdate2']) { $regdate2 = strtotime(MooGetGPC('regdate2', 'string', 'G')); $members_condition[] = " m.regdate<='{$regdate2}'"; } if ($_GET['s_cid'] != '') { $s_cid = MooGetGPC('s_cid', 'integer', 'G'); $members_condition[] = " m.s_cid='{$s_cid}'"; } if ($_GET['next_contact_time1']) { $next_contact_time1 = strtotime(MooGetGPC('next_contact_time1', 'string', 'G')); $member_admininfo_condition[] = " ma.next_contact_time>='{$next_contact_time1}'"; } if ($_GET['next_contact_time2']) { $next_contact_time2 = strtotime(MooGetGPC('next_contact_time2', 'string', 'G')); $member_admininfo_condition[] = " ma.next_contact_time<='{$next_contact_time2}'"; } if ($_GET['age1']) { $age1 = MooGetGPC('age1', 'integer', 'G'); $tmp_start = gmdate('Y', time()) - $age1; $members_condition[] = " m.birthyear<='{$tmp_start}'"; } if ($_GET['age2']) { $age2 = MooGetGPC('age2', 'integer', 'G'); $tmp_end = gmdate('Y', time()) - $age2; $members_condition[] = " m.birthyear>='{$tmp_end}'"; } if ($_GET['last_login_time1']) { $last_login_time1 = strtotime(MooGetGPC('last_login_time1', 'string', 'G')); $members_condition[] = " l.last_login_time>='{$last_login_time1}'"; } if ($_GET['last_login_time2']) { $last_login_time2 = strtotime(MooGetGPC('last_login_time2', 'string', 'G')); $members_condition[] = " l.last_login_time<='{$last_login_time2}'"; } if ($_GET['uploadtime']) { $uploadtime = date('Y/m/d', strtotime(MooGetGPC('uploadtime', 'string', 'G'))); $members_condition[] = " p.pic_date='{$uploadtime}'"; } if (!empty($_GET['province']) && $_GET['province'] != '-1') { $province = MooGetGPC('province', 'integer', 'G'); $members_condition[] = " m.province='{$province}'"; } if (!empty($_GET['city']) && $_GET['city'] != '-1') { $city = MooGetGPC('city', 'integer', 'G'); $members_condition[] = " m.city='{$city}'"; } if (!empty($_GET['salary']) && $_GET['salary'] != '-1') { $salary = MooGetGPC('salary', 'integer', 'G'); $members_condition[] = " m.salary='{$salary}'"; } if ($_GET['sid']) { $sid = MooGetGPC('sid', 'integer', 'G'); $members_condition[] = " m.sid='{$sid}'"; } if (!empty($_GET['master_member'])) { $master_member = MooGetGPC('master_member', 'integer', 'G'); $member_admininfo_condition[] = " ma.master_member='{$master_member}'"; } if ($_GET['telphone']) { $telphone = trim(MooGetGPC('telphone', 'string', 'G')); $members_condition[] = " m.telphone='{$telphone}'"; } //当前在线1,2为一天,3为一周内,4为一周外 if ($_GET['online']) { $online = MooGetGPC('online', 'string', 'G'); switch ($online) { case 1: $time = time() - 100; $member_admininfo_condition[] = " ma.real_lastvisit>{$time}"; break; case 2: $time = time() - 24 * 3600; $member_admininfo_condition[] = " ma.real_lastvisit>{$time}"; break; case 3: $time1 = time() - 7 * 24 * 3600; $time2 = time() - 24 * 3600; $member_admininfo_condition[] = " ma.real_lastvisit > {$time1} and ma.real_lastvisit < {$time2}"; break; case 4: $time = time() - 7 * 24 * 3600; $member_admininfo_condition[] = " ma.real_lastvisit < {$time}"; break; } } if ($_GET['username']) { $username = trim(MooGetGPC('username', 'string', 'G')); $members_condition[] = " m.username LIKE '%{$username}%'"; } if ($_GET['nickname']) { $nickname = trim(MooGetGPC('nickname', 'string', 'G')); $members_condition[] = " m.nickname LIKE '%{$nickname}%'"; } //members_field表 $members_field_sql = $members_field_left_join = ''; if ($_GET['truename']) { $truename = trim(MooGetGPC('truename', 'string', 'G')); $memberfield_condition[] = " m.truename LIKE '%{$truename}%'"; } if (!empty($_GET['workcityprovince1']) && $_GET['workcityprovince1'] != '-1') { $hometownprovince = MooGetGPC('workcityprovince1', 'integer', 'G'); $memberfield_condition[] = " m.hometownprovince='{$hometownprovince}'"; } if (!empty($_GET['workcitycity1']) && $_GET['workcitycity1'] != '-1') { $hometowncity = MooGetGPC('workcitycity1', 'integer', 'G'); $memberfield_condition[] = " m.hometowncity='{$hometowncity}'"; } if (!empty($_GET['ismok']) && $_GET['ismok'] != '-1') { $ismok = $_GET['ismok']; $smoking = implode(',', $ismok); $memberfield_condition[] = " m.smoking in({$smoking})"; } if (!empty($_GET['idrink']) && $_GET['idrink'] != '-1') { $idrink = $_GET['idrink']; $drinking = implode(',', $idrink); $memberfield_condition[] = " m.drinking in({$drinking})"; } if (!empty($_GET['child']) && $_GET['child'] != '-1') { $child = $_GET['child']; $children = implode(',', $child); $members_condition[] = " m.children in({$children})"; } if (!empty($_GET['wantchildren']) && $_GET['wantchildren'] != '-1') { $wantchild = $_GET['wantchildren']; $wantchildren = implode(',', $wantchild); $memberfield_condition[] = " m.wantchildren in({$wantchildren})"; } $height1 = $_GET['height1']; $height2 = $_GET['height2']; if (!empty($_GET['height1']) || !empty($_GET['height2'])) { if ($height1 && $height2 && $height2 > $height1) { $members_condition[] = ' (m.height >= ' . $height1 . ' AND m.height <= ' . $height2 . ')'; } else { if ($height1 && $height2 && $height2 < $height1) { $members_condition[] = ' (m.height <= ' . $height1 . ' AND m.height >= ' . $height2 . ')'; } else { if ($height1 && !$height2) { $members_condition[] = ' m.height >= ' . $height1; } else { if ($height2 && !$height1) { $members_condition[] = ' m.height <=' . $height2; } else { if ($height1 && $height2 && $height1 == $height2) { $members_condition[] = ' m.height =' . $height1; } } } } } } $weight1 = $_GET['weight1']; $weight2 = $_GET['weight2']; if (!empty($_GET['weight1']) || !empty($_GET['weight2'])) { if ($weight1 && $weight2 && $weight2 > $weight1) { $memberfield_condition[] = ' (m.weight >= ' . $weight1 . ' AND m.weight <= ' . $weight2 . ')'; } else { if ($weight1 && $weight2 && $weight2 < $weight1) { $memberfield_condition[] = ' (m.weight <= ' . $weight1 . ' AND m.weight >= ' . $weight2 . ')'; } else { if ($weight1 && !$weight2) { $memberfield_condition[] = ' m.weight >= ' . $weight1; } else { if ($weight2 && !$weight1) { $memberfield_condition[] = ' m.weight <=' . $weight2; } else { if ($weight1 && $weight2 && $weight1 == $weight2) { $memberfield_condition[] = ' m.weight =' . $weight1; } } } } } } if (!empty($_GET['body']) && $_GET['body'] != '0') { $body = $_GET['body']; $body = implode(',', $body); $memberfield_condition[] = " m.body in({$body})"; } if (!empty($_GET['education']) && $_GET['education'] != '0') { $education = $_GET['education']; $education = implode(',', $education); $members_condition[] = " m.education in({$education})"; } if (!empty($_GET['occupation']) && $_GET['occupation'] != '0') { $occupation = $_GET['occupation']; $occupation = implode(',', $occupation); $memberfield_condition[] = " m.occupation in({$occupation})"; } if (!empty($_GET['house']) && $_GET['house'] != '0') { $house = $_GET['house']; $house = implode(',', $house); $members_condition[] = " m.house in({$house})"; } if (!empty($_GET['vehicle']) && $_GET['vehicle'] != '0') { $vehicle = $_GET['vehicle']; $vehicle = implode(',', $vehicle); $memberfield_condition[] = " m.vehicle in({$vehicle})"; } if (!empty($_GET['corptp']) && $_GET['corptp'] != '0') { $corptp = $_GET['corptp']; $corptype = implode(',', $corptp); $memberfield_condition[] = " m.corptype in({$corptype})"; } if (!empty($_GET['family']) && $_GET['family'] != '0') { $family = $_GET['family']; $family = implode(',', $family); $memberfield_condition[] = " m.family in({$family})"; } if ($_GET['qq']) { $qq = $_GET['qq']; $sql_qq = "select qq from {$GLOBALS['dbTablePre']}members_base where qq='{$qq}'"; $res_qq = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_qq, true); if (!empty($res_qq['qq'])) { $memberfield_condition[] = " b.qq='{$qq}'"; } else { $members_condition[] = " m.username LIKE '%{$qq}%'"; } } $callno = MooGetGPC('callno', 'string', 'G'); if (!empty($callno)) { $memberfield_condition[] = "b.callno='{$callno}'"; } $members_sql = $member_admininfo_sql = $memberfield_sql = $sql_where = ''; //members表 if (!empty($members_condition)) { $members_sql = implode(' AND ', $members_condition); //普通客服和组长搜索不到封锁的和关闭资料的会员 if (in_array($GLOBALS['groupid'], $GLOBALS['admin_all_group']) || in_array($GLOBALS['groupid'], $GLOBALS['general_service'])) { $members_sql = $members_sql ? $members_sql . " and ((m.showinformation=1 and m.is_lock=1 ) or (m.usertype=1))" : "((m.showinformation=1 and m.is_lock=1 ) or (m.usertype=1))"; } } if (!empty($member_admininfo_condition)) { $member_admininfo_sql = implode(' AND ', $member_admininfo_condition); } if (!empty($memberfield_condition)) { // $members_field_left_join = "LEFT JOIN {$GLOBALS['dbTablePre']}members_base b ON m.uid=b.uid"; $memberfield_sql = implode(' AND ', $memberfield_condition); } if ($members_sql && $member_admininfo_sql && $memberfield_sql) { $sql_where = ' WHERE ' . $members_sql . ' AND ' . $member_admininfo_sql . ' AND ' . $memberfield_sql; } elseif ($members_sql && $member_admininfo_sql) { $sql_where = ' WHERE ' . $members_sql . ' AND ' . $member_admininfo_sql; } elseif ($member_admininfo_sql && $memberfield_sql) { $sql_where = ' WHERE ' . $member_admininfo_sql . ' AND ' . $memberfield_sql; } elseif ($members_sql && $memberfield_sql) { $sql_where = ' WHERE ' . $members_sql . ' AND ' . $memberfield_sql; } elseif ($members_sql) { $sql_where = ' WHERE ' . $members_sql; } elseif ($member_admininfo_sql) { $sql_where = ' WHERE ' . $member_admininfo_sql; } elseif ($memberfield_sql) { $sql_where = ' WHERE ' . $memberfield_sql; //members_field表 } if (!empty($members_sql) || !empty($member_admininfo_sql) || !empty($memberfield_sql)) { $sql = "SELECT m.uid FROM {$GLOBALS['dbTablePre']}members_search m LEFT JOIN {$GLOBALS['dbTablePre']}member_admininfo ma ON m.uid=ma.uid LEFT JOIN {$GLOBALS['dbTablePre']}members_base b ON ma.uid=b.uid left join {$GLOBALS['dbTablePre']}members_login as l on ma.uid=l.uid left join web_full_log as f on m.uid=f.uid left join web_pic as p on m.uid=p.uid {$sql_where}"; $r = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql); $u = array(); if (!empty($r)) { foreach ($r as $v) { array_push($u, $v['uid']); } } $u = array_unique($u); $total = sizeof($u); $ul = implode(',', $u); $sql = "SELECT m.uid,m.username,m.gender,m.birthyear,b.mainimg,m.telphone,m.salary,m.s_cid,m.is_lock,m.province,m.city,b.allotdate,m.regdate,m.sid,m.usertype,l.last_login_time,ma.next_contact_time,ma.effect_grade,ma.old_sid,ma.real_lastvisit,f.action_time FROM {$GLOBALS['dbTablePre']}members_search m LEFT JOIN {$GLOBALS['dbTablePre']}member_admininfo ma ON m.uid=ma.uid LEFT JOIN {$GLOBALS['dbTablePre']}members_base b ON ma.uid=b.uid left join {$GLOBALS['dbTablePre']}members_login as l on ma.uid=l.uid left join web_full_log as f on m.uid=f.uid where m.uid in ({$ul}) LIMIT {$offset},{$limit}"; // echo $sql; $members = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true); $member_list = $members; if (!empty($_GET['order_tel'])) { $tel = get_telphone($members); if ($members) { foreach ($members as $user) { $user['num'] = $tel[$user['telphone']]; $member_list[] = $user; } //当点击同号手机数时排序 foreach ($member_list as $key => $row) { $edition[$key] = $row[num]; } array_multisort($edition, SORT_DESC, $member_list); //二维数组排序 } } //note 获得当前的url 去除多余的参数page= $currenturl = $_SERVER["REQUEST_URI"]; $currenturl2 = preg_replace("/(&page=\\d+)/", "", $currenturl); $page_links = multipage($total, $page_per, $page, $currenturl2); } //所有客服列表 /* $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}admin_user ORDER BY uid ASC"; $kefu_list = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql,0,0,0,true); //所管理的客服id列表 $myservice_idlist = get_myservice_idlist(); $myservice_sid_arr = array(); if($myservice_idlist != 'all' && $myservice_idlist!=''){ $myservice_sid_arr = explode(',',$myservice_idlist); foreach($myservice_sid_arr as $key=>$value){ if(empty($value)){ unset($myservice_sid_arr[$key]); } } $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}admin_user WHERE uid IN (".implode(',',$myservice_sid_arr).") ORDER BY uid ASC"; $kefu_list = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql,0,0,0,true); } */ $kefu_list = get_kefulist(); require "data/kefulist_cache_.php"; require adminTemplate("allmember_advancesearch"); }
function myuser_members_list($h) { $allow_grade = array('new_member' => 1, 'continue_communication' => 2, 'have_need' => 3, 'accept_service' => 4, 'accept_price' => 5, 'confirm_pay' => 6, 'destroy_order' => 7, 'reverse_member' => 8, 'give_up' => 9); $grade_name = array('new_member' => '新分用户', 'continue_communication' => '可继续沟通', 'have_need' => '有急迫动机需求', 'accept_service' => '认可网站服务', 'accept_price' => '认可价格', 'confirm_pay' => '确认付款', 'destroy_order' => '毁单', 'reverse_member' => '倒退会员', 'give_up' => '放弃会员'); $page_per = 20; $page = get_page(); $limit = 20; $offset = ($page - 1) * $limit; //获取查询条件及排序 $grade = $allow_grade[$h]; // echo $grade;die; $where = get_search_condition(''); $allow_order = array('uid' => 'ID', 'birthyear' => '年龄', 'salary' => '收入', 'allotdate' => '分配时间', 'ma.real_lastvisit' => '最后登陆时间', 'login_meb' => '登录次数', 'sid' => '客服', 'regdate' => '注册时间', 'last_login_time' => '最后登录时间', 'next_contact_time' => '下次联系时间', 'real_lastvisit' => '在线状态'); $update_arr['birthyear'] = 1; $sort_str = "allotdate"; $query_builder = get_query_builder($where, $allow_order, '', '', $sort_str, 'desc', $update_arr); $where = $query_builder['where']; // AND m.sid=0 $sql_sort = $query_builder['sort']; $sort_arr = $query_builder['sort_arr']; $rsort_arr = $query_builder['rsort_arr']; $sql_where = " WHERE ma.effect_grade={$grade}"; $where = $sql_where . $where; $total = get_myuser_count($where); $members = get_myuser_list($where, $sql_sort, "LIMIT {$offset},{$limit}"); $tel = get_telphone($members); if (!empty($members)) { foreach ($members as $user) { $user['num'] = $tel[$user['telphone']]; $member_list[] = $user; } //当点击同号手机数时排序 if (isset($_GET['order_tel'])) { foreach ($member_list as $key => $row) { $edition[$key] = $row['num']; } array_multisort($edition, SORT_DESC, $member_list); //二维数组排序 } } //毁单理由 if ($h == 'destroy_order') { $destroy_order = 'yes'; if (isset($member_list)) { foreach ($member_list as $key => $user) { $user['info'] = get_destory_order($user['uid']); $member_list[$key] = $user; } } } //来源 if (isset($member_list)) { foreach ($member_list as $key => $user) { if (preg_match_all("/(wf=\\w+)&?|(st=\\w+)&?/i", $user['source'], $matches)) { $member_list[$key]['source'] = $matches[1][0] . "<br />" . $matches[2][1]; } } } // echo "<pre>"; // print_r($member_list);die; //当前在线会员 $online_member_total = get_online_member_total($sql_where); //新分会员里显示当天分配数量 if ($h == 'new_member') { $allodate = strtotime(date("Y-m-d 00:00:00")); $sql_new = "SELECT allot_member,allot_time FROM {$GLOBALS['dbTablePre']}admin_user where uid={$GLOBALS['adminid']}"; $admin_user_inf = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_new, true); if ($admin_user_inf['allot_time'] > $allodate) { $allot_member = $admin_user_inf['allot_member']; } else { $allot_member = 0; } } //note 获取分页链接 $currenturl = "index.php?action=myuser&h={$h}"; $page_links = multipage($total, $page_per, $page, $currenturl); $title = $grade_name[$h]; include_once adminTemplate('myuser_members_list'); }