Beispiel #1
0
 public function answer_force_fold_action()
 {
     if (!$this->user_info['permission']['is_moderator'] and !$this->user_info['permission']['is_administortar']) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你没有权限进行此操作')));
     }
     $answer_info = $this->model('answer')->get_answer_by_id($_POST['answer_id']);
     if (!$answer_info) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('回复不存在')));
     }
     if (!$answer_info['force_fold']) {
         $this->model('answer')->update_answer_by_id($_POST['answer_id'], array('force_fold' => 1));
         if (!$this->model('integral')->fetch_log($answer_info['uid'], 'ANSWER_FOLD_' . $answer_info['answer_id'])) {
             ACTION_LOG::set_fold_action_history($answer_info['answer_id'], 1);
             $this->model('integral')->process($answer_info['uid'], 'ANSWER_FOLD_' . $answer_info['answer_id'], get_setting('integral_system_config_answer_fold'), AWS_APP::lang()->_t('回复折叠') . ' #' . $answer_info['answer_id']);
         }
         H::ajax_json_output(AWS_APP::RSM(array('action' => 'fold'), 1, AWS_APP::lang()->_t('强制折叠回复')));
     } else {
         $this->model('answer')->update_answer_by_id($_POST['answer_id'], array('force_fold' => 0));
         H::ajax_json_output(AWS_APP::RSM(array('action' => 'unfold'), 1, AWS_APP::lang()->_t('撤销折叠回复')));
     }
 }
Beispiel #2
0
 public function user_rate($type, $answer_id, $uid, $user_name)
 {
     switch ($type) {
         default:
             return false;
             break;
         case 'thanks':
         case 'uninterested':
             break;
     }
     if ($user_rated = $this->user_rated($type, $answer_id, $uid)) {
         if ($type == 'thanks') {
             return true;
         }
         $this->delete('answer_' . $type, 'uid = ' . intval($uid) . ' AND answer_id = ' . intval($answer_id));
     } else {
         $this->insert('answer_' . $type, array('uid' => $uid, 'answer_id' => $answer_id, 'user_name' => $user_name, 'time' => time()));
     }
     $this->update_user_rate_count($type, $answer_id);
     $answer_info = $this->get_answer_by_id($answer_id);
     if ($type == 'thanks') {
         $this->model('integral')->process($uid, 'ANSWER_THANKS', get_setting('integral_system_config_thanks'), '感谢回复 #' . $answer_info['answer_id'], $answer_info['answer_id']);
         $this->model('integral')->process($answer_info['uid'], 'THANKS_ANSWER', -get_setting('integral_system_config_thanks'), '回复被感谢 #' . $answer_info['answer_id'], $answer_info['answer_id']);
     } else {
         if ($answer_info['uninterested_count'] >= get_setting('uninterested_fold')) {
             if (!$this->model('integral')->fetch_log($answer_info['uid'], 'ANSWER_FOLD_' . $answer_info['answer_id'])) {
                 ACTION_LOG::set_fold_action_history($answer_info['answer_id'], 1);
                 $this->model('integral')->process($answer_info['uid'], 'ANSWER_FOLD_' . $answer_info['answer_id'], get_setting('integral_system_config_answer_fold'), '回复折叠 #' . $answer_info['answer_id']);
             }
         }
     }
     $this->model('account')->update_thanks_count($answer_info['uid']);
     return !$user_rated;
 }