Ejemplo n.º 1
0
 public function delete($cid, $source)
 {
     $info = array('cid' => $cid, 'source' => $source);
     if (empty($info['cid']) && $info['source']) {
         return false;
     }
     $sql = "DELETE FROM " . DB_PREFIX . "visit WHERE cid IN(" . $info['cid'] . ") AND source='" . $info['source'] . "'";
     $this->db->query($sql);
     $sql = "DELETE FROM " . DB_PREFIX . "visit_queue WHERE cid IN(" . $info['cid'] . ") AND source='" . $info['source'] . "'";
     $this->db->query($sql);
     switch ($info['source']) {
         case 'user':
             include_once ROOT_PATH . 'lib/class/member.class.php';
             $obj_member = new member();
             $obj_member->add_visit($info['cid'], -1);
             break;
         case 'action':
             include_once ROOT_PATH . 'lib/class/activity.class.php';
             $obj_activity = new activityCLass();
             $obj_activity->updateAddData(array('scan_num' => -1, 'action_id' => $info['cid']));
             break;
         case 'team':
             include_once ROOT_PATH . 'lib/class/team.class.php';
             $obj_team = new team();
             $obj_team->update_total(array('visit_num' => -1, 'team_id' => $info['cid']));
             break;
         case 'topic':
             include_once ROOT_PATH . 'lib/class/team.class.php';
             $obj_team = new team();
             $obj_team->update_topic_views(array('view_num' => -1, 'topic_id' => $info['cid']));
             break;
         default:
             break;
     }
     return true;
 }
Ejemplo n.º 2
0
 public function show($cond)
 {
     $sql = "SELECT * FROM " . DB_PREFIX . "recommend WHERE 1 " . $cond;
     $q = $this->db->query($sql);
     $info = array();
     $id_array = array();
     while ($row = $this->db->fetch_array($q)) {
         $id_array[$row['source']][] = $row['cid'];
         $info[] = $row;
     }
     //	hg_pre($id_array);
     $user = array();
     if (!empty($id_array['user'])) {
         include_once ROOT_PATH . 'lib/class/member.class.php';
         $obj_member = new member();
         $data = $obj_member->getMemberById(implode(',', $id_array['user']));
         $user = $data[0];
         //	hg_pre($user);
     }
     $action = array();
     if (!empty($id_array['action'])) {
         include_once ROOT_PATH . 'lib/class/activity.class.php';
         $obj_activity = new activityCLass();
         $data = $obj_activity->show(implode(',', $id_array['action']));
         $action = $data['data'];
         $team_id = $space = '';
         foreach ($action as $k => $v) {
             $team_id .= $space . $v['team_id'];
             $space = ',';
         }
         if ($team_id) {
             include_once ROOT_PATH . 'lib/class/team.class.php';
             $obj_team = new team();
             $team_tmp = $obj_team->get_team_by_id($team_id);
             $team_tmp = $team_tmp[0];
             foreach ($action as $k => $v) {
                 $action[$k]['team_name'] = $team_tmp[$v['team_id']]['team_name'];
             }
         }
     }
     $team = array();
     if (!empty($id_array['team'])) {
         include_once ROOT_PATH . 'lib/class/team.class.php';
         $obj_team = new team();
         $data = $obj_team->get_team_by_id(implode(',', $id_array['team']));
         $team = $data[0];
     }
     $topic = array();
     if (!empty($id_array['topic'])) {
         include_once ROOT_PATH . 'lib/class/team.class.php';
         $obj_team = new team();
         $data = $obj_team->get_topic_by_id(implode(',', $id_array['topic']));
         $topic = $data[0];
     }
     $sql = "SELECT * FROM " . DB_PREFIX . "column WHERE 1";
     $q = $this->db->query($sql);
     $column = array();
     while ($row = $this->db->fetch_array($q)) {
         $column[$row['id']] = $row['name'];
     }
     $ret = array();
     foreach ($info as $k => $v) {
         $tmp = ${$v}['source'];
         $ret[$k] = array('id' => $v['id'], 'cid' => $v['cid'], 'title' => $v['title'], 'source' => $v['source'], 'column_id' => $column[$v['column_id']], 'pubtime' => $v['pubtime'], 'data' => $tmp[$v['cid']]);
     }
     return $ret;
 }
Ejemplo n.º 3
0
            $mark = new mark();
            $markData = array('source' => 'topic', 'source_id' => $topic_ids, 'state' => $state, 'type_state' => 'team');
            $mark->update_mark_state($markData);
            if ($state == 0) {
                //删除话题搜索
                $this->teamApi->delete_search($topic_ids, 'topic');
            } elseif ($state == 1) {
                //插入话题搜索
                $this->teamApi->add_search($topic_ids, 'topic');
            }
            //删除话题
            $this->topic->update(array('state' => $state, 'type_state' => 'team'), $topic_ids);
        }
    }
    /**
	 * 删除小组所有信息
	 * @param String $ids
	 */
    public function real_del()
    {
        $team_ids = trim(urldecode($this->input['team_id']));
        //删除小组的关注
        $option = new option();
        $attenData = array('source' => 'team', 'source_id' => $team_ids, 'action' => 'attention');
        $option->delete($attenData);
        //删除小组的标签
        $mark = new mark();
        $markData = array('source' => 'team', 'source_id' => $team_ids, 'action' => 'team_tag');
        $mark->delete_source_id_mark($markData);
        //删除小组的主题标签
        $themeMarkData = array('source' => 'team', 'source_id' => $team_ids, 'action' => 'team_theme');
        $mark->delete_source_id_mark($themeMarkData);
        //删除小组下的行动召集者
        $this->team->del_apply($team_ids);
        //删除小组下的黑名单
Ejemplo n.º 4
0
 public function import()
 {
     $source = $this->input["source"] ? trim($this->input["source"]) : 'user';
     switch ($source) {
         case 'user':
             require_once ROOT_PATH . 'lib/class/member.class.php';
             $obj_member = new member();
             $ret = $obj_member->show(-1);
             if (!empty($ret)) {
                 $sql = "DELETE FROM " . DB_PREFIX . "search_queue WHERE source='" . $source . "'";
                 $this->db->query($sql);
                 $sql = "INSERT IGNORE INTO " . DB_PREFIX . "search_queue(cid,source,state) VALUES";
                 $space = "";
                 foreach ($ret as $v) {
                     $sql .= $space . "(" . $v['id'] . ",'" . $source . "',0)";
                     $space = ',';
                 }
                 $this->db->query($sql);
                 echo "用户完成插入队列";
             } else {
                 echo "暂无用户数据";
             }
             break;
         case 'team':
             require_once ROOT_PATH . 'lib/class/team.class.php';
             $obj_team = new team();
             $ret = $obj_team->show(-1);
             if (!empty($ret)) {
                 $sql = "DELETE FROM " . DB_PREFIX . "search_queue WHERE source='" . $source . "'";
                 $this->db->query($sql);
                 $sql = "INSERT IGNORE INTO " . DB_PREFIX . "search_queue(cid,source,state) VALUES";
                 $space = "";
                 foreach ($ret as $v) {
                     $sql .= $space . "(" . $v['team_id'] . ",'" . $source . "',0)";
                     $space = ',';
                 }
                 $this->db->query($sql);
                 echo "小组完成插入队列";
             } else {
                 echo "暂无小组数据";
             }
             break;
         case 'action':
             require_once ROOT_PATH . 'lib/class/activity.class.php';
             $obj_activity = new activityCLass();
             $ret_tmp = $obj_activity->show_all();
             $ret = $ret_tmp['data'];
             if (!empty($ret)) {
                 $sql = "DELETE FROM " . DB_PREFIX . "search_queue WHERE source='" . $source . "'";
                 $this->db->query($sql);
                 $sql = "INSERT IGNORE INTO " . DB_PREFIX . "search_queue(cid,source,state) VALUES";
                 $space = "";
                 foreach ($ret as $v) {
                     $sql .= $space . "(" . $v['action_id'] . ",'" . $source . "',0)";
                     $space = ',';
                 }
                 $this->db->query($sql);
                 echo "行动完成插入队列";
             } else {
                 echo "暂无行动数据";
             }
             break;
         case 'topic':
             require_once ROOT_PATH . 'lib/class/team.class.php';
             $obj_team = new team();
             $ret = $obj_team->show_topic(-1);
             if (!empty($ret)) {
                 $sql = "DELETE FROM " . DB_PREFIX . "search_queue WHERE source='" . $source . "'";
                 $this->db->query($sql);
                 $sql = "INSERT IGNORE INTO " . DB_PREFIX . "search_queue(cid,source,state) VALUES";
                 $space = "";
                 foreach ($ret as $v) {
                     $sql .= $space . "(" . $v['topic_id'] . ",'" . $source . "',0)";
                     $space = ',';
                 }
                 $this->db->query($sql);
                 echo "讨论完成插入队列";
             } else {
                 echo "暂无讨论数据";
             }
             break;
         default:
             break;
     }
 }