Ejemplo n.º 1
0
 public function RevokeQuestion($Question, $Update = 1)
 {
     //获取问题内容
     $QuestionInfo = $this->GetComplain($Question['QuestionId'], "id,description,status,sync,comment,author");
     //如果获取到问题
     if ($QuestionInfo['id']) {
         $oMenCache = new Base_Cache_Memcache("Complaint");
         $Setting = $oMenCache->get('setting');
         //如果投诉单已经同步到投诉
         if ($QuestionInfo['sync'] == 1) {
             //如果问题状态未初始创建 或者 开关允许任何状态撤销
             if ($QuestionInfo['status'] == 0 || $Setting['complainSwitch']) {
                 //解包备注字段
                 $Comment = unserialize($QuestionInfo['comment']);
                 //备注内容加入撤销信息
                 $time = time();
                 $Comment['revoke'] = array('rtime' => $time, 'revokeReason' => $Question['RevokeReason'], 'ip' => $Question['IP']);
                 //更新投诉记录的状态
                 $UpdateArr = array('status' => 2, 'rtime' => $time, 'comment' => serialize($Comment));
                 //如果需要更新
                 if ($Update) {
                     $updateComplain = $this->updateComplain($QuestionInfo['id'], $UpdateArr);
                 } else {
                     $updateComplain = 1;
                 }
                 //如果更新成功
                 if ($updateComplain) {
                     //从搜索引擎删除数据
                     base_common::delete_search('c_' . $QuestionInfo['id']);
                     //推送信息到投诉
                     $CommonConfig = (require dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/CommonConfig/commonConfig.php");
                     $data = "scid=" . $QuestionInfo['id'] . "&uid=" . urlencode($QuestionInfo['author']) . "&ip=" . $Question['IP'] . "&revokeTime=" . $time . "&revokeReason=" . urlencode($Question['RevokeReason']) . "&sign=" . $CommonConfig['COMPLAIN_SIGN'];
                     $Revoke = base_common::do_post($this->config->ComplainRevokeUrl, $data);
                     $RevokeArr = json_decode($Revoke, true);
                     //如果推送到投诉失败
                     if ($RevokeArr['return'] != 1) {
                         //记入重试队列
                         $RevokeQueue = array('scid' => $QuestionInfo['id'], 'uid' => $Question['UserName'], 'ip' => $Question['IP'], 'revokeTime' => $time, 'revokeReason' => $Question['RevokeReason']);
                         $this->addRevokeQueue($RevokeQueue);
                     }
                     return true;
                 } else {
                     return false;
                 }
             } else {
                 return false;
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
 }