$condition = array(); if ($op == 'add') { $condition[$action] = 1; } elseif ($op == 'reduction') { $condition[$action] = 0; } $result = $this->topic->update($condition, $topic_id); $this->addItem($result); $this->output(); } /** * (删除|屏蔽)话题 */ public function delete() { $topic_id = isset($this->input['topic_id']) ? intval($this->input['topic_id']) : -1; if ($topic_id < 0) { $this->errorOutput(PARAM_WRONG); } $topic_info = $this->topic->detail($topic_id, 1); if (!$topic_info) { $this->errorOutput(TEAM_NO_TOPIC); } $action = trim(urldecode($this->input['action'])); if (empty($action)) { $action = 'drop'; } $condition = array(); if ($action == 'drop') { $condition['state'] = 0; } elseif ($action == 'hidden') { $condition['state'] = -1; } //删除话题回复 $this->topic->update_reply($condition, '', $topic_id); //删除附件 $this->topic->update_topic_material($topic_id, 0); //删除视频 $this->topic->update_topic_video($topic_id, 0); //删除赞 $option = new option(); $favorData = array('source' => 'topic', 'action' => 'favor', 'source_id' => $topic_id, 'state' => 0); $option->updateState($favorData); //删除标签 $mark = new mark(); $markData = array('source' => 'topic', 'source_id' => $topic_id, 'state' => 0);
//删除小组下的行动召集者 $this->team->update_apply(array('status' => $state), '', $team_ids); //删除小组下的黑名单 $this->team->update_blacklist(array('status' => $state), '', $team_ids); //删除申请的小组信息 $this->team->update_team_apply(array('status' => $state), '', $team_ids); //删除小组下的话题 $this->setTopicState($team_ids, $state); //删除小组下的行动 $action = new activityCLass(); $actionData = array('team_id' => $team_ids, 'type' => 'team', 'state' => $state); $action->updateDeleteState($actionData); } //逻辑删除还原话题数据 private function setTopicState($team_ids, $state) { $topic_ids = $this->topic->get_topic_ids($team_ids, true); //获取未删除的话题数据 if ($topic_ids) { //删除话题下的回复数据 $rids = $this->topic->get_reply_ids($topic_ids); //获取未删除的回复数据 if ($rids && is_array($rids)) { $this->topic->update_reply(array('state' => $state, 'type_state' => 'team'), implode(',', $rids)); } //删除附件 $this->topic->update_topic_material(array('state' => $state, 'type_state' => 'team'), '', $topic_ids); //删除视频 $this->topic->update_topic_video(array('state' => $state, 'type_state' => 'team'), '', $topic_ids); //删除赞 $option = new option(); $favorData = array('source' => 'topic', 'action' => 'favor', 'source_id' => $topic_ids, 'state' => $state, 'type_state' => 'team'); $option->updateState($favorData); //删除标签
$materialData = array( 'user_id' => $reply_info['poster_id'], 'user_name' => $reply_info['poster_name'], 'topic_id' => $reply_info['topic_id'], 'team_id' => $topic_info['source_id'], 'reply_id' => 0, ); if(is_array($img_info) && !empty($img_info)) { $materialNum = $this->topic->add_material($img_info, $materialData); //插入附件 //更新话题下的附件个数 $this->topic->update(array('material_num' => $materialNum), $reply_info['topic_id'], true); } } //视频修改 if (isset($this->input['video_url']) && !$reply_info['reply_user_id']) { $video_url = trim(urldecode($this->input['video_url'])); $video_info = $this->teamApi->show_video($reply_info['topic_id'], 'topic'); if ($video_url != $video_info['url']) { $video->update_video($video_info['id'], $video_url, 'topic', $reply_info['topic_id']); } } //标签修改 if (isset($this->input['topic_mark']) && !$reply_info['reply_user_id']) { $topic_mark = trim(urldecode($this->input['topic_mark'])); include_once ROOT_PATH . 'lib/class/mark.class.php'; $mark = new mark(); $data = array( 'source' => 'topic', 'source_id' => $reply_info['topic_id'], 'parent_id' => $topic_info['source_id'], 'action' => 'topic_tag',