Esempio n. 1
0
        if ($team_id < 0) {
            $this->errorOutput(PARAM_WRONG);
        }
        $team_info = $this->team->detail($team_id, 1);
        if (!$team_info['team_id']) {
            $this->errorOutput(PARAM_WRONG);
        }
        $user_ids = trim(urldecode($this->input['user_id']));
        $apply_users = $this->team->is_apply_user($team_id, $user_ids);
        if ($apply_users) {
            foreach ($apply_users as $v) {
                $this->addItem($v);
            }
        }
        $this->output();
    }
    /**
	 * 获取关注小组的用户
Esempio n. 2
0
        $this->output();
    }
    /**
	 * 设置小组信息操作
	 */
    public function setting()
    {
        $team_id = intval($this->input['team_id']);
        //检测对应的小组是否存在
        $team_info = $this->team->detail($team_id, 1);
        if (!$team_info) {
            $this->errorOutput(TEAM_NO_EXISTS);
        }
        if ($team_info['creater_id'] != $this->user['user_id']) {
            $this->errorOutput(NO_PERMISSION);
        }
        $data = $this->filter_data();
        $verify_data = array();
        //检测小组类型是否存在
        if (isset($data['team_type']) && $data['team_type']) {
            $result_type = $this->team->check_team_type($data['team_type']);
            if (!$result_type) {
                $this->errorOutput(PARAM_WRONG);
            }
            $verify_data['team_type'] = $data['team_type'];
        }
        if ($team_info['team_category'] != $data['team_category']) {
            //检测小组分类是否存在
            $result_category = $this->team->check_team_category($data['team_category']);
            if (!$result_category) {
                $this->errorOutput(PARAM_WRONG);
            }
            $verify_data['team_category'] = $data['team_category'];
        }
        if ($team_info['team_name'] != $data['team_name']) {
            //检测更新的小组名称是否存在
            $result_name = $this->team->check_team_name($data['team_name'], $team_id);
            if ($result_name) {
                $this->errorOutput(TEAM_EXISTS);
            }
            $verify_data['team_name'] = $data['team_name'];
        }
        if ($team_info['introduction'] != $data['introduction']) {
            $verify_data['introduction'] = $data['introduction'];
        }
        if (isset($data['team_logo']) && $data['team_logo']) {
            $verify_data['team_logo'] = $data['team_logo'];
        }
        if (isset($data['notice'])) {
            if ($team_info['notice'] != $data['notice']) {
                $verify_data['notice'] = $data['notice'];
            }
        }
        $verify_data['update_time'] = TIMENOW;
        $result = $this->team->update($verify_data, $team_id);
        //标签更新
        if ($team_info['tags'] != $data['tags']) {
            $team_mark = $data['tags'];
        }
        if (isset($team_mark) && $result) {
            $mark = new mark();
            $data = array('source' => 'team', 'source_id' => $team_id, 'parent_id' => $team_id, 'action' => 'team_tag', 'user_id' => $team_info['creater_id']);
            if ($team_mark) {
                $data['name'] = $team_mark;
            }
            $result_mark = $mark->update_source_id_mark($data);
            if ($result_mark) {
                $this->team->update(array('tags' => $team_mark), $team_id);
            } else {
                $this->errorOutput(FAIL_OP);
            }
        }
        if ($verify_data['notice'] && $result) {
            //获取关注小组的用户信息
            $option = new option();
            $member = $option->members('team', $team_id, 'attention', 0, -1);
            //发送通知
            $send_arr = array();
            if ($member['data']['attention']) {
                $send_con = array();
                foreach ($member['data']['attention']['infos'] as $v) {
                    $send_con['from_id'] = 0;
                    $send_con['to_id'] = $v['user_id'];
                    $send_con['content'] = '您关注的"' . $team_info['team_name'] . '小组"有新公告!';
                    $send_con['page_link'] = 'team.php?team_id=' . $team_id;
                    $send_con['link_text'] = '点击查看';
                    $send_arr[] = $send_con;
                }
            }
            if ($send_arr) {
                $this->notify->notify_send(json_encode($send_arr), 0);
            }
        }
        //更新搜索