Invite a staff.

@param string $account
@param string $wechatId

@return mixed
972427
public function invite(string $account, string $wechatId)
    {
        $params = [
            'kf_account' => $account,
            'invite_wx' => $wechatId,
        ];

        return $this->httpPostJson('customservice/kfaccount/inviteworker', $params);
    }
1139983
public function addConnectToken($account = null, $params = array())
    {
        $params = $this->checkFilterParams($params, array(
            'callback_url',
            'email',
            'first_name',
            'last_name',
            'source_callback_url',
            'source_expunge_on_deleted_flag',
            'source_sync_all_folders',
            'source_sync_folders',
            'source_raw_file_list',
            'status_callback_url'
        ), array('callback_url'));
        if ($params === false) {
            throw new \InvalidArgumentException("params array contains invalid parameters or misses required parameters");
        }

        return $this->lastRequest->post(
            $account,
            'connect_tokens',
            $params,
            null,
            array('Content-Type: application/x-www-form-urlencoded')
        );
    }
667230
def invite_user(self, email, role):
        
        parameters = {
            'email': email,
            'role': role
        }

        connection = Connection(self.token)
        connection.set_url(self.production, self.TEAM_USERS_URL)
        connection.add_params(parameters)

        return connection.post_request()
620979
public function sendPreview($account,$title,$summary,$content,$photoid,$srcurl='') {
		$send_snoopy = new Snoopy;
		$submit = "https://mp.weixin.qq.com/cgi-bin/operate_appmsg?sub=preview&t=ajax-appmsg-preview";
		$send_snoopy->set_submit_normal();
		$send_snoopy->rawheaders['Cookie']= $this->cookie;
		$send_snoopy->referer = 'https://mp.weixin.qq.com/cgi-bin/operate_appmsg?sub=edit&t=wxm-appmsgs-edit-new&type=10&subtype=3&lang=zh_CN';
		$post = array(
				'AppMsgId'=>'',
				'ajax'=>1,
				'content0'=>$content,
				'count'=>1,
				'digest0'=>$summary,
				'error'=>'false',
				'fileid0'=>$photoid,
				'preusername'=>$account,
				'sourceurl0'=>$srcurl,
				'title0'=>$title,
		);
		$post['token'] = $this->_token;
		$send_snoopy->submit($submit,$post);
		$tmp = $send_snoopy->results;
		$this->log('sendpreview:'.$tmp);
		$json = json_decode($tmp,true);
		return $json;
	}
789845
public function send()
    {
        $this->logger->debug('Send template message', $this->request);

        if (!$this->request['template_id']) {
            return $this->err('缺少模板编号', -2);
        }

        if (!$this->request['touser']) {
            return $this->err('缺少用户OpenID', -3);
        }

        $account = wei()->wechatAccount->getCurrentAccount();
        $api = $account->createApiService();
        if ($account->isService()) {
            return $this->sendServiceTemplate($account, $api);
        } else {
            return $this->sendWxaTemplate($account, $api);
        }
    }
177770
public function getSaldo(SEPAAccount $account)
    {
        $dialog = $this->getDialog();
        $dialog->syncDialog();
        $dialog->initDialog();

        switch ((int) $dialog->getHksalMaxVersion()) {
            case 4:
            case 5:
                $hksalAccount = new Deg(
                    $account->getAccountNumber(),
                    $account->getSubAccount(),
                    static::DEFAULT_COUNTRY_CODE, $account->getBlz()
                );
                $hksalAccount->addDataElement($account->getAccountNumber());
                $hksalAccount->addDataElement($account->getSubAccount());
                $hksalAccount->addDataElement(static::DEFAULT_COUNTRY_CODE);
                $hksalAccount->addDataElement($account->getBlz());
                break;
            case 6:
                $hksalAccount = new Ktv(
                    $account->getAccountNumber(),
                    $account->getSubAccount(),
                    new Kik(280, $account->getBlz())
                );
                break;
            case 7:
                $hksalAccount = new Kti(
                    $account->getIban(),
                    $account->getBic(),
                    $account->getAccountNumber(),
                    $account->getSubAccount(),
                    new Kik(280, $account->getBlz())
                );
                break;
            default:
                throw new \Exception('Unsupported HKSAL version: ' . $dialog->getHksalMaxVersion());
        }

        $message = new Message(
            $this->bankCode,
            $this->username,
            $this->pin,
            $dialog->getSystemId(),
            $dialog->getDialogId(),
            $dialog->getMessageNumber(),
            array(
                new HKSAL($dialog->getHksalMaxVersion(), 3, $hksalAccount, HKSAL::ALL_ACCOUNTS_N)
            ),
            array(
                AbstractMessage::OPT_PINTAN_MECH => $dialog->getSupportedPinTanMechanisms()
            )
        );

        $response = $dialog->sendMessage($message);
        $response = new GetSaldo($response->rawResponse);

        return $response->getSaldoModel();
    }
709717
public function setWechat(Wechat $wechat)
    {
        Yii::$app->session->set(self::SESSION_MANAGE_WECHAT_KEY, $wechat->id);
        $this->_wechat = $wechat;
    }
893024
public function createComponentApiService()
    {
        $api = wei()->wechatComponentApi;

        // 如果未设置appSecret,认为是未初始化
        if (!$api->getAppSecret()) {
            // 获取第三方平台的appId(允许指定某个应用使用特定的第三方平台)
            $account = wei()->wechatAccount()->cache()->findOrInit(['applicationId' => $api->getAppId()]);
            $api->setOption([
                'appSecret' => $account['applicationSecret'],
                'verifyTicket' => $account['verifyTicket'],
            ]);
        }

        return $api;
    }
752200
public function deleteKFAccount($account)
    {
        if (!$this->access_token && !$this->getAccessToken()) {
            return false;
        }
        $result = Tools::httpGet(self::API_BASE_URL_PREFIX . self::CS_KF_ACCOUNT_DEL_URL . "access_token={$this->access_token}" . '&kf_account=' . $account);
        if ($result) {
            $json = json_decode($result, true);
            if (empty($json) || !empty($json['errcode'])) {
                $this->errCode = isset($json['errcode']) ? $json['errcode'] : '505';
                $this->errMsg = isset($json['errmsg']) ? $json['errmsg'] : '无法解析接口返回内容！';
                return $this->checkRetry(__FUNCTION__, func_get_args());
            }
            return $json;
        }
        return false;
    }
369219
public function inviteNewUser($email, $roles)
    {
        $user = static::firstOrCreate(compact('email'));
        $user->assignRole($roles);

        /** @var Invitation $invites */
        $invites = app(Invitation::class);
        $invites->generateToken($user->id);

        Detail::firstOrCreate([
            'user_id'      => $user->id,
            'display_name' => $email,
        ]);

        return $user;
    }
173798
public function setAccountAvatar($accountName, $avatarPath)
    {
        $result = $this->wechat->httpPost(self::WECHAT_ACCOUNT_AVATAR_SET_PREFIX, [
            'media' => $this->wechat->uploadFile($avatarPath)
        ], [
            'access_token' => $this->wechat->getAccessToken(),
            'kf_account' => $accountName
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'ok';
    }
871816
public function multiAccountImportAsync($accounts, AsyncCallback $callback = null)
    {
        $request = new MultiAccountImportRequest($accounts);
        $response = new MultiAccountImportResponse();
        return $this->client->sendRequestAsync($request, $response, $callback);
    }
821636
public function create(string $account, string $nickname)
    {
        $params = [
            'kf_account' => $account,
            'nickname' => $nickname,
        ];

        return $this->httpPostJson('customservice/kfaccount/add', $params);
    }
777556
public function showAction(Request $request, Account $account)
    {
        $this->get('white_october_breadcrumbs')
            ->addItem('Home',
                $this->get('router')->generate('_homepage')
            )
            ->addItem('Accounts',
                $this->get('router')->generate('phospr_account')
            )
        ;

        $treePath = $this->get('phospr.account_handler')
            ->getTreePath($account)
        ;

        foreach ($treePath as $node) {
            if ($node->getLvl()) {
                $this->get('white_october_breadcrumbs')
                    ->addItem($node->getName(),
                        $this->get('router')->generate('phospr_account_show', array(
                            'path' => $node->getPath()
                    )))
                ;
            }
        }

        $calculatedBalance = 0;

        foreach ($account->getPostings() as $posting) {
            $calculatedBalance += $posting->getAmount();

            $posting->setCalculatedBalance($calculatedBalance);
        }

        $journal = $this->get('phospr.journal_handler')->createJournal();

        $form = $this->createForm(new SimpleJournalType(), $journal);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->get('doctrine')->getManager();

            $amount  = $form->getData()->getCreditAmount();
            $amount -= $form->getData()->getDebitAmount();

            $ph = $this->get('phospr.posting_handler');

            $form->getData()->addPosting($ph->createPosting($account, $amount));
            $form->getData()->addPosting($ph->createPosting(
                $form->getData()->getOffsetAccount(),
                -1*$amount
            ));

            $em->persist($form->getData());
            $em->flush();

            return $this->redirect($this->generateUrl(
                'phospr_account_show', array('path' => $account->getPath())
            ));
        }

        return array(
            'account' => $account,
            'form'    => $form->createView(),
        );
    }
202368
public function inviteTeamMember($id_or_email)
    {
        $key = strpos($id_or_email, '@') ? 'email_address' : 'account_id';

        $response = $this->rest->post(
            static::TEAM_ADD_MEMBER_PATH,
            array($key => $id_or_email)
        );

        $this->checkResponse($response);

        return new Team($response);
    }
256984
public function invite($nickname, $channel, $priority = SMARTIRC_MEDIUM)
    {
        return $this->send('INVITE '.$nickname.' '.$channel, $priority);
    }
478124
public function post($account, $action = '', $parameters = null, $file = null, $httpHeadersToSet = array())
    {
        return $this->sendRequest('POST', $account, $action, $parameters, $file, null, $httpHeadersToSet);
    }