Exemplo n.º 1
0
function get_search_condition($where)
{
    global $h;
    $condition[] = $where;
    $sid = MooGetGPC('sid', 'integer', 'G');
    if ($sid) {
        $condition[] = " m.sid={$sid}";
    }
    if (!empty($_GET['search_date'])) {
        if ($_GET['search_type'] == 1) {
            $field = 'm.regdate';
        } else {
            $field = 'b.allotdate';
        }
        $search_date = strtotime(MooGetGPC('search_date', 'string', 'G'));
        $search_date2 = $search_date + 60 * 60 * 24;
        $condition[] = " {$field}>='{$search_date}' AND {$field}<='{$search_date2}'";
    }
    if (!empty($_GET['uid'])) {
        $uid = trim(MooGetGPC('uid', 'integer', 'G'));
        $condition[] = " m.uid='{$uid}'";
    }
    //所管理的客服id列表
    $myservice_idlist = get_myservice_idlist();
    if (empty($myservice_idlist)) {
        if ($h == 'give_up') {
            if (in_array($GLOBALS['groupid'], $GLOBALS['admin_aftersales'])) {
                //售后能看到放弃会员列表
            }
        } else {
            $condition[] = " m.sid IN({$GLOBALS['adminid']})";
        }
    } elseif ($myservice_idlist == 'all') {
        //all为客服主管能查看所有的
    } elseif ($h == 'give_up') {
        if (in_array($GLOBALS['groupid'], $GLOBALS['admin_aftersales'])) {
            //售后能看到放弃会员列表
        } else {
            $condition[] = " m.sid IN({$myservice_idlist})";
        }
    } else {
        $condition[] = " m.sid IN({$myservice_idlist})";
    }
    if ($GLOBALS['adminid'] == 23 && $h == 'high_member') {
        //针对售后组长(王海红)显示过期的
        $condition[] = "m.endtime < " . time();
    }
    $result = implode(' AND ', $condition);
    /*
     *如果是销售客服,返回WHERE ma.effect_grade=7 AND m.sid IN(62) 
     *如果是组长,返回WHERE ma.effect_grade=7 AND m.sid IN(16,22,26,30,31,39,51,62,66,69,74,82,86,88,162,211,213,216,222,229)
     *如果是$myservice_idlist == 'all',返回的是 WHERE ma.effect_grade=7
     */
    //	echo $result;die;
    return $result;
}
Exemplo n.º 2
0
function active_rightbottom_message()
{
    $type = MooGetGPC('type', 'string');
    $sql_where = ' WHERE  1=1 ';
    //note 显示全部
    if (isset($_GET['type']) == 'all') {
        $sql_where .= "";
        //note 显示已处理过的
    } else {
        if ((isset($_GET['type']) ? $_GET['type'] : '') == 'dealed') {
            $sql_where .= " AND dealstate = '1'";
            //note 显示未处理过的
        } else {
            $sql_where .= " AND dealstate = '0'";
        }
    }
    //分页
    $page_per = 20;
    $page = max(1, MooGetGPC('page', 'integer', 'G'));
    $limit = 20;
    $offset = ($page - 1) * $limit;
    //所管理的客服id列表
    $myservice_idlist = get_myservice_idlist();
    if (empty($myservice_idlist)) {
        $sql_where .= " AND sid IN({$GLOBALS['adminid']})";
    } elseif ($myservice_idlist == 'all') {
        //all为客服主管能查看所有的
    } else {
        $sql_where .= " AND sid IN({$myservice_idlist})";
    }
    if (isset($_GET['id'])) {
        $id = MooGetGPC('id', 'integer', 'G');
        $sql = "UPDATE {$GLOBALS['dbTablePre']}admin_remark SET status=1 WHERE id='{$id}'";
        $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        salert('操作成功', 'index.php?action=other_rightbottom&h=message');
    }
    $total = getcount('admin_remark', $sql_where);
    $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}admin_remark {$sql_where} ORDER BY id DESC LIMIT {$offset},{$limit}";
    $remark_list = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
    //note 获得当前的url 去除多余的参数
    /* $currenturl = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; 
    	$currenturl = preg_replace("/(&page=\d+)/","",$currenturl);
    	$currenturl = preg_replace("/(&type=undealed)/","",$currenturl);
    	$currenturl = preg_replace("/(&type=dealed)/","",$currenturl);
    	$currenturl = preg_replace("/(&type=all)/","",$currenturl);
    	$currenturl2 = $currenturl;
    	$currenturl = $currenturl."&type=$type";
    	echo $currenturl; */
    $currenturl = "index.php?action=other_rightbottom&h=message&type={$type}";
    //note 跳转到某一页
    $page_num = ceil($total / $limit);
    $page_links = multipage($total, $page_per, $page, $currenturl);
    //note 调用模板
    require adminTemplate('other_rightbottom_message');
}
Exemplo n.º 3
0
function ajax_delmyuser()
{
    //所管理的客服id列表
    $myservice_idlist = get_myservice_idlist();
    //   error_log($myservice_idlist);
    $uid = MooGetGPC('uid', 'integer', 'G');
    $deldesc = trim(MooGetGPC('deldesc', 'string', 'G'));
    $deldesc = iconv("GBK", "UTF-8", $deldesc);
    if (empty($uid) || empty($deldesc)) {
        echo 'no uid or desc';
        exit;
    }
    if ($myservice_idlist != 'all') {
        $myservice_idlist = explode(',', $myservice_idlist);
    }
    //	error_log(print_r($_GET,true));
    $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}members_search WHERE uid='{$uid}'";
    $sid = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
    if ($sid['sid'] == $GLOBALS['adminid'] || $myservice_idlist == 'all' || in_array($sid['sid'], $myservice_idlist)) {
        //删除会员转到某个客服名下
        if (file_exists("data/del_to_user.txt")) {
            $file_kefuid = fopen("data/del_to_user.txt", 'r');
            $del_to_sid = fread($file_kefuid, 11);
            fclose($file_kefuid);
        }
        $sql = "UPDATE {$GLOBALS['dbTablePre']}members_search  SET sid='{$del_to_sid}',is_well_user=0  WHERE uid='{$uid}' ";
        $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        searchApi('members_man members_women')->updateAttr(array('sid', 'is_well_user'), array($uid => array((int) $del_to_sid, 0)));
        //if(MOOPHP_ALLOW_FASTDB) {MooFastdbUpdate('members','uid',$uid);}
        //对应的维护会员总数减1
        $sql = "UPDATE {$GLOBALS['dbTablePre']}admin_user SET member_count=member_count-1 WHERE uid='{$sid['sid']}'";
        $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        $sql = "UPDATE {$GLOBALS['dbTablePre']}admin_user SET member_count=member_count+1 WHERE uid='{$del_to_sid}'";
        $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        //后台扩展表标记为删除状态
        $sql = "UPDATE {$GLOBALS['dbTablePre']}member_admininfo SET is_delete=1,old_sid='{$sid['sid']}' WHERE uid='{$uid}'";
        $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        //写入到后台扩展表小记中
        $time = time();
        $deldesc = '[删除原因]:' . $deldesc;
        $sql = "INSERT INTO {$GLOBALS['dbTablePre']}member_backinfo SET mid='{$GLOBALS['adminid']}',manager='{$GLOBALS['username']}',uid='{$uid}',effect_grade='10',comment='{$deldesc}',dateline='{$time}'";
        $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        //删除会员写表记录
        $sql = "INSERT INTO {$GLOBALS['dbTablePre']}admin_deluser SET sid='{$GLOBALS['adminid']}',username='******'username']}',uid='{$uid}',dateline='{$time}'";
        $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        if (MOOPHP_ALLOW_FASTDB) {
            $value['sid'] = 52;
            $value['is_well_user'] = 0;
            MooFastdbUpdate('members_search', 'uid', $uid, $value);
        }
        //写日志
        serverlog(3, $GLOBALS['dbTablePre'] . 'members_search', "{$GLOBALS['username']}客服将自己的会员{$uid}删除放弃", $GLOBALS['adminid'], $uid);
        echo 'ok';
    }
}
Exemplo n.º 4
0
/**
 * 检查普通客服修改用户资料
 * @author:fanglin
 */
function check_memberinfo_list()
{
    //所管理的客服id列表
    $sql_where = '';
    $myservice_idlist = get_myservice_idlist();
    if (empty($myservice_idlist)) {
        $sql_where = " AND sid IN({$GLOBALS['adminid']})";
    } elseif ($myservice_idlist == 'all') {
        //all为客服主管能查看所有的
    } else {
        $sql_where = " AND sid IN({$myservice_idlist})";
    }
    $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}admin_editmembersinfo_sql WHERE status=0 {$sql_where} ORDER BY id DESC";
    $list = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
    require adminTemplate("check_memberinfo_list");
}
Exemplo n.º 5
0
function other_member_allot_record_group()
{
    $groupid = MooGetGPC('groupid', 'integer', 'G');
    $sid = MooGetGPC('sid', 'integer', 'G');
    if ($sid) {
        other_member_allot_record_user();
        return;
    }
    if ($groupid) {
        $sql = "SELECT manage_list FROM {$GLOBALS['dbTablePre']}admin_manage where id={$groupid}";
        $sid_arr = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
        $sid_list = $sid_arr['manage_list'];
    } else {
        $sid_list = get_myservice_idlist();
    }
    if (!empty($sid_list)) {
        $condition[] = "type=2 and  uid in (" . $sid_list . ")";
    }
    $type = MooGetGPC('type', 'string', 'P');
    $keyword = MooGetGPC('keyword', 'string', 'P');
    if (!empty($_REQUEST['allot_time1'])) {
        $allot_time1 = MooGetGPC('allot_time1', 'string');
        $allodate1 = strtotime($allot_time1);
        $allodate1 = strtotime(date("Y-m-d 00:00:00", $allodate1));
        $condition[] = " dateline>='{$allodate1}'";
    } else {
        $allodate1 = strtotime(date("Y-m-d 00:00:00")) - 86400;
        $condition[] = " dateline>='{$allodate1}'";
    }
    if (!empty($_REQUEST['allot_time2'])) {
        $allot_time2 = MooGetGPC('allot_time2', 'string');
        $allodate2 = strtotime($allot_time2);
        $allodate2 = strtotime(date("Y-m-d 23:59:59", $allodate2));
        $condition[] = " dateline<='{$allodate2}'";
    } else {
        $allodate2 = strtotime(date("Y-m-d 23:59:59")) - 86400;
        $condition[] = " dateline<='{$allodate2}'";
    }
    $sql_where = 'WHERE ' . implode(' AND ', $condition);
    $sql = "SELECT uid,username,member_count,sum(allot_member) AS allot_member FROM {$GLOBALS['dbTablePre']}admin_telcount {$sql_where} group by uid ";
    $ret = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
    require_once adminTemplate('other_member_allot_record_group');
}
Exemplo n.º 6
0
function bind_list()
{
    $bindArr = array(0 => '未联系', 1 => '<span style="color:#0FF">已绑定</span>', 2 => '<span style="color:#F00">绑定过期</span>');
    $page = max(1, MooGetGPC('page', 'integer', 'G'));
    $pagesize = 16;
    $start = ($page - 1) * $pagesize;
    $choose = '';
    $uid = '';
    if (isset($_GET['choose'])) {
        $choose = $_GET['choose'];
    }
    if (isset($_GET['uid'])) {
        $uid = (int) $_GET['uid'];
    }
    //所管理的客服id列表
    $myservice_idlist = get_myservice_idlist();
    $sql_where = '';
    if (empty($myservice_idlist)) {
        $sql_where = " WHERE ms.sid = {$GLOBALS['adminid']} ";
    } elseif ($myservice_idlist == 'all') {
        //all为客服主管能查看所有的
    } else {
        $sql_where = " WHERE ms.sid IN({$myservice_idlist})";
    }
    if ($uid) {
        $str = empty($sql_where) ? ' WHERE' : ' AND';
        $sql_where .= $str . " mb." . $choose . "='{$uid}'";
    }
    $sql = "SELECT COUNT(1) c FROM {$GLOBALS['dbTablePre']}members_bind mb \n\t\tLEFT JOIN {$GLOBALS['dbTablePre']}members_search ms ON mb.a_uid = ms.uid \n\t\t{$sql_where} ";
    $total = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
    $sql = "SELECT mb.* \n\t\t\t\tFROM {$GLOBALS['dbTablePre']}members_bind mb \n\t\t\t\tLEFT JOIN {$GLOBALS['dbTablePre']}members_search ms ON mb.a_uid = ms.uid \n\t\t\t\t{$sql_where} \n\t\t\t\tORDER BY bind,id desc \n\t\t\t\tLIMIT {$start},{$pagesize}";
    $bindrs = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
    $currenturl = 'index.php?action=active_bind&h=list';
    $pages = multipage($total['c'], $pagesize, $page, $currenturl);
    require adminTemplate('active_bind_list');
}
Exemplo n.º 7
0
function active_commission_list()
{
    error_reporting(0);
    //note 分页处理
    $page = max(1, MooGetGPC('page', 'integer'));
    $limit = 5;
    $offset = ($page - 1) * $limit;
    //note 所管理的客服id列表
    $myservice_idlist = get_myservice_idlist();
    if (empty($myservice_idlist)) {
        $condition[] = " m.sid IN({$GLOBALS['adminid']})";
    } elseif ($myservice_idlist == 'all') {
    } else {
        $condition[] = " m.sid IN({$myservice_idlist})";
    }
    $type = MooGetGPC('type', 'string');
    //note 显示全部
    if (isset($_GET['type']) && $_GET['type'] == 'all') {
        //note 显示已处理过的
    } else {
        if (isset($_GET['type']) && $_GET['type'] == 'dealed') {
            $condition[] = " dealstate = 1";
            //note 显示未处理过的
        } else {
            $condition[] = " dealstate = 0";
        }
    }
    //note 处理搜索会员聊天
    if (isset($_GET['action']) && $_GET['action'] == 'active_commission') {
        $choose = MooGetGPC('members_choose', 'string');
        $keyword = MooGetGPC('keyword', 'string');
        if (!empty($choose) && !empty($keyword)) {
            $condition[] = "  {$choose} = '{$keyword}'";
        }
    }
    //note 处理搜索会员聊天
    if ($_GET['action'] == 'active_commission') {
        $choose = MooGetGPC('choose', 'string');
        $keyword = MooGetGPC('keyword', 'string');
        if (!empty($choose) && !empty($keyword)) {
            $condition[] = "  {$choose} = '{$keyword}'";
        }
    }
    $sql_where = '';
    if (!empty($condition)) {
        $sql_where = 'WHERE ' . implode(' AND ', $condition);
    }
    //note 查询语句
    $sql = "select count(distinct other_contact_you) as num from {$GLOBALS['dbTablePre']}service_contact left join {$GLOBALS['dbTablePre']}members_search as m ON other_contact_you=m.uid  {$sql_where}";
    $total = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
    $sql = "select distinct other_contact_you from {$GLOBALS['dbTablePre']}service_contact  left join {$GLOBALS['dbTablePre']}members_search as m ON other_contact_you=m.uid {$sql_where}  ORDER BY sendtime DESC LIMIT {$offset},{$limit}";
    $user_arr = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
    $other_contact_you_list = '';
    if ($user_arr) {
        foreach ($user_arr as $v) {
            $other_contact_you_list .= $v['other_contact_you'] . ',';
        }
    }
    $other_contact_you_list = rtrim($other_contact_you_list, ',');
    //var_dump(!empty($other_contact_you_list));exit;
    if (!empty($other_contact_you_list)) {
        $sql = "select uid,nickname,gender,birthyear from {$GLOBALS['dbTablePre']}members_search where uid in ({$other_contact_you_list}) order by field(uid,{$other_contact_you_list})";
        $temp1 = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
        foreach ($temp1 as $k => $v) {
            $user_arr[$k]['nickname'] = $v['nickname'];
            $user_arr[$k]['gender'] = $v['gender'];
            $user_arr[$k]['birthyear'] = $v['birthyear'];
        }
        $sql = "select mid,dealstate,other_contact_you,you_contact_other,stat,sendtime from {$GLOBALS['dbTablePre']}service_contact where other_contact_you in ({$other_contact_you_list}) order by sendtime desc";
        $temp1 = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
        $temp2 = array();
        foreach ($temp1 as $v) {
            if (!isset($temp2[$v['other_contact_you']])) {
                foreach ($user_arr as $u_k => $u_v) {
                    if ($u_v['other_contact_you'] == $v['other_contact_you']) {
                        $user_arr[$u_k]['sendtime'] = $v['sendtime'];
                        $user_arr[$u_k]['mid'] = $v['mid'];
                        $user_arr[$u_k]['dealstate'] = $v['dealstate'];
                    }
                }
            }
            $temp2[$v['other_contact_you']]['you_contact_you_list'][] = $v['you_contact_other'];
            $temp2[$v['other_contact_you']]['state_list'][] = $v['stat'];
            $temp2[$v['other_contact_you']]['sendtime_list'][] = $v['sendtime'];
        }
        //note 得到发送委托会员基本信息
        foreach ($user_arr as $k => $v) {
            //得到接受委托会员基本信息
            $contact_id_list = $temp2[$v['other_contact_you']]['you_contact_you_list'];
            $sendtime_id_list = $temp2[$v['other_contact_you']]['sendtime_list'];
            $state_id_list = $temp2[$v['other_contact_you']]['state_list'];
            if (empty($contact_id_list)) {
                continue;
            }
            $user_info2 = array();
            $sql = "select uid,nickname,gender,birthyear from {$GLOBALS['dbTablePre']}members_search where uid in (" . implode(',', $contact_id_list) . ")";
            $user_info2 = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
            foreach ($user_info2 as $kk => $vv) {
                $user_arr[$k]['contact_list'][$kk]['uid'] = $vv['uid'];
                $user_arr[$k]['contact_list'][$kk]['nickname'] = $vv['nickname'];
                $user_arr[$k]['contact_list'][$kk]['gender'] = $vv['gender'];
                $user_arr[$k]['contact_list'][$kk]['birthyear'] = date("Y", time()) - $vv['birthyear'];
                $user_arr[$k]['contact_list'][$kk]['sendtime'] = date("Y-m-d H:i:s", $sendtime_id_list[$kk]);
                $user_arr[$k]['contact_list'][$kk]['state'] = $state_id_list[$kk];
            }
        }
    }
    //note 获得当前的url 去除多余的参数
    $currenturl = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
    $currenturl = preg_replace("/www./", "", $currenturl);
    $currenturl = preg_replace("/(&page=\\d+)/", "", $currenturl);
    $currenturl = preg_replace("/(&type=undealed)/", "", $currenturl);
    $currenturl = preg_replace("/(&type=dealed)/", "", $currenturl);
    $currenturl = preg_replace("/(&type=all)/", "", $currenturl);
    $currenturl2 = $currenturl;
    $currenturl = $currenturl . "&type={$type}";
    $pages = multipage($total['num'], $limit, $page, $currenturl);
    //note 跳转到某一页
    $page_num = ceil($total['num'] / $limit);
    //note 插入日志
    serverlog(1, $GLOBALS['dbTablePre'] . 'members_search', "{$GLOBALS['username']}操作会员委托", $GLOBALS['adminid']);
    require adminTemplate('active_commission_list');
}
Exemplo n.º 8
0
function active_websms_list()
{
    $type = MooGetGPC('type', 'string');
    $sql_where = "";
    //note 显示全部
    if (isset($_GET['type']) && $_GET['type'] == 'all') {
        $sql_where = "";
        //note 显示已处理过的
    } else {
        if (isset($_GET['type']) && $_GET['type'] == 'dealed') {
            $sql_where .= " AND s.dealstate = '1'";
            //note 显示未处理过的
        } else {
            $sql_where .= " AND s.dealstate = '0'";
        }
    }
    //note 系统发给会员的信息不显示
    $sql_where .= " AND s.s_fromid != '0'";
    //note 处理搜索会员聊天
    if (isset($_GET['action']) && $_GET['action'] == 'active_websms') {
        $choose = MooGetGPC('choose', 'string');
        $keyword = MooGetGPC('keyword', 'string');
        //$where = '';
        if (!empty($choose) && !empty($keyword)) {
            if ($choose == 's_content' || $choose == 's_title') {
                $sql_where .= " AND {$choose} like '%{$keyword}%'";
            } else {
                $sql_where .= " AND {$choose} = '{$keyword}'";
            }
        }
    }
    $page = max(1, MooGetGPC('page', 'integer'));
    $limit = 5;
    $offset = ($page - 1) * $limit;
    //note 所管理的客服id列表
    $myservice_idlist = get_myservice_idlist();
    if (empty($myservice_idlist)) {
        $sql_where = " AND m.sid IN({$GLOBALS['adminid']})";
    } elseif ($myservice_idlist == 'all') {
        //all为客服主管能查看所有的
    } else {
        $sql_where = " AND m.sid IN({$myservice_idlist})";
    }
    $sql = "SELECT count(m.uid) as c FROM {$GLOBALS['dbTablePre']}services s \n\tLEFT JOIN {$GLOBALS['dbTablePre']}members_search m ON s.s_fromid = m.uid \n\tWHERE s.s_cid!='3' {$sql_where}";
    $total_count = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
    /*$sql = "SELECT m.uid FROM {$GLOBALS['dbTablePre']}services s 
    	LEFT JOIN {$GLOBALS['dbTablePre']}members m ON s.s_fromid = m.uid 
    	WHERE s.s_cid!='50' {$sql_where}";
    	$total_count=$GLOBALS['_MooClass']['MooMySQL']->getOne($sql);*/
    //	echo $sql.'<br />';
    //$total = count($total_count['uid']);
    $total = $total_count['c'];
    $sql = "SELECT s.*,m.nickname FROM {$GLOBALS['dbTablePre']}services s \n\t\t\tLEFT JOIN {$GLOBALS['dbTablePre']}members_search m ON s.s_fromid = m.uid \n\t\t\tWHERE s.s_cid!='3' {$sql_where} ORDER BY s.s_id DESC LIMIT {$offset},{$limit}";
    $user_arr = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
    //	echo $sql.'<br />';
    //note 获得当前的url 去除多余的参数
    $currenturl = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
    $currenturl = preg_replace("/www./", "", $currenturl);
    $currenturl = preg_replace("/(&page=\\d+)/", "", $currenturl);
    $currenturl = preg_replace("/(&type=undealed)/", "", $currenturl);
    $currenturl = preg_replace("/(&type=dealed)/", "", $currenturl);
    $currenturl = preg_replace("/(&type=all)/", "", $currenturl);
    $currenturl2 = $currenturl;
    $currenturl = $currenturl . "&type={$type}";
    $pages = multipage($total, $limit, $page, $currenturl);
    //note 跳转到某一页
    $page_num = ceil($total / $limit);
    //note 插入日志
    serverlog(1, $GLOBALS['dbTablePre'] . 'servies', "{$GLOBALS['username']}查看站内短信列表", $GLOBALS['adminid']);
    require adminTemplate('active_websms_list');
}
Exemplo n.º 9
0
function vipuser_getvip_group()
{
    $groupid = MooGetGPC('groupid', 'integer', 'G');
    if ($groupid) {
        $sql = "SELECT manage_list FROM {$GLOBALS['dbTablePre']}admin_manage where id={$groupid}";
        $sid_arr = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
        $sid_list = $sid_arr['manage_list'];
    } else {
        $sid_list = get_myservice_idlist();
    }
    $pay_service = MooGetGPC('pay_service', 'integer', 'G');
    $count = array();
    $where = $note = '';
    if (!empty($_GET['start_time']) || !empty($_GET['end_time'])) {
        $start_time = strtotime(trim(MooGetGPC('start_time', 'string', 'G')));
        $end_time = strtotime(trim(MooGetGPC('end_time', 'string', 'G'))) + 86400;
        if ($start_time) {
            $where .= " AND `apply_time` > {$start_time} ";
        }
        if ($end_time) {
            if ($start_time && $end_time <= $start_time) {
                $end_time = $start_time + 86400;
                $note = '由于结束时间不能小于开始时间,系统自动将结束时间更改为:' . date('Y-m-d', $end_time);
            }
            $where .= " AND `apply_time` <= {$end_time} ";
        }
    }
    if (isset($_GET['pay_service'])) {
        $where .= " AND pay_service={$pay_service}";
    }
    if (!empty($sid_list)) {
        $where .= " AND apply_sid in (" . $sid_list . ")";
    }
    //总体
    $sql = "SELECT COUNT(*) AS c,SUM(`pay_money`) AS qian,`pay_service` FROM {$GLOBALS['dbTablePre']}payment_new WHERE `status` IN(1,3) {$where} GROUP BY `pay_service`";
    $totalCount = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
    //每个客服
    $sql = "SELECT sum(`pay_money`) AS total,COUNT(*) AS num ,`apply_sid` FROM {$GLOBALS['dbTablePre']}payment_new WHERE `status` IN(1,3) {$where} GROUP BY `apply_sid`";
    $everyCount = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
    require adminTemplate('vipuser_summary_group');
}
Exemplo n.º 10
0
/**
 *  安徽卫视周日我最大 活动 
 *  2011-07-02
 */
function ahtvtj()
{
    global $_MooClass;
    $adminid = $GLOBALS['adminid'];
    $dbpre = $GLOBALS['dbTablePre'];
    $page_per = 15;
    $channel = MooGetGPC('channel', 'integer', 'G');
    $startdate = MooGetGPC('startdate', 'string', 'G');
    $enddate = MooGetGPC('enddate', 'string', 'G');
    $choose = MooGetGPC('choose', 'string', 'G');
    $keyword = trim(MooGetGPC('keyword', 'string', 'G'));
    $notsite = MooGetGPC('notsite', 'string', 'G');
    $attenduser = MooGetGPC('attenduser', 'string', 'G');
    //	   $channel_names = array(1 => '周日我最大', 2 => '幸福来敲门', 3 => '相亲齐上阵', 4 => '七夕活动');
    $channels = $_MooClass['MooMySQL']->getAll("select id, title from {$dbpre}activity");
    foreach ($channels as $v) {
        if ($v['id'] == 0) {
            continue;
        }
        $channel_names[$v['id']] = $v['title'];
    }
    $condition = array();
    if ($notsite) {
        $condition[] = "a.uid=0";
    }
    if ($attenduser) {
        $condition[] = "a.isattend=1";
    }
    // else $condition[] = "a.isattend=0";
    if ($channel >= 1) {
        $condition[] = "a.channel=" . $channel;
    }
    if (!empty($startdate)) {
        $condition[] = "a.regtime>='" . $startdate . "'";
    }
    if (!empty($enddate)) {
        $condition[] = "a.regtime<='" . $enddate . "'";
    }
    if (!empty($choose) && $keyword !== '') {
        if ($choose == 'username') {
            $condition[] = "a.{$choose} like '%{$keyword}%'";
        } else {
            $condition[] = "a.{$choose}='{$keyword}'";
        }
    }
    $select = "select a.id, a.uid, a.username, a.gender, a.birthday, a.province, a.city, a.mobile, a.regtime, a.channel, a.isattend";
    $from = "from {$dbpre}ahtv_reguser a left join {$dbpre}members_search b on a.uid=b.uid";
    $sql_condition = implode(' and ', $condition);
    if (!$sql_condition) {
        $sql_condition = 'true';
    }
    //得到所属客服下的会员
    $myservice_idlist = get_myservice_idlist();
    $myservice_idlist = empty($myservice_idlist) ? 'all' : $myservice_idlist;
    //计算总记录数
    //note 所管理的用户列表
    if (empty($myservice_idlist)) {
        $sql = "select count(id) as count {$from} where {$sql_condition} and b.sid={$adminid} order by id";
    } elseif ($myservice_idlist == 'all') {
        //all为客服主管能查看所有的
        $sql = "select count(id) as count from {$dbpre}ahtv_reguser a where {$sql_condition} order by id";
    } else {
        $sql = "select count(id) as count {$from} where {$sql_condition} and b.sid in ({$myservice_idlist}) order by id";
    }
    $a = $_MooClass['MooMySQL']->getOne($sql);
    $total = $a['count'];
    $currenturl = "index.php?action=financial_ahtv_reguser&h=list&channel={$channel}&startdate={$startdate}&enddate={$enddate}&choose={$choose}&keyword={$keyword}&notsite={$notsite}&attenduser={$attenduser}";
    $page_num = ceil($total / $page_per);
    $page = max(1, min(MooGetGPC('page', 'integer'), $page_num));
    $offset = ($page - 1) * $page_per;
    $pages = multipage($total, $page_per, $page, $currenturl);
    $limit = "limit {$offset}, {$page_per}";
    //详细记录查询
    if (empty($myservice_idlist)) {
        $sql = $select . " " . $from . " where b.sid={$adminid} and {$sql_condition} {$limit}";
    } elseif ($myservice_idlist == 'all') {
        //all为客服主管能查看所有的
        $sql = $select . " from {$dbpre}ahtv_reguser a where {$sql_condition} {$limit}";
    } else {
        $sql = $select . " " . $from . " where b.sid in ({$myservice_idlist}) and {$sql_condition} {$limit}";
    }
    $reguser = $_MooClass['MooMySQL']->getAll($sql);
    foreach ($reguser as &$value) {
        $birthday_arr = explode('-', $value['birthday']);
        $birthday = $birthday_arr[0] . '年';
        if (!empty($birthday_arr[1])) {
            $birthday .= $birthday_arr[1] . '月';
        }
        $value['birthday'] = $birthday;
    }
    require_once adminTemplate('financial_ahtv_reguser');
}
Exemplo n.º 11
0
function get_kefulist()
{
    $sql_where = '';
    //所管理的客服id列表
    $myservice_idlist = get_myservice_idlist();
    if (empty($myservice_idlist)) {
        $sql_where = " WHERE uid IN({$GLOBALS['adminid']})";
    } elseif ($myservice_idlist == 'all') {
        //all为客服主管能查看所有的
        $sql_where = " where uid>1";
    } else {
        $sql_where = " WHERE uid IN({$myservice_idlist})";
    }
    $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}admin_user {$sql_where} ORDER BY uid ASC";
    $result = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
    // if(in_array($GLOBALS['groupid'],$GLOBALS['admin_service_team'])) print_r($result);
    return $result;
}
Exemplo n.º 12
0
function check_feedback()
{
    global $adminid, $kefu_arr, $groupid;
    $sid = $GLOBALS['adminid'];
    $type = MooGetGPC('type', 'string') == '' ? 'list' : MooGetGPC('type', 'string');
    $usersid = MooGetGPC('usersid', 'string', 'G');
    //makui
    $lei = "意见反馈";
    $id = MooGetGPC('id', 'integer');
    $gid = MooGetGPC('gid', 'integer');
    $uid = MooGetGPC('uid', 'integer');
    // 系统
    $checkArr = array(1 => '已回复', 0 => '未回复');
    $serArr = array(1 => '网站功能', 2 => '红娘服务');
    $attArr = array(0 => '其他', 1 => '表扬', 2 => '批评', 3 => '建议');
    $fraction_arr = array(1 => '非常不满意', 2 => '不满意', 3 => '一般', 4 => '满意', 5 => '非常满意');
    switch ($type) {
        case 'list':
            $pass = MooGetGPC('pass', 'integer', 'G');
            //note 获得当前url
            $currenturl = "index.php?action=check&h=feedback";
            $currenturl2 = preg_replace("/(&page=\\d+)/", "", $currenturl);
            $currenturl2 = preg_replace("/(&pass=\\d+)/", "", $currenturl2) . "&pass={$pass}";
            $currenturl2 = preg_replace("/(&usersid=\\d+)/", '', $currenturl2);
            $page = get_page();
            $prepage = 20;
            $start = ($page - 1) * $prepage;
            if (isset($_GET['usersid']) && MooGetGPC('usersid', 'string', 'G') == 0) {
                salert("无所属客服");
            }
            //所管理的客服id列表
            $myservice_idlist = get_myservice_idlist();
            if (empty($myservice_idlist)) {
                $sql_where = " WHERE m.sid IN({$GLOBALS['adminid']})";
            } elseif ($myservice_idlist == 'all') {
                //all为客服主管能查看所有的
                if (isset($_GET['usersid'])) {
                    $sql_where = "where m.sid='{$usersid}'";
                }
                //查看某一客服的会员
            } else {
                $sql_where = " WHERE m.sid IN({$myservice_idlist})";
                if (isset($_GET['usersid'])) {
                    $sql_where .= " AND m.sid='{$usersid}'";
                }
                //查看某一客服的会员
            }
            if (empty($sql_where)) {
                $sql_where .= " WHERE g.syscheck='{$pass}'";
            } else {
                $sql_where .= " AND g.syscheck='{$pass}'";
            }
            $s_stat1 = MooGetGPC('s_stat1', 'integer');
            $s_stat2 = MooGetGPC('s_stat2', 'integer');
            if ($s_stat1 > 0 || $s_stat2 > 0) {
                if ($s_stat1 > 0) {
                    $s_stat1 -= 1;
                    $sql_where .= " and g.stat1={$s_stat1} ";
                }
                if ($s_stat2 > 0) {
                    $sql_where .= $and . " and g.stat2={$s_stat2} ";
                }
            }
            $sql = "SELECT count(1) as c FROM {$GLOBALS['dbTablePre']}service_getadvice g\n\t        \t\tLEFT JOIN {$GLOBALS['dbTablePre']}members m ON g.uid=m.uid\n\t        \t\t{$sql_where}";
            $total_re = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
            $total = $total_re['c'];
            //serverlog(1,$dbTablePre."service_getadvice","查询意见反馈",$GLOBALS['adminid']);
            $sql = "SELECT g.gid,g.uid,g.stat1,g.stat2,g.content,g.submitdate,g.syscheck,m.sid, g.fraction FROM {$GLOBALS['dbTablePre']}service_getadvice g\n\t       \t\t\tLEFT JOIN {$GLOBALS['dbTablePre']}members m ON g.uid=m.uid\n\t       \t\t\t{$sql_where}\n\t        \t\tORDER BY g.gid DESC LIMIT {$start},{$prepage}";
            $advice = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
            require adminTemplate("check_advice_list");
            break;
        case 'show':
            $showadvice = $GLOBALS['_MooClass']['MooMySQL']->getOne("SELECT s.*, m.sid FROM {$GLOBALS['dbTablePre']}service_getadvice s left join {$GLOBALS['dbTablePre']}members m on s.uid=m.uid WHERE s.`gid`='{$gid}'");
            //serverlog(1,$dbTablePre."service_getadvice","查看意见反馈",$GLOBALS['adminid']);
            require adminTemplate("check_show");
            break;
        case 'submit':
            $content = MooGetGPC('content', 'string');
            $is_pass = MooGetGPC('pass', 'string');
            $is_onpass = MooGetGPC('nopass', 'string');
            if ($is_onpass) {
                if ($gid == '' || $uid == '') {
                    salert('参数错误');
                }
                $GLOBALS['_MooClass']['MooMySQL']->query("DELETE FROM {$GLOBALS['dbTablePre']}service_getadvice WHERE `gid`='{$gid}'");
                salert('删除成功!', 'index.php?action=check&h=feedback');
            } elseif ($is_pass) {
                if ($gid == '' || $content == '' || $uid == '') {
                    salert('参数错误');
                }
                $GLOBALS['_MooClass']['MooMySQL']->query("UPDATE {$GLOBALS['dbTablePre']}service_getadvice SET `syscheck`=1 WHERE `gid`='{$gid}'");
                sendusermessage($uid, $content, "回复意见反馈");
                serverlog(1, $dbTablePre . "service_getadvice", $GLOBALS['username'] . "回复意见反馈" . $gid, $GLOBALS['adminid']);
                salert('回复此信息成功', 'index.php?action=check&h=feedback');
            }
            //echo "<script>window.history.go(-2);</script>";
            break;
    }
}
Exemplo n.º 13
0
function myuser_remark()
{
    $sid = $groupid = '';
    $condition = array();
    $manage_list = $link = '';
    //提交删除
    if (isset($_POST['submit']) ? $_POST['submit'] : '') {
        $id = $_POST['changesid'];
        foreach ($id as $v) {
            $sql = "delete from {$GLOBALS['dbTablePre']}member_effectgrade where id='{$v}'";
            $GLOBALS['_MooClass']['MooMySQL']->query($sql);
        }
    }
    //客服访问权限
    $myservice_idlist = get_myservice_idlist();
    if (empty($myservice_idlist)) {
        $condition[] = " sid IN({$GLOBALS['adminid']}) ";
    } elseif ($myservice_idlist == 'all') {
        //if(isset($_GET['usersid'])){$condition .="  g.sid='$usersid'";}
        //all为客服主管能查看所有的
        $adminUser = $GLOBALS['_MooClass']['MooMySQL']->getAll("select uid,username from web_admin_user", 0, 0, 0, true);
    } else {
        $condition[] = "  sid IN({$myservice_idlist}) ";
        // if(isset($_GET['usersid'])){$condition .="  g.sid='$usersid'";}
        $adminUser = $GLOBALS['_MooClass']['MooMySQL']->getAll("select uid,username from web_admin_user  where uid in ({$myservice_idlist}) ", 0, 0, 0, true);
    }
    $sid = MooGetGPC('sid', 'integer', 'G');
    $groupid = MooGetGPC('groupid', 'string', 'G');
    if ($groupid) {
        $group = get_group_type($groupid);
        $manage_list = $group[0]['manage_list'];
        $condition[] = " sid IN({$manage_list})";
    } elseif ($groupid && $sid) {
        $condition[] = " sid='{$sid}'";
    }
    $group_list = get_group_type();
    if ($manage_list) {
        $manage_arr = explode(',', $manage_list);
        foreach ($manage_arr as $value) {
            $adminUser = $GLOBALS['_MooClass']['MooMySQL']->getOne("select uid,username from web_admin_user  where uid={$value}", true);
            $manage_uid = $adminUser['uid'];
            $manage_username = $adminUser['username'];
            $manage[] = array("uid" => $manage_uid, "username" => $manage_username);
        }
    }
    //选择条件
    $sid = trim(MooGetGPC('sid', 'string', 'G'));
    if (!empty($sid)) {
        unset($condition);
        $condition[] = " sid ={$sid} ";
    }
    // print_r($condition);
    /*$startTime=MooGetGPC('startTime','string','G');
    	if(!empty($startTime)){
    	   $starttimestamp=strtotime($startTime);
    	   $condition[] = " dateline>='{$starttimestamp}'"; 
        }*/
    $endTime = MooGetGPC('endTime', 'string', 'G');
    if (!empty($endTime)) {
        $endtimestamp = strtotime($endTime . "+1 day");
        $condition[] = " dateline<'{$endtimestamp}'";
    }
    $where = " where 1  ";
    if (!empty($condition)) {
        $condition_sql = implode(' and ', $condition);
        $where .= " and  {$condition_sql}";
    } else {
        $where .= "";
    }
    $sql = "SELECT count(id) AS c FROM {$GLOBALS['dbTablePre']}member_effectgrade    {$where} ";
    $remark_total = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
    $total = $remark_total['c'];
    $limit = 6;
    $page = intval(MooGetGPC('page', 'integer', 'G'));
    if ($page <= 0) {
        $page = 1;
    }
    $page_total = max(1, ceil($total / $limit));
    $page = min($page, $page_total);
    $offset = ($page - 1) * $limit;
    $sql = "SELECT id,sid,gid,remark,dateline  FROM {$GLOBALS['dbTablePre']}member_effectgrade  {$where}  order by dateline desc  LIMIT {$offset},{$limit}";
    $remark_list = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
    if (!empty($sid)) {
        $title = "查看客服{$sid}的评语";
    } else {
        $title = '客服盘库评语';
    }
    $currenturl = "index.php?action=myuser&h=remark&sid={$sid}&groupid={$groupid}";
    $page_links = multipage($total, $limit, $page, $currenturl);
    if (in_array($GLOBALS['groupid'], $GLOBALS['admin_service_arr'])) {
        $isAdmin = 1;
    }
    require_once adminTemplate('myuser_remark');
}
Exemplo n.º 14
0
function get_search_condition($where = '')
{
    $condition[] = $where;
    $keyword = trim(MooGetGPC('keyword', 'string', 'G'));
    $choose = MooGetGPC('choose', 'string', 'G');
    $gender = MooGetGPC('gender', 'integer', 'G');
    $province = MooGetGPC('province', 'integer', 'G');
    $islock = MooGetGPC('islock', 'integer', 'G');
    $age_start = MooGetGPC('age_start', 'integer', 'G');
    $age_end = MooGetGPC('age_end', 'integer', 'G');
    $effect_grade = MooGetGPC('effect_grade', 'G');
    $regdate = MooGetGPC('regdate', 'string', 'G');
    $endTime = MooGetGPC('end', 'string', 'G');
    $startTime = MooGetGPC('start', 'string', 'G');
    $isControl = MooGetGPC('isControl', 'string', 'G');
    $isForcast = MooGetGPC('isForcast', 'string', 'G');
    $cf = MooGetGPC('cf', 'string', 'G');
    //可控预测的会员操作
    $uidControlArr = array();
    if ($isControl == 'yes') {
        if (empty($cf)) {
            $sql = "select uid from web_member_isControl where dateline>={$startTime} and dateline<{$endTime} and sid={$keyword} and flag=1";
        } else {
            $sql = "select uid from web_member_isControl where sid={$keyword} and flag=1";
        }
        $uidControlArr = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
        $uidlist = "";
        $comma = "";
        foreach ($uidControlArr as $v) {
            $uidlist .= $comma . $v['uid'];
            $comma = ",";
        }
        $condition[] = " m.uid in ({$uidlist})";
    }
    //可控预测的会员操作
    $uidForcastArr = array();
    if ($isForcast == 'yes') {
        if (empty($cf)) {
            $sql = "select uid from web_member_isControl where dateline>={$startTime} and dateline<{$endTime} and sid={$keyword} and isforcast=1";
        } else {
            $sql = "select uid from web_member_isControl where  sid={$keyword} and isforcast=1";
        }
        $uidForcastArr = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
        $uidlist = "";
        $comma = "";
        foreach ($uidForcastArr as $v) {
            $uidlist .= $comma . $v['uid'];
            $comma = ",";
        }
        $condition[] = " m.uid in ({$uidlist})";
    }
    if (!empty($choose) && !empty($keyword)) {
        if ($choose == 'username' || $choose == 'nickname') {
            $condition[] = " m.{$choose} like '%{$keyword}%'";
        } else {
            $condition[] = " m.{$choose} = '{$keyword}'";
        }
    }
    if ($gender == 2 || $gender == 1) {
        if ($gender == 1) {
            $condition[] = " m.gender='1'";
        } else {
            $condition[] = " m.gender='0'";
        }
    } elseif ($gender == 3) {
        $condition[] = "m.gender>=0 and m.gender<=1 ";
    }
    if (!empty($province)) {
        if ($province == '10101201' || $province == '10101002') {
            $condition[] = " m.city='{$province}'";
        } else {
            $condition[] = " m.province='{$province}'";
        }
    }
    if (!empty($islock)) {
        if ($islock == 1) {
            $condition[] = " m.is_lock='1'";
        } else {
            $condition[] = " m.is_lock='0'";
        }
    }
    if ($age_start || $age_end) {
        $age_start = $age_start ? $age_start : 0;
        $age_end = $age_end ? $age_end : 100;
        $age1 = min($age_start, $age_end);
        $age2 = max($age_start, $age_end);
        $age1 = date('Y') - $age1;
        $age2 = date('Y') - $age2;
        $condition[] = " m.birthyear >= {$age2}";
        $condition[] = " m.birthyear <= {$age1}";
    }
    //当前在线1,2为一天,3为一周内,4为一周外
    if (isset($_GET['online'])) {
        $online = MooGetGPC('online', 'string', 'G');
        switch ($online) {
            case 1:
                $time = time() - 100;
                $condition[] = " ma.real_lastvisit>={$time}";
                break;
            case 2:
                $time = time() - 24 * 3600;
                $condition[] = " ma.real_lastvisit>={$time}";
                break;
            case 3:
                $time1 = time() - 7 * 24 * 3600;
                $time2 = time() - 24 * 3600;
                $condition[] = " ma.real_lastvisit >= {$time1}";
                $condition[] = " ma.real_lastvisit <= {$time2}";
                break;
            case 4:
                $time = time() - 7 * 24 * 3600;
                $condition[] = " ma.real_lastvisit <= {$time}";
                break;
        }
    }
    //所管理的客服id列表
    $myservice_idlist = get_myservice_idlist();
    if (empty($myservice_idlist)) {
        $condition[] = " m.sid IN({$GLOBALS['adminid']})";
    } elseif ($myservice_idlist == 'all') {
        //all为客服主管能查看所有的
    } else {
        $condition[] = " m.sid IN({$myservice_idlist})";
    }
    //分类
    if (!empty($effect_grade)) {
        $condition[] = " ma.effect_grade ={$effect_grade}";
    }
    //分类 起始日期结束日期
    if (empty($isControl) && empty($isForcast)) {
        if ($endTime) {
            $condition[] = "   ma.dateline<'{$endTime}'";
        }
    }
    if (empty($isControl) && empty($isForcast)) {
        if ($startTime) {
            $condition[] = "   ma.dateline>'{$startTime}'";
        }
    }
    //注册时间
    if ($regdate) {
        $regstamp = strtotime('+1 day', strtotime($regdate));
        $regstampstart = strtotime('-9 day', strtotime($regdate));
        $condition[] = "   m.regdate>='{$regstampstart}' and m.regdate<='{$regstamp}'";
    }
    $result = implode(' AND ', $condition);
    return $result;
}
Exemplo n.º 15
0
function financial_member_grade_count()
{
    global $_MooClass, $dbTablePre, $userid, $pagesize, $grade;
    $page = max(1, MooGetGPC('page', 'integer', 'G'));
    $limit = 20;
    $offset = ($page - 1) * $limit;
    $myservice_idlist = get_myservice_idlist();
    if (empty($myservice_idlist)) {
        $condition[] = " sid IN({$GLOBALS['adminid']})";
    } elseif ($myservice_idlist == 'all') {
        //all为客服主管能查看所有的
    } else {
        $condition[] = " sid IN({$myservice_idlist})";
    }
    if ($_POST['start_time'] || $_POST['end_time']) {
        $start_time = strtotime(trim(MooGetGPC('start_time', 'string', 'P')));
        $end_time = strtotime(trim(MooGetGPC('end_time', 'string', 'P'))) + 86400;
        if ($start_time) {
            $condition[] = " dateline > {$start_time} ";
        }
        if ($end_time) {
            if ($start_time && $end_time <= $start_time) {
                $end_time = $start_time + 86400;
                //结束时间小于开始时间,默认搜索一天
            }
            $condition[] = " dateline <= {$end_time} ";
        }
    }
    if ($condition) {
        $result = "where " . implode(' AND ', $condition);
    }
    $sql = "SELECT uid,sid,dateline,states FROM {$dbTablePre}change_grade {$result} order by dateline desc limit {$offset},{$limit}";
    $total = getcount('change_grade', $result);
    $currenturl = "index.php?action=financial&h=member_grade_count";
    $pages = multipage($total, $limit, $page, $currenturl);
    $con_info = $_MooClass['MooMySQL']->getAll($sql);
    foreach ($con_info as $v) {
    }
    //print_r($con_info);
    require adminTemplate('financial_member_grade_count');
}
Exemplo n.º 16
0
function active_leer_list()
{
    //note 分页处理
    $page = max(1, MooGetGPC('page', 'integer'));
    $limit = 5;
    $offset = ($page - 1) * $limit;
    $type = MooGetGPC('type', 'string');
    //note 显示全部
    if (isset($_GET['type']) && $_GET['type'] == 'all') {
        //note 显示已处理过的
    } else {
        if (isset($_GET['type']) && $_GET['type'] == 'dealed') {
            $condition[] = " dealstate = '1'";
            //note 显示未处理过的
        } else {
            $condition[] = " dealstate = '0'";
        }
    }
    //note 所管理的客服id列表
    $myservice_idlist = get_myservice_idlist();
    if (empty($myservice_idlist)) {
        $condition[] = " m.sid IN({$GLOBALS['adminid']})";
    } elseif ($myservice_idlist == 'all') {
    } else {
        $condition[] = " m.sid IN({$myservice_idlist})";
    }
    //note 处理搜索会员聊天
    if (isset($_GET['action']) && $_GET['action'] == 'active_leer') {
        $choose = MooGetGPC('choose', 'string');
        $keyword = MooGetGPC('keyword', 'string');
        if (!empty($choose) && !empty($keyword)) {
            $condition[] .= " {$choose} = '{$keyword}'";
        }
    }
    $sql_where = '';
    if (!empty($condition)) {
        $sql_where = 'WHERE ' . implode(' AND ', $condition);
    }
    //note 查询语句
    $sql = "SELECT COUNT(*) num FROM {$GLOBALS['dbTablePre']}service_leer l LEFT JOIN {$GLOBALS['dbTablePre']}members_search m ON l.senduid=m.uid {$sql_where}";
    $total = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
    $sql = "SELECT l.*,m.nickname as send_nickname, m.gender as send_gender FROM {$GLOBALS['dbTablePre']}service_leer l LEFT JOIN {$GLOBALS['dbTablePre']}members_search m ON l.senduid=m.uid  {$sql_where} ORDER BY l.lid DESC LIMIT {$offset},{$limit}";
    $user_arr = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
    //	foreach($user_arr as $k => $v) {
    //		//note 查询出发送用户的昵称,性别
    //		$sql = "SELECT nickname,gender FROM {$GLOBALS['dbTablePre']}members_search WHERE uid = '{$v[senduid]}'";
    //		$send_user = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
    //		$user_arr[$k]['send_nickname'] = $send_user['nickname'];
    //		$user_arr[$k]['send_gender'] = $send_user['gender'];
    //
    //		//note 查询出接受用户的昵称,性别
    //		$sql = "SELECT nickname,gender FROM {$GLOBALS['dbTablePre']}members_search WHERE uid = '{$v[receiveuid]}'";
    //		$receive_user = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
    //		$user_arr[$k]['receive_nickname'] = $receive_user['nickname'];
    //		$user_arr[$k]['receive_gender'] = $receive_user['gender'];
    //
    //	}
    //start
    /* $receiveuids = array();
    	foreach ($user_arr as $k=>$v)
    	{
    		if (!in_array($v['receiveuid'],$receiveuids)){
    			$receiveuids[] = $v['receiveuid'];
    		}
    	}
    	if (!empty($receiveuids))
    	{
    		sort($receiveuids);
    		$sql       = "SELECT nickname,gender FROM {$GLOBALS['dbTablePre']}members_search WHERE uid IN(".implode(',',$receiveuids).")";
    
    		$receive_user = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
    		foreach ($user_arr as $k=>$v)
    		{
    			if (($keys = array_search($v['receiveuid'], $receiveuids)) !== false){
    				 isset($receive_user[$keys]['nickname']) && $user_arr[$k]['receive_nickname'] = $receive_user[$keys]['nickname'];
    				 isset($receive_user[$keys]['gender']) && $user_arr[$k]['receive_gender']   = $receive_user[$keys]['gender'];
    			}
    		}
    	} */
    //end
    //note 获得当前的url 去除多余的参数
    $currenturl = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
    $currenturl = preg_replace("/(&page=\\d+)/", "", $currenturl);
    $currenturl = preg_replace("/(&type=undealed)/", "", $currenturl);
    $currenturl = preg_replace("/(&type=dealed)/", "", $currenturl);
    $currenturl = preg_replace("/(&type=all)/", "", $currenturl);
    $currenturl2 = $currenturl;
    $currenturl = $currenturl . "&type={$type}";
    $pages = multipage($total['num'], $limit, $page, $currenturl);
    //note 跳转到某一页
    $page_num = ceil($total['num'] / $limit);
    //note 插入日志
    serverlog(1, $GLOBALS['dbTablePre'] . 'service_leer', "{$GLOBALS['username']}查看秋波列表", $GLOBALS['adminid']);
    require adminTemplate('active_leer_list');
}
Exemplo n.º 17
0
function active_email_list()
{
    //note 分页处理
    $page = max(1, MooGetGPC('page', 'integer'));
    $limit = 5;
    $offset = ($page - 1) * $limit;
    $type = MooGetGPC('type', 'string');
    //note 显示全部
    if (isset($_GET['type']) && $_GET['type'] == 'all') {
        //note 显示已处理过的
    } else {
        if (isset($_GET['type']) && $_GET['type'] == 'dealed') {
            $condition[] = " a.dealstate = '1'";
            //note 显示未处理过的
        } else {
            $condition[] = " a.dealstate = '0'";
        }
    }
    //note 所管理的客服id列表
    $myservice_idlist = get_myservice_idlist();
    if (empty($myservice_idlist)) {
        $condition[] = " a.sid IN({$GLOBALS['adminid']})";
    } elseif ($myservice_idlist == 'all') {
    } else {
        $condition[] = " a.sid IN({$myservice_idlist})";
    }
    //note 处理
    if (isset($_GET['action']) && $_GET['action'] == 'active_email') {
        $choose = MooGetGPC('choose', 'string');
        $keyword = MooGetGPC('keyword', 'string');
        if (!empty($choose) && !empty($keyword)) {
            $condition[] = " {$choose} like '{$keyword}" . "%'";
        }
    }
    // var_dump($condition);
    $sql_where = '';
    if (!empty($condition)) {
        $sql_where = ' and  ' . implode(' AND ', $condition);
    }
    //note 查询语句
    //$sql = "SELECT COUNT(a.id) num FROM {$GLOBALS['dbTablePre']}admin_remark a ,{$GLOBALS['dbTablePre']}members_search m  where a.title like '%会员给给你发消息了,请速查看。%'  and  SUBSTRING_INDEX(a.title,'会',1)=m.uid $sql_where";
    //$total = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
    $sql = "SELECT COUNT(a.id) num FROM {$GLOBALS['dbTablePre']}admin_remark a   where a.title like '%给您发消息了,请速查看。'  {$sql_where}";
    $total = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
    $sql = "SELECT a.id as id,a.sid as sid,a.title as title,a.content as content,a.dateline as dateline ,a.dealstate as dealstate FROM {$GLOBALS['dbTablePre']}admin_remark a  where (a.title like '%给您发消息了,请速查看。')  {$sql_where} ORDER BY a.`dateline` DESC  LIMIT {$offset},{$limit}";
    //$sql = "SELECT a.id as id,a.sid as sid,a.title as title,a.content as content,a.dateline as dateline ,a.dealstate as dealstate,m.uid as uid,m.nickname as nickname FROM {$GLOBALS['dbTablePre']}admin_remark a , {$GLOBALS['dbTablePre']}members_search m where (a.title like '%给你发消息了,请速查看。%') and  m.uid=SUBSTRING_INDEX(a.title,'会',1) $sql_where ORDER BY a.`dateline` DESC  LIMIT {$offset},{$limit}";
    $user_arr = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
    //chuzx 获取客服用户名
    $sids = array();
    //保存sid
    foreach ($user_arr as $k => $v) {
        if (in_array($v['sid'], $sids)) {
            continue;
        }
        $sids[] = $v['sid'];
    }
    if (!empty($sids)) {
        $sql = "SELECT username FROM {$GLOBALS['dbTablePre']}admin_user WHERE uid IN (" . implode(',', $sids) . ")";
        $names = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
        /* $sql  = "select uid,username from web_members_search";
        		$members=$GLOBALS['_MooClass']['MooMySQL']->getAll($sql); */
        foreach ($user_arr as $k => $v) {
            if (($keys = array_search($v['sid'], $sids)) !== false) {
                $user_arr[$k]['username'] = $names[$keys]['username'];
            }
            if (preg_match("/\\d{5,9}/", $v['title'], $matches)) {
                $user_arr[$k]['uid'] = $matches[0];
            }
        }
    }
    //end chuzx
    //note 获得当前的url 去除多余的参数
    /* $currenturl = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; 
    	$currenturl = preg_replace("/(&page=\d+)/","",$currenturl);
    	$currenturl = preg_replace("/(&type=undealed)/","",$currenturl);
    	$currenturl = preg_replace("/(&type=dealed)/","",$currenturl);
    	$currenturl = preg_replace("/(&type=all)/","",$currenturl);
    	$currenturl2 = $currenturl;
    	$currenturl = $currenturl."&type=$type";
    	echo $currenturl; */
    $currenturl2 = $currenturl = "index.php?action=active_email&h=list&type={$type}&choose={$choose}&keyword={$keyword}";
    $pages = multipage($total['num'], $limit, $page, $currenturl);
    //note 跳转到某一页
    $page_num = ceil($total['num'] / $limit);
    require adminTemplate('active_email_list');
}
Exemplo n.º 18
0
/**
 * 登陆系统后组长,客服显示自己范围内的用户, 主管显示全部
 * @param string $where 查询条件 组合语句
 * @param string $keyword 查询条件 
 */
function active_commission_loginlist($where, $keyword)
{
    $member_arr = array();
    //note 所管理的客服id列表
    $myservice_idlist = get_myservice_idlist();
    //note 所管理的用户列表
    if (empty($myservice_idlist)) {
        $sql = "select uid FROM {$GLOBALS['dbTablePre']}members_search WHERE sid IN ({$GLOBALS['adminid']})";
    } elseif ($myservice_idlist == 'all') {
        //all为客服主管能查看所有的
        $sql = "select uid FROM {$GLOBALS['dbTablePre']}members_search limit 100";
    } else {
        $sql = "select uid FROM {$GLOBALS['dbTablePre']}members_search WHERE sid IN ({$myservice_idlist})";
    }
    $members = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
    foreach ($members as $v) {
        $member_arr[] = $v['uid'];
    }
    $member_list = implode(",", $member_arr);
    //note 组装sql语句
    if (empty($member_list)) {
        $where .= " AND other_contact_you IN (null)";
    } else {
        $where .= " AND other_contact_you IN ({$member_list})";
    }
    //note 返回客服查看用户范围
    $return_arr = array();
    $return_arr['where'] = $where;
    $return_arr['members'] = $member_arr;
    return $return_arr;
}
Exemplo n.º 19
0
function check_voice()
{
    $uid = MooGetGPC('uid', 'integer', 'P');
    $usersid = MooGetGPC('usersid', 'string');
    $pass = MooGetGPC('pass', 'integer');
    if (empty($pass)) {
        $sql_where = 'where b.toshoot_voice_check=1';
    } else {
        $sql_where = 'where b.toshoot_voice_check=2';
    }
    if (!empty($uid)) {
        $sql_where .= " and b.uid='{$uid}'";
    }
    $myservice_idlist = get_myservice_idlist();
    if (empty($myservice_idlist)) {
        $sql_where .= " and a.sid ={$GLOBALS['adminid']}";
    } elseif ($myservice_idlist == 'all') {
        //all为客服主管能查看所有的
        if ($_REQUEST['usersid'] != "-1") {
            $sql_where .= isset($_REQUEST['usersid']) ? " and a.sid='{$usersid}' " : '';
        }
        $adminUser = $GLOBALS['_MooClass']['MooMySQL']->getAll("select uid,username from web_admin_user");
    } else {
        if ($_REQUEST['usersid'] != "-1") {
            $sql_where .= ' and a.sid' . (isset($_REQUEST['usersid']) ? "={$usersid} " : " IN({$myservice_idlist}) ");
        }
        $adminUser = $GLOBALS['_MooClass']['MooMySQL']->getAll("select uid,username from web_admin_user where uid in (" . $myservice_idlist . ")");
    }
    $sql = "select count(*) as c from {$GLOBALS['dbTablePre']}certification b left join {$GLOBALS['dbTablePre']}members_search a on a.uid=b.uid {$sql_where}";
    $count = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
    //分页
    $page_per = 20;
    $page = get_page();
    $limit = 20;
    $total = $count['c'];
    $offset = ($page - 1) * $limit;
    $myurl = explode('|', getUrl());
    $myurl[1] = $myurl[1] . (isset($_REQUEST['usersid']) ? '&usersid=' . $usersid : '');
    $page_links = multipage($total, $page_per, $page, $myurl[1]);
    $sql = "select a.uid,a.nickname,a.gender,a.birthyear,a.sid,c.lastvisit,b.toshoot_voice_check,b.toshoot_voice_time from {$GLOBALS['dbTablePre']}certification b left join {$GLOBALS['dbTablePre']}members_search a on a.uid=b.uid left join {$GLOBALS['dbTablePre']}members_login as c on c.uid=b.uid {$sql_where} limit {$offset},20";
    $check_voice = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
    require_once adminTemplate('check_voice');
}
Exemplo n.º 20
0
function active_uplink_list()
{
    $condition = array();
    $type = MooGetGPC('type', 'string', "G");
    //if(isset($_GET['xx']) && !empty($_GET['xx'])) {
    $choose = MooGetGPC('choose', 'string', "G");
    $keyword = MooGetGPC('keyword', 'string', "G");
    $startdate = MooGetGPC('startdate', 'string', "G");
    $enddate = MooGetGPC('enddate', 'string', "G");
    $starttime = strtotime($startdate);
    $endtime = strtotime($enddate);
    if (!empty($starttime)) {
        $condition[] = "reptime>" . $starttime;
    }
    if (!empty($endtime)) {
        $condition[] = "reptime<" . $endtime;
    }
    if (!empty($choose)) {
        if (!empty($startdate) && !empty($enddate)) {
            if (!empty($keyword)) {
                $condition[] = $choose . "= " . $keyword;
            }
        }
    }
    //}
    //note分页处理
    $page = max(1, MooGetGPC('page', 'integer'));
    $limit = 15;
    $offset = ($page - 1) * $limit;
    //得到所属客服下的会员
    $myservice_idlist = get_myservice_idlist();
    $myservice_idlist = empty($myservice_idlist) ? 'all' : $myservice_idlist;
    //计算总记录数
    //note 所管理的用户列表
    $adminid = $GLOBALS['adminid'];
    if (empty($myservice_idlist)) {
        $condition[] = "sid={$adminid}";
    } elseif ($myservice_idlist == 'all') {
        //all为客服主管能查看所有的
    } else {
        $condition[] = "  sid in ({$myservice_idlist})";
    }
    $where = implode(" and ", $condition);
    if (!empty($where)) {
        $where = " where " . $where;
    }
    if (!empty($where)) {
        $sql = "SELECT COUNT(*) num FROM {$GLOBALS['dbTablePre']}uplinkcontent " . $where;
        $sql_detail = "SELECT * FROM {$GLOBALS['dbTablePre']}uplinkcontent " . $where . " order by reptime desc  LIMIT {$offset},{$limit}";
    } else {
        $sql = "SELECT COUNT(*) num FROM {$GLOBALS['dbTablePre']}uplinkcontent {$where}";
        $sql_detail = "SELECT * FROM {$GLOBALS['dbTablePre']}uplinkcontent  {$where} order by reptime desc  LIMIT {$offset},{$limit}";
    }
    $total = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
    $user_arr = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql_detail);
    $currenturl = "index.php?action=active_uplink&h=list&choose={$choose}&keyword={$keyword}&startdate={$startdate}&enddate={$enddate}";
    $currenturl = $currenturl . "&type={$type}";
    $pages = multipage($total['num'], $limit, $page, $currenturl);
    //note 跳转到某一页
    $page_num = ceil($total['num'] / $limit);
    //note 插入日志
    serverlog(1, $GLOBALS['dbTablePre'] . 'servies', "{$GLOBALS['username']}查看会员上行列表", $GLOBALS['adminid']);
    //note 载入模块
    require adminTemplate('active_uplink_list');
}
Exemplo n.º 21
0
Arquivo: ajax.php Projeto: noikiy/zays
/**
* 输出所有备注,后台右下角提醒
* @author:fanglin
* 可对组,所有客服,某个id客服提醒
*/
function ajax_remark()
{
    $result = '';
    $sid = MooGetGPC('sid', 'integer', 'G');
    $type = MooGetGPC('type', 'string', 'G');
    $time = time();
    $myservice_idlist = get_myservice_idlist();
    if ($type == 'timeover') {
        //最近备注
        if (empty($myservice_idlist) || $myservice_idlist === $GLOBALS['adminid']) {
            $sql = "SELECT id,sid,groupid,title,content,status,awoketime,dateline,dealstate,send_id,flag FROM {$GLOBALS['dbTablePre']}admin_remark WHERE\n\t\t\t\t`status`='0' AND `awoketime`>='{$time}' AND (`sid`='{$GLOBALS['adminid']}')  ORDER BY `awoketime` ASC limit 30";
            // OR groupid='{$GLOBALS['groupid']}' OR groupid='-1')
        } elseif ($myservice_idlist == 'all') {
            $sql = "SELECT id,sid,groupid,title,content,status,awoketime,dateline,dealstate,send_id,flag FROM {$GLOBALS['dbTablePre']}admin_remark WHERE\n\t\t\t\t`status`='0' AND `awoketime`>='{$time}' AND (`sid`='{$GLOBALS['adminid']}')  ORDER BY `awoketime` ASC limit 30";
            // OR groupid='{$GLOBALS['groupid']}' OR groupid='-1')
        } else {
            if (!in_array($GLOBALS['groupid'], $GLOBALS['admin_userinfo_check']) && !in_array($GLOBALS['groupid'], $GLOBALS['admin_service_team'])) {
                $sql = "SELECT id,sid,groupid,title,content,status,awoketime,dateline,dealstate,send_id,flag FROM {$GLOBALS['dbTablePre']}admin_remark WHERE\n\t\t\t\t`status`='0' AND `awoketime`>='{$time}' AND  (`sid` in ({$myservice_idlist}))  ORDER BY `awoketime` ASC limit 30";
                //OR groupid='{$GLOBALS['groupid']}' OR groupid='-1')
            } else {
                $sql = "SELECT id,sid,groupid,title,content,status,awoketime,dateline,dealstate,send_id,flag FROM {$GLOBALS['dbTablePre']}admin_remark WHERE\n\t\t\t\t`status`='0' AND `awoketime`>='{$time}' AND (`sid`='{$GLOBALS['adminid']}')   ORDER BY `awoketime` ASC limit 30";
                //OR groupid='{$GLOBALS['groupid']}' OR groupid='-1')
            }
        }
        $remark = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
    } elseif ($type == 'notime') {
        //备注
        if (empty($myservice_idlist)) {
            $sql = "SELECT id,sid,groupid,title,content,status,awoketime,dateline,dealstate,send_id,flag FROM {$GLOBALS['dbTablePre']}admin_remark WHERE \n\t\t\t\t `status`='0' AND `awoketime`='' AND flag>0  and  (`sid`='{$GLOBALS['adminid']}') ORDER BY id desc limit 10";
            //OR groupid='{$GLOBALS['groupid']}' OR groupid='-1'
        } elseif ($myservice_idlist == 'all') {
            $sql = "SELECT id,sid,groupid,title,content,status,awoketime,dateline,dealstate,send_id,flag FROM {$GLOBALS['dbTablePre']}admin_remark WHERE \n\t\t\t\t `status`='0' AND `awoketime`='' AND flag>0  and  (`sid`='{$GLOBALS['adminid']}') \tORDER BY id desc limit 10";
            //OR groupid='{$GLOBALS['groupid']}' OR groupid='-1'
        } else {
            if (!in_array($GLOBALS['groupid'], $GLOBALS['admin_userinfo_check']) && !in_array($GLOBALS['groupid'], $GLOBALS['admin_service_team'])) {
                $sql = "SELECT id,sid,groupid,title,content,status,awoketime,dateline,dealstate,send_id,flag FROM {$GLOBALS['dbTablePre']}admin_remark WHERE \n\t\t\t\t`status`='0' AND  `awoketime`='' AND flag>0   and (`sid` in ({$myservice_idlist})) ORDER BY id desc limit 10";
                // OR groupid='{$GLOBALS['groupid']}' OR groupid='-1')
            } else {
                $sql = "SELECT id,sid,groupid,title,content,status,awoketime,dateline,dealstate,send_id,flag FROM {$GLOBALS['dbTablePre']}admin_remark WHERE \n\t\t\t\t `status`='0' AND `awoketime`='' AND flag>0  and  (`sid`='{$GLOBALS['adminid']}') ORDER BY id desc limit 10";
                //OR groupid='{$GLOBALS['groupid']}' OR groupid='-1')
            }
        }
        $remark = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
    } elseif ($type == 'all') {
        //所有备注
        $sql = "SELECT id,sid,groupid,title,content,status,awoketime,dateline,dealstate,send_id,flag FROM {$GLOBALS['dbTablePre']}admin_remark WHERE \n\t\t\t\t(`sid`='{$GLOBALS['adminid']}') AND status=0 ORDER BY id desc limit 50";
        // OR groupid='{$GLOBALS['groupid']}' OR groupid='-1'
        $remark = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
    }
    $six_minute = time() - 300;
    $sql = "select s_fromid from {$GLOBALS['dbTablePre']}service_chat where s_uid='{$GLOBALS['adminid']}' and s_status=0 and s_time>'{$six_minute}' GROUP BY s_fromid";
    $chatmsg = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
    //=============回电总数单独统计====================
    if (empty($myservice_idlist) || $myservice_idlist === $GLOBALS['adminid']) {
        $sql = "SELECT id,sid,groupid,title,content,status,awoketime,dateline,dealstate,send_id,flag FROM {$GLOBALS['dbTablePre']}admin_remark WHERE\n\t\t\t\t\t(`sid`='{$GLOBALS['adminid']}') AND `status`='0' AND `awoketime`>='{$time}' limit 10";
        //  OR groupid='{$GLOBALS['groupid']}' OR groupid='-1' ORDER BY `awoketime` ASC";
    } elseif ($myservice_idlist == 'all') {
        $sql = "SELECT id,sid,groupid,title,content,status,awoketime,dateline,dealstate,send_id,flag FROM {$GLOBALS['dbTablePre']}admin_remark WHERE (`sid`='{$GLOBALS['adminid']}') AND `status`='0' AND `awoketime`>='{$time}' limit 10";
        // OR groupid='{$GLOBALS['groupid']}' OR groupid='-1' ORDER BY `awoketime` ASC";
    } else {
        if (!in_array($GLOBALS['groupid'], $GLOBALS['admin_userinfo_check']) && !in_array($GLOBALS['groupid'], $GLOBALS['admin_service_team'])) {
            $sql = "SELECT id,sid,groupid,title,content,status,awoketime,dateline,dealstate,send_id,flag FROM {$GLOBALS['dbTablePre']}admin_remark WHERE\n\t\t\t\t\t`status`='0' AND `awoketime`>='{$time}' and (`sid` in ({$myservice_idlist})) limit 10";
            // OR groupid='{$GLOBALS['groupid']}' OR groupid='-1'  ORDER BY `awoketime` ASC";
        } else {
            $sql = "SELECT id,sid,groupid,title,content,status,awoketime,dateline,dealstate,send_id,flag FROM {$GLOBALS['dbTablePre']}admin_remark WHERE\n\t\t\t\t\t(`sid`='{$GLOBALS['adminid']}')  AND `status`='0' AND `awoketime`>='{$time}' limit 10";
            // OR groupid='{$GLOBALS['groupid']}' OR groupid='-1'
        }
    }
    $remark_timeover = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
    if (empty($myservice_idlist) || $myservice_idlist === $GLOBALS['adminid']) {
        $sql = "SELECT id FROM {$GLOBALS['dbTablePre']}admin_remark WHERE (`sid`='{$GLOBALS['adminid']}') and flag>0  AND  `status`='0' AND `awoketime`='' \tORDER BY id desc limit 10";
        // OR groupid='{$GLOBALS['groupid']}' OR groupid='-1'
    } elseif ($myservice_idlist == 'all') {
        $sql = "SELECT id FROM {$GLOBALS['dbTablePre']}admin_remark WHERE (`sid`='{$GLOBALS['adminid']}') and flag>0 AND `status`='0' AND `awoketime`='' ORDER BY id desc limit 10";
        //OR groupid='{$GLOBALS['groupid']}' OR groupid='-1'
    } else {
        if (!in_array($GLOBALS['groupid'], $GLOBALS['admin_userinfo_check']) && !in_array($GLOBALS['groupid'], $GLOBALS['admin_service_team'])) {
            $sql = "SELECT id FROM {$GLOBALS['dbTablePre']}admin_remark WHERE  `status`='0' AND `awoketime`=''  and flag>0 AND \n\t\t\t\t(`sid` in ({$myservice_idlist})) ORDER BY id desc limit 10";
            // OR groupid='{$GLOBALS['groupid']}' OR groupid='-1'
        } else {
            $sql = "SELECT id FROM {$GLOBALS['dbTablePre']}admin_remark WHERE (`sid`='{$GLOBALS['adminid']}') and flag>0 AND `status`='0' AND `awoketime`='' \tORDER BY id desc limit 10";
            // OR groupid='{$GLOBALS['groupid']}' OR groupid='-1'
        }
    }
    $remark_notime = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
    if (count($remark_timeover) == 0 && empty($chatmsg) && count($remark_notime) == 0) {
        echo 0;
        exit;
    }
    if (!empty($chatmsg)) {
        $result .= "<ul class=\"bgon\">";
        foreach ($chatmsg as $msg) {
            $result .= "<li><a href='index.php?n=chat&chatorid=" . $msg['s_fromid'] . "' target='_brank' onclick=\"javascript:\$(this).empty()\">客服ID:" . $msg['s_fromid'] . "发给你在线消息</a></li>";
        }
        $result .= "</ul>";
    }
    if (empty($remark)) {
        $result .= "<p>您有<a href='#'>0条备注</a></p>";
    } else {
        $result .= "<ul class=\"remark\">";
        foreach ($remark as $key => $arr) {
            if ($arr['status'] == 0) {
                $result .= "<li class=\"title state-{$arr['id']}\"  onclick=\"showcontent(" . $key . ");\"><a href=\"javascript:deal(" . $arr['id'] . ")\" id=\"state-" . $arr['id'] . "\" style=\"float:right;\">未解决</a>";
            } else {
                $result .= "<li class=\"title\" onclick=\"showcontent(" . $key . ");\"><a href=\"javascript:aworke()\" style=\"float:right;\">已解决</a>";
            }
            if ($arr['title'] == '会员付款') {
                $result .= $key + 1 . ".<span style='color:#ff0000;font-weight:bold;'>" . $arr['sid'] . ":" . MooCutstr($arr['title'], 20, "…") . "</span></li>";
            } else {
                $result .= $key + 1 . "." . $arr['sid'] . ":" . MooCutstr($arr['title'], 20, "…") . "</li>";
            }
            $result .= "<li class=\"content state-{$arr['id']}\"  id=\"content-" . $key . "\">" . $arr['content'] . "</li>";
        }
        $result .= "</ul>";
    }
    /*if($type!='notime'){
      	 $count=count($remark);
      }elseif($type=='notime'){
      	 $count=0;
      }*/
    $result .= "|最近备注(" . count($remark_timeover) . ")";
    $result .= "|备注回电(" . count($remark_notime) . ")";
    /*if ($type=='timeover'){
       $result .= "|最近备注(".count($remark).")";
      }elseif ($type=='notime'){
      	$result .= "|备注回电(".count($remark).")";
      }*/
    echo $result;
    exit;
}
Exemplo n.º 22
0
function allmember_fooquery()
{
    $page_per = 10;
    $page = max(1, MooGetGPC('page', 'integer'));
    $limit = 10;
    $offset = ($page - 1) * $limit;
    //得到所属客服下的
    $myservice_idlist = get_myservice_idlist();
    $listGroup = explode(',', $myservice_idlist);
    //如果组长  ,列出成员表
    //echo $myservice_idlist.'and'.$GLOBALS['adminid'];
    $admin_userinfo_check = $GLOBALS['admin_userinfo_check'][0];
    $sql = "select uid,username from web_admin_user where groupid = {$admin_userinfo_check}";
    $name = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
    //if(MooGetGPC('Dealsubmit','string','P')){
    $deal = MooGetGPC('channel', 'integer', 'R');
    $send_id = MooGetGPC('send_id', 'integer', 'R');
    $sid = MooGetGPC('sid', 'integer', 'R');
    $starttime = MooGetGPC('startdate', 'string', 'R');
    $endtime = MooGetGPC('enddate', 'string', 'R');
    $start_time = strtotime($starttime);
    $end_time = strtotime($endtime + '+1 day');
    $channel = MooGetGPC('channel', 'string', 'R');
    //}
    $isPost = MooGetGPC('Dealsubmit', 'string', 'P');
    $page = MooGetGPC('page', 'string', 'R');
    $total = 0;
    $remark = array();
    if (empty($myservice_idlist)) {
        if ($isPost || $page) {
            if ($send_id == 0) {
                $where = " and status = '{$deal}' and dateline>='{$start_time}' and dateline<='{$end_time}'";
            } else {
                $where = " and status = '{$deal}' and dateline>='{$start_time}' and dateline<='{$end_time}' and send_id = '{$send_id}'";
            }
            $sql = "select count(id) as total from web_admin_remark where  flag>0 {$where}  and sid in ({$GLOBALS['adminid']})";
            $num = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
            $total = $num['total'];
            $sql = "select id,sid,title,content,dateline,status,flag from web_admin_remark where  flag>0 {$where} and sid in ({$GLOBALS['adminid']})  limit {$offset},{$limit} ";
            $remark = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
        }
    } elseif ($myservice_idlist == 'all') {
        //all为客服主管能查看所有的
        $adminUser = $GLOBALS['_MooClass']['MooMySQL']->getAll("select uid,username from web_admin_user", 0, 0, 0, true);
        if ($isPost || $page) {
            if ($send_id == 0) {
                $where = "and status = '{$deal}' and dateline>='{$start_time}' and dateline<='{$end_time}'";
            } else {
                $where = "and status = '{$deal}' and dateline>='{$start_time}' and dateline<='{$end_time}' and send_id = '{$send_id}'";
            }
            if ($sid > 0) {
                $where = "and status = '{$deal}' and dateline>='{$start_time}' and dateline<='{$end_time}' and sid = '{$sid}'";
            }
            $sql = "select count(id) as num_1 from web_admin_remark where  flag=1 {$where}";
            $num_1 = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
            $sql = "select count(id) as num_2 from web_admin_remark where  flag=2 {$where}";
            $num_2 = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
            $sql = "select count(id) as num_3 from web_admin_remark where  flag=3 {$where}";
            $num_3 = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
            $total = $num_1['num_1'] + $num_2['num_2'] + $num_3['num_3'];
            $sql = "select id,sid,title,content,dateline,status,flag from web_admin_remark where  flag>0 {$where} limit {$offset},{$limit}";
            $remark = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
        }
    } else {
        //组长以上权限
        $adminUser = $GLOBALS['_MooClass']['MooMySQL']->getAll("select uid,username from web_admin_user  where uid in ({$myservice_idlist})", 0, 0, 0, true);
        if ($isPost || $page) {
            if ($sid == 0) {
                $where = "and status = '{$deal}' and dateline>='{$start_time}' and dateline<='{$end_time}' and sid in ({$myservice_idlist})";
            } else {
                $where = "and status = '{$deal}' and dateline>='{$start_time}' and dateline<='{$end_time}' and sid = '{$sid}'";
            }
            $sql = "select count(id) as num_1 from web_admin_remark where  flag=1 {$where} ";
            $num_1 = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
            $sql = "select count(id) as num_2 from web_admin_remark where  flag=2 {$where} ";
            $num_2 = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
            $sql = "select count(id) as num_3 from web_admin_remark where  flag=3 {$where} ";
            $num_3 = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true);
            $total = $num_1['num_1'] + $num_2['num_2'] + $num_3['num_3'];
            $sql = "select id,sid,title,content,dateline,status,flag from web_admin_remark where flag>0 {$where}  limit {$offset},{$limit}";
            $remark = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true);
        }
    }
    $currenturl = "index.php?action=allmember&h=fooquery&startdate={$starttime}&enddate={$endtime}&channel={$channel}&send_id={$send_id}";
    $pages = multipage($total, $page_per, $page, $currenturl);
    $page_num = ceil($total / $limit);
    $title = '400回电查询';
    require_once adminTemplate('allmember_fooquery');
}
Exemplo n.º 23
0
/**
 * 红娘币奖赏查询
 * @param integer $my
 */
function reward_log($my = 0)
{
    global $str_;
    $sid_user = "******";
    $mange_list = array();
    $page_per = 15;
    $page = max(1, MooGetGPC('page', 'integer'));
    $limit = 15;
    $offset = ($page - 1) * $limit;
    $start = MooGetGPC('start', 'string', 'G');
    $end = MooGetGPC('end', 'string', 'G');
    $uid = MooGetGPC('sid', 'integer', 'G');
    $groupid = MooGetGPC('groupid', 'string', 'G');
    if ($uid != "") {
        $sql_s = "SELECT *FROM {$GLOBALS['dbTablePre']}admin_user WHERE uid=" . $uid;
        $sid_u = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql_s);
        $sid_user = $sid_u[0]['username'];
    }
    $where = $data = $ref = array();
    $total = 0;
    if ($groupid) {
        //$mange_list=array();
        $sql_ = "SELECT *FROM {$GLOBALS['dbTablePre']}admin_manage where id=" . $groupid;
        //这个查询出用户的manage_list
        $mange_list = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_);
        $man_id = $mange_list['manage_list'];
        //查询到这组的id
        $sql_user = "******" . $man_id . ")";
        //这个查询用户的id名字
        $mang_list = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql_user);
        $group = get_group_type($groupid);
        $where[] = "uid in (" . $man_id . ")";
        $ref[] = 'groupid=' . $groupid;
    }
    $group_list = get_group_type();
    $ins = rtrim($str_, ",");
    if (!empty($start) || !empty($end)) {
        if (!empty($start)) {
            $ref[] = 'start=' . $start;
        }
        if (!empty($end)) {
            $ref[] = 'end=' . $end;
        }
        if (!empty($start) && !empty($end)) {
            $where[] = '`time` BETWEEN ' . strtotime($start) . ' AND ' . strtotime($end);
        } else {
            $time = empty($start) ? $end : $start;
            $where[] = '`time` BETWEEN ' . strtotime($time) . ' AND ' . strtotime($time . ' 23:59:59');
        }
    }
    if (!empty($uid)) {
        $where[] = '`uid`=' . $uid;
        $ref[] = 'sid=' . $uid;
    }
    $wheres = empty($where) ? '' : 'where ' . implode(' and ', $where);
    $total = getcount('reward_log', $wheres);
    $sql = 'SELECT `id`,`uid`,`adminid`,`amount`,`time`,`type` ,`rewardid` FROM `' . $GLOBALS['dbTablePre'] . 'reward_log` ' . $wheres . ' LIMIT ' . $offset . ',' . $limit;
    $data = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql);
    $myservice = get_myservice_idlist();
    $myservices = $myservice == 'all' ? $GLOBALS['kefu_arr'] : explode(',', $myservice);
    $currenturl = "index.php?action=matchmaker&h=" . $GLOBALS['h'] . (empty($ref) ? '' : '&' . implode('&', $ref)) . "&groupid=" . $groupid;
    $pages = multipage($total, $limit, $page, $currenturl);
    $page_num = ceil($total / $limit);
    require_once adminTemplate('matchmaker_reward_log_list');
}