Beispiel #1
0
function to_send_message()
{
    global $_MooClass, $dbTablePre, $userid, $pagesize, $user_arr, $timestamp, $serverid;
    //print_r($_POST);
    //note s_cid 发送者的权限(回复时才有)
    $s_cid = MooGetGPC('s_cid', 'integer', 'P');
    //echo $s_cid;exit;
    //收件人id
    $sid = MooGetGPC('s_id', 'integer', 'P');
    //发件人id
    $mid = MooGetGPC('m_id', 'integer', 'P');
    ///echo $sid;exit;
    $s_title = MooGetGPC('s_title', 'string', 'P');
    $s_title = rtrim($s_title);
    //对主题字数限制
    $s_title = MooStrReplace(MooCutstr($s_title, 30, $dot = ''));
    $s_content = MooGetGPC('s_content', 'string', 'P');
    //note 特殊字符
    $s_content = rtrim(MooStrReplace(safeFilter($s_content)));
    $send_mymessage = MooGetGPC('send_mymessage', 'integer', 'P');
    $message_back = MooGetGPC('message_back', 'integer', 'P');
    //note 双方屏蔽不给操作
    if (MooGetScreen($mid, $sid)) {
        MooMessage('因特殊原因,消息发送失败', "index.php?n=service&h=rose&t=getmorerose", '01');
        exit;
    }
    if ($mid && $sid && $s_title && $s_content) {
        $m_level = get_userrank($userid);
        //会员等级
        if ($m_level == 2 && $user_arr['usertype'] != 3) {
            //普通会员需要审核(除采集会员之外)
            //if($user_arr['gender'] == 0){	//如果是男方发的,需要审核,0表示
            $send_status = $_MooClass['MooMySQL']->query("insert into {$dbTablePre}services (s_cid,s_uid,s_fromid,s_title,s_content,s_time,sid,flag) values ('{$s_cid}','{$sid}','{$mid}','{$s_title}','{$s_content}'," . time() . ",'{$user_arr['sid']}','0')");
        } else {
            $send_status = $_MooClass['MooMySQL']->query("insert into {$dbTablePre}services (s_cid,s_uid,s_fromid,s_title,s_content,s_time,sid,flag) values ('{$s_cid}','{$sid}','{$mid}','{$s_title}','{$s_content}'," . time() . ",'{$user_arr['sid']}','1')");
        }
        //发送短信和邮件
        include_once "./module/crontab/crontab_config.php";
        $res = MooMembersData($sid);
        //	   $send_user_info = $_MooClass['MooMySQL']->getAll("select * from `{$dbTablePre}members_search` a  left join  {$dbTablePre}members_choice b  on a.uid=b.uid  where a.uid = '$userid'");
        $send_user_info = array_merge(MooGetData("members_choice", 'uid', $userid), MooMembersData($userid));
        //	   $send_user_info = $send_user_info[0];
        //头像路径
        $path = thumbImgPath(2, $send_user_info['pic_date'], $send_user_info['pic_name'], $send_user_info['gender']);
        if (file_exists($path)) {
            $img_path = $path;
        } else {
            if ($send_user_info['gender'] == 1) {
                $img_path = "/public/images/service_nopic_woman.gif";
            } else {
                $img_path = "/public/images/service_nopic_man.gif";
            }
        }
        $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
        //发送者用户名
        $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
        //发送者性别
        $province = $send_user_info['province'] ? $provice_list[$send_user_info['province']] : '';
        //省
        $city = $send_user_info['city'] ? $city_list[$send_user_info['city']] : '';
        //市
        $height = $send_user_info['height'] ? $height_list[$send_user_info['height']] : "未知";
        //身高
        ob_start();
        require_once MooTemplate('public/mail_space_messagetpl', 'module');
        //模板
        $body = ob_get_clean();
        MooSendMail($res['username'], "真爱一生网系统温馨提示", $body, "", false, $sid);
        $week_time = 24 * 3600 * 7;
        //一周时间秒数
        $interval_time = $timestamp - $user_arr['last_login_time'];
        //当前时间-最后登录时间
        $date1 = date("Y-m-d", strtotime("last Monday"));
        $date2 = date("Y-m-d", strtotime("Sunday"));
        if ($interval_time > $week_time) {
            //不活跃用户每周发一条短信
            $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '" . $sid . "', sid = '" . $userid . "',phone = '" . $res['telphone'] . "',sendtime = '" . date("Y-m-d") . "'");
            $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='{$sid}' and sendtime>='{$date1}' and sendtime<='{$date2}'", true);
            if ($cos['c'] <= 1) {
                //fanglin暂时屏蔽
                Push_message_intab($sid, $res['telphone'], "邮件", "用户ID:" . $userid . "," . $send_user_grade . ",已给您发送电子邮件,请登录www.zhenaiyisheng.cc查看!4008787920【真爱一生网】", $userid);
            }
        } else {
            //活跃用户每天一条
            //每天该用户超过5条信息不发送短信
            $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='{$sid}' and sendtime='" . date("Y-m-d") . "'", true);
            if ($cos['c'] < 5) {
                $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '" . $sid . "', sid = '" . $userid . "',phone = '" . $res['telphone'] . "',sendtime = '" . date("Y-m-d") . "'");
                //fanglin暂时屏蔽
                Push_message_intab($sid, $res['telphone'], '邮件', "用户ID:" . $userid . "," . $send_user_grade . ",已给您发送电子邮件,请登录www.zhenaiyisheng.cc!4008787920【真爱一生网】", $userid);
            }
        }
        //note 发送资料给接收方
        if ($send_mymessage) {
        }
        //note 备份邮件操作
        if ($message_back) {
            //note 发送MAIL时所需信息
            $user = $_MooClass['MooMySQL']->getOne("select username,nickname from {$dbTablePre}members_search where uid='{$mid}'");
            //note 发送MAIL时收信人的邮箱
            $ToAddress = $user['username'];
            //note 发送MAIL时主题
            $ToSubject = '提示:您在真爱一生网所发的消息备份';
            //note 发送MAIL时Body内容所需信息
            $username = $user['nickname'];
            //note 发送MAIL时Body内容所需信息
            $toname = $_MooClass['MooMySQL']->getOne("select nickname from {$dbTablePre}members_search where uid='{$sid}'");
            if ($username) {
                $ToBody = $username;
            } else {
                $ToBody = 'ID号为' . $mid . '的会员<br>';
            }
            if ($toname['nickname']) {
                $ToBody .= ':您好,您于' . date('Y-m-d H:i:s', time()) . ',在真爱一生网发送电子邮件给' . $toname['nickname'] . ',内容如下:<br>';
            } else {
                $ToBody .= ':您好,您于' . date('Y-m-d H:i:s', time()) . ',在真爱一生网发送电子邮件给ID号为' . $sid . '的会员,内容如下:<br>';
            }
            if ($username) {
                $ToBody .= '&nbsp;&nbsp;&nbsp;&nbsp;发件人:' . $username . '<br>';
            } else {
                $ToBody .= '&nbsp;&nbsp;&nbsp;&nbsp;发件人:ID号为' . $mid . '<br>';
            }
            if ($toname['nickname']) {
                $ToBody .= '&nbsp;&nbsp;&nbsp;&nbsp;收件人:' . $toname['nickname'] . '<br>';
            } else {
                $ToBody .= '&nbsp;&nbsp;&nbsp;&nbsp;收件人:ID号为' . $sid . '<br>';
            }
            $ToBody .= '&nbsp;&nbsp;&nbsp;&nbsp;主题:' . $s_title . '<br>';
            $ToBody .= '&nbsp;&nbsp;&nbsp;&nbsp;正文:<br>&nbsp;&nbsp;&nbsp;&nbsp;' . $s_content;
            MooSendMail($ToAddress, $ToSubject, $ToBody, $is_template = true, $sid);
        }
        //添加成功提示信息
        if ($send_status) {
            /*普通会员对全权会员反馈白名单*/
            if ($res['usertype'] == '3' && $user_arr['usertype'] != '3' && !$serverid) {
                white_list($res['uid'], $user_arr['uid']);
            }
            /*客服模拟全权记录*/
            if ($user_arr['usertype'] == '3' && $serverid && $res['usertype'] != '3') {
                $action = '站内信';
                fulllog($user_arr['uid'], $serverid, $action, $res);
            }
            //提醒所属客服
            $usid = $user_arr['sid'];
            $title = '您的会员 ' . $mid . ' 向 ' . $sid . ' 发送了邮件';
            $awoketime = $timestamp + 3600;
            $sql_remark = "insert into {$dbTablePre}admin_remark set sid='{$usid}',title='{$title}',content='{$title}',awoketime='{$awoketime}',dateline='{$timestamp}'";
            $res = $_MooClass['MooMySQL']->query($sql_remark);
            if ($user_arr['gender'] == 0) {
                //男方发的
                MooMessage('发送成功,真爱一生审核后对方即可以收到。', 'index.php?n=service&h=message&t=sendmessage', '05');
            } else {
                MooMessage('发送成功', 'index.php?n=service&h=message&t=sendmessage', '05');
            }
        } else {
            MooMessage('发送失败', 'index.php?n=service&h=message&t=send&sendtoid=' . $sid, '03');
        }
    } else {
        MooMessage('数据填写不完整', 'index.php?n=service&h=message&t=send&sendtoid=' . $sid, '02');
    }
}
Beispiel #2
0
function sendnewleer()
{
    global $_MooClass, $dbTablePre, $timestamp, $user_arr, $serverid;
    $sendtoid = MooGetGPC('sendtoid', 'integer');
    $userid = $user_arr['uid'];
    //note 分配客服
    //allotserver($userid);
    //note 获得照片总数
    //$query = $_MooClass['MooMySQL']->query("SELECT imgid FROM {$dbTablePre}pic WHERE uid = '$sendtoid'");
    //$pic_total = $_MooClass['MooMySQL']->numRows($query);
    $query = $_MooClass['MooMySQL']->getOne("SELECT count(1) as c FROM {$dbTablePre}pic WHERE uid = '{$sendtoid}'");
    $pic_total = $query['c'];
    //note 自己不能给自己发送秋波,直接转到秋波列表页面
    if ($sendtoid == $userid) {
        MooMessage('自己不可以给自己发过送秋波', 'javascript:history.go(-1);', '04');
        exit;
    }
    $result = $_MooClass['MooMySQL']->getOne("select groupid from web_admin_user where uid='{$serverid}'");
    $groupid = $result['groupid'];
    //系统管理员权限
    $GLOBALS['system_admin'] = array(60);
    if (in_array($groupid, $GLOBALS['system_admin'])) {
        $serverid = null;
    }
    if ($serverid) {
        MooMessage('对不起您不能模拟操作', 'javascript:history.go(-1);', '04');
        exit;
    }
    //note 双方屏蔽不给操作
    if (MooGetScreen($userid, $sendtoid)) {
        MooMessage('因特殊原因,送秋波失败', "index.php?n=service&h=rose&t=getmorerose", '03');
        exit;
    }
    //note 要做性别过滤,异性的发送秋波,直接转到秋波列表页面
    $send_user1 = leer_send_user1($sendtoid);
    $user = leer_send_user1($userid);
    if ($send_user1['gender'] == $user['gender']) {
        MooMessage('同性之间不可互发秋波', 'javascript:history.go(-1);', '02');
        exit;
    }
    //测试用的 by hwt
    if ($_POST['sendleer']) {
        if (empty($GLOBALS['MooUid'])) {
            list($uid, $password) = explode("\t", MooAuthCode($_MooCookie['auth'], 'DECODE'));
            $uid = intval($uid);
        } else {
            $uid = $GLOBALS['MooUid'];
        }
        if (empty($uid)) {
            MooMessage('您还没有登录', 'index.php?n=login');
        }
        $leer = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}service_leer WHERE receiveuid = '{$sendtoid}' AND senduid = '{$userid}' ");
        if ($leer['lid']) {
            $lid = $leer['lid'];
            //note 如果已经发送过秋波,就增加发送秋波的次数
            $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}service_leer SET num = num + 1,receivenum = receivenum + 1,sendtime = '{$timestamp}',receivetime = '{$timestamp}',receive_del = '0' WHERE lid = '{$lid}'");
            //note 如果已经收到这个人的秋波,已经拒绝,现在改变注意,又发送秋波给这个人,拒绝状态2更改为0
            $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}service_leer SET stat = '0' WHERE senduid = '{$sendtoid}' AND receiveuid = '{$uid}' AND stat = '2'");
        } else {
            //note 发送新的秋波,写入数据库 发送者,接受者,发送时间
            $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}service_leer SET sendtime = '{$timestamp}',receivetime = '{$timestamp}',receivenum = '1', num = '1', senduid  = '{$uid}',receiveuid = '{$sendtoid}'");
        }
        //将新注册的会员更新为优质会员
        if (in_array($user_arr['sid'], array(0, 52, 123)) && $user_arr['is_well_user'] != 1) {
            update_iswell_user($user_arr['uid']);
        }
        //发送短信和邮件
        include_once "./module/crontab/crontab_config.php";
        if (MOOPHP_ALLOW_FASTDB) {
            $res = MooFastdbGet('members', 'uid', $sendtoid);
        } else {
            $res = $_MooClass['MooMySQL']->getOne("select * from {$dbTablePre}members where uid='{$sendtoid}'");
        }
        $send_user_info = $_MooClass['MooMySQL']->getOne("select * from `{$dbTablePre}members` a  left join  {$dbTablePre}choice b  on a.uid=b.uid  where a.uid = '{$uid}' LIMIT 1");
        //头像路径
        $path = thumbImgPath(2, $send_user_info[pic_date], $send_user_info[pic_name]);
        if (file_exists($path)) {
            $img_path = $path;
        } else {
            if ($send_user_info['gender'] == 1) {
                $img_path = "/public/images/service_nopic_woman.gif";
            } else {
                $img_path = "/public/images/service_nopic_man.gif";
            }
        }
        $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
        //发送者用户名
        $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
        //发送者性别
        $province = $provice_list[$send_user_info[province]];
        //省
        $city = $city_list[$send_user_info[city]];
        //市
        $height = $send_user_info[height] ? $height_list[$send_user_info[height]] : "未知";
        //身高
        ob_start();
        //require_once MooTemplate('public/mail_space_leertpl', 'module'); //秋波模板
        require_once MooTemplate('public/mail_space_leertpl', 'module');
        //秋波模板
        $body = ob_get_clean();
        MooSendMail($res['username'], "真爱一生网系统温馨提示", $body, "", false, $sendtoid);
        // MooSendMailSpace($res['username'],"真爱一生网系统温馨提示","真爱一生网提醒:有会员给您发送秋波了!请尽快查收!您的帐号是:".$res['username'],$type="1",$send_user,$send_type = "秋波",$userid,$send_user_img,$age,$tall,$area,$sendtime,$introduce);
        //每天向同一用户发送多次,短信记录数表只记一次
        $send_leer_date = isset($leer['sendtime']) ? date("Y-m-d", $leer['sendtime']) : date("Y-m-d");
        //
        $today_leer_count = isset($leer['lid']) ? $leer['num'] + 1 : 1;
        if (date("Y-m-d") > $send_leer_date) {
            $today_leer_count = 1;
        }
        /*if($res['is_phone']){
            SendMsg($res['telphone'],"真爱一生网 用户ID:".$userid.",".$send_user_grade.",已给您发送秋波,请及时把握您的缘分!4006780405");
          }*/
        //SendMsg($res['telphone'],"秋波","真爱一生网 用户ID:".$userid.",".$send_user_grade.",已给您发送秋波,请及时把握您的缘分!4006780405",$userid);
        /*
                    $week_time = 24*3600*7;//一周时间秒数
                    $interval_time = $timestamp - $user_arr['last_login_time'];//当前时间-最后登录时间
                    $date1 = date("Y-m-d",strtotime("last Monday"));
                    $date2 = date("Y-m-d",strtotime("Sunday"));
                    
                    if($interval_time > $week_time){//不活跃用户每周发一条短信
                            $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '".$sendtoid."', sid = '".$userid."',phone = '".$res['telphone']."',sendtime = '".date("Y-m-d")."'" );
                            $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='$sendtoid'  and sendtime>='$date1' and sendtime<='$date2'");
                            if($cos['c']<=1){
                                //fanglin暂时屏蔽
                              Push_message_intab($sendtoid,$res['telphone'],"秋波","真爱一生网 用户ID:".$userid.",".$send_user_grade.",已给您发送秋波,请及时把握您的缘分!4006780405",$userid);
                           }
                    }else{ //活跃用户每天一条
                         if($send_leer_date==date("Y-m-d") && $today_leer_count == 1){  //每天同一个用户发送多次秋波,短信只记一次
                           $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='$sendtoid' and sendtime='".date("Y-m-d")."'");
                           if($cos[c]<5){
                              $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '".$sendtoid."', sid = '".$userid."',phone = '".$res['telphone']."',sendtime = '".date("Y-m-d")."'" );
                              //fanglin暂时屏蔽
                              Push_message_intab($sendtoid,$res['telphone'],"秋波","真爱一生网 用户ID:".$userid.",".$send_user_grade.",已给您发送秋波,请及时把握您的缘分!4006780405",$userid);
                           }
                       }    
                    }*/
        //提醒所属客服
        $sid = $user_arr['sid'];
        $title = '您的会员 ' . $user_arr['uid'] . ' 向 ' . $sendtoid . ' 发送了秋波';
        $awoketime = $timestamp + 3600;
        $sql_remark = "insert into {$dbTablePre}admin_remark set sid='{$sid}',title='{$title}',content='{$title}',awoketime='{$awoketime}',dateline='{$timestamp}'";
        $res = $_MooClass['MooMySQL']->query($sql_remark);
        $users =& $res;
        MooMessage('发送秋波成功', 'index.php?n=service&h=leertest&t=sendnewleer');
    } else {
        $sql = "SELECT content  FROM {$dbTablePre}members_sendinfo where type=1 and isShow=1";
        $sendinfo = $_MooClass['MooMySQL']->getAll($sql);
        require MooTemplate('public/service_leer_sendnewleer', 'module');
    }
}
Beispiel #3
0
function space_viewpro()
{
    global $_MooClass, $dbTablePre, $userid, $timestamp, $user_arr, $val_arr, $style_user_arr, $diamond, $_MooCookie, $memcached;
    //$val_arr统计资料完善度
    //	$uid = $GLOBALS ['style_uid'];
    $uid = $_GET['other_uid'];
    $is_only_show = true;
    $status = array();
    //验证是否合法成功登陆
    $and_uuid = isset($_GET['uuid']) ? $_GET['uuid'] : '';
    $userid = $_GET['uid'] = isset($_GET['uid']) ? $_GET['uid'] : '';
    if ($userid) {
        $userid = $mem_uid = $memcached->get('uid_' . $userid);
    }
    $checkuuid = check_uuid($and_uuid, $userid);
    if (!$checkuuid) {
        $error = "uuid_error";
        echo return_data($error, false);
        exit;
    }
    $user_arr = MooMembersData($userid);
    $user_oth = MooMembersData($uid);
    //note 判断被浏览的会员是否存在
    $status = array_merge(MooMembersData($uid), MooGetData('members_login', 'uid', $uid));
    $user_per_num = getUserinfo_per($user_arr);
    $error = array();
    //*****************白名单*******************
    if ($uid != $userid) {
        $is_only_show = false;
    }
    //*****************白名单*******************
    if (empty($is_only_show)) {
        //if(MOOPHP_ALLOW_FASTDB && $status['is_lock'] != 1){//is_lock默认1不封锁用户,0则封锁
        if ($status['is_lock'] != 1) {
            $error = "此会员已经找到真爱,关闭了个人资料";
            echo return_data($error, false);
            exit;
        }
        if (!$status) {
            $error = "此会员已经找到真爱,关闭了个人资料";
            echo return_data($error, false);
            exit;
            //note 判断被浏览的用户是否允许其他会员查看他的资料
        } elseif (!$status['showinformation'] && $status['uid'] != $userid) {
            //showinformation默认1允许其他会员查看,0则不允许
            switch ($status['showinformation_val']) {
                //showinformation_val用户关闭资料的理由
                case 1:
                    $error = "此会员已找到正在交往的对象,故资料未公开";
                    echo return_data($error, FALSE);
                    exit;
                    break;
                case 2:
                    $error = "此会员已找到真爱,即将踏上红地毯,故资料未公开,转向我的真爱一生";
                    echo return_data($error, false);
                    exit;
                    break;
                case 3:
                    $error = "此会员最近很忙,无法及时回复邮件,故资料未公开,转向我的真爱一生";
                    break;
                case 4:
                    $error = "此会员资料未公开,原因可能是TA已经找到真爱了,转向我的真爱一生";
                    echo return_data($error, false);
                    exit;
                    break;
            }
        }
    }
    //note 浏览资料页面时候,写入谁浏览谁表,自己浏览自己的除外
    if ($userid && $uid && $userid != $uid) {
        //note 不让屏蔽的会员查看
        if (MooGetScreen($userid, $uid)) {
            $error = "由于特殊原因对方资料未公开,转向我的真爱一生";
            echo return_data($error, false);
            exit;
        }
        if ($user_oth['gender'] != $user_arr['gender']) {
            //service_visitor 某某会员浏览某某会员记录表
            $visitor = $_MooClass['MooMySQL']->getOne("SELECT vid FROM {$dbTablePre}service_visitor WHERE uid = '{$userid}' AND visitorid = '{$uid}'");
            //note 再次浏览的,更新浏览时间
            if ($visitor['vid']) {
                $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}service_visitor SET visitortime = '{$timestamp}' WHERE uid='{$userid}' AND visitorid = '{$uid}' limit 1");
            } else {
                $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}service_visitor SET uid = '{$userid}',visitorid='{$uid}',visitortime = '{$timestamp}'");
            }
            if (MooUserIsOnline($uid)) {
                $browser = $_MooClass['MooMySQL']->getOne("SELECT id FROM {$dbTablePre}service_browser WHERE uid = '{$userid}' AND browserid = '{$uid}'");
                //note 再次浏览的,更新浏览时间
                if ($browser['id']) {
                    $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}service_browser SET browsertime = '{$timestamp}' WHERE uid='{$userid}' AND browserid = '{$uid}' limit 1");
                } else {
                    $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}service_browser SET uid = '{$userid}',browserid='{$uid}',browsertime = '{$timestamp}'");
                }
            }
        }
    }
    //note 查看会员资料信息
    $c = MooGetData('members_choice', 'uid', $uid) + MooGetData('members_introduce', 'uid', $uid);
    $user =& $status;
    /***创建浏览队列 ***/
    if ($userid && $uid && $userid != $uid) {
        if ($user_oth['gender'] != $user_arr['gender'] && $user['uid'] != $userid) {
            if ($user['usertype'] == 3 && $user_arr['usertype'] != 3 && $user['showinformation'] == 1 && $user_arr['s_cid'] >= 40) {
                $iscan = $GLOBALS['fastdb']->get($userid . '_scan_space');
                //浏览的全权会员列表
                $iscan = empty($iscan) ? array() : json_decode($iscan, true);
                $iscan = in_array($uid, $iscan) ? $iscan : array_push($iscan, $uid);
                $GLOBALS['fastdb']->set($userid . '_scan_space', json_encode($iscan));
            }
            if ($user['usertype'] != 3) {
                $scan_i = $GLOBALS['fastdb']->get('scan_space_' . $uid);
                //访问的记录列表
                $scan_i = empty($scan_i) ? array() : json_decode($scan_i, true);
                if (!empty($scan_i)) {
                    $scan_s = array();
                    foreach ($scan_i as $k => $scan) {
                        $scan_s[$k] = $scan[0];
                    }
                    if (in_array($userid, $scan_s)) {
                        $scan_i[array_search($userid, $scan_s)] = array($userid, time());
                    } else {
                        array_push($scan_i, array($userid, time()));
                    }
                } else {
                    array_push($scan_i, array($userid, time()));
                }
                $GLOBALS['fastdb']->set('scan_space_' . $uid, json_encode($scan_i));
            }
        }
    }
    //note_显示相册中的普通照片
    $user_pic = $_MooClass['MooMySQL']->getAll("SELECT imgurl,pic_date,pic_name FROM {$dbTablePre}pic WHERE syscheck=1 and isimage='0' and uid='{$uid}'");
    $user['pic'] = $user_pic;
    $gender = $user_arr['gender'] == '0' ? '1' : '0';
    //0为男,1为女
    $agebegin = date("Y") - $user_arr['birthyear'] - 3;
    $ageend = date("Y") - $user_arr['birthyear'] + 3;
    $workprovince = $user_arr['province'];
    $workcity = $user_arr['city'];
    $search_url = MOOPHP_URL . "/index.php?n=search&h=quick&gender=" . $gender . "&age_start=" . $agebegin . "&age_end=" . $ageend . "&workprovince=" . $workprovince . "&workcity=" . $workcity . "&isphoto=1&imageField=&quick_search=搜索";
    //note 您可能喜欢的人,匹配相同地区
    $able_like = $userid ? youAbleLike(5) : array();
    //note 获取会员认证证件
    //note 当查看其他个人主页时,当前浏览的主页条件是否匹配
    $user2 = false;
    if ($uid != "" && $uid != $user_arr['uid'] && $user['gender'] != $user_arr['gender']) {
        $c2 = MooGetData('members_choice', 'uid', $userid);
        $user2 = MooMembersData($userid);
    }
    //note 获得用户资料的完整度,以百分比显示makui
    $all_len = 0;
    if ($uid == $user_arr['uid']) {
        $all_len = (int) (getUserinfo_per($user_arr) * 100);
    }
    $user['all_len'] = $all_len;
    //note 匹配指数分数得出
    $mark = 0;
    if ($uid && $uid != $user_arr['uid'] && $user['gender'] != $user_arr['gender']) {
        $cho = MooGetData('members_choice', 'uid', $user_arr['uid']);
        $year = isset($cho['birthyear']) ? $cho['birthyear'] : $user_arr['birthyear'];
        if ($year - 5 <= $user['birthyear'] && $user['birthyear'] <= $year + 5) {
            $mark_age = 9;
            $mark += 9;
        } else {
            $mark_age = 6;
            $mark += 6;
        }
        if ($cho['height1'] <= $user['height'] && $user['height'] <= $cho['height2']) {
            $mark_height = 7;
            $mark += 7;
        } else {
            $mark_height = 5;
            $mark += 5;
        }
        if ($cho['weight1'] <= $user['weight'] && $user['weight'] <= $cho['weight2']) {
            $mark_weight = 5;
            $mark += 5;
        } else {
            $mark_weight = 3;
            $mark += 3;
        }
        if ($cho['workprovince'] == $user['province']) {
            $mark_workprovince = 8;
            $mark += 8;
        } else {
            $mark_workprovince = 6;
            $mark += 6;
        }
        if ($cho['workcity'] == $user['city']) {
            $mark_workcity = 16;
            $mark += 16;
        } else {
            $mark_workcity = 5;
            $mark += 10;
        }
        if ($cho['education'] == $user['education']) {
            $mark_education = 8;
            $mark += 8;
        } else {
            $mark_education = 5;
            $mark += 5;
        }
        if ($cho['salary'] == $user['salary']) {
            $mark_salary = 9;
            $mark += 9;
        } else {
            $mark_salary = 7;
            $mark += 7;
        }
        if ($cho['marriage'] == $user['marriage']) {
            $mark_marriage = 8;
            $mark += 8;
        } else {
            $mark_marriage = 5;
            $mark += 5;
        }
        if ($cho['children'] == $user['children']) {
            $mark_children = 8;
            $mark += 8;
        } else {
            $mark_children = 6;
            $mark += 6;
        }
        if ($cho['drinking'] == $user['drinking']) {
            $mark_drinking = 5;
            $mark += 5;
        } else {
            $mark_drinking = 3;
            $mark += 3;
        }
        if ($cho['smoking'] == $user['smoking']) {
            $mark_smoking = 5;
            $mark += 5;
        } else {
            $mark_smoking = 2;
            $mark += 2;
        }
        if ($cho['body'] == $user['body']) {
            $mark_body = 6;
            $mark += 12;
        } else {
            $mark_body = 4;
            $mark += 8;
        }
    }
    $returnurl = 'index.php?' . $_SERVER['QUERY_STRING'];
    //返回的url
    //note 检查绑定是否过期
    if ($user['isbind'] == 1) {
        $user['isbind'] = check_bind($user['bind_id']);
    }
    $activity = $_MooClass['MooMySQL']->getOne("SELECT uid,username,regtime,channel FROM {$dbTablePre}ahtv_reguser where  uid='{$uid}' and  isattend=1");
    //鲜花发送语
    if ($user_arr['gender'] == 0) {
        //boy
        $sql = "SELECT id,content  FROM {$dbTablePre}members_sendinfo where type=2 and isShow=1";
    } else {
        //girl
        $sql = "SELECT id,content  FROM {$dbTablePre}members_sendinfo where type=1 and isShow=1";
    }
    $sendinfo = $_MooClass['MooMySQL']->getAll($sql);
    $users = array();
    $mainimg = MooGetphoto($status['uid'], $style = "com");
    $status['mainimg'] = $mainimg;
    $users['material'] = $status;
    $users['mating'] = $c;
    //资料完整度
    $users['inte'] = $user_per_num * 100;
    $users['inte'] = round($users['inte']);
    $users['material']['password'] = '';
    $users['material']['regip'] = '';
    $users['material']['qq'] = '';
    $users['material']['msn'] = '';
    $users['material']['telphone'] = '';
    $users['material']['username'] = '';
    if (empty($error)) {
        echo return_data($users);
        exit;
    } else {
        echo return_data($error, false);
        exit;
    }
}
Beispiel #4
0
function ajax_sendRose()
{
    global $dbTablePre;
    $sendfromuid = MooGetGPC('sendfrom', 'string', 'P');
    $sendtouid = MooGetGPC('sendto', 'string', 'P');
    $sendtime = strtotime(MooGetGPC('sendtime', 'string', 'P'));
    $sendfrom = MooMembersData($sendfromuid);
    $sendto = MooMembersData($sendtouid);
    if ($sendfrom['usertype'] != 3) {
        exit('1');
    }
    if ($sendto['usertype'] == 3) {
        exit(3);
    }
    if (MooGetScreen($sendfromuid, $sendtouid)) {
        exit(0);
    }
    if ($sendfrom['gender'] == $sendto['gender']) {
        exit(10);
    }
    $is_first_send = true;
    $rose = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}service_rose WHERE receiveuid = '{$sendtouid}' AND senduid = '{$sendfromuid}' ORDER BY rid DESC LIMIT 1");
    if ($rose['rid']) {
        $is_first_send = false;
        $rid = $rose['rid'];
        //note 如果已经发送过玫瑰,就增加发送玫瑰的次数
        $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}service_rose SET num = num + 1, receivenum = receivenum + 1,sendtime = '{$timestamp}',receivetime='{$timestamp}',receive_del=0,send_del=0 WHERE rid = '{$rid}'");
    } else {
        //note 发送新的玫瑰,写入数据库 发送者,接受者,发送时间
        $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}service_rose SET num = 1, receivenum = 1, sendtime = '{$timestamp}',receivetime='{$timestamp}',senduid  = '{$sendfromuid}',receiveuid = '{$sendtouid}' ");
    }
    $gender = $sendfrom['gender'] == 1 ? '女' : '男';
    if ($is_first_send && $sendto['is_phone'] && $sendto['telphone']) {
        Push_message_intab($sendtouid, $sendto['telphone'], "鲜花", "真爱一生网 用户ID:" . $sendfromuid . "," . $gender . ",已给您发送鲜花, 请及时把握您的缘分!4008787920【真爱一生网】", $sendfromuid, $sendtime);
    }
}
Beispiel #5
0
function addmyfriend()
{
    global $_MooClass, $dbTablePre, $pagesize, $user_arr, $timestamp, $serverid;
    $sendtoid = MooGetGPC('sendtoid', 'integer');
    $userid = $user_arr['uid'];
    if ($sendtoid == $userid) {
        MooMessage('自己不可加自己为意中人', 'javascript:history.go(-1);', '04');
        exit;
    }
    //note 双方屏蔽不给操作
    if (MooGetScreen($userid, $sendtoid)) {
        MooMessage('因特殊原因,加意中人失败', "index.php?n=service&h=rose&t=getmorerose", '03');
        exit;
    }
    $result = $_MooClass['MooMySQL']->getOne("select groupid from web_admin_user where uid='{$serverid}'");
    $groupid = $result['groupid'];
    //系统管理员权限
    $GLOBALS['system_admin'] = array(60);
    if (in_array($groupid, $GLOBALS['system_admin'])) {
        $serverid = null;
    }
    if ($serverid) {
        MooMessage('对不起您不能模拟操作', 'javascript:history.go(-1);', '04');
        exit;
    }
    //note 分配客服
    //allotserver($userid);
    //note 获得照片总数
    //$query = $_MooClass['MooMySQL']->query("SELECT imgid FROM {$dbTablePre}pic WHERE uid = '$sendtoid'");
    //$pic_total = $_MooClass['MooMySQL']->numRows($query);
    $query = $_MooClass['MooMySQL']->getOne("SELECT count(1) as c FROM {$dbTablePre}pic WHERE uid = '{$sendtoid}'");
    $pic_total = $query['c'];
    //note 要做性别过滤,异性的发送玫瑰,直接转到玫瑰列表页面
    $send_user1 = leer_send_user1($sendtoid);
    $user = leer_send_user1($userid);
    if ($send_user1['gender'] == $user['gender']) {
        MooMessage('不可加同性为意中人', 'javascript:history.go(-1);', '04');
        exit;
    }
    if (empty($GLOBALS['MooUid'])) {
        list($uid, $password) = explode("\t", MooAuthCode($_MooCookie['auth'], 'DECODE'));
        $uid = intval($uid);
    } else {
        $uid = $GLOBALS['MooUid'];
    }
    if (empty($uid)) {
        MooMessage('您还没有登录', 'index.php?n=login', '04');
    }
    $friend = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}service_friend WHERE friendid = '{$sendtoid}' AND uid = '{$uid}'", true);
    if ($friend['fid']) {
        $content = '对不起,对方已经在您的意中人列表中';
        $url = 'index.php?n=space&h=viewpro&uid=' . $sendtoid;
        MooMessage($content, $url, '02');
    } else {
        //note 加为意中人,新插入一行记录,谁加谁
        $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}service_friend SET friendid  = '{$sendtoid}',uid = '{$uid}',sendtime='" . time() . "'");
    }
    //将新注册的会员更新为优质会员
    if (in_array($user_arr['sid'], array(0, 52, 123)) && $user_arr['is_well_user'] != 1) {
        update_iswell_user($uid);
    }
    //发送短信和邮件
    include_once "./module/crontab/crontab_config.php";
    if (MOOPHP_ALLOW_FASTDB) {
        $res = MooFastdbGet('members_search', 'uid', $sendtoid);
        $res_b = MooFastdbGet('members_base', 'uid', $sendtoid);
        $res = array_merge($res, $res_b);
    } else {
        $res = $_MooClass['MooMySQL']->getOne("select s.telphone,b.is_phone,s.username from {$dbTablePre}members_search s left join {$dbTablePre}members_base b on s.uid=b.uid where uid='{$sendtoid}'");
    }
    $send_user_info = $_MooClass['MooMySQL']->getAll("select c.*,b.*,a.* from `{$dbTablePre}members_search` a left join {$dbTablePre}members_base b on a.uid=b.uid  left join  {$dbTablePre}choice c  on a.uid=c.uid  where a.uid = '{$uid}'");
    $send_user_info = $send_user_info[0];
    //头像路径
    $path = thumbImgPath(2, $send_user_info[pic_date], $send_user_info[pic_name], $send_user_info['gender']);
    if (file_exists($path)) {
        $img_path = $path;
    } else {
        if ($send_user_info['gender'] == 1) {
            $img_path = "/public/images/service_nopic_woman.gif";
        } else {
            $img_path = "/public/images/service_nopic_man.gif";
        }
    }
    $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
    //发送者用户名
    $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
    //发送者性别
    $province = $provice_list[$send_user_info[province]];
    //省
    $city = $city_list[$send_user_info[city]];
    //市
    $height = $send_user_info[height] ? $height_list[$send_user_info[height]] : "未知";
    //身高
    ob_start();
    require_once MooTemplate('public/mail_space_friendtpl', 'module');
    //模板
    $body = ob_get_clean();
    //	   MooSendMailSpace2($res['username'],"真爱一生网系统温馨提示","真爱一生网提醒:有会员将您添加为意中人了!请尽快查收!您的帐号是:".$res['username'],$type="1",$body);
    MooSendMail($res['username'], "真爱一生网系统温馨提示", $body, "", false, $sendtoid);
    // MooSendMailSpace($res['username'],"真爱一生网系统温馨提示","真爱一生网提醒:有会员给您发送秋波了!请尽快查收!您的帐号是:".$res['username'],$type="1",$send_user,$send_type = "秋波",$userid,$send_user_img,$age,$tall,$area,$sendtime,$introduce);
    $week_time = 24 * 3600 * 7;
    //一周时间秒数
    $interval_time = $timestamp - $user_arr['last_login_time'];
    //当前时间-最后登录时间
    $date1 = date("Y-m-d", strtotime("last Monday"));
    $date2 = date("Y-m-d", strtotime("Sunday"));
    if ($interval_time > $week_time) {
        //不活跃用户每周发一条短信
        $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '" . $sendtoid . "', sid = '" . $userid . "',phone = '" . $res['telphone'] . "',sendtime = '" . date("Y-m-d") . "'");
        $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='{$sendtoid}'  and sendtime>='{$date1}' and sendtime<='{$date2}'");
        if ($cos[c] <= 1) {
            //fanglin暂时屏蔽
            Push_message_intab($sendtoid, $res['telphone'], "意中人", "真爱一生网 用户ID:" . $userid . "," . $send_user_grade . ",已将您添加为意中人,请及时把握您的缘分!4006780405", $userid);
        }
    } else {
        //每天该用户超过5条信息不发送短信
        $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='{$sendtoid}' and sendtime='" . date("Y-m-d") . "'");
        if ($cos[c] < 5) {
            $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '" . $sendtoid . "', sid = '" . $userid . "',phone = '" . $res['telphone'] . "',sendtime = '" . date("Y-m-d") . "'");
            //fanglin暂时屏蔽
            Push_message_intab($sendtoid, $res['telphone'], "意中人", "真爱一生网 用户ID:" . $userid . "," . $send_user_grade . ",已将您添加为意中人,请及时把握您的缘分!4006780405", $userid);
        }
    }
    require MooTemplate('public/service_friend_addmyfriend', 'module');
}
Beispiel #6
0
function make($uid)
{
    global $_MooClass, $dbTablePre, $timestamp, $memcached, $_MooCookie, $user_arr;
    $province = isset($_MooCookie['province']) ? $_MooCookie['province'] : '';
    $city = isset($_MooCookie['city']) ? $_MooCookie['city'] : '';
    // 增加一处判断 cookie 没有记录的时候直接从 user_arr 获取城市信息
    if (!empty($user_arr) && (empty($province) || empty($city))) {
        $province = empty($province) ? empty($user_arr['province']) ? empty($user_arr['hometownprovince']) ? '' : $user_arr['hometownprovince'] : $user_arr['province'] : $province;
        $city = empty($city) ? empty($user_arr['city']) ? empty($user_arr['hometowncity']) ? '' : $user_arr['hometowncity'] : $user_arr['city'] : $city;
    }
    if (empty($province) && empty($city)) {
        return 0;
    }
    //exit ();
    $time = time();
    $randdo = rand(1, 15);
    if ($randdo > 8) {
        return 0;
    }
    // note 当前会员工作地
    if (MOOPHP_ALLOW_FASTDB) {
        $current_user = MooFastdbGet('members_search', 'uid', $uid);
    } else {
        $current_user = $_MooClass['MooMySQL']->getOne("select province,city,gender,birthyear,s_cid from {$dbTablePre}members_search where uid='{$uid}'");
    }
    // note 与当前会员在同一工作地或同一省的会员
    $fgender = $current_user['gender'] == '0' ? '1' : '0';
    // 取当前用户相反性别
    if ($fgender == 1) {
        // 2.2.1男找女:年龄小于自己的优先,向下无限制(限制在12岁),向上在5岁以内;
        // $age1 = $current_user['birthyear']-1;
        $age1 = $current_user['birthyear'] - 5;
        $age2 = $current_user['birthyear'] + 12;
    } else {
        // 2.2.2女找男:年龄大于自己的优先,向上20岁以内,向下3岁以内;
        $age1 = $current_user['birthyear'] - 20;
        $age2 = $current_user['birthyear'] + 3;
    }
    // note 修正广东省深圳和广州的区域查询
    if (in_array($province, array(10101201, 10101002))) {
        $city = $province;
        $province = 10101000;
    }
    // 修正直辖市查询
    if (in_array($province, array('10102000', '10103000', '10104000', '10105000'))) {
        $city = '0';
    }
    if ($fgender == '0' || $fgender == '1') {
        // girl search boy
        $sql = "SELECT count(1) AS num FROM {$dbTablePre}members_search   WHERE gender='{$fgender}' and  province='{$province}' and is_lock=1  AND birthyear>='{$age1}' AND birthyear<='{$age2}' and images_ischeck=1  " . (!empty($current_user) && $current_user['s_cid'] < 40 ? ' and usertype=1' : '  and usertype=3');
        // and
        // usertype=1
    }
    if (MOOPHP_ALLOW_FASTDB) {
        global $fastdb;
        $md5_sql1 = md5($sql);
        $user = unserialize($fastdb->get($md5_sql1));
        if (!$user || $user['last_time'] < time()) {
            $user = $_MooClass['MooMySQL']->getOne($sql);
            $user['last_time'] = time() + 3600 * 24 * 7;
            $fastdb->set($md5_sql1, serialize($user));
        }
    } else {
        $user = $_MooClass['MooMySQL']->getOne($sql);
    }
    $rand = $user['num'];
    $rand = mt_rand(0, $rand);
    $arrUser = array();
    /*if ($user ['num'] > 60) { // exceed 60
    		if ($fgender == '0' || $fgender == '1') { // girls find boys
    			$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}members_search AS mes1  left join {$dbTablePre}members_base m on mes1.uid=m.uid  WHERE mes1.gender='{$fgender}' and  mes1.province='{$province}' and mes1.is_lock=1  and mes1.birthyear>='$age1' AND mes1.birthyear<='$age2' and mes1.images_ischeck=1  and mes1.showinformation=1 " . ((! empty ( $current_user ) && $current_user ['s_cid'] < 40) ? ' and mes1.usertype=1' : '  and mes1.usertype=3') . " order by  mes1.city<>'{$city}',mes1.city desc LIMIT {$rand},1"; // and
    			                                                                                                                                                                                                                                                                                                                                                                                                                                                                               // mes1.usertype=1
    		}
    		
    		 $arrUser = $_MooClass['MooMySQL']->getOne($sql,true);
    	} else { //
    		if ($fgender == '0' || $fgender == '1') { // girls find boys
    			$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}members_search AS mes1 left join {$dbTablePre}members_base m on mes1.uid=m.uid  WHERE mes1.gender='{$fgender}' and  mes1.is_lock=1 and  mes1.birthyear>='$age1' AND mes1.birthyear<='$age2'  and mes1.images_ischeck=1  and mes1.showinformation=1 " . ((! empty ( $current_user ) && $current_user ['s_cid'] < 40) ? ' and mes1.usertype=1' : '  and mes1.usertype=3') . " order by mes1.province<>'{$province}',mes1.city<>'{$city}',mes1.province desc,mes1.city desc LIMIT {$rand},1"; // and
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  // mes1.usertype=1
    		}
    	
    	}*/
    //echo 'aaa';exit;
    $cl = searchApi('members_man members_women');
    //print_r($cl);
    if ($user['num'] > 60) {
        if ($fgender == '0' || $fgender == '1') {
            $cond[] = array('gender', $fgender, false);
            $cond[] = array('is_lock', '1', false);
            $cond[] = array('province', $province, false);
            $cond[] = array('city', $city, false);
            $cond[] = array('birthyear', array($age1, $age2), false);
            $cond[] = array('images_ischeck', '1', false);
            $cond[] = array('showinformation', '1', false);
            if (!empty($current_user) && $current_user['s_cid'] < 40) {
                $cond[] = array('usertype', '1', false);
            } else {
                $cond[] = array('usertype', '3', false);
            }
            $cl->SetMatchMode(SPH_MATCH_EXTENDED);
            //设置模式
            $cl->SetRankingMode(SPH_RANK_PROXIMITY);
            //设置评分模式
            $cl->SetFieldWeights(array('province' => 1, 'city' => 2));
            //设置字段的权重,如果city命中,那么权重算2
            //$cl->SetSortMode ('SPH_SORT_EXPR','@weight');//按照权重排序
            $sort = '@weight';
            //$sort = 'city desc';
            $rs_total = $cl->getResultOfReset($cond, array(), $sort);
            if ($rs_total['total_found'] >= 1) {
                $rand = mt_rand(1, $rs_total['total_found']);
            }
            $limit = array($rand, 1);
            $rs = $cl->getResultOfReset($cond, $limit, $sort);
        }
    } else {
        if ($fgender == '0' || $fgender == '1') {
            $cond[] = array('gender', $fgender, false);
            $cond[] = array('is_lock', '1', false);
            //$cond[] = array('province',$province,false);
            $cond[] = array('birthyear', array($age1, $age2), false);
            $cond[] = array('images_ischeck', '1', false);
            $cond[] = array('showinformation', '1', false);
            if (!empty($current_user) && $current_user['s_cid'] < 40) {
                $cond[] = array('usertype', '1', false);
            } else {
                $cond[] = array('usertype', '3', false);
            }
            $cl->SetMatchMode(SPH_MATCH_EXTENDED);
            //设置模式
            $cl->SetRankingMode(SPH_RANK_PROXIMITY);
            //设置评分模式
            $cl->SetFieldWeights(array('province' => 1, 'city' => 2));
            //设置字段的权重,如果city命中,那么权重算2
            //$cl->SetSortMode ('SPH_SORT_EXPR','@weight');//按照权重排序
            $sort = '@weight';
            $limit = array($rand, 1);
            //$sort = 'province desc,city desc';
            $rs_total = $cl->getResultOfReset($cond, $limit, $sort);
            if ($rs_total['total_found'] >= 1) {
                $rand = mt_rand(1, $rs_total['total_found']);
            }
            $rs = $cl->getResultOfReset($cond, $limit, $sort);
        }
    }
    if (is_array($rs) && isset($rs['matches']) && !empty($rs['matches'])) {
        $ids = $cl->getIds();
        //print_r($ids);
        if (!empty($ids)) {
            $arrUser['uid'] = $ids[0];
        }
        //$arrUser = $_MooClass ['MooMySQL']->getOne($sql,true);
    }
    if ($arrUser && !MooGetScreen($arrUser['uid'], $uid)) {
        if (MOOPHP_ALLOW_FASTDB) {
            $user = MooFastdbGet('members_login', 'uid', $arrUser['uid']);
        } else {
            $user = $_MooClass['MooMySQL']->getOne('SELECT `lastvisit` FROM `' . $dbTablePre . 'members_login` WHERE uid=' . $arrUser['uid']);
        }
        if ($user['lastvisit'] < $GLOBALS['timestamp'] - 600) {
            $nowtime = $GLOBALS['timestamp'];
        } else {
            $nowtime = rand(1, 100) > 70 ? $GLOBALS['timestamp'] : $GLOBALS['timestamp'] - rand(60, 120) * 60;
        }
        $_MooClass['MooMySQL']->query("UPDATE `{$dbTablePre}members_login` SET `lastvisit`=" . $nowtime . " WHERE `uid`=" . $arrUser['uid']);
        if (MOOPHP_ALLOW_FASTDB) {
            MooFastdbUpdate('members_login', 'uid', $arrUser['uid'], array('lastvisit' => $nowtime));
        }
        $result = $_MooClass['MooMySQL']->getOne("SELECT `vid` FROM `{$dbTablePre}service_visitor` WHERE uid='{$arrUser['uid']}' AND visitorid='{$uid}' AND `who_del`!=2", true);
        if ($result['vid']) {
            $_MooClass['MooMySQL']->query("UPDATE `{$dbTablePre}service_visitor` SET `visitortime`='{$nowtime}' WHERE `vid`={$result['vid']}");
        } else {
            $_MooClass['MooMySQL']->query("INSERT INTO `{$dbTablePre}service_visitor` SET `uid`='{$arrUser['uid']}',`visitorid`='{$GLOBALS['MooUid']}',`visitortime`='{$nowtime}',`who_del`=1");
        }
        return $arrUser['uid'];
    } else {
        return 0;
    }
}
Beispiel #7
0
function sendnewfl()
{
    global $_MooClass, $dbTablePre, $timestamp, $user_arr, $serverid, $memcached, $_MooCookie, $GLOBALS;
    //是否合法登录
    $and_uuid = isset($_GET['uuid']) ? $_GET['uuid'] : '';
    $uid = $_GET['uid'] = isset($_GET['uid']) ? $_GET['uid'] : '';
    if ($uid) {
        $userid = $mem_uid = $memcached->get('uid_' . $uid);
    }
    $checkuuid = check_uuid($and_uuid, $userid);
    if (!$checkuuid) {
        $error = "uuid_error";
        echo return_data($error, false);
        exit;
    }
    $sendtoid = MooGetGPC('sendtoid', 'integer', 'P');
    //
    $user_arr = MooMembersData($userid);
    $uid = $userid;
    $return = array();
    $is_first_send = true;
    $query = $_MooClass['MooMySQL']->getOne("SELECT count(1) as c FROM {$dbTablePre}pic WHERE uid = '{$sendtoid}'");
    $pic_total = $query['c'];
    //note 自己不能给自己发送秋波,直接转到秋波列表页面
    if ($sendtoid == $userid) {
        $error = "自己不可以给自己发过送鲜花";
        echo return_data($error, false);
        exit;
    }
    $result = $_MooClass['MooMySQL']->getOne("select groupid from web_admin_user where uid='{$serverid}'");
    $groupid = $result['groupid'];
    //系统管理员权限
    $GLOBALS['system_admin'] = array(60);
    if (in_array($groupid, $GLOBALS['system_admin'])) {
        $serverid = null;
    }
    if ($serverid && $user_arr['usertype'] != 3) {
        //只能模拟全权会员
        $error = "对不起您不能模拟操作";
        echo return_data($error, false);
        exit;
    }
    //note 双方屏蔽不给操作
    if (MooGetScreen($userid, $sendtoid)) {
        $error = "因特殊原因,送鲜花失败";
        echo return_data($error, false);
        exit;
    }
    //note 要做性别过滤,异性的发送秋波,直接转到秋波列表页面
    $send_user1 = leer_send_user1($sendtoid);
    $user = leer_send_user1($userid);
    if ($send_user1['gender'] == $user['gender']) {
        $error = "同性之间不可互发鲜花";
        echo return_data($error, false);
        exit;
        exit;
    }
    if ($user['rosenumber'] <= 0) {
        $error = '您没有鲜花了,获取更多鲜花';
        echo return_data($error, false);
        exit;
    }
    //
    //发送短信和邮件
    include_once "./module/crontab/crontab_config.php";
    $res = MooMembersData($sendtoid);
    $send_user_info = array_merge(MooGetData('members_choice', 'uid', $userid), MooMembersData($userid));
    //头像路径
    $path = thumbImgPath(2, $send_user_info['pic_date'], $send_user_info['pic_name'], $send_user_info['gender']);
    if (file_exists($path)) {
        $img_path = $path;
    } else {
        if ($send_user_info['gender'] == 1) {
            $img_path = "/public/images/service_nopic_woman.gif";
        } else {
            $img_path = "/public/images/service_nopic_man.gif";
        }
    }
    $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
    //发送者用户名
    $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
    //发送者性别
    $province = $send_user_info['province'] ? $provice_list[$send_user_info['province']] : '';
    //省
    $city = $send_user_info['city'] ? $city_list[$send_user_info['city']] : '';
    //市
    $height = $send_user_info['height'] ? $height_list[$send_user_info['height']] : "未知";
    //身高
    ob_start();
    //require_once MooTemplate('public/mail_space_rosetpl', 'module'); //模板
    $body = ob_get_clean();
    if ($res['usertype'] != 3) {
        MooSendMail($res['username'], "真爱一生网系统温馨提示", $body, "", false, $sendtoid);
    }
    if (empty($GLOBALS['MooUid'])) {
        list($uid, $password) = explode("\t", MooAuthCode($_MooCookie['auth'], 'DECODE'));
        $uid = intval($uid);
    } else {
        $uid = $GLOBALS['MooUid'];
    }
    //if(empty($uid)){
    //	MooMessage('您还没有登录','index.php?n=login');
    //}
    $leer = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}service_rose WHERE receiveuid = '{$sendtoid}' AND senduid = '{$userid}' ORDER BY rid DESC LIMIT 1");
    //库中验证鲜花数
    //$rosenum_check =  $GLOBALS['_MooClass']['MooMySQL']->getOne("SELECT rosenumber FROM {$GLOBALS['dbTablePre']}members_base  WHERE `uid`='{$uid}'  LIMIT 1",true);
    //if($rosenum_check['rosenumber'] > 0) {
    if ($leer['rid']) {
        $is_first_send = false;
        $rid = $leer['rid'];
        //note 如果已经发送过玫瑰,就增加发送玫瑰的次数
        $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}service_rose SET num = num + 1, receivenum = receivenum + 1,sendtime = '{$timestamp}',receivetime='{$timestamp}',receive_del=0,send_del=0 WHERE rid = '{$rid}'");
    } else {
        //note 发送新的玫瑰,写入数据库 发送者,接受者,发送时间
        $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}service_rose SET num = 1, receivenum = 1, sendtime = '{$timestamp}',receivetime='{$timestamp}',senduid  = '{$uid}',receiveuid = '{$sendtoid}' ");
    }
    //note 发送一朵玫瑰,自己就要减少一朵玫瑰
    $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}members_base SET rosenumber = rosenumber - 1 WHERE uid = '{$uid}'");
    if (MOOPHP_ALLOW_FASTDB) {
        $user_rosenum = $GLOBALS['_MooClass']['MooMySQL']->getOne("SELECT rosenumber FROM {$GLOBALS['dbTablePre']}members_base  WHERE `uid`='{$uid}'  LIMIT 1", true);
        $value['rosenumber'] = $user_rosenum['rosenumber'];
        MooFastdbUpdate('members_base', 'uid', $userid, $value);
    }
    //}
    //将新注册的会员更新为优质会员
    if (in_array($user_arr['sid'], array(0, 52, 123)) && $user_arr['is_well_user'] != 1) {
        update_iswell_user($user_arr['uid']);
    }
    //每天向同一用户发送多次,短信记录数表只记一次
    $send_rose_date = isset($leer['sendtime']) ? date("Y-m-d", $leer['sendtime']) : date("Y-m-d");
    //
    $today_rose_count = isset($leer['rid']) ? $leer['num'] + 1 : 1;
    if (date("Y-m-d") > $send_rose_date) {
        $today_rose_count = 1;
    }
    $sendinfo = MooGetGPC('sendinfo', 'string', 'G');
    if (!empty($sendinfo)) {
        $sendinfo = ",对您说:" . $sendinfo;
    }
    if ($res['usertype'] != 3) {
        if ($serverid) {
            //客服模拟会员登录可以选择发送短信或彩信
            $SMStype = MooGetGPC('selectSMSorCMS', 'string', 'G');
            if ($SMStype == 'SMS' && $res['is_phone']) {
                Push_message_intab($sendtoid, $res['telphone'], "鲜花", "真爱一生网 用户ID:" . $userid . "," . $send_user_grade . ",已给您发送鲜花" . $sendinfo . "     请及时把握您的缘分!4006780405", $userid);
            } elseif ($SMStype == 'CMS' && $res['is_phone']) {
                //====发送彩信   begin  ====
                //发送人有照片
                $sql = "SELECT uid,telphone FROM {$dbTablePre}members_search where uid='{$userid}' and images_ischeck=1 and pic_num>0";
                $sendfrom_user_info = $_MooClass['MooMySQL']->getOne($sql, true);
                //发送条件:本站注册会员,有电话号码的,开启短信通知的会员发送
                /* $sql="SELECT telphone FROM {$dbTablePre}members where uid='{$sendtoid}'";// and is_phone=1 and telphone!='' and usertype=1";
                   $sendto_user_info=$_MooClass['MooMySQL']->getOne($sql);*/
                if ($sendfrom_user_info['uid']) {
                    $sendedMMSCount = $memcached->get('hznsimulate' . $serverid);
                    if (empty($sendedMMSCount)) {
                        $sendedMMSCount = 0;
                    }
                    //if($sendedMMSCount > 10){
                    //	MooMessage('您今天累计已经发过10条彩信','index.php?n=service&h=rose');
                    //}
                    send_mms_commission($res['telphone'], 'rose', $userid);
                    $memcached->set('hznsimulate' . $serverid, ++$sendedMMSCount, 0, 28800);
                }
                //====发送彩信 end =====
            }
        } else {
            //真实会员登录
            if ($res['is_phone'] && $is_first_send && $res['s_cid'] != 40) {
                //第一次发才短信提示
                // SendMsg($res['telphone'],"真爱一生网 用户ID:".$userid.",".$send_user_grade.",已给您发送鲜花".$sendinfo."     请及时把握您的缘分!4006780405");
                Push_message_intab($sendtoid, $res['telphone'], "鲜花", "真爱一生网 用户ID:" . $userid . "," . $send_user_grade . ",已给您发送鲜花" . $sendinfo . "     请及时把握您的缘分!4006780405", $userid);
            }
        }
    }
    /*
    	$week_time = 24*3600*7;//一周时间秒数
    	$interval_time = $timestamp - $user_arr['last_login_time'];//当前时间-最后登录时间
    	$date1 = date("Y-m-d",strtotime("last Monday"));
    	$date2 = date("Y-m-d",strtotime("Sunday"));
    	
    	//echo "interval_time:".$interval_time . ' and '.'week:'.$week_time;exit;
    
    	if($interval_time > $week_time){//不活跃用户每周发一条短信
    		 $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '".$sendtoid."', sid = '".$userid."',phone = '".$res['telphone']."',sendtime = '".date("Y-m-d")."'" );
    		 $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='$sendtoid'  and sendtime>='$date1' and sendtime<='$date2'");
    		 if($cos[c] <= 1){
    			//fanglin暂时屏蔽
    			Push_message_intab($sendtoid,$res['telphone'],"鲜花","真爱一生网 用户ID:".$userid.",".$send_user_grade.",已给您发送鲜花,请及时把握您的缘分!4006780405",$userid);
    		 }
    	}else{
    		  //echo $today_rose_count;exit;
    		  if($send_rose_date==date("Y-m-d") && $today_rose_count == 1){	//每天同一个用户发送多次秋波,短信只记一次
    			   $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='$sendtoid' and sendtime='".date("Y-m-d")."'");
    			   
               //print_r($cos);exit;
    			   if($cos[c]<5){
    				  $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '".$sendtoid."', sid = '".$userid."',phone = '".$res['telphone']."',sendtime = '".date("Y-m-d")."'" );
    				  //fanglin暂时屏蔽
    				  Push_message_intab($sendtoid,$res['telphone'],"鲜花","真爱一生网 用户ID:".$userid.",".$send_user_grade.",已给您发送鲜花,请及时把握您的缘分!4006780405",$userid);
    			   }
    		}
    	}
    */
    /*
    	//发送彩信
    	$sql="SELECT uid FROM {$dbTablePre}members where uid='{$uid}' and mainimg!='' and images_ischeck=1 and pic_num>0";
    	//$sql="SELECT uid FROM {$dbTablePre}members where uid='{$uid}'";
    	$sendout_user_info=$_MooClass['MooMySQL']->getOne($sql);
    	//发送人有照片
    	$sql="SELECT telphone FROM {$dbTablePre}members where uid='{$sendtoid}' and is_phone=1 and telphone!='' and usertype=1";
    	$sendto_user_info=$_MooClass['MooMySQL']->getOne($sql);
    	//发送条件:本站注册会员,有电话号码的,开启短信通知的会员发送
        
    	//echo $sendto_user_info['telphone'].' and '.$sendout_user_info['uid'];exit;
    	if($sendto_user_info['telphone']&&$sendout_user_info['uid']){
    		//echo 'ffff';exit;
    		if(send_mms_commission($sendto_user_info['telphone'],'rose',$sendout_user_info['uid'])){
    			$note="。";
    		}else{
    			$note="!";
    		}
    	}
    */
    /*普通会员对全权会员反馈白名单*/
    if ($res['usertype'] == '3' && $user_arr['usertype'] != '3' && !$serverid) {
        white_list($res['uid'], $user_arr['uid']);
    }
    /*客服模拟全权记录*/
    if ($user_arr['usertype'] == '3' && $serverid && $res['usertype'] != '3') {
        $action = '鲜花';
        fulllog($user_arr['uid'], $serverid, $action, $res);
    }
    //提醒所属客服
    $sid = $user_arr['sid'];
    $title = '您的会员 ' . $user_arr['uid'] . ' 向 ' . $sendtoid . ' 发送了鲜花';
    $awoketime = $timestamp + 3600;
    $sql_remark = "insert into {$dbTablePre}admin_remark set sid='{$sid}',title='{$title}',content='{$title}',awoketime='{$awoketime}',dateline='{$timestamp}'";
    $res = $_MooClass['MooMySQL']->query($sql_remark);
    $return = "发送鲜花成功";
    echo return_data($return);
    exit;
    //MooMessage('发送鲜花成功',"index.php?n=service&h=rose&t=isendrose","05");
    //require MooTemplate('public/service_rose_sendrose', 'module');
}
Beispiel #8
0
function send_rose()
{
    global $_MooClass, $dbTablePre, $timestamp, $user_arr, $serverid;
    $sendtoid = MooGetGPC('sendtoid', 'integer');
    $userid = $user_arr['uid'];
    //note 分配客服
    //allotserver($userid);
    //note 获得照片总数
    $query = $_MooClass['MooMySQL']->query("SELECT imgid FROM {$dbTablePre}pic WHERE uid = '{$sendtoid}'");
    $pic_total = $_MooClass['MooMySQL']->numRows($query);
    //note 自己不能给自己发送玫瑰,直接转到玫瑰列表页面
    if ($userid == $sendtoid) {
        MooMessage('自己不可以给自己送鲜花', "index.php?n=service&h=rose&t=getmorerose");
        exit;
    }
    //客服不能模拟操作
    $result = $_MooClass['MooMySQL']->getOne("select groupid from web_admin_user where uid='{$serverid}'");
    $groupid = $result['groupid'];
    //系统管理员权限
    $GLOBALS['system_admin'] = array(60);
    if (in_array($groupid, $GLOBALS['system_admin'])) {
        $serverid = null;
    }
    if ($serverid) {
        MooMessage('对不起您不能模拟操作', 'javascript:history.go(-1);', '04');
        exit;
    }
    //note 双方屏蔽不给操作
    if (MooGetScreen($userid, $sendtoid)) {
        MooMessage('因特殊原因,送鲜花失败', "index.php?n=service&h=rose&t=getmorerose");
        exit;
    }
    //note 要做性别过滤,异性的发送玫瑰,直接转到玫瑰列表页面
    $send_user1 = leer_send_user1($sendtoid);
    $user = leer_send_user1($userid);
    if ($send_user1['gender'] == $user['gender']) {
        MooMessage('不可给同性发送鲜花', 'javascript:history.go(-1);');
        exit;
    }
    //note 如果自己没有玫瑰花了,就提示没有玫瑰花了
    if ($user['rosenumber'] <= 0) {
        MooMessage('您没有鲜花了,获取更多鲜花', "index.php?n=service&h=rose&t=getmorerose");
        exit;
    }
    //发送短信和邮件
    include_once "./module/crontab/crontab_config.php";
    if (MOOPHP_ALLOW_FASTDB) {
        $res = MooFastdbGet('members_search', 'uid', $sendtoid);
        $res_b = MooFastdbGet('members_base', 'uid', $sendtoid);
        $res = array_merge($res, $res_b);
    } else {
        $res = $_MooClass['MooMySQL']->getOne("select s.telphone,b.is_phone,s.username from {$dbTablePre}members_search s left join {$dbTablePre}members_base b on s.uid=b.uid  where s.uid='{$sendtoid}'");
    }
    $send_user_info = $_MooClass['MooMySQL']->getAll("select b.*,c.*,a.* from `{$dbTablePre}members_search` a left join {$dbTablePre}members_base c on a.uid=c.uid  left join  {$dbTablePre}members_choice b  on a.uid=b.uid  where a.uid = '{$userid}'");
    $send_user_info = $send_user_info[0];
    //头像路径
    $path = thumbImgPath(2, $send_user_info[pic_date], $send_user_info[pic_name], $send_user_info['gender']);
    if (file_exists($path)) {
        $img_path = $path;
    } else {
        if ($send_user_info['gender'] == 1) {
            $img_path = "/public/images/service_nopic_woman.gif";
        } else {
            $img_path = "/public/images/service_nopic_man.gif";
        }
    }
    $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
    //发送者用户名
    $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
    //发送者性别
    $province = $provice_list[$send_user_info['province']];
    //省
    $city = $city_list[$send_user_info['city']];
    //市
    $height = $send_user_info['height'] ? $height_list[$send_user_info['height']] : "未知";
    //身高
    ob_start();
    require_once MooTemplate('public/mail_space_rosetpl', 'module');
    //模板
    $body = ob_get_clean();
    MooSendMail($res['username'], "真爱一生网系统温馨提示", $body, "", false, $sendtoid);
    if (empty($GLOBALS['MooUid'])) {
        list($uid, $password) = explode("\t", MooAuthCode($_MooCookie['auth'], 'DECODE'));
        $uid = intval($uid);
    } else {
        $uid = $GLOBALS['MooUid'];
    }
    if (empty($uid)) {
        MooMessage('您还没有登录', 'index.php?n=login');
    }
    $leer = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}service_rose WHERE receiveuid = '{$sendtoid}' AND senduid = '{$userid}' ORDER BY rid DESC LIMIT 1");
    if ($user['rosenumber'] > 0) {
        if ($leer['rid']) {
            $rid = $leer['rid'];
            //note 如果已经发送过玫瑰,就增加发送玫瑰的次数
            $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}service_rose SET num = num + 1, receivenum = receivenum + 1,sendtime = '{$timestamp}',receivetime='{$timestamp}',receive_del=0,send_del=0 WHERE rid = '{$rid}'");
        } else {
            //note 发送新的玫瑰,写入数据库 发送者,接受者,发送时间
            $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}service_rose SET num = 1, receivenum = 1, sendtime = '{$timestamp}',receivetime='{$timestamp}',senduid  = '{$uid}',receiveuid = '{$sendtoid}' ");
        }
        //note 发送一朵玫瑰,自己就要减少一朵玫瑰
        //enkytest
        //enkytestend
        $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}members_base SET rosenumber = rosenumber - 1 WHERE uid = '{$uid}'");
        if (MOOPHP_ALLOW_FASTDB) {
            $user_rosenum = $GLOBALS['_MooClass']['MooMySQL']->getOne("SELECT rosenumber FROM {$GLOBALS['dbTablePre']}members_base  WHERE `uid`='{$uid}'  LIMIT 1");
            $value['rosenumber'] = $user_rosenum['rosenumber'];
            MooFastdbUpdate('members_base', 'uid', $userid, $value);
        }
    }
    //将新注册的会员更新为优质会员
    if (in_array($user_arr['sid'], array(0, 52, 123)) && $user_arr['is_well_user'] != 1) {
        update_iswell_user($user_arr['uid']);
    }
    //每天向同一用户发送多次,短信记录数表只记一次
    $send_rose_date = isset($leer['sendtime']) ? date("Y-m-d", $leer['sendtime']) : date("Y-m-d");
    //
    $today_rose_count = isset($leer['rid']) ? $leer['num'] + 1 : 1;
    if (date("Y-m-d") > $send_rose_date) {
        $today_rose_count = 1;
    }
    if ($res['is_phone']) {
        SendMsg($res['telphone'], "真爱一生网 用户ID:" . $userid . "," . $send_user_grade . ",已给您发送鲜花,请及时把握您的缘分!4006780405");
    }
    //提醒所属客服
    $sid = $user_arr['sid'];
    $title = '您的会员 ' . $user_arr['uid'] . ' 向 ' . $sendtoid . ' 发送了鲜花';
    $awoketime = $timestamp + 3600;
    $sql_remark = "insert into {$dbTablePre}admin_remark set sid='{$sid}',title='{$title}',content='{$title}',awoketime='{$awoketime}',dateline='{$timestamp}'";
    $res = $_MooClass['MooMySQL']->query($sql_remark);
    MooMessage('发送鲜花成功' . $note, "index.php?n=service&h=rose&t=isendrose", "05");
    require MooTemplate('public/service_rose_sendrose', 'module');
}
Beispiel #9
0
function sendcontact()
{
    global $_MooClass, $dbTablePre, $timestamp, $user, $user_arr, $hzn, $serverid;
    $returnurl = 'index.php?' . $_SERVER['QUERY_STRING'];
    //返回的url
    $userid = $GLOBALS['MooUid'];
    //note 目前默认系统不审核
    $contact_sys_check = '0';
    //note 目前系统默认是委托真爱一生等待对方的回应
    $contact_stat = '1';
    $content = MooCutstr(safeFilter(MooGetGPC('content1', 'string')), 200, '');
    $sendid = MooGetGPC('sendid', 'integer');
    //客服不可模拟操作
    /*if($hzn == "hongniangwang"){
          MooMessage('对不起您不能模拟操作','javascript:history.go(-1);','04');
          exit;
      }*/
    if ($serverid) {
        MooMessage('对不起您不能模拟操作', 'javascript:history.go(-1);', '04');
        exit;
    }
    //自己不可委托真爱一生联系自己
    if ($sendid == $userid) {
        MooMessage('自己不可委托真爱一生联系自己', 'javascript:history.go(-1);', '02');
        exit;
    }
    //note 双方屏蔽不给操作
    if (MooGetScreen($userid, $sendid)) {
        MooMessage('因特殊原因,委托失败', "index.php?n=service&h=rose&t=getmorerose", '03');
        exit;
    }
    $formsubmit1 = MooGetGPC('formsubmit1', 'string');
    //委托联系人表
    $checkuser = $_MooClass['MooMySQL']->getOne("SELECT mid,sendtime FROM {$dbTablePre}service_contact WHERE you_contact_other='{$sendid}' AND other_contact_you = '{$userid}' and receive_del=0 and send_del=0 and is_server=0");
    //查今天委托次数
    $checkuser2 = $user_arr;
    //note 委托也要做性别限制
    if (MOOPHP_ALLOW_FASTDB) {
        $user_s = MooFastdbGet('members_search', 'uid', $sendid);
    } else {
        $user_s = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}members_search WHERE uid = '{$sendid}'", true);
    }
    //note 获得照片总数
    $ret_count = $_MooClass['MooMySQL']->getOne("SELECT count(imgid) as c FROM {$dbTablePre}pic WHERE uid = '{$user_s['uid']}'");
    $pic_total = $ret_count['c'];
    if ($checkuser2['gender'] == $user_s['gender']) {
        MooMessage('同性之间不可委托真爱一生', 'javascript:history.go(-1);', '02');
        exit;
    }
    //note 检查绑定是否过期
    if ($user_s['isbind'] == 1) {
        //note 如果被绑定,检测绑定是否到期
        $user_s['isbind'] = check_bind($user_s['bind_id']);
        if ($user_s['isbind'] == 1) {
            MooMessage('不能向绑定中的会员发委托', 'javascript:history.go(-1);', '02');
            exit;
        }
    }
    if ($user_s['showinformation'] != 1) {
        MooMessage('发起委托失败,该会员已经关闭资料!', 'javascript:history.go(-1);', '02');
        exit;
    }
    //note 如果已经联系他就直接提示
    if ($checkuser['mid']) {
        MooMessage("对不起,您已经委托真爱一生联系TA了", 'javascript:history.go(-1);', '02');
    }
    //note 如果是今天超过3次就直接提示
    $mtime = date("Ymd");
    $contact_time_Ymd = date("Ymd", $checkuser2['contact_time']);
    if ($contact_time_Ymd == $mtime && $checkuser2['contact_num'] >= 3) {
        MooMessage("今天委托真爱一生已经超过3次", 'javascript:history.go(-1);', '02');
    }
    //提交时
    if ($formsubmit1 && $content && $sendid) {
        if (!$checkuser['mid']) {
            //发送短信和邮件
            include_once "./module/crontab/crontab_config.php";
            if (MOOPHP_ALLOW_FASTDB) {
                $res = MooFastdbGet('members_search', 'uid', $sendid);
            } else {
                $res = $_MooClass['MooMySQL']->getOne("select telphone,is_phone,username from {$dbTablePre}members_search where uid='{$sendid}'");
            }
            if (MOOPHP_ALLOW_FASTDB) {
                $send_user_info = MooFastdbGet('members_search', 'uid', $userid);
                $send_user_info = array_merge($send_user_info, MooFastdbGet('members_choice', 'uid', $userid));
            } else {
                $send_user_info = $_MooClass['MooMySQL']->getAll("select b.*,a.* from `{$dbTablePre}members_search` a  left join  {$dbTablePre}members_choice b  on a.uid=b.uid  where a.uid = '{$userid}'");
                $send_user_info = $send_user_info['0'];
            }
            //头像路径
            $path = thumbImgPath(2, $send_user_info['pic_date'], $send_user_info['pic_name'], $send_user_info['gender']);
            if (file_exists($path)) {
                $img_path = $path;
            } else {
                if ($send_user_info['gender'] == 1) {
                    $img_path = "/public/images/service_nopic_woman.gif";
                } else {
                    $img_path = "/public/images/service_nopic_man.gif";
                }
            }
            $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
            //发送者用户名
            $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
            //发送者性别
            $province = $provice_list[$send_user_info['province']];
            //省
            $city = $city_list[$send_user_info['city']];
            //市
            $height = $send_user_info['height'] ? $height_list[$send_user_info['height']] : "未知";
            //身高
            ob_start();
            require_once MooTemplate('public/mail_space_commissiontpl', 'module');
            //模板
            $body = ob_get_clean();
            MooSendMail($res['username'], "真爱一生网系统温馨提示", $body, "", false, $sendid);
            /*发送短信提醒   begin
                          $week_time = 24*3600*7;//一周时间秒数
                          $interval_time = $timestamp - $user_arr['last_login_time'];//当前时间-最后登录时间
                          $date1 = date("Y-m-d",strtotime("last Monday"));
                          $date2 = date("Y-m-d",strtotime("Sunday"));
                          
                          if($interval_time > $week_time){//不活跃用户每周发一条短信
                               $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '".$sendid."', sid = '".$userid."',phone = '".$res['telphone']."',sendtime = '".date("Y-m-d")."'" );
                               $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='$sendtoid'  and sendtime>='$date1' and sendtime<='$date2'");
                              if($cos['c'] <= 1){
                                  //fanglin暂时屏蔽
                                  Push_message_intab($sendid,$res['telphone'],"委托","真爱一生网 用户ID:".$send_user_info['uid'].",".$send_user_grade.",已委托真爱一生联系您,请及时把握您的缘分!4006780405",$send_user_info['uid']);
                              }
                          }else{
                               //每天该用户超过5条信息不发送短信
                             $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='$sendid' and sendtime='".date("Y-m-d")."'");
                             if($cos['c']<5){
                                $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '".$sendid."', sid = '".$userid."',phone = '".$res['telphone']."',sendtime = '".date("Y-m-d")."'" );
                                //fanglin暂时屏蔽
                                Push_message_intab($sendid,$res['telphone'],"委托","真爱一生网 用户ID:".$send_user_info['uid'].",".$send_user_grade.",已委托真爱一生联系您,请及时把握您的缘分!4006780405",$send_user_info['uid']);
                             }
                          }
            		end */
            //note 今天提交委托真爱一生,表中的委托计数还是昨天的就 update为0
            if ($contact_time_Ymd != $mtime) {
                $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}members_base SET contact_num = 0,contact_time = '{$timestamp}' WHERE uid = '{$userid}'");
                if (MOOPHP_ALLOW_FASTDB) {
                    $value = array();
                    $value['contact_num'] = 0;
                    $value['contact_time'] = $timestamp;
                    MooFastdbUpdate('members_base', 'uid', $userid, $value);
                }
            }
            //note 如果今天提交委托真爱一生次数超过3次不能再发起委托,否则更新次数
            $today_contact_num = $_MooClass['MooMySQL']->getOne("SELECT contact_num FROM {$dbTablePre}members_base WHERE uid = '{$userid}'", true);
            //$today_contact_num = $checkuser2;
            $today_contact_num = $today_contact_num['contact_num'];
            //今天委托的次数
            //if($user_arr['uid']=='20796965') $today_contact_num=0;
            if ($today_contact_num < 3) {
                //优质会员列表
                $update_sql = '';
                if (empty($user_arr['sid']) && $user_arr['usertype'] == 1) {
                    $update_sql = ',is_well_user=1';
                }
                $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}members_base SET contact_num = contact_num + 1,contact_time = '{$timestamp}' {$update_sql}  WHERE uid = '{$userid}'");
                if (MOOPHP_ALLOW_FASTDB) {
                    $oldarr = MooFastdbGet('members_base', 'uid', $userid);
                    $value = array();
                    $value['contact_num'] = $oldarr['contact_num'] + 1;
                    $value['contact_time'] = $timestamp;
                    if ($update_sql != '') {
                        $value['is_well_user'] = 1;
                    }
                    MooFastdbUpdate('members_base', 'uid', $userid, $value);
                }
                //note 记录委托真爱一生的内容
                $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}service_contact SET content = '{$content}',other_contact_you = '{$userid}',you_contact_other='{$sendid}',stat = '{$contact_stat}',syscheck='{$contact_sys_check}',sendtime = '{$timestamp}'");
                //将新注册的会员更新为优质会员
                if (in_array($user_arr['sid'], array(1, 52, 123)) && $user_arr['is_well_user'] != 1) {
                    update_iswell_user($user_arr['uid']);
                }
                //if($user_arr['uid']=='20796965'){
                //====发送委托彩信   begin  ====
                $sql = "SELECT uid,telphone FROM {$dbTablePre}members_search where uid='{$userid}' and mainimg!='' and images_ischeck=1 and pic_num>0";
                $sendout_user_info = $_MooClass['MooMySQL']->getOne($sql);
                //发送人有照片
                //echo $sendid."<br />".$userid;
                $sql = "SELECT s.telphone FROM {$dbTablePre}members_search as s\n\t                       left join {$dbTablePre}members_base as b on s.uid=b.uid\n\t                       where s.uid='{$sendid}' and b.is_phone=1 and s.telphone!='' and s.usertype=1";
                $sendto_user_info = $_MooClass['MooMySQL']->getOne($sql, true);
                //发送条件:本站注册会员,有电话号码的,开启短信通知的会员发送
                //print_r($sendout_user_info);
                //exit;$sendout_user_info['telphone']
                if ($sendto_user_info['telphone'] && $sendout_user_info['uid']) {
                    //SendMsg('18911883821',"真爱一生网 用户ID:".$user_arr['uid'].",".$gender.",已给委托真爱一生 委托您,请及时把握您的缘分!4006780405");
                    send_mms_commission($sendto_user_info['telphone'], 'contact', $sendout_user_info['uid']);
                }
                //====发送委托彩信 end =====
                //}
                MooMessage("委托成功", 'index.php?n=service', '05');
            } else {
                MooMessage("今天委托真爱一生已经 超过3次", 'javascript:history.go(-1);', '02');
            }
        } else {
            MooMessage("对不起,您已经委托真爱一生联系TA了", 'javascript:history.go(-1);', '02');
        }
    }
    //是否有手机号码
    if (MOOPHP_ALLOW_FASTDB) {
        $status = MooFastdbGet('certification', 'uid', $userid);
    } else {
        $status = $_MooClass['MooMySQL']->getOne("SELECT telphone FROM {$dbTablePre}certification WHERE uid='{$userid}'", true);
    }
    if (!$status['telphone']) {
        MooMessage("对不起,您没有通过手机验证,请先通过验证再委托", 'index.php?n=myaccount&h=telphone', '02');
    } else {
        $tel = $status['telphone'];
    }
    require MooTemplate('public/service_contact_sendcontact', 'module');
}
Beispiel #10
0
function sendEmail()
{
    global $_MooClass, $dbTablePre, $timestamp, $user_arr, $timestamp, $memcached;
    $sendtouid = MooGetGPC('uid', 'integer', 'P');
    $userid = $user_arr['uid'];
    $title = MooGetGPC('title', 'string', 'P');
    $content = MooGetGPC('content', 'string', 'P');
    $serverid = Moo_is_kefu();
    if ($serverid && $user_arr['usertype'] != 3) {
        exit('simulate');
    }
    if (empty($sendEmailCount)) {
        $sendEmailCount = 0;
    }
    $sendEmailCount = $memcached->get('sendEmail' . $userid);
    if ($sendEmailCount > 3) {
        exit('limited');
    }
    if ($sendtouid == $userid) {
        exit('sameone');
    }
    if (MooGetScreen($userid, $sendtouid)) {
        exit('shield');
    }
    if (!in_array($user_arr['s_cid'], array(10, 20, 30))) {
        exit('upgrade');
    }
    $sendToUser = MooMembersData($sendtouid);
    if (isset($sendToUser['gender']) && $sendToUser['gender'] == $user_arr['gender']) {
        exit('gender');
    }
    if (isset($sendToUser['showinformation']) && $sendToUser['showinformation'] != 1) {
        exit('closeInfo');
    }
    //是否有手机号码
    if (MOOPHP_ALLOW_FASTDB) {
        $_R_ = MooFastdbGet('certification', 'uid', $userid);
    } else {
        $sql = "SELECT telphone FROM {$dbTablePre}certification WHERE uid='{$userid}'";
        $_R_ = $_MooClass['MooMySQL']->getOne($sql, true);
    }
    if (empty($_R_['telphone']) && empty($serverid)) {
        exit('telNo');
    }
    $sql = "select count(s_id) as cnt from web_members_search where s_fromid='{$userid}' and s_uid='{$sendtouid}' and s_type=1";
    $_S_ = $_MooClass['MooMySQL']->getOne($sql, true);
    if (isset($_S_['cnt']) && $_S_['cnt'] > 3) {
        exit('已经超出了发送邮件的数量!');
    }
    $gender = $user_arr['gender'] == 1 ? "美女" : "帅哥";
    $data['s_content'] = trim(safeFilter($content));
    $data['s_title'] = $title;
    $data['s_fromid'] = $userid;
    $data['s_uid'] = $sendtouid;
    $data['s_time'] = time();
    $data['sid'] = $user_arr['sid'];
    if ($user_arr['usertype'] != 3) {
        $data['flag'] = 0;
    } else {
        $data['flag'] = 1;
    }
    inserttable('services', $data);
    $memcached->set('sendEmail' . $userid, ++$sendEmailCount, 0, 86400);
    //************提醒所属客服**************
    $sid = $user_arr['sid'];
    $title = '您的会员 ' . $userid . ' 发送邮件到' . $sendtouid;
    $awoketime = $timestamp + 3600;
    $sql_remark = "insert into {$dbTablePre}admin_remark set sid='{$sid}',title='发邮件',content='{$title}',awoketime='{$awoketime}',dateline='{$timestamp}'";
    $res = $_MooClass['MooMySQL']->query($sql_remark);
    $pattern = '/^((1[345]\\d{9})|(18[0-9]\\d{8}))$/';
    if (isset($sendToUser['usertype']) && $sendToUser['usertype'] == 1 && preg_match($pattern, $sendToUser['telphone'])) {
        Push_message_intab($sendtouid, $sendToUser['telphone'], "站内信", "尊敬的会员您好!ID:{$userid}给您发送了邮件!幸福热线:4008787920", $userid);
    }
}
Beispiel #11
0
function make($uid, $usertype)
{
    global $_MooClass, $dbTablePre, $timestamp, $memcached;
    $time = time();
    $randdo = rand(1, 10);
    if ($randdo > 8) {
        return 0;
    } elseif ($randdo > 5) {
        //省内
        $address = "province";
    } else {
        //本市
        $address = "ctiy";
    }
    $lastmake = $memcached->get('lastmake' . $GLOBALS['MooUid']);
    if (empty($lastmake)) {
        $memcached->set('lastmake' . $GLOBALS['MooUid'], $time);
    } else {
        if ($lastmake + rand(100, 180) > $time) {
            return 0;
        } else {
            $memcached->replace('lastmake' . $GLOBALS['MooUid'], $time);
        }
    }
    //note 当前会员工作地
    if (MOOPHP_ALLOW_FASTDB) {
        $current_user = MooFastdbGet('members_search', 'uid', $uid);
    } else {
        $current_user = $_MooClass['MooMySQL']->getOne("select province,city,gender,birthyear from {$dbTablePre}members_search where uid='{$uid}'");
    }
    //note 与当前会员在同一工作地或同一省的会员
    $fgender = $current_user['gender'] == '0' ? '1' : '0';
    //取当前用户相反性别
    //note 与会员年龄上下相差5岁左右的
    if ($fgender == 1) {
        $age1 = $current_user['birthyear'] - 1;
        $age2 = $current_user['birthyear'] + 9;
    } else {
        $age1 = $current_user['birthyear'] - 9;
        $age2 = $current_user['birthyear'] + 1;
    }
    MooPlugins('ipdata');
    $ip = GetIP();
    $user_address = convertIp($ip);
    //$user_address="安徽省合肥市 电信";
    include "ework/include/crontab_config.php";
    foreach ($provice_list as $key => $provice_arr) {
        if (strpos($user_address, $provice_arr) !== false) {
            $province = $key;
            break;
        }
    }
    if (!$province) {
        $province = $current_user['province'];
    }
    $age_between = " AND mes1.birthyear>='{$age1}' AND mes1.birthyear<='{$age2}'";
    if ($fgender == '0') {
        //if($usertype=='1'){
        //$sql = "SELECT count(1) AS num FROM {$dbTablePre}membersfastsort_man WHERE  province='{$province}'  AND birthyear>='$age1' AND birthyear<='$age2' and images_ischeck=1";
        //}else{
        $sql = "SELECT count(1) AS num FROM {$dbTablePre}members_search WHERE  province='{$province}'  AND birthyear>='{$age1}' AND birthyear<='{$age2}' and images_ischeck=1 and usertype=1";
        //}
    }
    if ($fgender == '1') {
        //if($usertype=='1'){//普通会员
        //$sql = "SELECT count(1) AS num FROM {$dbTablePre}membersfastsort_women WHERE  province='{$province}'  AND birthyear>='$age1' AND birthyear<='$age2' and images_ischeck=1";
        //}else{//高级会员产生的浏览为本站的
        $sql = "SELECT count(1) AS num FROM {$dbTablePre}members_search WHERE  province='{$province}'  AND birthyear>='{$age1}' AND birthyear<='{$age2}' and images_ischeck=1 and usertype=1";
        //}
    }
    if (MOOPHP_ALLOW_FASTDB) {
        global $fastdb;
        $md5_sql1 = md5($sql);
        $inprovince = unserialize($fastdb->get($md5_sql1));
        if (!$inprovince || $inprovince['last_time'] < time()) {
            $inprovince = $_MooClass['MooMySQL']->getOne($sql);
            $inprovince['last_time'] = time() + 3600 * 24 * 7;
            $fastdb->set($md5_sql1, serialize($inprovince));
        }
    } else {
        $inprovince = $_MooClass['MooMySQL']->getOne($sql);
    }
    $rand = $inprovince['num'] > 60 ? $inprovince['num'] : 30000;
    $rand = mt_rand(1, $rand);
    $arrUser = array();
    /*if($inprovince['num']>60){	
    		if($fgender == '0'){
    			//if($usertype=='1'){
    				//$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}membersfastsort_man AS mes1 WHERE   (mes1.province='{$province}') and mes1.is_lock=1  $age_between and images_ischeck=1  LIMIT {$rand},1";
    			//}else{
    				$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}members_search AS mes1 WHERE   (mes1.province='{$province}') and mes1.is_lock=1  $age_between and images_ischeck=1 and usertype=1 LIMIT {$rand},1";
    			//}
    		}
    		
    		if($fgender == '1'){
    			//if($usertype=='1'){
    				//$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}membersfastsort_women AS mes1 WHERE   (mes1.province='{$province}') and mes1.is_lock=1  $age_between and images_ischeck=1 LIMIT {$rand},1";
    			//}else{				
    				$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}members_search AS mes1 WHERE   (mes1.province='{$province}') and mes1.is_lock=1  $age_between and images_ischeck=1 and usertype=1 LIMIT {$rand},1";
    			//}
    		}
    
    		$arrUser = $_MooClass['MooMySQL']->getOne($sql);//mes1.uid >= mes2.uid		
        }else{
    		if($fgender == '0'){
    			//if($usertype=='1'){
    				//$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}membersfastsort_man AS mes1 WHERE   mes1.is_lock=1  $age_between and images_ischeck=1 LIMIT {$rand},1";
    			//}else{				
    				$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}members_search AS mes1 WHERE   mes1.is_lock=1  $age_between and images_ischeck=1 and usertype=1 LIMIT {$rand},1";
    			//}
    		}
    		
    		if($fgender == '1'){
    			//if($usertype=='1'){
    				//$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}membersfastsort_women AS mes1 WHERE   mes1.is_lock=1  $age_between and images_ischeck=1 LIMIT {$rand},1";
    			//}else{				
    				$sql = "SELECT mes1.uid as uid FROM {$dbTablePre}members_search AS mes1 WHERE   mes1.is_lock=1  $age_between and images_ischeck=1 and usertype=1 LIMIT {$rand},1";
    			//}
    		}		
    		$arrUser = $_MooClass['MooMySQL']->getOne($sql);//mes1.uid >= mes2.uid
    		
    	}*/
    $cl = searchApi('members_man members_women');
    if ($user['num'] > 60) {
        if ($fgender == '0' || $fgender == '1') {
            $cond[] = array('gender', $fgender, false);
            $cond[] = array('is_lock', '1', false);
            $cond[] = array('province', $province, false);
            $cond[] = array('birthyear', array($age1, $age2), false);
            $cond[] = array('images_ischeck', '1', false);
            $cond[] = array('showinformation', '1', false);
            if (!empty($current_user) && $current_user['s_cid'] < 40) {
                $cond[] = array('usertype', '1', false);
            } else {
                $cond[] = array('usertype', '3', false);
            }
            $sort = 'city desc';
            $rs_total = $cl->getResult($cond, array(), $sort);
            if ($rs_total['total_found'] >= 1) {
                $rand = mt_rand(1, $rs_total['total_found']);
            }
            $limit = array($rand, 1);
            $rs = $cl->getResult($cond, $limit, $sort);
        }
    } else {
        if ($fgender == '0' || $fgender == '1') {
            $cond[] = array('gender', $fgender, false);
            $cond[] = array('is_lock', '1', false);
            //$cond[] = array('province',$province,false);
            $cond[] = array('birthyear', array($age1, $age2), false);
            $cond[] = array('images_ischeck', '1', false);
            $cond[] = array('showinformation', '1', false);
            if (!empty($current_user) && $current_user['s_cid'] < 40) {
                $cond[] = array('usertype', '1', false);
            } else {
                $cond[] = array('usertype', '3', false);
            }
            $sort = 'province desc,city desc';
            $rs_total = $cl->getResult($cond, array(), $sort);
            if ($rs_total['total_found'] >= 1) {
                $rand = mt_rand(1, $rs_total['total_found']);
            }
            $limit = array($rand, 1);
            $rs = $cl->getResult($cond, $limit, $sort);
        }
    }
    if (is_array($rs) && isset($rs['matches']) && !empty($rs['matches'])) {
        $ids = $cl->getIds();
        //print_r($ids);
        if (!empty($ids)) {
            $arrUser['uid'] = $ids[0];
        }
        //$arrUser = $_MooClass ['MooMySQL']->getOne($sql,true);
    }
    if ($arrUser && !MooGetScreen($arrUser['uid'], $uid)) {
        $nowtime = time();
        if (MOOPHP_ALLOW_FASTDB) {
            $user = MooFastdbGet('members_search', 'uid', $arrUser['uid']);
            $time = time() - 600;
            if ($user['lastvisit'] < $time) {
                $_MooClass['MooMySQL']->query("UPDATE `{$dbTablePre}members_login` SET `lastvisit`=" . $nowtime . " WHERE `uid`=" . $arrUser['uid']);
            }
            $val = array();
            $val['lastvisit'] = $nowtime;
            MooFastdbUpdate('members_login', 'uid', $arrUser['uid'], $val);
            //!!
        } else {
            $_MooClass['MooMySQL']->query("UPDATE `{$dbTablePre}members_login` SET `lastvisit`=" . $nowtime . " WHERE `uid`=" . $arrUser['uid']);
        }
        $result = $_MooClass['MooMySQL']->getOne("SELECT `vid` FROM `{$dbTablePre}service_visitor` WHERE uid='{$arrUser['uid']}' AND visitorid='{$uid}' AND `who_del`!=2");
        if ($result['vid']) {
            $_MooClass['MooMySQL']->query("UPDATE `{$dbTablePre}service_visitor` SET `visitortime`='{$nowtime}' WHERE `vid`={$result['vid']}");
        } else {
            $_MooClass['MooMySQL']->query("INSERT INTO `{$dbTablePre}service_visitor` SET `uid`='{$arrUser['uid']}',`visitorid`='{$GLOBALS['MooUid']}',`visitortime`='{$nowtime}',`who_del`=1");
        }
    }
    /*	return 	$arrUser?$arrUser:0;*/
}
Beispiel #12
0
function to_send_message()
{
    global $_MooClass, $dbTablePre, $userid, $user_arr, $memcached, $timestamp, $serverid;
    $and_uuid = isset($_GET['uuid']) ? $_GET['uuid'] : '';
    $uid = isset($_GET['uid']) ? $_GET['uid'] : '';
    if ($uid) {
        $userid = $mem_uid = $memcached->get('uid_' . $uid);
    }
    $uuid = $memcached->get('uuid_' . $userid);
    //$error[] = array("getand_uuid"=>$and_uuid,"getuid"=>$uid,"userid"=>$userid,"mem_uuid"=>$uuid);
    $checkuuid = check_uuid($and_uuid, $userid);
    if (!$checkuuid) {
        $error = "uuid_error";
        echo return_data($error, false);
        exit;
    }
    $user_arr = MooMembersData($userid);
    $contentid = MooGetGPC('s_id', 'integer', 'P');
    //不可给同性别发送消息
    $receive_info = MooMembersData($contentid);
    $receive_gender = $receive_info['gender'];
    if ($user_arr['gender'] == $receive_gender) {
        $err = "不可给同性别发送消息";
        echo return_data($err, false);
        exit;
    }
    //系统管理员权限
    /*$result=$_MooClass['MooMySQL']->getOne("select groupid from web_admin_user where uid='{$serverid}'");
      $groupid=$result['groupid'];
      
      //$GLOBALS['system_admin'] = array(60);
      if(in_array($groupid,$GLOBALS['system_admin'])){
          $serverid=null;
      }*/
    $result = $_MooClass['MooMySQL']->getOne("select groupid from web_admin_user where uid='{$serverid}'");
    $groupid = $result['groupid'];
    if ($serverid && $user_arr['usertype'] != 3) {
        $err = "对不起您不能模拟操作";
        echo return_data($err, false);
        exit;
    }
    if ($serverid && $user_arr['usertype'] == 3 && !in_array($groupid, $GLOBALS['admin_aftersales'])) {
        $err = "对不起您不能模拟操作";
        echo return_data($err, false);
        exit;
    }
    //如果是本站注册会员
    if ($user_arr['usertype'] == 1) {
        $m_level = get_userrank($userid);
        //会员等级
        if ($m_level != 1) {
            //不是高级会员
            if (!checkIsMobileCertical($userid)) {
                //没有通过了手机验证
                $err = "您还没有进行手机验证,请先认证";
                echo return_data($err, false);
                exit;
            } else {
                //if(!checkIsOver($userid)){ //过了试用期
                $err = "只有钻石或高级会员才可以发送电子邮件给对方";
                echo return_data($err, false);
                exit;
                //}
            }
        }
    }
    //print_r($_POST);
    //note s_cid 发送者的权限(回复时才有)
    $s_cid = MooGetGPC('s_cid', 'integer', 'P');
    //echo $s_cid;exit;
    //收件人id
    $sid = $contentid;
    //发件人id
    $mid = $userid;
    ///echo $sid;exit;
    $s_title = MooGetGPC('s_title', 'string', 'P');
    $s_title = rtrim($s_title);
    //对主题字数限制
    $s_title = MooStrReplace(MooCutstr($s_title, 30, $dot = ''));
    $s_content = MooGetGPC('s_content', 'string', 'P');
    //note 特殊字符
    $s_content = rtrim(MooStrReplace(safeFilter($s_content)));
    $send_mymessage = MooGetGPC('send_mymessage', 'integer', 'P');
    $message_back = MooGetGPC('message_back', 'integer', 'P');
    //note 双方屏蔽不给操作
    if (MooGetScreen($mid, $sid)) {
        $err = "因特殊原因,消息发送失败";
        echo return_data($err, false);
        exit;
    }
    if ($mid && $sid && $s_title && $s_content) {
        $m_level = get_userrank($userid);
        //会员等级
        if ($m_level == 2 && $user_arr['usertype'] != 3) {
            //普通会员需要审核(除采集会员之外)
            //if($user_arr['gender'] == 0){	//如果是男方发的,需要审核,0表示
            $send_status = $_MooClass['MooMySQL']->query("insert into {$dbTablePre}services (s_cid,s_uid,s_fromid,s_title,s_content,s_time,sid,flag) values ('{$s_cid}','{$sid}','{$mid}','{$s_title}','{$s_content}'," . time() . ",'{$user_arr['sid']}','0')");
        } else {
            $send_status = $_MooClass['MooMySQL']->query("insert into {$dbTablePre}services (s_cid,s_uid,s_fromid,s_title,s_content,s_time,sid,flag) values ('{$s_cid}','{$sid}','{$mid}','{$s_title}','{$s_content}'," . time() . ",'{$user_arr['sid']}','1')");
        }
        //发送短信和邮件
        include_once "./module/crontab/crontab_config.php";
        $res = MooMembersData($sid);
        //	   $send_user_info = $_MooClass['MooMySQL']->getAll("select * from `{$dbTablePre}members_search` a  left join  {$dbTablePre}members_choice b  on a.uid=b.uid  where a.uid = '$userid'");
        $send_user_info = array_merge(MooGetData("members_choice", 'uid', $userid), MooMembersData($userid));
        //	   $send_user_info = $send_user_info[0];
        //头像路径
        $path = thumbImgPath(2, $send_user_info['pic_date'], $send_user_info['pic_name'], $send_user_info['gender']);
        if (file_exists($path)) {
            $img_path = $path;
        } else {
            if ($send_user_info['gender'] == 1) {
                $img_path = "/public/images/service_nopic_woman.gif";
            } else {
                $img_path = "/public/images/service_nopic_man.gif";
            }
        }
        $send_username = $send_user_info['nickname'] ? $send_user_info['nickname'] : $send_user_info['uid'];
        //发送者用户名
        $send_user_grade = $send_user_info['gender'] == 1 ? "女" : "男";
        //发送者性别
        $province = $send_user_info['province'] ? $provice_list[$send_user_info['province']] : '';
        //省
        $city = $send_user_info['city'] ? $city_list[$send_user_info['city']] : '';
        //市
        $height = $send_user_info['height'] ? $height_list[$send_user_info['height']] : "未知";
        //身高
        ob_start();
        require_once MooTemplate('public/mail_space_messagetpl', 'module');
        //模板
        $body = ob_get_clean();
        MooSendMail($res['username'], "真爱一生网系统温馨提示", $body, "", false, $sid);
        $week_time = 24 * 3600 * 7;
        //一周时间秒数
        $interval_time = $timestamp - $user_arr['last_login_time'];
        //当前时间-最后登录时间
        $date1 = date("Y-m-d", strtotime("last Monday"));
        $date2 = date("Y-m-d", strtotime("Sunday"));
        if ($interval_time > $week_time) {
            //不活跃用户每周发一条短信
            $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '" . $sid . "', sid = '" . $userid . "',phone = '" . $res['telphone'] . "',sendtime = '" . date("Y-m-d") . "'");
            $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='{$sid}' and sendtime>='{$date1}' and sendtime<='{$date2}'", true);
            if ($cos['c'] <= 1) {
                //fanglin暂时屏蔽
                Push_message_intab($sid, $res['telphone'], "邮件", "真爱一生网 用户ID:" . $userid . "," . $send_user_grade . ",已给您发送电子邮件,请及时到真爱一生网查看!4006780405", $userid);
            }
        } else {
            //活跃用户每天一条
            //每天该用户超过5条信息不发送短信
            $cos = $_MooClass['MooMySQL']->getOne("select count(*) as c from {$dbTablePre}today_send where uid='{$sid}' and sendtime='" . date("Y-m-d") . "'", true);
            if ($cos['c'] < 5) {
                $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}today_send SET uid = '" . $sid . "', sid = '" . $userid . "',phone = '" . $res['telphone'] . "',sendtime = '" . date("Y-m-d") . "'");
                //fanglin暂时屏蔽
                Push_message_intab($sid, $res['telphone'], '邮件', "真爱一生网 用户ID:" . $userid . "," . $send_user_grade . ",已给您发送电子邮件,请及时到真爱一生网查看!4006780405", $userid);
            }
        }
        //note 发送资料给接收方
        if ($send_mymessage) {
        }
        //note 备份邮件操作
        if ($message_back) {
            //note 发送MAIL时所需信息
            $user = $_MooClass['MooMySQL']->getOne("select username,nickname from {$dbTablePre}members_search where uid='{$mid}'");
            //note 发送MAIL时收信人的邮箱
            $ToAddress = $user['username'];
            //note 发送MAIL时主题
            $ToSubject = '提示:您在真爱一生网所发的消息备份';
            //note 发送MAIL时Body内容所需信息
            $username = $user['nickname'];
            //note 发送MAIL时Body内容所需信息
            $toname = $_MooClass['MooMySQL']->getOne("select nickname from {$dbTablePre}members_search where uid='{$sid}'");
            if ($username) {
                $ToBody = $username;
            } else {
                $ToBody = 'ID号为' . $mid . '的会员<br>';
            }
            if ($toname['nickname']) {
                $ToBody .= ':您好,您于' . date('Y-m-d H:i:s', time()) . ',在真爱一生网发送电子邮件给' . $toname['nickname'] . ',内容如下:<br>';
            } else {
                $ToBody .= ':您好,您于' . date('Y-m-d H:i:s', time()) . ',在真爱一生网发送电子邮件给ID号为' . $sid . '的会员,内容如下:<br>';
            }
            if ($username) {
                $ToBody .= '&nbsp;&nbsp;&nbsp;&nbsp;发件人:' . $username . '<br>';
            } else {
                $ToBody .= '&nbsp;&nbsp;&nbsp;&nbsp;发件人:ID号为' . $mid . '<br>';
            }
            if ($toname['nickname']) {
                $ToBody .= '&nbsp;&nbsp;&nbsp;&nbsp;收件人:' . $toname['nickname'] . '<br>';
            } else {
                $ToBody .= '&nbsp;&nbsp;&nbsp;&nbsp;收件人:ID号为' . $sid . '<br>';
            }
            $ToBody .= '&nbsp;&nbsp;&nbsp;&nbsp;主题:' . $s_title . '<br>';
            $ToBody .= '&nbsp;&nbsp;&nbsp;&nbsp;正文:<br>&nbsp;&nbsp;&nbsp;&nbsp;' . $s_content;
            MooSendMail($ToAddress, $ToSubject, $ToBody, $is_template = true, $sid);
        }
        //添加成功提示信息
        if ($send_status) {
            /*普通会员对全权会员反馈白名单*/
            if ($res['usertype'] == '3' && $user_arr['usertype'] != '3' && !$serverid) {
                white_list($res['uid'], $user_arr['uid']);
            }
            /*客服模拟全权记录*/
            if ($user_arr['usertype'] == '3' && $serverid && $res['usertype'] != '3') {
                $action = '站内信';
                fulllog($user_arr['uid'], $serverid, $action, $res);
            }
            //提醒所属客服
            $usid = $user_arr['sid'];
            $title = '您的会员 ' . $mid . ' 向 ' . $sid . ' 发送了邮件';
            $awoketime = $timestamp + 3600;
            $sql_remark = "insert into {$dbTablePre}admin_remark set sid='{$usid}',title='{$title}',content='{$title}',awoketime='{$awoketime}',dateline='{$timestamp}'";
            $res = $_MooClass['MooMySQL']->query($sql_remark);
            if ($user_arr['gender'] == 0) {
                //男方发的
                $suc = "发送成功,真爱一生审核后对方即可以收到。";
                echo return_data($suc, true);
                exit;
            } else {
                $suc = "发送成功";
                echo return_data($suc, true);
                exit;
            }
        } else {
            $err = "发送失败";
            echo return_data($err, false);
            exit;
        }
    } else {
        $err = "数据填写不完整";
        echo return_data($err, false);
        exit;
    }
}
Beispiel #13
0
function space_viewpro()
{
    global $_MooClass, $dbTablePre, $userid, $timestamp, $user_arr, $val_arr, $style_user_arr, $diamond, $_MooCookie, $memcached;
    //$val_arr统计资料完善度
    $uid = MooGetGPC('uid', 'integer', 'G') ? MooGetGPC('uid', 'integer', 'G') : $userid;
    $skinName = MooGetGPC('skiname', 'string', 'G');
    $is_only_show = true;
    $status = array();
    //note 判断被浏览的会员是否存在
    $status = array_merge(MooMembersData($uid), MooGetData('members_login', 'uid', $uid));
    //*****************白名单*******************
    if ($uid != $userid) {
        $is_only_show = false;
    }
    if (empty($is_only_show)) {
        //if(MOOPHP_ALLOW_FASTDB && $status['is_lock'] != 1){//is_lock默认1不封锁用户,0则封锁
        if ($status['is_lock'] != 1) {
            MooMessage('此会员已经找到真爱,关闭了个人资料,转向我的真爱一生,寻找自己的真爱吧!', 'index.php?n=service');
        }
        if (!$status) {
            MooMessage('此会员已经找到真爱,关闭了个人资料,转向我的真爱一生,寻找自己的真爱吧!', 'index.php?n=service');
            //note 判断被浏览的用户是否允许其他会员查看他的资料
        } elseif (!$status['showinformation'] && $status['uid'] != $userid) {
            //showinformation默认1允许其他会员查看,0则不允许
            switch ($status['showinformation_val']) {
                //showinformation_val用户关闭资料的理由
                case 1:
                    MooMessage('此会员已找到正在交往的对象,故资料未公开,转向我的真爱一生', 'index.php?n=service');
                    break;
                case 2:
                    MooMessage('此会员已找到真爱,即将踏上红地毯,故资料未公开,转向我的真爱一生', 'index.php?n=service');
                    break;
                case 3:
                    MooMessage('此会员最近很忙,无法及时回复邮件,故资料未公开,转向我的真爱一生', 'index.php?n=service');
                    break;
                case 4:
                    MooMessage('此会员资料未公开,原因可能是TA已经找到真爱了,转向我的真爱一生', 'index.php?n=service');
                    break;
            }
        }
    }
    $serverid = Moo_is_kefu();
    //后台管理员
    if ($serverid) {
        $result = $_MooClass['MooMySQL']->getOne("select groupid from web_admin_user where uid='{$serverid}'");
        $groupid = $result['groupid'];
        //系统管理员权限
        $GLOBALS['system_admin'] = array(60);
        if (in_array($groupid, $GLOBALS['system_admin'])) {
            $serverid = null;
        }
    }
    //note 浏览资料页面时候,写入谁浏览谁表,自己浏览自己的除外
    if ($userid && $uid && $userid != $uid) {
        //note 不让屏蔽的会员查看
        if (MooGetScreen($userid, $uid)) {
            MooMessage('由于特殊原因对方资料未公开,转向我的真爱一生', 'index.php?n=service');
        }
        if (empty($serverid)) {
            //service_visitor 某某会员浏览某某会员记录表
            $visitor = $_MooClass['MooMySQL']->getOne("SELECT vid FROM {$dbTablePre}service_visitor WHERE uid = '{$userid}' AND visitorid = '{$uid}'");
            //note 再次浏览的,更新浏览时间
            if ($visitor['vid']) {
                $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}service_visitor SET visitortime = '{$timestamp}' WHERE uid='{$userid}' AND visitorid = '{$uid}' limit 1");
            } else {
                $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}service_visitor SET uid = '{$userid}',visitorid='{$uid}',visitortime = '{$timestamp}'");
            }
            //MemoryCache('visitor', $userid.'行78, space/index.php');
            /*
            //===simulatereal
            if(MOOPHP_ALLOW_FASTDB){
            	$browsered = MooFastdbGet('members','uid',$uid);
            }else{
            	$sql="SELECT isOnline FROM {$dbTablePre}members where uid='$uid'";
                            $browsered=$_MooClass['MooMySQL']->getOne($sql);
            }
            */
            if (MooUserIsOnline($uid)) {
                $browser = $_MooClass['MooMySQL']->getOne("SELECT id FROM {$dbTablePre}service_browser WHERE uid = '{$userid}' AND browserid = '{$uid}'");
                //note 再次浏览的,更新浏览时间
                if ($browser['id']) {
                    $_MooClass['MooMySQL']->query("UPDATE {$dbTablePre}service_browser SET browsertime = '{$timestamp}' WHERE uid='{$userid}' AND browserid = '{$uid}' limit 1");
                } else {
                    $_MooClass['MooMySQL']->query("INSERT INTO {$dbTablePre}service_browser SET uid = '{$userid}',browserid='{$uid}',browsertime = '{$timestamp}'");
                }
            }
        }
    }
    //note 查看会员资料信息
    $c = MooGetData('members_choice', 'uid', $uid) + MooGetData('members_introduce', 'uid', $uid);
    $user =& $status;
    /***创建浏览队列 ***/
    if (empty($serverid) && !empty($userid)) {
        if ($user['gender'] != $user_arr['gender'] && $user['uid'] != $userid) {
            if ($user['usertype'] == 3 && $user_arr['usertype'] != 3 && $user['showinformation'] == 1 && $user_arr['s_cid'] >= 40) {
                $iscan = $GLOBALS['fastdb']->get($userid . '_scan_space');
                //浏览的全权会员列表
                $iscan = empty($iscan) ? array() : json_decode($iscan, true);
                if (!empty($iscan)) {
                    $iscan = in_array($uid, $iscan) ? $iscan : array_push($iscan, $uid);
                }
                $GLOBALS['fastdb']->set($userid . '_scan_space', json_encode($iscan));
            }
            if ($user['usertype'] != 3) {
                $scan_i = $GLOBALS['fastdb']->get('scan_space_' . $uid);
                //访问的记录列表
                $scan_i = empty($scan_i) ? array() : json_decode($scan_i, true);
                if (!empty($scan_i)) {
                    $scan_s = array();
                    foreach ($scan_i as $k => $scan) {
                        $scan_s[$k] = $scan[0];
                    }
                    if (in_array($userid, $scan_s)) {
                        $scan_i[array_search($userid, $scan_s)] = array($userid, time());
                    } else {
                        array_push($scan_i, array($userid, time()));
                    }
                } else {
                    array_push($scan_i, array($userid, time()));
                }
                $GLOBALS['fastdb']->set('scan_space_' . $uid, json_encode($scan_i));
            }
        }
    }
    //note_显示相册中的普通照片
    $user_pic = $_MooClass['MooMySQL']->getAll("SELECT imgurl,pic_date,pic_name FROM {$dbTablePre}pic WHERE syscheck=1 and isimage='0' and uid='{$uid}'");
    $gender = $user_arr['gender'] == '0' ? '1' : '0';
    //0为男,1为女
    $agebegin = date("Y") - $user_arr['birthyear'] - 3;
    $ageend = date("Y") - $user_arr['birthyear'] + 3;
    $workprovince = $user_arr['province'];
    $workcity = $user_arr['city'];
    $search_url = MOOPHP_URL . "/index.php?n=search&h=quick&gender=" . $gender . "&age_start=" . $agebegin . "&age_end=" . $ageend . "&workprovince=" . $workprovince . "&workcity=" . $workcity . "&isphoto=1&imageField=&quick_search=搜索";
    //note 您可能喜欢的人,匹配相同地区
    $able_like = $userid ? youAbleLike($l, 0) : array();
    //note 获取会员认证证件
    $usercer = certification($uid);
    //获取视频
    /* $sql = "select toshoot_video_time,toshoot_video_url from {$dbTablePre}certification where uid='{$uid}' and toshoot_video_check=2";
    	$get_video = $_MooClass ['MooMySQL']->getOne ( $sql );
    	$cs_path = videoPathEncrypt ( MOOPHP_URL . '/' . $get_video ['toshoot_video_url'] . '/mov_' . $uid . '.flv' ); */
    //获取录音
    /* $sql_voi = "select toshoot_voice_time,toshoot_voice_url from {$dbTablePre}certification where uid='{$uid}' and toshoot_voice_check=2";
    	$get_voice = $_MooClass ['MooMySQL']->getOne ( $sql_voi );
    	$voice_path = MOOPHP_URL . '/' . $get_voice ['toshoot_voice_url'] . '/voi_' . $uid . '.flv'; */
    //note 当查看其他个人主页时,当前浏览的主页条件是否匹配
    $user2 = false;
    if ($uid != "" && $uid != $user_arr['uid'] && $user['gender'] != $user_arr['gender']) {
        $c2 = MooGetData('members_choice', 'uid', $userid);
        $user2 = MooMembersData($userid);
    }
    $skin_style = $_MooClass['MooMySQL']->getAll("select * from {$dbTablePre}members_skin");
    $returnurl = 'index.php?' . $_SERVER['QUERY_STRING'];
    //返回的url
    //note 检查绑定是否过期
    if ($user['isbind'] == 1) {
        $user['isbind'] = check_bind($user['bind_id']);
    }
    if ($diamond) {
        $Template = MooTemplate('space_viewpro', 'data');
    } else {
        if (!empty($skinName)) {
            $Template = MooTemplate("public/space_{$skinName}", 'module');
        } elseif ($user['skin']) {
            $Template = MooTemplate("public/space_" . $user['skin'], 'module');
        } else {
            $Template = MooTemplate('public/space_viewpro', 'module');
        }
    }
    //模拟动作
    if (!empty($userid) && !empty($serverid) && $user['usertype'] == 1) {
        $urlArr = array("ajax.php?n=service&h=sendleer", "ajax.php?n=service&h=addLiker");
        $key = array_rand($urlArr);
        $url = $urlArr[$key];
    }
    //是否存在音乐
    if (in_array($user_arr['s_cid'], array(10, 20, 30))) {
        $isMusic = false;
        $sql = "select musicName from web_vipmusic where uid='{$uid}'";
        $music = $_MooClass['MooMySQL']->getOne($sql);
        if ($music['musicName']) {
            $music_url = "data/music/{$uid}/{$music['musicName']}";
            if (file_exists($music_url)) {
                $isMusic = true;
            }
        }
    }
    require $Template;
}