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
            $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) {