获取部门成员(详情)
@param  integer $departmentId 部门id
@param  integer $fetchChild   是否递归获取子部门下面的成员
@param  integer $status       成员类型 可叠加
@return Bag
969918
public function lists($departmentId, $fetchChild = 1, $status = 1)
    {
        $params = array(
                    'department_id'     => $departmentId,
                    'fetch_child'       => $fetchChild,
                    'status'            => $status,
                );

        return new Bag($this->http->get(self::API_LIST, $params));
    }
1093312
static public function fetch( $id, $locale = false )
    {
        if ( is_string( $locale ) )
            $tags = self::fetchList( array( 'id' => $id ), null, null, false, $locale );
        else
            $tags = self::fetchList( array( 'id' => $id ) );

        if ( is_array( $tags ) && !empty( $tags ) )
            return $tags[0];

        return false;
    }
506282
public function setStatus($id, $status)
    {
        if (!is_numeric($status)) {
            throw new Exception('Status argument must be an integer');
        }

        $entity = $this->findById($id)->firstOrFail();
        $entity->status = $status;
        $this->save($entity);

        return $entity;
    }
1060063
public function updateEntryById(string $sectionHandle, int $id): JsonResponse
    {
        $request = $this->requestStack->getCurrentRequest();

        $optionsResponse = $this->preFlightOptions($request, self::ALLOWED_HTTP_METHODS);
        if ($optionsResponse) {
            return $optionsResponse;
        }

        $this->dispatcher->dispatch(
            ApiUpdateEntry::NAME,
            new ApiUpdateEntry($request, $sectionHandle)
        );

        if ($abort = $this->shouldAbort($request)) {
            return $abort;
        }

        try {
            $responseData = [ 'code' => JsonResponse::HTTP_OK ];
            $this->putToPost();
            $form = $this->form->buildFormForSection(
                $sectionHandle,
                $this->requestStack,
                SectionFormOptions::fromArray([
                    ReadOptions::ID => $id
                ]),
                false
            );

            $originalEntry = clone $this->readSection->read(
                ReadOptions::fromArray([
                    ReadOptions::SECTION => $sectionHandle,
                    ReadOptions::ID => $id
                ])
            )->current();

            $form->submit($request->get($form->getName()), false);

            $jsonResponse = new JsonResponse(
                $responseData,
                $responseData['code'],
                $this->getDefaultResponseHeaders($request)
            );

            if ($form->isValid()) {
                $newEntry = $form->getData();
                $this->dispatcher->dispatch(
                    ApiBeforeEntryUpdatedAfterValidated::NAME,
                    new ApiBeforeEntryUpdatedAfterValidated(
                        $request,
                        $responseData,
                        $jsonResponse,
                        $originalEntry,
                        $newEntry
                    )
                );

                if ($abort = $this->shouldAbort($request)) {
                    return $abort;
                }

                $responseData = $this->save($form, $jsonResponse, $request);
                $jsonResponse->setData($responseData);
                $this->dispatcher->dispatch(
                    ApiEntryUpdated::NAME,
                    new ApiEntryUpdated(
                        $request,
                        $responseData,
                        $jsonResponse,
                        $originalEntry,
                        $newEntry
                    )
                );
            } else {
                $responseData['errors'] = $this->getFormErrors($form);
                $responseData['code'] = JsonResponse::HTTP_BAD_REQUEST;
                $jsonResponse->setData($responseData);
                $jsonResponse->setStatusCode($responseData['code']);
            }

            return $jsonResponse;
        } catch (\Exception $exception) {
            return $this->errorResponse($request, $exception);
        }
    }
879981
public function success(string $id, string $message, int $status = 200)
    {
        Log::info($id . ' : ' . $message);

        return response ()->json (['success' => true, 'id' => $id, 'message' => $message], $status);
    }
943701
public function fetch($fetchMode = \PDO::FETCH_BOTH)
    {
        $fetchResult = $this->mysqliStatement->fetch();

        if ($fetchResult === false) {
            throw new MysqliException($this->mysqliStatement->error, $this->mysqliStatement->errno);
        }

        if ($fetchResult === null) {
            return;
        }

        $values = array();
        foreach ($this->result as $value) {
            $values[] = $value;
        }

        if ($fetchMode === null) {
            $fetchMode = $this->defaultFetchMode;
        }

        switch ($fetchMode) {
            case \PDO::FETCH_NUM:
                return $values;
            case \PDO::FETCH_ASSOC:
                return array_combine($this->resultFields, $values);
            case \PDO::FETCH_BOTH:
                $result = array_combine($this->resultFields, $values);
                $result += $values;

                return $result;
            default:
                throw MysqliException::fetchModeNotSupported($fetchMode);
        }
    }
462815
public function getDepartments($departmentId)
    {
        $apiUrl = 'https://qyapi.weixin.qq.com/cgi-bin/department/list';

        $result = $this->_curl($apiUrl, [
            'access_token' => $this->getAccessToken(),
            'id' => $departmentId,
        ]);

        return ($result and isset($result['department'])) ? $result['department'] : null;
    }
1013641
public function load($contentTypeId, $status = Type::STATUS_DEFINED)
    {
        return $this->loadFromRows(
            $this->contentTypeGateway->loadTypeData($contentTypeId, $status),
            $contentTypeId,
            $status
        );
    }
249377
public function paginate($fetchMode = PDO::FETCH_ASSOC) {
        $distinct = $this->distinct ? 'DISTINCT' : '';
        $groupby = '';
        if (!empty($this->group)) {
            $groupby = 'GROUP BY ' . $this->group;
            if (!empty($this->having)) $groupby .= ' ' . $this->having;
        }

        //先获取数量
        $sql = "SELECT $distinct count('*') FROM `$this->table` $this->alias $this->join $this->where $groupby";
        $sql = str_replace('table.',$this->alias.'.',$sql);
        $num = $this->execute($sql, $this->params)->fetchColumn();

        //再获取数据
        $order = !empty($this->order) ? "ORDER BY $this->order" : '';

        $this->fields = $this->fields?$this->fields:'*';
        $sql = "SELECT $distinct $this->fields FROM `$this->table` $this->alias $this->join $this->where $groupby $order $this->limit";
        $sql = str_replace('table.',$this->alias.'.',$sql);

        $result = $this->execute($sql, $this->params)->fetchAll($fetchMode);
        $result = $this->_data($result,true);

        return [$num,$result];
    }
754287
static function fetch( $scriptID, $asObject = true )
    {
        $conditions = array( 'id' => $scriptID );

        return eZPersistentObject::fetchObject( eZScheduledScript::definition(),
                                                null, $conditions, $asObject );
    }
1188091
static function fetch( $id, $asObject = true, $status = eZRSSExport::STATUS_VALID )
    {
        return eZPersistentObject::fetchObject( eZRSSExportItem::definition(),
                                                null,
                                                array( "id" => $id,
                                                       'status' => $status ),
                                                $asObject );
    }
388811
public function fetchDoc($guid, $options = [])
    {
        $options['guid'] = $guid;
        return $this->_request(self::FETCH_DOC, $options);
    }
984893
static function fetchByStatus( $statusID, $asObject = true )
    {
        if ( $statusID == 0 )
            return eZOrderStatus::createUndefined();
        return eZPersistentObject::fetchObject( eZOrderStatus::definition(),
                                                null,
                                                array( "status_id" => $statusID ),
                                                $asObject );
    }
1132187
public function loadContentTypes($groupId, $status = 0)
    {
        return $this->mapper->extractTypesFromRows(
            $this->contentTypeGateway->loadTypesDataForGroup($groupId, $status)
        );
    }
679539
static function fetch( $id )
    {
        $cond = array( 'id' => $id );
        $return = eZPersistentObject::fetchObject( self::definition(), null, $cond );
        return $return;
    }
1138831
public function loadCategoryData($storeId, $productIds)
    {
        $select       = $this->getCategoryProductSelect($productIds, $storeId);
        $categoryData = $this->getConnection()->fetchAll($select);

        $categoryIds = [];

        foreach ($categoryData as $categoryDataRow) {
            $categoryIds[] = $categoryDataRow['category_id'];
        }

        $storeCategoryName = $this->loadCategoryNames(array_unique($categoryIds), $storeId);

        foreach ($categoryData as &$categoryDataRow) {
            $categoryDataRow['name'] = '';
            if (isset($storeCategoryName[(int) $categoryDataRow['category_id']])) {
                $categoryDataRow['name'] = $storeCategoryName[(int) $categoryDataRow['category_id']];
            }
        }

        return $categoryData;
    }
375058
public function index($page = null, $status = null)
    {
        $url = sprintf('buckets/%d/todolists/%d/todos.json', $this->bucket, $this->parent);

        $todos = $this->client->get($url, [
            'query' => [
                'status' => $status,
                'page' => $page,
            ],
        ]);

        return $this->indexResponse($todos, Todo::class);
    }