Пример #1
0
function send_message($qid, $author_id, $author, $title = '')
{
    header("content-type:text/html;charset=utf-8");
    if (extension_loaded('mbstring')) {
        if (mb_strlen($title, 'UTF-8') > 10) {
            $title = mb_substr($title, 0, 10, 'UTF-8') . '...';
        }
    } else {
        $title = cutstr($title, 20, '...');
    }
    try {
        $client = new SoapClient("http://message.5173.com/Service/SiteMessageWebService.asmx?wsdl");
        $header = new SoapHeader('http://5173.com/', 'SiteMessageSoapHead', array('DomainName' => 'scadmin.5173.com', 'UserId' => 'scadmin', 'Password' => 'scadmin'));
        $client->__setSoapHeaders($header);
        $params = array('siteMessage' => array('PolicyId' => 'KfScadmin', 'ReceiverId' => $author_id, 'ReceiverName' => $author, 'SenderId' => '5173.com', 'SenderName' => '5173.com', 'RelatedId' => '5173.com', 'RelatedType' => 'Bk.Core.Imp.OrderExtended', 'ReceiverType' => 'User', 'MsgLinkParams' => array('http://' . config::FRONT_DOMAIN . '/index.php?question/detail/' . $qid), 'MsgListTitleParams' => array($title), 'OperationLinkParams' => array('http://' . config::FRONT_DOMAIN . '/index.php?question/detail/' . $qid), 'PolicyTitleParams' => null, 'MsgContentParams' => null), 'sync' => false);
        $client->__soapCall("SendSiteMessage", array('parameters' => $params));
    } catch (SoapFault $ex) {
        send_AIC('http://scadmin.5173.com', '发送站内信异常', 1, '站内信接口');
        exit('1');
    }
}
Пример #2
0
 function onhandle_zwquestion_edit()
 {
     $hasHandleAnsweAttachDeletePrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "handleAttachDelete");
     !$hasHandleAnsweAttachDeletePrivilege['return'] && exit('3');
     $zq_title = isset($this->post['zq_title']) ? htmlspecialchars($this->post['zq_title']) : '';
     $zw_id = isset($this->post['zw_id']) ? intval($this->post['zw_id']) : 0;
     if ($zw_id != 0) {
         $q_arr = $_ENV['question']->Get($zw_id);
         if ($q_arr['id']) {
             $questionInfo = array('description' => $zq_title);
             $update = $_ENV['question']->updateQuestion($zw_id, $questionInfo);
             if ($update) {
                 //更新Solr服务器
                 $q_info = $_ENV['question']->Get_Search_Data($zw_id);
                 if (!empty($q_info)) {
                     if ($q_info['hidden'] == 1) {
                         unset($q_info['hidden']);
                         try {
                             $this->set_search($q_info);
                         } catch (Exception $e) {
                             send_AIC('http://scadmin.5173.com/index.php?admin_question/handle_zwquestion_edit.html', '搜索服务器异常', 1, '搜索接口');
                         }
                     } else {
                         $this->delete_search($q_info['id']);
                     }
                 }
                 $str = '';
                 if ($zq_title != '') {
                     $str .= $this->ask_login_name . '编辑了子问题标题,由【' . $q_arr['description'] . '】修改为【' . $zq_title . '】;';
                 }
                 $this->sys_admin_log($zw_id, $this->ask_login_name, $str, 9);
                 //系统操作日志
                 exit('1');
             }
         } else {
             exit('0');
         }
     } else {
         exit('0');
     }
 }
Пример #3
0
 function ontransformLogView_accept()
 {
     $TransformLogId = intval($this->post['TransformLogId']);
     $AcceptResult = intval($this->post['AcceptResult']);
     $AcceptResult = in_array($AcceptResult, array(1, 2)) ? $AcceptResult : 1;
     $AcceptReason = trim($this->post['AcceptReason']);
     $AcceptComplainTransformLogPrivilege = $_ENV['menu']->checkPermission($this->ask_login_name, $_SERVER['QUERY_STRING'], "acceptTransformLog");
     if ($AcceptComplainTransformLogPrivilege['return'] == 1) {
         $LogInfo = $_ENV['question']->getTransformLogById($TransformLogId);
         if ($LogInfo['TransformLogId'] > 0) {
             if (intval($LogInfo['transform_status']) == 0) {
                 if ($AcceptResult == 1) {
                     $comment = unserialize($LogInfo['comment']);
                     $modify = $_ENV['question']->modifyQuestionCid($LogInfo['from_id'], $comment['CidArr'], $LogInfo['ApplyOperator'], $this->setting["askSuggestTransComplain"], $comment['TransformReason'], 1);
                     // 更新成功
                     if ($modify['result'] == 1 || $modify['result'] == 7) {
                         //转换到投诉
                         $convert = $_ENV['question']->convertQuestionToComplain($LogInfo['from_id'], $modify['from_type'], $modify['to_type'], $LogInfo['ApplyOperator'], $comment['TransformReason']);
                         if ($convert > 0) {
                             $message = $this->ask_login_name . "同意 " . $LogInfo['ApplyOperator'] . "将问题" . $LogInfo['from_id'] . "改为投诉,关联投诉单号:" . $convert . "理由为:" . $AcceptReason;
                             $log = $this->sys_admin_log($LogInfo['from_id'], $this->ask_login_name, $message, 5);
                             //系统操作日志
                             $comment['AcceptReason'] = $AcceptReason;
                             $logInfo = array('acceptTime' => time(), "AcceptOperator" => $this->ask_login_name, "transform_status" => 1, "comment" => serialize($comment), "to_id" => $convert);
                             $_ENV['question']->updateTransformLog($TransformLogId, $logInfo);
                             $complainInfo = $_ENV['complain']->get_ComplainInfo($convert);
                             // 增加新的纪录到 搜索服务器
                             if (isset($complainInfo['id'])) {
                                 $q_search['id'] = 'c_' . $complainInfo['id'];
                                 $q_search['title'] = $complainInfo['description'];
                                 $q_search['description'] = $complainInfo['description'];
                                 $q_search['tag'] = json_encode(array(), true);
                                 $q_search['question_type'] = 'complain';
                                 $q_search['time'] = $complainInfo['time'];
                                 $q_search['atime'] = 0;
                                 // 从搜索服务器上删除咨询或建议问题
                                 $this->delete_search($LogInfo['from_id']);
                                 if ($complainInfo['public'] == 0) {
                                     try {
                                         $this->set_search($q_search);
                                     } catch (Exception $e) {
                                         send_AIC('http://scadmin.5173.com/control/admin/question/convertQuestionToComplain.html', '咨询建议转投诉,添加到搜索服务器异常', 1, '搜索接口');
                                     }
                                 } else {
                                     $this->delete_search('c_' . $complainInfo['id']);
                                 }
                             }
                             $_ENV['question']->rebuildQuestionDetail($LogInfo['from_id'], "question");
                             $_ENV['question']->rebuildQuestionDetail($complainInfo['id'], "complain");
                             $return = array('return' => 1, 'comment' => "已通过");
                         } else {
                             $return = array('return' => 0, 'comment' => "审批失败");
                         }
                     } else {
                         $return = array('return' => $modify['result'], 'comment' => $modify['comment']);
                     }
                 } else {
                     $comment = unserialize($LogInfo['comment']);
                     $comment['AcceptReason'] = $AcceptReason;
                     $logInfo = array('acceptTime' => time(), "AcceptOperator" => $this->ask_login_name, "transform_status" => 2, "comment" => serialize($comment));
                     $update = $_ENV['question']->updateTransformLog($TransformLogId, $logInfo);
                     if ($update) {
                         $message = $this->ask_login_name . "拒绝 " . $LogInfo['ApplyOperator'] . "将问题" . $LogInfo['from_id'] . "改为投诉,理由为:" . $AcceptReason;
                         $log = $this->sys_admin_log($LogInfo['from_id'], $this->ask_login_name, $message, 5);
                         //系统操作日志
                         $return = array('return' => 1, 'comment' => "已拒绝");
                     } else {
                         $return = array('return' => 0, 'comment' => "审批失败");
                     }
                 }
             } elseif (intval($LogInfo['transform_status']) == 1) {
                 $return = array('return' => 0, 'comment' => "此单已经转换完毕,无需重复审核,审核人:" . $LogInfo['AcceptOperator']);
             } elseif (intval($LogInfo['transform_status']) == 2) {
                 $return = array('return' => 0, 'comment' => "此单已被拒绝,审核人:" . $LogInfo['AcceptOperator']);
             }
         } else {
             $return = array('return' => 0, 'comment' => "无此申请记录");
         }
     } else {
         $return = array('return' => 0, 'comment' => $AcceptComplainTransformLogPrivilege['comment']);
     }
     echo json_encode($return);
 }
Пример #4
0
 function transformAskSuggest($complainInfo, $qid, $transform, $to_type, $loginId, $reason)
 {
     $questionInfo = $this->Get($qid);
     if (isset($questionInfo['id'])) {
         $this->pdo->begin();
         // 如果追问要转换的类型和父问题不一致,追问变主问题
         if ($questionInfo['pid'] > 0) {
             $parentQuestionInfo = $this->Get($questionInfo['pid']);
             if ($parentQuestionInfo['cid'] != $complainInfo['cid']) {
                 $updateQuestionNum1 = $this->Update($questionInfo['id'], array('pid' => 0));
             } else {
                 $updateQuestionNum1 = 1;
             }
         } else {
             $updateQuestionNum1 = 1;
         }
         $complainComment = unserialize($complainInfo['comment']);
         $complainComment['convert'] = array('to_type' => $to_type, 'to_id' => $qid, 'transformTime' => $_SERVER['REQUEST_TIME'], 'loginId' => $loginId, 'reason' => $reason);
         // 隐藏该投诉问题,更新comment字段
         $updateComplainInfo = array('comment' => serialize($complainComment), 'public' => 1, 'sync' => 1);
         $updateComplainNum = $_ENV['complain']->Update($complainInfo['id'], $updateComplainInfo);
         $questionInfo['comment']['order_id'] = $complainInfo['order_id'];
         $questionComment = unserialize($questionInfo['comment']);
         $questionComment['convert'] = array('from_type' => 'complain', 'from_id' => $complainInfo['id']);
         $dataArr = array('cid' => $complainInfo['cid'], 'cid1' => 0, 'cid2' => 0, 'cid3' => 0, 'cid4' => 0, 'status' => 1, 'display_h' => 0, 'qtype' => $complainInfo['qtype'], 'comment' => serialize($questionComment), 'is_hawb' => 0, 'js_kf' => '', 'receive_time' => 0);
         $updateQuestionNum2 = $this->Update($qid, $dataArr);
         // 显示转后问题,更新comment字段
         $TransformLogId = $this->insertTransformLog($transform);
         // 记录转换日志
         $_ENV['help']->Update($qid, array('display' => 0));
         // 显示协助处理单
         if ($updateComplainNum > 0 && $updateQuestionNum2 > 0 && $TransformLogId > 0 && $updateQuestionNum1 > 0) {
             $table_name = $this->base->getDbTable($this->table_answer);
             $this->pdo->delete($table_name, '`qid` = ?', $qid);
             $this->pdo->commit();
             // 该问题的接手客服在不忙碌就直接分给他,否则重新分单
             $result = $this->ApplyToOperator($qid, $questionInfo['js_kf']);
             //增加一条记录到搜索服务器
             $q_search['id'] = $questionInfo['id'];
             $q_search['title'] = $questionInfo['description'];
             $q_search['description'] = $questionInfo['description'];
             $q_search['tag'] = json_encode(array(), true);
             $q_search['time'] = $questionInfo['time'];
             $q_search['atime'] = 0;
             try {
                 $this->set_search($q_search);
                 // 从搜索服务器上该删除投诉记录
                 $this->delete_search('c_' . $complainInfo['id']);
             } catch (Exception $e) {
                 send_AIC('http://sc.5173.com/model/question.class.php/transformAskSuggest', '投诉转咨询建议搜索服务器添加失败', 1, '搜索接口');
             }
             return true;
         } else {
             $this->pdo->rollBack();
             return false;
         }
     } else {
         return false;
         // 问题不存在
     }
 }
Пример #5
0
             $_ENV['question']->rebuildQuestionDetail($post['qid'], "complain");
             $_ENV['question']->rebuildQuestionDetail($result, "question");
             $return = array('msg' => 'success', 'return' => 1);
             $base->delete_search('c_' . $post['qid']);
             $QuestionInfo = $_ENV['question']->Get($result);
             $q_search['id'] = $QuestionInfo['id'];
             $q_search['title'] = $QuestionInfo['description'];
             $q_search['description'] = $QuestionInfo['description'];
             $q_search['tag'] = json_encode(array(), true);
             $q_search['time'] = 0;
             $q_search['atime'] = 0;
             if ($QuestionInfo['hidden'] == 1) {
                 try {
                     $base->set_search($q_search);
                 } catch (Exception $e) {
                     send_AIC('http://sc.5173.com/model/complain.class.php/complainQuestionTransform', '投诉转咨询建议搜索服务器添加失败', 1, '搜索接口');
                 }
             }
             break;
     }
     exit(json_encode($return));
 } else {
     if ($post['act'] == 'orderPost') {
         $qtype = intval($post['qtype']);
         $author = trim($post['author']);
         $orderId = trim($post['orderid']);
         $qtype <= 0 && exit(json_encode(array('msg' => '非法参数qtype', 'return' => 0)));
         empty($author) &&  exit(json_encode(array('msg' => 'author为空', 'return' => 0)));
         empty($orderId) &&  exit(json_encode(array('msg' => 'orderId为空', 'return' => 0)));
         $result = $_ENV['question']->getBaoXianOrderPost($post);
         if ($result == 1) {
Пример #6
0
$db = new db(DB_HOST, DB_USER, DB_PW, DB_NAME, DB_CHARSET, DB_CONNECT);
$memcache = new CacheMemcache();
$setting = $memcache->load('setting');
$ts_warn_maxNum = isset($setting['ts_warn_maxNum']) ? $setting['ts_warn_maxNum'] : 3;
// 投诉同步失败报警最大数量,默认3
$ts_warn_num = isset($setting['ts_warn_num']) ? $setting['ts_warn_num'] : 0;
// 投诉同步失败报警阈值:
$ts_warn_time = isset($setting['ts_warn_time']) ? $setting['ts_warn_time'] : 0;
// 投诉同步失败报警时间间隔 ,不填就是 所有
if ($ts_warn_time != 0) {
    $timeRang = time() - $ts_warn_time;
    $where .= " AND time > {$timeRang}";
}
$sql = "SELECT count(id) FROM ask_complain WHERE sync <= -{$ts_warn_num} {$where}";
$num = $db->result_first($sql);
echo $sql . '<br>ts_warn_maxNum = ' . $setting['ts_warn_maxNum'] . '<br>' . 'ts_warn_time = ' . $setting['ts_warn_time'] . '<br>' . 'ts_warn_num = ' . $setting['ts_warn_num'] . '<br>';
if (!empty($num)) {
    if ($num >= $ts_warn_maxNum) {
        if ($ts_warn_time != 0) {
            $warm_message = "{$ts_warn_time} 秒内 投诉失败数量:{$num} 报警";
            send_AIC('http://scadmin.5173.com/api/sync_data.php', $warm_message, 1, '同步进程报警');
        } else {
            $warm_message = "投诉失败数量:{$num} 报警";
        }
    } else {
        $warm_message = 'ok';
    }
} else {
    $warm_message = 'ok';
}
echo $warm_message;
Пример #7
0
 function onsuggest()
 {
     $question_type = "suggest";
     $question_type_list = $this->ask_config->getQuestionType();
     $title = "服务中心-我要" . $question_type_list[$question_type];
     $all_num = $_ENV['question']->total_question();
     $qtypeId = isset($this->get[2]) ? intval($this->get[2]) : (isset($this->post['qtypeId']) ? intval($this->post['qtypeId']) : 0);
     $loginName = $this->ask_front_name;
     $allQtype = $_ENV['qtype']->GetAllQType(1, "", 0);
     if (!isset($allQtype[$qtypeId])) {
         header("Location: http://sc.5173.com/index.php?question/ask_skip.html");
     }
     $subList = $_ENV['qtype']->GetSubList($qtypeId);
     if (!empty($subList)) {
         header("Location: http://sc.5173.com/index.php?question/subList/suggest/{$qtypeId}.html");
     }
     $qtypeName = $allQtype[$qtypeId];
     $operatorInfo = '';
     // 获取我的专属客服
     if ($this->ask_front_name == '游客') {
         $selfAuthor_where = '';
         // 获取专属客服条件
     } else {
         $t_cid = $_ENV['question']->getType(3);
         $operatorInfo = $_ENV['operator']->getMySelfAuthor($this->ask_front_name);
         $selfAuthor_where = $_ENV['question']->front_selfAuthor_where($operatorInfo['login_name'], '', 1, $t_cid);
     }
     if ($selfAuthor_where) {
         $selfAuthorNum = $_ENV['question']->front_mySelfAuthorNum($selfAuthor_where);
     } else {
         $selfAuthorNum = 0;
     }
     $url = '';
     if ($qtypeName['pid'] > 0) {
         $url = '<a href="http://sc.5173.com/index.php?question/subList/suggest/' . $qtypeName['pid'] . '.html">选择' . $allQtype[$qtypeName['pid']]['name'] . '类' . $question_type_list[$question_type] . '</a>&nbsp;&nbsp;&gt;&nbsp;&nbsp';
     }
     //未登陆跳转地址
     $login_url = "http://" . config::FRONT_LOGIN_DOMAIN . "/?returnUrl=" . urlencode(curPageURL());
     $display_yzm = false;
     if ($this->ask_front_name != '游客') {
         $contact = $this->cache->get(md5('SJ' . $this->ask_front_id));
         if (false === $contact) {
             $contact = get_mobile($this->ask_front_id);
             if (!empty($contact)) {
                 $this->cache->set(md5('SJ' . $this->ask_front_id), $contact, 1800);
             }
             //缓存30分钟
         }
         if (!empty($contact)) {
             $en_contact = substr_replace($contact, '****', 3, 4);
         }
     }
     $suggest_title = isset($this->post['title']) ? htmlspecialchars(trim($this->post['title'])) : '';
     $description = isset($this->post['description']) && $this->post['description'] != "我们非常重视您的" . $question_type_list[$question_type] . ",请在这里告诉我们" ? htmlspecialchars(trim($this->post['description'])) : '';
     $contact_num = isset($this->post['contact_num']) ? htmlspecialchars($this->post['contact_num']) : (isset($en_contact) ? $en_contact : '');
     $J_code = isset($this->post['J_code']) ? strtolower(htmlspecialchars($this->post['J_code'])) : '';
     if ($this->ask_front_name == '游客') {
         $author = isset($this->post['author']) && $this->post['author'] != '请输入5173用户名' ? trim($this->post['author']) : '';
         $author_id = '';
     } else {
         $author_id = $this->ask_front_id;
         $author = $this->ask_front_name;
     }
     $t_yzm = tcookie('yzm');
     if (empty($t_yzm)) {
         tcookie('yzm', time(), 1800);
         //存放半个小时
     } else {
         $over_time = time() - $t_yzm;
         //距离现在的秒数
         if ($over_time < 1800) {
             $display_yzm = true;
         } else {
             tcookie('yzm', '', time() - 3600);
             //删除
         }
     }
     if ($this->ask_front_name != '游客') {
         $display_yzm = false;
     }
     //登陆用户不显示验证码
     if (isset($this->post['contact'])) {
         $comment['contact'] = $this->post['contact'];
     } else {
         $comment['contact']['mobile'] = isset($en_contact) ? $en_contact : '';
     }
     $flag = 0;
     if (isset($this->post['act'])) {
         if (isset($this->post['contact'])) {
             $comment['contact'] = $this->post['contact'];
             if ($comment['contact']['mobile'] != "") {
                 if (isset($en_contact) && $comment['contact']['mobile'] == $en_contact) {
                     $comment['contact']['mobile'] = $contact;
                 }
                 if (!checkmobile($comment['contact']['mobile'])) {
                     $errorMsg['mobile'] = '手机号';
                     unset($comment['contact']['mobile']);
                 } else {
                     $flag++;
                 }
             } else {
                 $errorMsg['mobile'] = '手机号';
                 unset($comment['contact']['mobile']);
             }
             if ($comment['contact']['qq'] != "") {
                 if (!isQQ($comment['contact']['qq'])) {
                     //$errorMsg['qq'] = 'QQ号';
                     unset($comment['contact']['qq']);
                 } else {
                     //$flag++;
                 }
             } else {
                 //$errorMsg['qq'] = 'QQ号';
                 unset($comment['contact']['qq']);
             }
             if ($comment['contact']['weixin'] != '') {
                 if (strlen($comment['contact']['weixin']) > 20 || strlen($comment['contact']['weixin']) < 4 || trim($comment['contact']['weixin']) == "微信号") {
                     //$errorMsg['weixin'] = '微信号';
                     unset($comment['contact']['weixin']);
                 } else {
                     //$flag++;
                 }
             } else {
                 //$errorMsg['weixin'] = '微信号';
                 unset($comment['contact']['weixin']);
             }
         }
         if ($flag == 0 && count($errorMsg) > 0) {
             $error = implode("、", $errorMsg) . "未填写或格式不正确";
             $comment['contact'] = $this->post['contact'];
             @(include template('suggest'));
             echo "<script>alert('" . $error . "');</script>";
             exit;
         }
         if ($description == '') {
             $comment['contact'] = $this->post['contact'];
             @(include template('suggest'));
             echo "<script>alert('建议内容不能为空。');</script>";
             exit;
         } elseif (mb_strlen($description, 'UTF-8') > 500 || mb_strlen($description, 'UTF-8') < 5) {
             $comment['contact'] = $this->post['contact'];
             @(include template('suggest'));
             echo "<script>alert('建议内容请保持在5-500个字内。');</script>";
             exit;
         }
         if ($this->ask_front_name == '游客') {
             if ($author == "" || mb_strlen($author, 'UTF-8') > 20) {
                 @(include template('suggest'));
                 echo "<script>alert('请输正确格式的5173登陆用户名');</script>";
                 exit;
             }
             if ($J_code == "" || $J_code != $_SESSION['code']) {
                 $comment['contact'] = $this->post['contact'];
                 @(include template('suggest'));
                 echo "<script>alert('验证码不正确!');</script>";
                 exit;
             }
         }
         //提问数限制
         $limit_question_num = intval($this->setting['limit_question_num']);
         if (!empty($limit_question_num)) {
             $comment['contact'] = $this->post['contact'];
             $num_ip = $_ENV['question']->get_num_by_ip(getip());
             if ($num_ip >= $limit_question_num) {
                 @(include template('suggest'));
                 echo "<script>alert('您的操作太频繁啦,让服务器休息一下,稍后再进行建议!');</script>";
                 exit;
             }
         }
         //IP黑名单
         $BlackList = explode("|", $this->setting['IpBlackList']);
         if (in_array(getip(), $BlackList)) {
             $comment['contact'] = $this->post['contact'];
             @(include template('suggest'));
             echo "<script>alert('您的操作太频繁啦,让服务器休息一下,稍后再建议!');</script>";
             exit;
         }
         if ($this->ask_front_name != '游客') {
             //登录提问
             $GagLog = $_ENV['user']->getGag($this->ask_front_name);
             if (count($GagLog) > 0) {
                 $comment['contact'] = $this->post['contact'];
                 @(include template('suggest'));
                 echo "<script>alert('很抱歉,您的帐号已被管理员禁言处理,请您自觉遵守5173言论规则。');</script>";
                 exit;
             }
         }
         $description = cutstr(strip_tags($description), 500, '');
         if (md5(trim(strip_tags($description))) == $_COOKIE['last_suggest']) {
             @(include template('suggest'));
             echo "<script>alert('亲,问题提交一次就OK,不用重复提交哦!');</script>";
             exit;
         }
         $img_path = $this->post['imgpath'];
         $img_path = stripcslashes($img_path);
         $img_path = str_replace('"small_pic"', ',"small_pic"', $img_path);
         $img_path = str_replace('"big_pic"', ',"big_pic"', $img_path);
         $p1 = strpos($img_path, "big_pic");
         $path = substr($img_path, $p1 + 10, strlen($img_path) - $p1 - 10 - 2);
         $path = str_replace('\\/', '/', $path);
         $attach = trim($path);
         if (isset($en_contact) && $comment['contact']['mobile'] == $en_contact) {
             $comment['contact']['mobile'] = $contact;
         }
         $cid = $_ENV['question']->getType(2);
         //建议分类id
         $cid = !empty($cid) ? intval($cid) : 0;
         $cid1Info = $_ENV['category']->getByQType($qtypeId, $cid);
         //qtype对应分类id
         $cid1 = intval($cid1Info['id']);
         $time = time();
         $trimDescription = preg_replace('/\\s+/', '', $description);
         $description = $this->keyWordCheck($trimDescription);
         $BrowerInfo = userBrowerInfo();
         $comment['OS'] = $BrowerInfo['OS'];
         $comment['Browser'] = $BrowerInfo['Browser'];
         $questionInfo = array("qtype" => $qtypeId, "author" => $author, "author_id" => $author_id, "title" => $suggest_title, "description" => $description, "attach" => $attach, "time" => $time, "ip" => getip(), "cid" => $cid, "cid1" => $cid1, "comment" => serialize($comment));
         $question_id = $_ENV['question']->insertQuestion($questionInfo);
         //更新Solr服务器
         $q_search = array();
         if ($question_id > 0) {
             setcookie('last_suggest', md5(trim(strip_tags($description))), time() + 3600);
             if ($this->ask_front_name == '游客') {
                 get_que_id('jy', $question_id);
                 //建议id写入cookie
             }
             $date = date("Y-m-d");
             $_ENV['question']->modifyUserQtypeNum($date, $qtypeId, 'suggest', 1);
             $login_name = trim($this->post['login_name']);
             if (!empty($login_name)) {
                 if ($this->setting['selfServiceFirst'] == 1) {
                     $Apply = $_ENV['question']->ApplyToOperator($question_id, $login_name);
                 }
             }
             $q_search['id'] = $question_id;
             $q_search['title'] = $description;
             $q_search['description'] = $description;
             $q_search['tag'] = json_encode(array(), true);
             $q_search['time'] = $time;
             $q_search['atime'] = 0;
             try {
                 $this->set_search($q_search);
             } catch (Exception $e) {
                 send_AIC('http://sc.5173.com/index.php?question/suggest.html', '搜索服务器异常', 1, '搜索接口');
             }
         }
         header("Location: " . url('question/suggest_success/' . $question_id . '/' . $time, true));
     }
     $telDisplay = $this->setting['telDisplay'];
     $xnDisplay = $this->setting['xnDisplay'];
     $qqDisplay = $this->setting['qqDisplay'];
     $_ENV['question']->PageView(1, getip());
     @(include template('suggest'));
 }
Пример #8
0
 function send_SMS($author_id)
 {
     $msg_switch_off = $this->db->result_first("SELECT v FROM " . DB_TABLEPRE . "setting WHERE k='msg_switch_off'");
     if ($msg_switch_off == 1) {
         $m_url = "http://usercenter.5173esb.com/service/GetUserBindMobileForSc?UserId=" . $author_id;
         $m_rs = topen($m_url);
         $m_result = base64_decode($m_rs);
         if (!empty($m_result)) {
             $key = "KFYTH";
             $clientIP = $_SERVER["SERVER_ADDR"];
             $category = "7028";
             $mobile = $m_result;
             $msg_content = $this->db->result_first("SELECT v FROM " . DB_TABLEPRE . "setting WHERE k='msg_content'");
             $content = urlencode($msg_content);
             $sign = md5($key . $clientIP);
             $url = vsprintf("http://mobile.5173.com/MobileAPI/SendSingleMessage?m_sign=%s&m_clientIP=%s&category=%s&mobile=%s&content=%s", array($sign, $clientIP, $category, $mobile, $content));
             $rs = topen($url);
             $result = json_decode($rs, true);
             if ($result['ResultNo'] != 0) {
                 send_AIC('http://scadmin.5173.com', $result['ResultDescription'], 1, '手机短信接口');
             }
         }
     }
 }
Пример #9
0
 function insertComplainAnswer($data)
 {
     $result = array();
     $complainAnswerTable = $this->getDbTable($this->table_answer);
     foreach ($data as $v) {
         $v = taddslashes($v);
         $dataArr = array('qid' => $v['scid'], 'csn' => $v['csn'], 'content' => $v['content'], 'time' => $v['atime'], 'contact' => $v['contact']);
         $insert = $this->pdo->insert($complainAnswerTable, $dataArr);
         if ($insert) {
             $complainInfo = $this->Get($dataArr['qid']);
             if ($complainInfo['public'] == 0) {
                 $q_search['id'] = 'c_' . $complainInfo['id'];
                 $q_search['title'] = $complainInfo['description'];
                 $q_search['description'] = $complainInfo['description'];
                 $q_search['tag'] = json_encode(array(), true);
                 $q_search['question_type'] = 'complain';
                 $q_search['time'] = $complainInfo['time'];
                 $q_search['atime'] = $dataArr['time'];
                 try {
                     $this->set_search($q_search);
                 } catch (Exception $e) {
                     send_AIC('http://sc.5173.com/crontab/scComplainSync.php "operation=ComplainAnswerToSc&syncNum=20', '同步complain站点回答问题,更新到solr服务器失败', 1, '搜索接口');
                 }
             } else {
                 $this->delete_search('c_' . $complainInfo['id']);
             }
             return $insert;
         } else {
             return false;
         }
     }
 }