當前位置: 首頁>>代碼示例>>PHP>>正文


PHP option::get_relation方法代碼示例

本文整理匯總了PHP中option::get_relation方法的典型用法代碼示例。如果您正苦於以下問題:PHP option::get_relation方法的具體用法?PHP option::get_relation怎麽用?PHP option::get_relation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在option的用法示例。


在下文中一共展示了option::get_relation方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: audit

                $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)));
            }
        }
開發者ID:h3len,項目名稱:Project,代碼行數:60,代碼來源:team_update.php

示例2: attention_op

            $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) {
開發者ID:h3len,項目名稱:Project,代碼行數:39,代碼來源:team_update.php

示例3: get_one_apply

    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);
開發者ID:h3len,項目名稱:Project,代碼行數:32,代碼來源:team.class.php

示例4: is_apply

    }
    /**
	 * 檢測是否申請過行動召集者
	 */
    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);
開發者ID:h3len,項目名稱:Project,代碼行數:27,代碼來源:team.php


注:本文中的option::get_relation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。