当前位置: 首页>>代码示例>>PHP>>正文


PHP option::add_relation方法代码示例

本文整理汇总了PHP中option::add_relation方法的典型用法代码示例。如果您正苦于以下问题:PHP option::add_relation方法的具体用法?PHP option::add_relation怎么用?PHP option::add_relation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在option的用法示例。


在下文中一共展示了option::add_relation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的option::add_relation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。