创建应用菜单
@param $agentId
@param array $data
@return bool
@throws \yii\web\HttpException
549058
public function createMenu($agentId, array $data)
    {
        $result = $this->httpRaw(self::WECHAT_MENU_CREATE_PREFIX, $data, [
            'access_token' => $this->getAccessToken(),
            'agentid' => $agentId
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'ok';
    }
267385
public function sendAll(array $data)
    {
        $result = $this->httpRaw(self::WECHAT_SEND_ALL_PREFIX, $data, [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['errcode']) && !$result['errcode'];
    }
35511
public function getUserInfo($code, $agentId = '')
    {
        $params = [
            'access_token' => $this->getAccessToken(),
            'code' => $code,
        ];
        if (!empty($agentId)) $params['agentid'] = $agentId;
        $result = $this->httpGet(self::WECHAT_USER_IFNO_GET_PREFIX, $params);
        return !isset($result['errcode']) ? $result : $this->dump($result);
    }
38429
public function updateMemberCardUser(array $data)
    {
        $url = 'https://api.weixin.qq.com/card/membercard/updateuser?access_token=ACCESS_TOKEN';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
954047
public function sendToUid($uid, $data, $fromDispatch = false)
    {
        if ($this->uid_fd_table->exist($uid)) {//本机处理
            $fd = $this->uid_fd_table->get($uid)['fd'];
            $this->send($fd, $data, true);
        } else {
            if ($fromDispatch) {
                $this->onUidSendFail($uid, $data, null);

                return;
            }
            if ($this->isCluster()) {
                ProcessManager::getInstance()->getRpcCall(ClusterProcess::class, true)->my_sendToUid($uid, $data);
            } else {
                $this->onUidSendFail($uid, $data, null);
            }
        }
    }
489626
public function create(array $data)
    {
        try
        {
            if ( $this->validator->with($data)->passes() )
            {
                $this->users->create($data,$data['activate']);
                return true;
            }
        }
        catch (LoginRequiredException $e)
        {
            $this->validator->add('LoginRequiredException',$e->getMessage());
        }
        catch (PasswordRequiredException $e)
        {
            $this->validator->add('PasswordRequiredException',$e->getMessage());
        }
        catch (UserExistsException $e)
        {
            $this->validator->add('UserExistsException',$e->getMessage());
        }

        return false;
    }
507446
public function updateNews($mediaId, array $articles, $agentId = 0)
    {
        $params = array(
                   'media_id' => $mediaId,
                   'agentid' => $agentId,
                   'mpnews'=>array('articles'=>$articles),
                  );

        return $this->http->jsonPost(self::API_FOREVER_NEWS_UPDATE, $params);
    }
1185502
public function update($id, array $data)
    {
        $this->validateId($id);

        $entity = $this->getById($id);
        $form   = $this->getEditForm();

        $form->bind($entity);
        $form->setData($data);

        if (!$valid = $form->isValid()) {
            return false;
        }

        $this->updateFromNode($entity);

        $this->getMapper()->save($entity);

        return $entity;
    }
51671
public function update($id, array $data): bool
    {
        $bool = $this->repo->update($data, $id);
        if (false === $bool) {
            throw new CommodityCateException('商品分类没有修改成功', ExceptionCode::UPDATED_FAILURE);
        }

        return $bool;
    }
319147
public function updatePartials(int $articleId, array $data): ArticleInterface
    {
        $this->shopware()->put('/api/articles/' . $articleId, [], $data);

        return $this->find($articleId);
    }
1040810
public function sendMessage(array $data)
    {
        $result = $this->httpRaw(self::WECHAT_MESSAGE_SEND_PREFIX, $data, [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'ok' ? $result : $this->dump([self::WECHAT_BASE_URL . self::WECHAT_MESSAGE_SEND_PREFIX, $this->getAccessToken(), $data, $result]);
    }
590077
public function sendMessage(array $data)
    {
        $result = $this->httpRaw(self::WECHAT_CUSTOM_MESSAGE_SEND_PREFIX, $data, [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'ok';
    }
182828
public function create(array $data): Model
    {
        $result = $this->repo->create($data);
        $pid = empty($data['pid']) ? 0 : $data['pid'];


        if ((int)$pid !== 0) {
            // 计算根id
            $parent = $this->show($data['pid']);
            $rootId = $parent->root_id;
            // 计算深度
            $deep = (int)$parent->deep + 1;
            // 计算path
            $path = $parent->path . $result->id . ",";
        } else {
            // 计算根id
            $rootId = $result->id;
            // 计算深度
            $deep = 0;
            // 计算path
            $path = "," . $result->id . ",";
        }

        /*
         | 将根id和分类深度写回去
         | 使用save方法
         */
        $result->root_id = $rootId;
        $result->deep = $deep;
        $result->path = $path;
        if (! $result->save()) {
            throw new CommodityCateException("商品分类没有添加成功", ExceptionCode::CREATED_FAILURE);
        }

        return $result;
    }
17964
public function set($agentId, $menus)
    {
        $menus = $this->extractMenus($menus);

        $this->http->jsonPost(self::API_CREATE.'?agentid='.$agentId, array('button' => $menus));

        return true;
    }
637698
protected function doWrite($sessionId, $data): bool
    {
        $this->sessionDataProvider->setData($data);
        $this->getFacade()->setEx($this->prefix . $sessionId, $this->sessionDataProvider, 'ex', $this->ttl);

        return true;
    }
594498
public function setActivateMemberCardUser(array $data)
    {
        $url = 'https://api.weixin.qq.com/card/membercard/activateuserform/set?access_token=ACCESS_TOKEN';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
823216
public function addPage(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_PAGE_ADD_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errcode']) && !$result['errcode'] ? $result['data'] : false;
    }