function cooperation_search() { $page = max(1, MooGetGPC('page', 'integer', 'G')); $limit = 20; $offset = ($page - 1) * $limit; $where = array(); $where['sid'] = MooGetGPC('sid', 'integer', 'P'); $where['activities'] = MooGetGPC('activities', 'string', 'P'); $where['cooperation'] = MooGetGPC('cooperation', 'integer', 'P'); if (!empty($where)) { foreach ($where as $key => $value) { if (!empty($value)) { $where[$key] = '`' . $key . '`=\'' . $value . '\''; } else { unset($where[$key]); } } } $where = empty($where) ? '' : 'where ' . implode(' and ', $where); $count = $GLOBALS['_MooClass']['MooMySQL']->getOne('SELECT COUNT(`id`) AS num FROM ' . $GLOBALS['dbTablePre'] . 'cooperation ' . $where); $data = $GLOBALS['_MooClass']['MooMySQL']->getAll('SELECT * FROM ' . $GLOBALS['dbTablePre'] . 'cooperation ' . $where . ' ORDER BY id DESC LIMIT ' . $offset . ',' . $limit); $currenturl = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"]; $currenturl2 = preg_replace("/(&page=\\d+)/", "", $currenturl); $total['num'] = isset($total['num']) && $total['num'] ? $total['num'] : 0; $pages = multipage($total['num'], $limit, $page, $currenturl); $page_num = ceil($total['num'] / $limit); $cooperation_config = $GLOBALS['cooperation_config']; $activities = $GLOBALS['activities']; $activitie = MooGetGPC('activities', 'string', 'P'); $sids = MooGetGPC('sid', 'integer', 'P'); serverlog(1, $GLOBALS['dbTablePre'] . 'cooperation', "{$GLOBALS['username']}查看志愿者合作列表", $GLOBALS['adminid']); require adminTemplate('active_cooperation_list'); exit; }
function system_adminaction_edit() { global $menu_nav_arr, $dbTablePre; $actionid = MooGetGPC('actionid', 'integer'); $ispost = MooGetGPC('ispost', 'integer'); if (empty($actionid)) { MooMessageAdmin('参数错误', 'index.php?action=adminaction&h=list', 1); } if ($ispost) { $actiondesc = MooGetGPC('actiondesc', 'string'); $actioncode = MooGetGPC('actioncode', 'string'); $navcode = MooGetGPC('navcode', 'string'); $navname = MooGetGPC('navname', 'string'); if (empty($actiondesc) || empty($actioncode) || empty($navcode) || empty($navname)) { $admin->showMessage('请将信息填写完整', 'index.php?action=adminaction&h=add', 1); } $sql = "UPDATE {$GLOBALS['dbTablePre']}admin_action SET navname='{$navname}',navcode='{$navcode}',actioncode='{$actioncode}',actiondesc='{$actiondesc}' WHERE id='{$actionid}'"; $result = $GLOBALS['_MooClass']['MooMySQL']->query($sql); if ($result) { //note 插入日志 serverlog(2, $GLOBALS['dbTablePre'] . 'admin_action', "{$GLOBALS['username']}修改操作{$actionid}", $GLOBALS['adminid']); salert('修改成功', 'index.php?action=system_adminaction&h=list'); //MooMessageAdmin('修改成功','index.php?action=system_adminaction&h=list',1); } else { salert('修改失败', 'index.php?action=system_adminaction&h=list'); //MooMessageAdmin('修改失败','index.php?action=system_adminaction&h=list',1); } } $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}admin_action WHERE id='{$actionid}'"; $adminaction = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql); require_once adminTemplate('adminaction_edit'); }
function site_media_edit() { $ispost = MooGetGPC('ispost', 'integer', 'P'); if ($ispost) { $id = MooGetGPC('id', 'integer', 'P'); $title = MooGetGPC('title', 'string', 'P'); $type = MooGetGPC('type', 'string', 'P'); $addtime = strtotime(MooGetGPC('addtime', 'string', 'P')); $source = MooGetGPC('source', 'string', 'P'); $content = MooGetGPC('content', 'string', 'P'); if (empty($content)) { salert("内容不能为空"); } $sql = "UPDATE {$GLOBALS['dbTablePre']}media SET sid = {$GLOBALS['adminid']},type = '{$type}', title = '{$title}', content = '{$content}', addtime = '{$addtime}', source = '{$source}' WHERE id={$id}"; $GLOBALS['_MooClass']['MooMySQL']->query($sql); //note 插入日志 serverlog(2, $GLOBALS['dbTablePre'] . 'media', "{$GLOBALS['username']}编辑媒体报道", $GLOBALS['adminid']); salert("编辑成功", "index.php?action=site_media&h=edit&id=" . $id); } $isedit = 1; $id = MooGetGPC('id', 'integer', 'G'); $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}media WHERE id = {$id}"; $news = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql); require adminTemplate('site_media_add'); }
function system_adminlog_del() { $logid_list = MooGetGPC('checkboxes', 'string'); $day = MooGetGPC('day', 'integer'); $time = time() - $day * 24 * 60 * 60; if (empty($logid_list) && empty($day)) { MooMessageAdmin('参数错误', 'index.php?action=system_adminlog&h=list', 1); } if (!empty($logid_list)) { $logid_string = implode(',', $logid_list); $sql = "DELETE FROM {$GLOBALS['dbTablePre']}server_log WHERE slid IN ({$logid_string})"; $result = $GLOBALS['_MooClass']['MooMySQL']->query($sql); $note = "ID:({$logid_string})"; } else { $sql = "DELETE FROM {$GLOBALS['dbTablePre']}server_log WHERE time<{$time}"; $result = $GLOBALS['_MooClass']['MooMySQL']->query($sql); $note = "时间早于" . date('Y-m-d H:i:s', $time); } //note 插入日志 serverlog(4, $GLOBALS['dbTablePre'] . 'server_log', "删除日志{$note}", $GLOBALS['adminid']); if ($result) { MooMessageAdmin('删除日志成功', 'index.php?action=system_adminlog&h=list', 1); } else { MooMessageAdmin('删除日志失败', 'index.php?action=system_adminlog&h=list', 1); } }
function site_recommendget() { global $_MooClass, $dbTablePre; $ispost = MooGetGPC('ispost', 'integer', 'G'); if ($ispost == '1') { $str = $_SERVER['REQUEST_URI']; preg_match_all('/uidlist=(\\d*)/i', $str, $uid); $uidarr = $uid[1]; $uidlist = implode(',', $uidarr); // echo $uidlist; $diamond_filename = "../data/cache/diamond_intro.php"; if (!file_exists($diamond_filename)) { echo "钻石会员推荐列表没有生成!"; exit; } else { if (!file_put_contents($diamond_filename, $uidlist)) { echo "写入不成功"; exit; } } //添加操作日志 serverlog(4, $GLOBALS['dbTablePre'] . "members_backinfo", "钻石会员推荐成功", $GLOBALS['adminid'], $GLOBALS['adminid']); salert("钻石会员推荐成功!", "index.php?action=site_recommend_diamond&h=list"); exit; } }
function financial_rewardpunish_list() { /*//note 处理搜索会员聊天 if($_GET['action'] == 'active_chat') { $choose = MooGetGPC('choose','string'); $keyword = MooGetGPC('keyword','string'); $where = ''; if(!empty($choose) && !empty($keyword)) { if($choose == 's_content') { $where = " WHERE $choose like '%$keyword%'"; }else{ $where = " WHERE $choose = '$keyword'"; } } } //note 登陆系统后客服显示自己范围内的, 主管显示全部 $return_arr = active_chat_loginlist($where,$keyword); $where = $return_arr['where']; $member_arr = $return_arr['members']; //note 分页处理 $page = max(1,MooGetGPC('page','integer')); $limit = 15; $offset = ($page-1)*$limit; //note 查询语句 if($where != '1') { //note 只查询属于该客服下的用户 //note 数据库查询 $sql = "SELECT COUNT(*) num FROM {$GLOBALS['dbTablePre']}service_chat $where"; $total = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql); $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}service_chat $where ORDER BY s_id DESC LIMIT {$offset},{$limit}"; $user_arr = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql); } //note 搜索分页处理 if(!empty($choose) && !empty($keyword)) { $currenturl = "index.php?action=active_chat&h=list&choose=$choose&keyword=".urlencode($keyword); }else { $currenturl = "index.php?action=active_chat&h=list"; } $pages = multipage( $total['num'], $limit, $page, $currenturl ); //note 跳转到某一页 $page_num = ceil($total['num']/$limit); */ $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}financial_rewardpunish"; $user_arr = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql); foreach ($user_arr as $k => $v) { $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}admin_user WHERE uid='{$v['uid']}'"; $user = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql); $user_arr[$k]['name'] = $user['name']; } //note 插入日志 serverlog(1, $GLOBALS['dbTablePre'] . 'financial_rewardpunish', "{$GLOBALS['username']}查看奖惩订单列表", $GLOBALS['adminid']); //note 调用模板 require adminTemplate('financial_rewardpunish_list'); }
function site_lovetype_del() { $id = MooGetGPC('id', 'integer', 'G'); $sql = "DELETE FROM {$GLOBALS['dbTablePre']}love_type WHERE id = {$id}"; $GLOBALS['_MooClass']['MooMySQL']->query($sql); //note 插入日志 serverlog(4, $GLOBALS['dbTablePre'] . 'love_type', '删除测试评分结果', $GLOBALS['adminid']); salert("删除成功", 'index.php?action=site_lovetype&h=list'); }
function site_lovequestion_del() { $tid = MooGetGPC('tid', 'integer', 'G'); $sql = "DELETE FROM {$GLOBALS['dbTablePre']}love_question WHERE lid = {$tid}"; $GLOBALS['_MooClass']['MooMySQL']->query($sql); //note 插入日志 serverlog(4, $GLOBALS['dbTablePre'] . 'love_question', '删除爱情测试题目', $GLOBALS['adminid']); salert("删除成功", 'index.php?action=site_lovequestion&h=list'); }
function login_login() { global $_MooClass, $dbTablePre, $memcached; /* $seccode1 = strtolower(MooGetGPC('vertify_code','string','P')); $seccode2 = MooGetGPC('seccode','string','C'); $session_seccode = $memcached->get($seccode2); if($seccode1 != $session_seccode){ MooMessageAdmin("验证码填写不正确,请确认。", "index.php?action=login",'','',3); } */ $username = MooGetGPC('username', 'string', 'P'); $password = MooGetGPC('password', 'string', 'P'); $password = md5($password); //判断用户名和密码是否为空 if ($username == '' || $password == '') { MooMessageAdmin('用户名或密码不能为空', 'index.php?n=login', 1); } $userinfo = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}admin_user WHERE `username`='{$username}' LIMIT 1 ", true); if ($userinfo['uid'] && $userinfo['password'] == $password) { MooSetCookie('admin', MooAuthCode("{$userinfo['uid']}\t{$userinfo['password']}", 'ENCODE'), 86400); //note 写入session表需要的字段值 $online_ip = GetIP(); $lastactive = $GLOBALS['timestamp']; //note 提取快到期的高级用户并加入备注中 $nowtime = time(); $endtime = $nowtime + 8 * 24 * 60 * 60; $_MooClass['MooMySQL']->query("DELETE FROM {$dbTablePre}custom_remark WHERE `keyword`='会员到期' AND `cid`='{$userinfo['uid']}'"); $remark = $_MooClass['MooMySQL']->getAll("SELECT `uid`,`endtime` FROM {$dbTablePre}members_search WHERE `sid`={$userinfo['uid']} AND `s_cid`=30 AND `endtime`<{$endtime}", 0, 0, 0, true); for ($i = 0; $i < count($remark); $i++) { $content = "尊敬的客服,您的红娘号为" . $remark[$i]['uid'] . "的会员将于" . date('Y-m-d', $remark[$i]['endtime']) . "到期,请尽快与该会员联系"; $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}custom_remark SET `cid`={$userinfo['uid']},`keyword`='会员到期',`content`='{$content}',`awoketime`='{$remark[$i]['endtime']}'"); } //更新最后登录相关记录 $sql = "UPDATE {$dbTablePre}admin_user SET lastlogin='******',lastip='{$online_ip}' WHERE uid='{$userinfo['uid']}'"; $GLOBALS['_MooClass']['MooMySQL']->query($sql); $sid_list = ''; //得到我所管理的客服id列表 $sid_list = get_mymanage_serviceid_list($userinfo['uid'], $userinfo['groupid']); $time = time(); $sql = "REPLACE INTO {$GLOBALS['dbTablePre']}admin_usersession SET uid='{$userinfo['uid']}',groupid='{$userinfo['groupid']}',dateline='{$time}',sid_list='{$sid_list}'"; $GLOBALS['_MooClass']['MooMySQL']->query($sql); //添加操作日志 serverlog(3, $dbTablePre . "admin_usersession", "{$userinfo['uid']}成功登陆后台", $userinfo['uid']); MooMessageAdmin('登陆成功', 'index.php?n=main', 1); } else { MooMessageAdmin('用户名或密码错误', 'index.php?n=login', 1); } }
function active_activity_list() { $type = MooGetGPC('type', 'integer', 'G'); $page = max(1, MooGetGPC('page', 'integer', 'G')); $limit = 20; $offset = ($page - 1) * $limit; $where = empty($type) ? '' : 'where `type`=' . $type; $sql = 'select `id`,`type`,`title`,`price`,`province`,`city`,`regtime` from `' . $GLOBALS['dbTablePre'] . 'activity` ' . $where . ' limit ' . $offset . ',' . $limit; $count = $GLOBALS['_MooClass']['MooMySQL']->getOne('select count(`id`) as total from `' . $GLOBALS['dbTablePre'] . 'activity` ' . $where); $count = empty($count) ? 0 : $count['total']; $data = empty($count) ? array() : $GLOBALS['_MooClass']['MooMySQL']->getAll($sql); serverlog(1, $GLOBALS['dbTablePre'] . 'activity', "{$GLOBALS['username']}查看活动列表", $GLOBALS['adminid']); require adminTemplate('active_activity_list'); }
function financial_telphonetime_list() { $sid_get = 1; $sid = $sid_get + 800; //note 查询出所有的客服 $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}admin_user"; $user_arr = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql); /* $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}admin_user WHERE uid='$v[uid]'"; $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}financial_telphonetime"; $user_arr = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql); foreach($user_arr as $k => $v){ $sql = " SELECT * FROM {$GLOBALS['dbTablePre']}admin_user WHERE uid='$v[uid]'"; $user = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql); $user_arr[$k]['name'] = $user['name']; } */ /* //note 处理导出功能 if($_GET['export']) { ob_clean(); if(empty($user_arr)){ echo '没有找到符合条件的财务报表'; exit; } $today = date("Y-m-d"); header("Content-type:application/vnd.ms-excel; charset=gbk"); header("Content-Disposition:attachment; filename={$today}.xls"); echo iconv('utf-8','gbk','客服')."\t"; echo iconv('utf-8','gbk','电话时间')."\t"; echo iconv('utf-8','gbk','日期')."\t\n"; foreach($user_arr as $k => $v){ echo iconv('utf-8','gbk',$v['name'])."\t"; echo iconv('utf-8','gbk',$v['telphonetime'])."\t"; echo iconv('utf-8','gbk',date("Y-m-d",$v['dateline']))."\t\n"; } exit; } */ //note 插入日志 serverlog(1, $GLOBALS['dbTablePre'] . 'financial_telphonetime', "{$GLOBALS['username']}查看个人电话时间", $GLOBALS['adminid']); //note 调用模板 require adminTemplate('financial_telphonetime_list'); }
function financial_ordertotal_list() { //note 处理搜索会员聊天 if ($_GET['action'] == 'financial_ordertotal') { $bgtime = MooGetGPC('bgtime', 'string'); $endtime = MooGetGPC('endtime', 'string'); $where = ' WHERE 1=1 '; if (!empty($bgtime) && !empty($endtime)) { $bgtime_arr = explode("-", $bgtime); $bgtime_mk = mktime(0, 0, 0, $bgtime_arr[1], $bgtime_arr[2], $bgtime_arr[0]); $endtime_arr = explode("-", $endtime); $endtime_mk = mktime(0, 0, 0, $endtime_arr[1], $endtime_arr[2], $endtime_arr[0]); if ($endtime < $bgtime) { echo "<script>alert('结束日期不能小于开始日期');window.location.href='index.php?action=financial_ordertotal&h=list'</script>"; exit; } $where .= " AND dateline >= '{$bgtime_mk}' AND dateline <= '{$endtime_mk}'"; } } //note 处理导出功能 $export = MooGetGPC('export', 'string', 'G'); //if($_GET['export']) { if ($export) { ob_clean(); if (empty($user_arr)) { echo '没有找到符合条件的财务报表'; exit; } $today = date("Y-m-d"); header("Content-type:application/vnd.ms-excel; charset=gbk"); header("Content-Disposition:attachment; filename={$today}.xls"); echo iconv('utf-8', 'gbk', '成功订单总数') . "\t"; echo iconv('utf-8', 'gbk', '日期') . "\t\n"; foreach ($user_arr as $k => $v) { echo iconv('utf-8', 'gbk', $v['name']) . "\t"; echo iconv('utf-8', 'gbk', date("Y-m-d", $v['dateline'])) . "\t\n"; } exit; } //note 数据库查询 $sql = "SELECT COUNT(*) num FROM {$GLOBALS['dbTablePre']}financial_orderok {$where}"; $total = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql); //note 插入日志 serverlog(1, $GLOBALS['dbTablePre'] . 'financial_orderok', "{$GLOBALS['username']}查看成功订单总数记录列表", $GLOBALS['adminid']); //note 调用模板 require adminTemplate('financial_ordertotal_list'); }
function system_adminmembers_move() { global $dbTablePre, $_MooClass; $kefu_list = get_kefulist(); $is_post = MooGetGPC('ispost', 'integer', 'G'); $fromuser = MooGetGPC('fromuser', 'integer', 'G'); if ($is_post && $fromuser) { $grade = MooGetGPC('grade', 'integer', 'G'); $getuser = MooGetGPC('getuser', 'integer', 'G'); $move_num = MooGetGPC('move_num', 'integer', 'G'); if ($move_num) { $limit = "limit {$move_num}"; } if ($grade) { $sql = "update {$dbTablePre}members_search m left join {$dbTablePre}member_admininfo a on m.uid=a.uid set m.sid={$getuser} where m.sid={$fromuser} and a.effect_grade={$grade} {$limit}"; $sql2 = "select m.uid as uid from {$dbTablePre}members_search m left join {$dbTablePre}member_admininfo a on m.uid=a.uid where m.sid={$fromuser} and a.effect_grade={$grade} {$limit}"; } else { $sql = "update {$dbTablePre}members_search set sid={$getuser} where sid={$fromuser} {$limit}"; $sql2 = "select uid from {$dbTablePre}members_search where sid={$fromuser} {$limit}"; } $rs = $_MooClass['MooMySQL']->getAll($sql2); if (isset($rs) && $rs) { foreach ($rs as $k => $v) { $str_arr[$v] = array($getuser); } searchApi('members_man members_women')->updateAttr(array('sid'), $str_arr); } $_MooClass['MooMySQL']->query($sql); $num = $_MooClass['MooMySQL']->affectedRows(); if ($num) { $sql = "update {$dbTablePre}admin_user set member_count=member_count-'{$num}' where uid={$fromuser}"; $_MooClass['MooMySQL']->query($sql); $sql = "update {$dbTablePre}admin_user set member_count=member_count+'{$num}' where uid={$getuser}"; $_MooClass['MooMySQL']->query($sql); serverlog(4, $GLOBALS['dbTablePre'] . "members_search", "{$GLOBALS['username']}将{$fromuser}号客服的{$num}个会员转出", $GLOBALS['adminid'], $uid); } salert("成功转移" . $num . "名会员", "index.php?action=system_adminmembers&h=move"); } require_once adminTemplate('system_adminmembers_move'); }
function system_admingroup_edit() { global $menu_nav_arr; $groupid = MooGetGPC('groupid', 'integer'); if (MooGetGPC('ispost', 'integer')) { $groupname = MooGetGPC('groupname', 'string', 'P'); $groupdesc = MooGetGPC('groupdesc', 'string', 'P'); $action_code = MooGetGPC('action_code', 'string', 'P'); $admin_nav = MooGetGPC('adminnav', 'string', 'P'); $login_type = MooGetGPC('login_type', 'string', 'P'); //$type = MooGetGPC('type','integer','P'); if (empty($groupname) || empty($groupdesc) || empty($action_code)) { MooMessageAdmin('请将信息填写完整', 'index.php?action=system_admingroup&h=add', 1); } $action = implode(",", $action_code); $admin_nav = @implode(",", $admin_nav); $sql = "UPDATE {$GLOBALS['dbTablePre']}admin_group SET groupname='{$groupname}', groupdesc='{$groupdesc}',nav='{$admin_nav}',action='{$action}' WHERE groupid='{$groupid}'"; $result = $GLOBALS['_MooClass']['MooMySQL']->query($sql); //note 插入日志 serverlog(3, $GLOBALS['dbTablePre'] . 'admin_group', $GLOBALS['username'] . "编辑{$groupname}权限", $GLOBALS['adminid']); if ($result) { salert('编辑成功'); } else { salert('编辑失败'); } } foreach ($menu_nav_arr as $key => $navcode) { $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}admin_action WHERE navcode = '{$key}'"; $var = "action_list_{$key}"; ${$var} = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql); } $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}admin_group WHERE groupid='{$groupid}'"; $group = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql); $action = explode(",", $group['action']); $nav = explode(",", $group['nav']); $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}admin_group ORDER BY groupid ASC"; $group_list = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql); require_once adminTemplate('admingroup_edit'); }
function system_adminuser_add() { if (MooGetGPC('ispost', 'integer')) { $userid = trim(MooGetGPC('aid', 'string', 'P')); $usercode = trim(MooGetGPC('usercode', 'string', 'P')); $username = trim(MooGetGPC('username', 'string', 'P')); $name = trim(MooGetGPC('name', 'string', 'P')); $groupid = trim(MooGetGPC('groupid', 'string', 'P')); $password = trim(MooGetGPC('password', 'string', 'P')); $desc = MooGetGPC('desc', 'string', 'P'); $isedit = MooGetGPC('isedit', 'string', 'P'); $is_allot = MooGetGPC('is_allot', 'integer', 'P'); // 是否自动分配客服 $sale_commission = MooGetGPC('sale_commission', 'integer', 'P'); $ccid = MooGetGPC('ccid', 'integer', 'P'); $addtime = time(); if (empty($username) || empty($groupid) || empty($name)) { salert('请将信息填写完整'); } if (empty($password) && !$isedit) { salert('请填写密码'); } $sql = "SELECT username FROM {$GLOBALS['dbTablePre']}admin_user WHERE username='******'"; $admin_user = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql); $password = md5($password); $sql = ""; if (empty($userid)) { if (!empty($admin_user)) { salert('此用户名已经存在!'); exit; } $sql = "INSERT INTO {$GLOBALS['dbTablePre']}admin_user SET `usercode`='{$usercode}',username='******',name='{$name}',groupid='{$groupid}',password='******',userdesc='{$desc}',is_allot='{$is_allot}',sale_commission='{$sale_commission}',dateline='{$addtime}'"; $note = '添加管理员成功'; $errors = '添加管理员失败'; serverlog(1, $GLOBALS['dbTablePre'] . 'members', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}创建客服", $GLOBALS['adminid']); } else { if (empty($_POST['password'])) { $sql = "UPDATE {$GLOBALS['dbTablePre']}admin_user SET `usercode`='{$usercode}',username='******',name='{$name}',groupid='{$groupid}',userdesc='{$desc}',is_allot='{$is_allot}',sale_commission='{$sale_commission}',ccid = '{$ccid}' WHERE uid='{$userid}'"; } else { $sql = "UPDATE {$GLOBALS['dbTablePre']}admin_user SET `usercode`='{$usercode}',username='******',name='{$name}',groupid='{$groupid}',password='******',userdesc='{$desc}',is_allot='{$is_allot}',sale_commission='{$sale_commission}',ccid = '{$ccid}' WHERE uid='{$userid}'"; } $note = '修改管理员成功'; $errors = '修改管理员失败'; serverlog(1, $GLOBALS['dbTablePre'] . 'members', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}修改{$userid}号客服信息", $GLOBALS['adminid']); } $result = $GLOBALS['_MooClass']['MooMySQL']->query($sql); if ($result) { salert($note); } else { salert($errors); } } if ($GLOBALS['groupid'] == 60) { $sql = "SELECT groupid,groupname FROM {$GLOBALS['dbTablePre']}admin_group "; } else { $sql = "SELECT groupid,groupname FROM {$GLOBALS['dbTablePre']}admin_group where groupid in (62,63,64,65,66,67,68,69,70,71)"; } $group_list = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql); // print_r($group_list); require_once adminTemplate('adminuser_add'); }
function allmember_foo() { global $dbTablePre; $condition = ''; /*$keyword = trim(MooGetGPC('keyword','string','P')); $choose = MooGetGPC('choose','string','P'); if(!empty($choose) && !empty($keyword)){ $condition = " $choose = '$keyword'"; }*/ $telephone = MooGetGPC('telephone', 'integer', 'P'); $memberid = MooGetGPC('memberid', 'integer', 'P') == 0 ? '' : MooGetGPC('memberid', 'integer', 'P'); $qq = MooGetGPC('qq', 'integer', 'P'); $callno = MooGetGPC('callno', 'integer', 'P'); $SearchType = MooGetGPC('SearchType', 'string', 'P'); if ($SearchType == 'tel') { //手机 $condition = " where m.telphone={$telephone}"; } elseif ($SearchType == 'memberid') { $condition = " where m.uid={$memberid}"; } elseif ($SearchType == 'qq') { $condition = " where mf.qq={$qq}"; } elseif ($SearchType == 'callno') { $condition = " where mf.callno={$callno}"; } $uid = $sid = $flag = $province = $city = 0; $nickname = $username = $regdate = $allotdate = $content = ''; if (MooGetGPC('submit', 'string', 'P')) { $uid = MooGetGPC('uid', 'integer', 'P'); $sid = MooGetGPC('sid', 'integer', 'P'); $content = MooGetGPC('content', 'string', 'P'); $flag = MooGetGPC('type', 'integer', 'P'); //提醒所属客服 $timestamp = time(); $date = date('Y-m-d H:i:s', $timestamp); $title = "会员 {$uid} 回电!"; $content = $uid . "于{$date}:" . $content; //$awoketime = $timestamp+3600; $sql_remark = "insert into {$GLOBALS['dbTablePre']}admin_remark set sid='{$sid}',title='{$title}',content='{$content}',awoketime='',dateline='{$timestamp}',flag={$flag},send_id={$GLOBALS['adminid']}"; $res = $GLOBALS['_MooClass']['MooMySQL']->query($sql_remark); serverlog(4, $dbTablePre . "admin_remark", "会员" . $uid . "回电发送", $GLOBALS['adminid']); $currenturl = "index.php?action=allmember&h=foo"; salert("发送成功!", $currenturl); } if (MooGetGPC('searchSubmit', 'string', 'P') && !empty($condition)) { $sql = "select m.uid as uid,m.nickname as nickname,m.province as province,m.city as city,mf.allotdate as allotdate,m.regdate as regdate,m.sid as sid from web_members_search m left join web_members_base mf on m.uid=mf.uid {$condition} limit 1"; $result = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true); $uid = $result['uid']; $nickname = $result['nickname']; $sid = $result['sid']; $regdate = $result['regdate']; $allotdate = $result['allotdate']; $province = $result['province']; $city = $result['city']; if (!empty($sid)) { $sql = "select username from web_admin_user where uid={$sid}"; $adminUser = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true); $username = $adminUser['username']; } } $currenturl = "index.php?action=allmember&h=foo"; $title = '400查询'; require_once adminTemplate('allmember_foo'); }
function ajax_this_login() { $time = time(); $uid = MooGetGPC('luid', 'integer', 'G'); $serverid = $GLOBALS['adminid']; $sql = "select * from {$GLOBALS['dbTablePre']}members_search where uid='{$uid}'"; $userinfo = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql); if (!$userinfo) { echo '用户不存在'; exit; } /* $useronline = $GLOBALS['_MooClass']['MooMySQL']->getOne("select * from {$GLOBALS['dbTablePre']}membersession where uid='$uid'"); if($useronline){ //echo '此用户在线';exit(); }*/ $userinfo_uid = $userinfo['uid']; $userinfo_pw = $userinfo['password']; //模拟用户登录 MooSetCookie('auth', '', -86400 * 365); MooSetCookie('kefu', '', -86400 * 365); MooSetCookie('auth', MooAuthCode("{$userinfo_uid}\t{$userinfo_pw}", 'ENCODE'), 86400); MooSetCookie('kefu', MooAuthCode("hongniangwang\t{$serverid}", 'ENCODE'), 86400); if (!session_id()) { session_start(); } $_SESSION['s_userid'] = $userinfo['uid']; //更新模拟时间 $GLOBALS['_MooClass']['MooMySQL']->query("update `{$GLOBALS['dbTablePre']}member_admininfo` set real_lastvisit='{$time}' where uid='{$uid}'"); if ($GLOBALS['groupid'] != 60) { $GLOBALS['_MooClass']['MooMySQL']->query("update `{$GLOBALS['dbTablePre']}members_login` set lastvisit='{$time}' where uid='{$uid}'"); if (MOOPHP_ALLOW_FASTDB) { $value['lastvisit'] = $time; MooFastdbUpdate('members_login', 'uid', $uid, $value); } } //$kefu = $_MooCookie['kefu'];exit($kefu); serverlog(4, $GLOBALS['dbTablePre'] . 'members_search', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}在后台以会员{$userinfo['uid']}的身份查看{$uid}", $GLOBALS['adminid'], $userinfo['uid']); echo 'ok'; }
function ajax_menu() { $page = max(1, MooGetGPC('page', 'integer', 'G')); $limit = 10; $offset = ($page - 1) * $limit; $sender = MooGetGPC('sender', 'integer', 'G'); $receiver = MooGetGPC('receiver', 'integer', 'G'); //$sender= 2158447; //$receiver = 2158450; if (empty($receiver)) { exit("empty receiver"); } $sql = "SELECT uid,nickname FROM {$GLOBALS['dbTablePre']}members_search WHERE uid = {$receiver}"; $user = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql, true); $sql = "SELECT DISTINCT(s_uid) FROM {$GLOBALS['dbTablePre']}service_chat WHERE s_fromid = {$receiver} ORDER BY s_time DESC LIMIT {$offset},{$limit}"; $mem = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true); $mem_list = array(); foreach ($mem as $v) { array_push($mem_list, $v['s_uid']); } $id_list = implode(',', $mem_list); if (!empty($id_list)) { $sql = "SELECT uid,nickname FROM {$GLOBALS['dbTablePre']}members_search WHERE uid IN ({$id_list}) AND uid != {$receiver}"; $members = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true); } else { echo '会员' . $receiver . '暂无聊天记录 <a href="javascript:history.back();">返回</a>'; exit; } //写日志 serverlog(1, $GLOBALS['dbTablePre'] . 'service_chat', "{$GLOBALS['adminid']}号客服{$GLOBALS['username']}查看会员{$receiver}的聊天", $GLOBALS['adminid']); require_once adminTemplate('chat_menu'); }
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'); }
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'); }
function ajax_change_remark_status() { $id = MooGetGPC('id', 'integer', 'G'); $sql = "UPDATE {$GLOBALS['dbTablePre']}admin_remark SET `status`='1' WHERE `id`='{$id}'"; $GLOBALS['_MooClass']['MooMySQL']->query($sql); serverlog(3, "{$GLOBALS['dbTablePre']}admin_remark", "{$GLOBALS['username']}修改备注编号{$id}为已解决", $GLOBALS['adminid']); echo 'ok'; }
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'); }
function del_recommend() { $uid = MooGetGPC('uid', 'integer', 'G'); $sql = "DELETE FROM {$GLOBALS['dbTablePre']}members_recommend WHERE uid = {$uid}"; $GLOBALS['_MooClass']['MooMySQL']->query($sql); echo 'ok'; //note 插入日志 serverlog(4, $GLOBALS['dbTablePre'] . 'members_recommend', '删除首页推荐会员uid=' . $uid, $GLOBALS['adminid']); }
/** * * 发布奖赏 */ function put_rewards() { $uid = MooGetGPC('uid', 'integer', 'P'); $amount = MooGetGPC('amount', 'integer', 'P'); $type = MooGetGPC('type', 'integer', 'P'); $rewardid = MooGetGPC('rewardid', 'string', 'P'); //奖惩缘由 $msg = MooGetGPC('msg', 'string', 'P'); if (empty($uid)) { exit(json_encode(array('flag' => 0, 'msg' => '数据传输有误'))); } if (empty($amount)) { exit(json_encode(array('flag' => 0, 'msg' => '请填写赏罚金额'))); } if (empty($rewardid) && empty($msg)) { exit(json_encode(array('flag' => 0, 'msg' => '请填写赏罚理由'))); } $my_config = array(); $my_config = $GLOBALS['_MooClass']['MooMySQL']->getOne('SELECT `balance`,`allot`,`amount` FROM `' . $GLOBALS['dbTablePre'] . 'admin_user` WHERE `uid`=' . $GLOBALS['adminid'], true); $my_allot = $GLOBALS['fastdb']->get('admin_allot_' . $GLOBALS['adminid']); //红娘币发送计数器,每日清空一次 $my_allot = intval($my_allot); if ($my_config['allot'] != -1 && $GLOBALS['groupid'] != 60 && $my_allot > $my_config['allot']) { exit(json_encode(array('flag' => 0, 'msg' => '超出当日奖励次数'))); } if ($my_config['balance'] != -1 && $GLOBALS['groupid'] != 60 && $my_config['balance'] < $amount && !empty($type)) { exit(json_encode(array('flag' => 0, 'msg' => '你的余额不足不能进行奖励'))); } if ($my_config['amount'] != -1 && $GLOBALS['groupid'] != 60 && $my_config['amount'] < $amount && !empty($type)) { exit(json_encode(array('flag' => 0, 'msg' => '奖励的金额超出了配额' . $my_config['amount']))); } /*插入红娘币配置表*/ $title = "无标题"; $sql = 'INSERT INTO `' . $GLOBALS['dbTablePre'] . 'reward_config` (`type`,`msg`,`money`,`title`) VALUES (\'' . $type . '\',\'' . $rewardid . '\',\'' . $amount . '\',\'' . $title . '\')'; $GLOBALS['_MooClass']['MooMySQL']->query($sql); $insertId = $GLOBALS['_MooClass']['MooMySQL']->insertId(); //获取 红娘币配置表插入产生的id $sql = 'INSERT INTO `' . $GLOBALS['dbTablePre'] . 'reward_log` (`uid`,`adminid`,`amount`,`time`,`type`,`rewardid`,`msg`) VALUES (\'' . $uid . '\',\'' . $GLOBALS['adminid'] . '\',\'' . $amount . '\',\'' . time() . '\',\'' . $type . '\',\'' . $insertId . '\',\'' . $msg . '\')'; if ($GLOBALS['_MooClass']['MooMySQL']->query($sql)) { $GLOBALS['_MooClass']['MooMySQL']->query('UPDATE `' . $GLOBALS['dbTablePre'] . 'admin_user` SET `balance`=`balance`' . (empty($type) ? '-' : '+') . $amount . ' WHERE `uid`=' . $uid); //奖罚下面的员工 if ($my_config['balance'] != -1 && $GLOBALS['groupid'] != 60 && !empty($type)) { $GLOBALS['_MooClass']['MooMySQL']->query('UPDATE `' . $GLOBALS['dbTablePre'] . 'admin_user` SET `balance`=`balance`-' . $amount . ' WHERE `uid`=' . $GLOBALS['adminid']); } $GLOBALS['fastdb']->get('admin_allot_' . $GLOBALS['adminid'], $my_allot + 1); serverlog('4', 'reward_log', (empty($type) ? '处罚' : '奖励') . $uid . '红娘币' . $amount, $GLOBALS['adminid']); exit(json_encode(array('flag' => 1, 'msg' => empty($type) ? '处罚成功' : '奖励成功'))); } else { exit(json_encode(array('flag' => 0, 'msg' => $sql))); } }
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'); }
function site_skin_del() { global $dbTablePre, $_MooClass; $uid = MooGetGPC('uid', 'string', 'G'); $del_img = $_MooClass['MooMySQL']->getOne("select * from {$dbTablePre}members_skin where uid='{$uid}'"); $sql = "delete from {$dbTablePre}members_skin where uid={$uid}"; if ($_MooClass['MooMySQL']->query($sql) && unlink("../" . $del_img['image'])) { //note 插入日志 serverlog(1, $GLOBALS['dbTablePre'] . 'members_skin', '删除皮肤成功', $GLOBALS['adminid']); salert("删除皮肤成功", "index.php?action=site_skin&h=list"); } }
function check_introduce() { $uidlist = MooGetGPC('uidlist', 'string', 'G'); if (empty($uidlist)) { salert('请选择审核的会员ID', 'index.php?action=check&h=monolog'); } $uid_arr = explode(',', $uidlist); foreach ($uid_arr as $v) { $sql = "UPDATE {$GLOBALS['dbTablePre']}choice SET `introduce`=`introduce_check`,`introduce_check`='',`introduce_pass`='1' WHERE `uid`='{$v}'"; $GLOBALS['_MooClass']['MooMySQL']->query($sql); if (MOOPHP_ALLOW_FASTDB) { $old_introduce = MooFastdbGet("choice", 'uid', $v); $value['introduce'] = $old_introduce['introduce_check']; $value['introduce_chack'] = ''; $value['introduce_pass'] = 1; MooFastdbUpdate("choice", 'uid', $uid, $value); } sendusermessage($uid, "尊敬的红娘会员,您的内心独白已经过红娘的审核", "内心独白审核"); $alert = '内心独白审核通过'; serverlog(3, $dbTablePre . "choice", $GLOBALS['username'] . "批量审核会员" . $uid . "的内心独白", $GLOBALS['adminid'], $v['uid']); } salert('审核成功', 'index.php?action=check&h=monolog'); }
function vipuser_hurrydiamond() { global $h, $renewals_status_grade, $renewalslink; $membersexpired = $afterday = ''; $page_per = 20; $page = max(1, MooGetGPC('page', 'integer', 'G')); $limit = 20; $offset = ($page - 1) * $limit; $type = MooGetGPC('type', 'string', 'G'); $keyword = trim(MooGetGPC('keyword', 'string', 'G')); $bgtime = strtotime(MooGetGPC('bgtime', 'string', 'G')); $endtime = strtotime(MooGetGPC('endtime', 'string', 'G')); $expired = MooGetGPC('expired', 'integer', 'G'); // echo $expired;die; $time = time(); if (!empty($type) && in_array($type, array('telphone', 'uid', 'username')) && !empty($keyword)) { $condition[] = " {$type} like '%{$keyword}%'"; } if ($bgtime) { $condition[] = " bgtime>='{$bgtime}'"; } if ($endtime) { $condition[] = " endtime<='{$endtime}'"; } //查询续费日期 $current_month = date('n'); $current_day = '7'; if (isset($_GET['afterday'])) { $afterday = MooGetGPC('afterday', 'string', 'G'); $time2 = strtotime("{$afterday}") - 1; $time1 = $time2 - 86399; $condition[] = " m.endtime>='{$time1}'"; $condition[] = " m.endtime<='{$time2}'"; } if ((isset($_GET['membersexpired']) ? $_GET['membersexpired'] : '') == '1') { $membersexpired = MooGetGPC('membersexpired', 'string', 'G'); $condition[] = " m.endtime>0"; $condition[] = " m.endtime<" . $time; } if (isset($_GET['renewals'])) { $renewals = MooGetGPC('renewals', 'integer', 'G'); $condition[] = " a.renewalstatus=" . $renewals; } if (empty($condition)) { $c = ''; } else { $c = ' AND ' . implode(' AND ', $condition); } $adminid = $GLOBALS['adminid']; $manager = $GLOBALS['username']; $sql_admin = "SELECT groupid FROM {$GLOBALS['dbTablePre']}admin_user WHERE uid='{$adminid}'"; $res_admin = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql_admin, true); $where = 'WHERE'; if (in_array($res_admin['groupid'], $GLOBALS['general_service'])) { $where .= ' m.sid=' . $adminid . ' AND m.s_cid=20 AND m.usertype=1' . $c; } else { $where .= ' m.s_cid=20 AND m.usertype=1' . $c; } // $total = getcount('members m',$where); $resto = $GLOBALS['_MooClass']['MooMySQL']->getOne("SELECT count(*) count FROM {$GLOBALS['dbTablePre']}members_search m left join {$GLOBALS['dbTablePre']}member_admininfo a on m.uid=a.uid {$where}", true); $total = $resto['count']; $sql = "SELECT m.uid,m.username,m.s_cid,m.gender,m.nickname,m.bgtime,m.endtime,a.renewalstatus FROM {$GLOBALS['dbTablePre']}members_search m left join {$GLOBALS['dbTablePre']}member_admininfo a on m.uid=a.uid {$where} ORDER BY m.endtime ASC LIMIT {$offset},{$limit}"; $user = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql, 0, 0, 0, true); $url2 = "afterday={$_GET['afterday']}&bgtime={$bgtime}&endtime={$endtime}&type={$type}&renewals={$_GET[renewals]}&keyword={$keyword}&membersexpired={$_GET[membersexpired]}"; $currenturl = "index.php?action=vipuser&h=hurrydiamond&" . $url2; $pages = multipage($total, $limit, $page, $currenturl); serverlog(1, $GLOBALS['dbTablePre'] . "members_search", "{$GLOBALS['username']}查看已到期的钻石会员列表", $GLOBALS['adminid']); require adminTemplate('vipuser_hurrymembers'); }
function vipuser_star() { $uid = MooGetGPC('uid', 'integer', 'G'); $sql = "UPDATE {$GLOBALS['dbTablePre']}members_search SET city_star=0 WHERE uid = {$uid}"; if (MOOPHP_ALLOW_FASTDB) { $value['s_cid'] = 40; MooFastdbUpdate('members_search', 'uid', $uid, $value); } serverlog(3, $dbTablePre . "members_search", "{$GLOBALS['username']}将用户ID:{$uid}的城市之星取消", $GLOBALS['adminid'], $uid); if ($GLOBALS['_MooClass']['MooMySQL']->query($sql)) { searchApi('members_man members_women')->updateAttr(array('city_star'), array($uid => array(0))); echo "ok"; } else { echo "error"; } exit; }
function financial_totalwage_remark() { $id = MooGetGPC('id', 'integer', 'G'); $type = MooGetGPC('type', 'string', 'G'); $sql = "SELECT remark FROM {$GLOBALS['dbTablePre']}financial_orderok WHERE id='{$id}'"; $row = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql); if ($_POST['ispost']) { $id = MooGetGPC('id', 'string', 'P'); $remark = MooGetGPC('content', 'string', 'P'); $sql = "UPDATE {$GLOBALS['dbTablePre']}financial_orderok SET remark = '{$remark}' WHERE id='{$id}'"; $query = $GLOBALS['_MooClass']['MooMySQL']->query($sql); if ($query) { //note 插入日志 if ($type == 'add') { serverlog(4, $GLOBALS['dbTablePre'] . 'financial_orderok', "{$GLOBALS['username']}写财务报表提成记录ID为:{$id}的备注", $GLOBALS['adminid']); MooMessageAdmin('备注添加成功', 'index.php?action=financial_totalwage&h=list'); } if ($type == 'update') { serverlog(3, $GLOBALS['dbTablePre'] . 'financial_orderok', "{$GLOBALS['username']}修改财务报表提成记录ID为:{$id}的备注", $GLOBALS['adminid']); MooMessageAdmin('备注修改成功', 'index.php?action=financial_totalwage&h=list'); } } } //note 调用模板 require adminTemplate('financial_totalwage_add'); }