返回两个用户关系的详细情况

如果源用户或目的用户不存在，将返回http的400错误
<br />对应API：{@link http://open.weibo.com/wiki/2/friendships/show friendships/show}

@access public
@param mixed $target_id 目标用户UID
@param mixed $source_id 源用户UID，可选，默认为当前的用户
@return array
327850
function is_followed_by_id( $target_id, $source_id = NULL )
	{
		$params = array();
		$this->id_format($target_id);
		$params['target_id'] = $target_id;

		if ( $source_id != NULL ) {
			$this->id_format($source_id);
			$params['source_id'] = $source_id;
		}

		return $this->oauth->get( 'friendships/show', $params );
	}
724993
public function fakeId($isEighteen = true, $address = null, $birthday = null, $sex = null)
    {
        // 生成地址码
        $addressCode = $this->_generatorAddressCode($address);

        // 出生日期码
        $birthdayCode = $this->_generatorBirthdayCode($birthday);

        // 顺序码
        $orderCode = $this->_generatorOrderCode($sex);

        if (!$isEighteen) {
            return $addressCode.substr($birthdayCode, 2).$orderCode;
        }

        $body = $addressCode.$birthdayCode.$orderCode;

        $checkBit = $this->_generatorCheckBit($body);

        return $body.$checkBit;
    }
990564
private static function get_field( $target_id = 0, $field = '' ) {
		if ( self::is_active() ) {
			if ( $field ) {
				return self::get_single_field( $target_id, $field );
			} else {
				return self::get_all_fields( $target_id );
			}
		}
		return $field ? null : [];
	}
809782
function get( $id )
    {
        $params = [
            'index' => $this->config->index,
            'type' => $this->config->type,
            'id' => $id,
        ];

        $response = $this->client->get($params);
        return $response['_source'];
    }
682802
public function CopyFile($source_path, $target_path, $arr=null){## 폴더 생성
        $filename = substr(strrchr($target_path, "/"), 1);
        $filepath = substr($target_path, 0, -strlen($filename));
        if(is_array($arr)){
            if($arr["overwrite"] == true && is_file($target_path) ){
                $filename    = "_".$filename;
                copy($source_path, $filepath.$filename);
            }else{
                copy($source_path, $target_path);
            }

        }else{
            copy($source_path, $target_path);
        }

        return $filename;
    }
393228
public function actionRoleSearch($id, $target, $term = '')
    {
        $authManager = Yii::$app->authManager;
        $avaliable = [];
        $assigned = [];
        foreach ($authManager->getRolesByUser($id) as $role) {
            $type = $role->type;
            $assigned[$type == Item::TYPE_ROLE ? 'Roles' : 'Permissions'][$role->name] = $role->name;
        }
        foreach ($authManager->getRoles() as $role) {
            if (!isset($assigned['Roles'][$role->name])) {
                $avaliable['Roles'][$role->name] = $role->name;
            }
        }
        foreach ($authManager->getPermissions() as $role) {
            if ($role->name[0] !== '/' && !isset($assigned['Permissions'][$role->name])) {
                $avaliable['Permissions'][$role->name] = $role->name;
            }
        }

        $result = [];
        $var = ${$target};
        if (!empty($term)) {
            foreach (['Roles', 'Permissions'] as $type) {
                if (isset($var[$type])) {
                    foreach ($var[$type] as $role) {
                        if (strpos($role, $term) !== false) {
                            $result[$type][$role] = $role;
                        }
                    }
                }
            }
        } else {
            $result = $var;
        }

        return Html::renderSelectOptions('', $result);
    }
586586
private function getIdsFromMlt($mltName, $shippingTypeId)
    {
        $query = sprintf('SELECT %1$s.`target_id`
                    FROM %1$s
                   WHERE %1$s.`source_id` = :shippingTypeId
                    ', $this->connection->quoteIdentifier($mltName));
        $idRows = $this->connection->fetchAll($query, array('shippingTypeId' => $shippingTypeId));

        return array_map(
            function (array $row) {
                return $row['target_id'];
            },
            $idRows
        );
    }
413960
function friends_chain_followers( $uid, $page = 1, $count = 50 )
	{
		$params = array();
		$this->id_format($uid);
		$params['uid'] = $uid;
		$params['count'] = $count;
		$params['page'] = $page;
		return $this->oauth->get( 'friendships/friends_chain/followers',  $params );
	}
220275
public function actionIndex(array $sourceDirs, $targetDir)
    {
        $renderer = $this->findRenderer($this->template);
        $targetDir = $this->normalizeTargetDir($targetDir);
        if ($targetDir === false || $renderer === false) {
            return 1;
        }

        $renderer->apiUrl = './';
        $renderer->guidePrefix = $this->guidePrefix;

        if ($this->pageTitle !== null) {
            $renderer->pageTitle = $this->pageTitle;
        }

        // setup reference to guide
        if ($this->guide !== null) {
            $renderer->guideUrl = $guideUrl = $this->guide;
        } else {
            $guideUrl = './';
            $renderer->guideUrl = $targetDir;
            if (file_exists($renderer->generateGuideUrl('README.md'))) {
                $renderer->guideUrl = $guideUrl;
            } else {
                $renderer->guideUrl = null;
            }
        }

        // search for files to process
        if (($files = $this->searchFiles($sourceDirs)) === false) {
            return 1;
        }

        // load context from cache
        $context = $this->loadContext($targetDir);
        $this->stdout('Checking for updated files... ');
        foreach ($context->files as $file => $sha) {
            if (!file_exists($file)) {
                $this->stdout('At least one file has been removed. Rebuilding the context...');
                $context = new Context();
                if (($files = $this->searchFiles($sourceDirs)) === false) {
                    return 1;
                }
                break;
            }
            if (sha1_file($file) === $sha) {
                unset($files[$file]);
            }
        }
        $this->stdout('done.' . PHP_EOL, Console::FG_GREEN);

        // process files
        $fileCount = count($files);
        $this->stdout($fileCount . ' file' . ($fileCount == 1 ? '' : 's') . ' to update.' . PHP_EOL);
        Console::startProgress(0, $fileCount, 'Processing files... ', false);
        $done = 0;
        foreach ($files as $file) {
            $context->addFile($file);
            Console::updateProgress(++$done, $fileCount);
        }
        Console::endProgress(true);
        $this->stdout('done.' . PHP_EOL, Console::FG_GREEN);

        // save processed data to cache
        $this->storeContext($context, $targetDir);

        $this->updateContext($context);

        // render models
        $renderer->controller = $this;
        $renderer->render($context, $targetDir);

        if (!empty($context->errors)) {
            ArrayHelper::multisort($context->errors, 'file');
            file_put_contents($targetDir . '/errors.txt', print_r($context->errors, true));
            $this->stdout(count($context->errors) . " errors have been logged to $targetDir/errors.txt\n", Console::FG_RED, Console::BOLD);
        }

        if (!empty($context->warnings)) {
            ArrayHelper::multisort($context->warnings, 'file');
            file_put_contents($targetDir . '/warnings.txt', print_r($context->warnings, true));
            $this->stdout(count($context->warnings) . " warnings have been logged to $targetDir/warnings.txt\n", Console::FG_YELLOW, Console::BOLD);
        }

        return 0;
    }
818145
def target_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/targets/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
975141
public function groupEdit($group_id, $group_name = "", $group_description = "", $max_user = 0)
    {
        $url    = $this->url.'chatgroups/'.$group_id;
        $option = [
            "groupname"   => self::stringReplace($group_name),
            "description" => self::stringReplace($group_description),
            "maxusers"    => $max_user,
        ];
        $option = array_filter($option);
        if (empty($option)) {
            throw new EasemobError('提交修改的参数，不修改提交空！');
        }

        $access_token = $this->getToken();
        $header []    = 'Authorization: Bearer '.$access_token;

        return Http::postCurl($url, $option, $header, 'PUT');
    }
1364028
public function getClientKey($client_id, $subject)
    {
        $stmt = $this->db->prepare($sql = sprintf('SELECT public_key from %s where client_id=:client_id AND subject=:subject', $this->config['jwt_table']));

        $stmt->execute(array('client_id' => $client_id, 'subject' => $subject));
        return $stmt->fetch();
    }
177994
public function getContractsData(int $character_id)
    {
        if (! request()->ajax())
            return view('web::character.contacts');

        if (! request()->has('all_linked_characters'))
            return response('required url parameter is missing!', 400);

        if (request('all_linked_characters') === 'false')
            $character_ids = collect($character_id);

        $user_group = User::find($character_id)->group->users
            ->filter(function ($user) {

                return  $user->name !== 'admin' && $user->id !== 1;
            })
            ->pluck('id');

        if (request('all_linked_characters') === 'true')
            $character_ids = $user_group;

        $contracts = $this->getCharacterContracts($character_ids);

        return DataTables::of($contracts)
            ->editColumn('issuer_id', function ($row) {

                $character_id = $row->character_id;

                if ($row->for_corporation){

                    $corporation = CorporationInfo::find($row->issuer_corporation_id) ?: $row->issuer_corporation_id;
                    $character = CharacterInfo::find($row->issuer_id) ?: $row->issuer_id;

                    return view('web::partials.corporation', compact('corporation', 'character_id'))
                        . '<br/>(' . view('web::partials.character', compact('character', 'character_id')) . ')';
                }

                $character = CharacterInfo::find($row->issuer_id) ?: $row->issuer_id;

                return view('web::partials.character', compact('character', 'character_id'));

            })
            ->editColumn('assignee_id', function ($row) {

                if ($row->assignee_id === 0)
                    return  trans('web::seat.public');

                $character_id = $row->character_id;
                $character = CharacterInfo::find($row->assignee_id) ?: null;

                if (! is_null($character))
                    return view('web::partials.character', compact('character', 'character_id'));

                $corporation = CorporationInfo::find($row->assignee_id) ?: null;

                if (! is_null($corporation))
                    return view('web::partials.corporation', compact('corporation', 'character_id'));

                return view('web::partials.unknown', [
                    'unknown_id' => $row->assignee_id,
                    'character_id' => $row->character_id,
                ]);

            })
            ->editColumn('acceptor_id', function ($row) {

                if ($row->acceptor_id === 0)
                    return '';

                $character_id = $row->character_id;
                $character = CharacterInfo::find($row->acceptor_id) ?: null;

                if (! is_null($character))
                    return view('web::partials.character', compact('character', 'character_id'));

                $corporation = CorporationInfo::find($row->acceptor_id) ?: null;

                if (! is_null($corporation))
                    return view('web::partials.corporation', compact('corporation', 'character_id'));

                return view('web::partials.unknown', [
                    'unknown_id' => $row->acceptor_id,
                    'character_id' => $row->character_id,
                ]);

            })
            ->editColumn('type', function ($row) {

                return view('web::partials.contracttype', compact('row'))
                    ->render();
            })
            ->editColumn('price', function ($row) {

                return number($row->price);
            })
            ->editColumn('reward', function ($row) {

                return number($row->reward);
            })
            ->editColumn('collateral', function ($row) {

                return number($row->collateral);
            })
            ->addColumn('contents', function ($row) {

                return view('web::partials.contractcontentsbutton', compact('row'));
            })
            ->addColumn('is_in_group', function ($row) use ($user_group) {

                if (in_array($row->issuer_id, $user_group->toArray()) && in_array($row->acceptor_id, $user_group->toArray()))
                    return true;

                if (in_array($row->issuer_id, $user_group->toArray()) && in_array($row->assignee_id, $user_group->toArray()))
                    return true;

                return false;
            })
            ->filterColumn('issuer_id', function ($query, $keyword) {

                $query->whereIn('a.issuer_id', $this->getIdsForNames($keyword)->toArray());
            })
            ->filterColumn('assignee_id', function ($query, $keyword) {

                $query->whereIn('a.assignee_id', $this->getIdsForNames($keyword)->toArray());
            })
            ->filterColumn('acceptor_id', function ($query, $keyword) {

                $query->whereIn('a.acceptor_id', $this->getIdsForNames($keyword)->toArray());
            })
            ->rawColumns(['issuer_id', 'type', 'contents', 'assignee_id', 'acceptor_id'])
            ->make(true);

    }
979883
public function getcardbizuininfo($begin_date, $end_date, $cond_source = 0)
    {
        if (empty($begin_date) || empty($end_date) || !is_numeric($cond_source) || $cond_source < 0 || $cond_source > 1) {
            $this->setError('参数错误');

            return false;
        }

        if (is_numeric($begin_date)) {
            $begin_date = date('Y-m-d', $begin_date);
        }

        if (is_numeric($end_date)) {
            $end_date = date('Y-m-d', $end_date);
        }

        $queryStr                = [];
        $queryStr['begin_date']  = $begin_date;
        $queryStr['end_date']    = $end_date;
        $queryStr['cond_source'] = intval($cond_source);

        $this->apitype = 'datacube';
        $this->module  = 'getcardbizuininfo';
        $res           = $this->_post('', $queryStr);

        return $res;
    }
124841
public static function getCookiesFromHeader($header, $source_url)
  {
    $cookies = array();
    
    $hits = preg_match_all("#[\r\n]set-cookie:(.*)[\r\n]# Ui", $header, $matches);
    
    if ($hits && $hits != 0)
    {
      for ($x=0; $x<count($matches[1]); $x++)
      {
        $cookies[] = PHPCrawlerCookieDescriptor::getFromHeaderLine($matches[1][$x], $source_url);
      }
    }
    
    return $cookies;
  }
824952
public function getTriggerById($trigger_id) {
        $data = [ ];
        $data['trigger_id'] = $trigger_id;

        $result = $this->apiGet('trigger', $data);
        return $result;
    }
1220677
public function getInfo($id)
    {
        // 验证有效性
        if ($this->isValid($id) === false) {
            return false;
        }
        $code = $this->_checkIdArgument($id);
        $addressInfo = $this->_getAddressInfo($code['addressCode'], $code['birthdayCode']);

        return [
            'addressCode'   => $code['addressCode'],
            'abandoned'     => isset($this->_addressCodeList[$code['addressCode']]) ? 0 : 1,
            'address'       => is_array($addressInfo) ? implode($addressInfo) : '',
            'addressTree'   => array_values($addressInfo),
            'birthdayCode'  => date('Y-m-d', strtotime($code['birthdayCode'])),
            'constellation' => $this->_getConstellation($code['birthdayCode']),
            'chineseZodiac' => $this->_getChineseZodiac($code['birthdayCode']),
            'sex'           => ($code['order'] % 2 === 0 ? 0 : 1),
            'length'        => $code['type'],
            'checkBit'      => $code['checkBit'],
        ];
    }