Esempio n. 1
0
                $this->errorOutput(FAIL_OP);
            }
        }
        //更新搜索
        $this->teamApi->update_search($team_id, 'team');
        $this->addItem($result);
        $this->output();
    }
    /**
	 * 小组数据批量审核
	 */
    public function audit()
    {
        $team_ids = $this->validate_data();
        $team_info = $this->team->team_by_id($team_ids, 0);
        $no_audit_id = array();
        $team_type = array();
        $team_category = array();
        foreach ($team_info as $v) {
            $no_audit_id[] = $v['team_id'];
            $team_type[$v['team_type']][] = $v;
            $team_category[$v['team_category']][] = $v;
        }
        if ($no_audit_id) {
            $no_audit_ids = implode(',', $no_audit_id);
            $result = $this->team->update(array('state' => 1), $no_audit_ids);
            if ($result) {
                //更新搜索
                $this->teamApi->update_search($no_audit_ids, 'team');
                $option = new option();
                //发送通知
                $send_arr = array();
                $send_con = array();
                foreach ($team_info as $v) {
                    $send_con['from_id'] = 0;
                    $send_con['to_id'] = $v['creater_id'];
                    $send_con['content'] = '您申请的"' . $v['team_name'] . '"小组已通过审核!';
                    $send_con['page_link'] = 'team.php?team_id=' . $v['team_id'];
                    $send_con['link_text'] = '点击查看';
                    $send_arr[] = $send_con;
                    $data = array('user_id' => $v['creater_id'], 'source' => 'team', 'source_id' => $v['team_id'], 'action' => 'attention');
                    $option_info = $option->get_relation($data);
                    if ($option_info['total'] == 0) {
                        $option->add_relation($v['creater_id'], 'team', $v['team_id'], 'attention');
                        $this->team->update(array('attention_num' => 1), $v['team_id'], true);
                    }
                }
                if ($send_arr) {
                    $this->notify->notify_send(json_encode($send_arr), 0);
                }
            }
        } else {
            $result = true;
        }
        if ($team_type) {
            //更新小组类型下小组数目
            foreach ($team_type as $k => $v) {
                $this->team->update_team_type($k, intval(count($v)));
            }
        }
Esempio n. 2
0
    public function get_one_apply($apply_id)
    {
        $sql = 'SELECT * FROM ' . DB_PREFIX . 'apply_action WHERE a_id = ' . $apply_id . ' AND status = 1';
        $result = $this->db->query_first($sql);
        return $result;
    }
    /**
	 * 获取申请活动召集者总数
	 * @param String $where
	 */
    public function get_apply_count($where = '')
    {
        $sql = 'SELECT COUNT(a_id) AS total FROM ' . DB_PREFIX . 'apply_action WHERE status = 1';
        if ($where) {
            $sql = $sql . ' AND ' . $where;
        }
        $info = $this->db->query_first($sql);
        return $info;
    }
    /**
	 * 获取某个小组的公告
	 * @param Int $team_id
	 * @param Int $offset
	 * @param Int $count
	 */
    public function get_notice_by_team($team_id, $offset, $count)
    {
        $data_limit = ' LIMIT ' . $offset . ' , ' . $count;
        $sql = 'SELECT * FROM ' . DB_PREFIX . 'team_announcement WHERE team_id = ' . $team_id;
        $sql .= ' ORDER BY pub_time DESC';
        $sql .= $data_limit;
        $query = $this->db->query($sql);
Esempio n. 3
0
    }
    /**
	 * 检测是否申请过行动召集者
	 */
    public function is_apply()
    {
        $team_id = intval($this->input['team_id']);
        $team_info = $this->team->detail($team_id, 1);
        if (!$team_info['team_id']) {
            $this->errorOutput(TEAM_NO_EXISTS);
        }
        $user_id = intval($this->user['user_id']);
        $result = $this->team->is_apply($team_id, $user_id);
        $this->addItem($result);
        $this->output();
    }
    /**
	 * 检查小组名称是否存在
	 */
    public function check_team_name()
    {
        $name = trim(urldecode($this->input['team_name']));
        if (empty($name)) {
            $this->errorOutput(PARAM_WRONG);
        }
        $result = $this->team->check_team_name($name);
        $this->addItem($result);
Esempio n. 4
0
            $result['avatar'] = $member_info[0][$user_id]['avatar'];
            $result['user_name'] = $member_info[0][$user_id]['nick_name'];
        } elseif ($type == 0) {
            $result = $this->team->quit_black_list($data);
        }
        $this->addItem($result);
        $this->output();
    }
    /**
	 * (加入|退出)关注
	 */
    public function attention_op()
    {
        $team_id = intval($this->input['team_id']);
        //检测对应的小组是否存在
        $team_info = $this->team->detail($team_id, 1);
        if (!$team_info) {
            $this->errorOutput(TEAM_NO_EXISTS);
        }
        $type = isset($this->input['op_type']) ? intval($this->input['op_type']) : -1;
        $user_id = intval($this->user['user_id']);
        if ($type < 0) {
            $this->errorOutput(PARAM_WRONG);
        }
        $option = new option();
        $data = array('user_id' => $user_id, 'source' => 'team', 'source_id' => $team_id, 'action' => 'attention');
        $out = $option->get_relation($data);
        $result = array('team_id' => $team_id);
        if ($type == 1) {
            if ($out['state'] == 0) {
                $option->add_relation($user_id, 'team', $team_id, 'attention');
                $this->team->update(array('attention_num' => 1), $team_id, true);
                //更新搜索
                $this->teamApi->update_search($team_id, 'team');
                $result['num'] = $team_info['attention_num'] + 1;
            }
        }
        if ($type == 0) {
            if ($out['state'] > 0) {