定制 tourze/wechat-work-staff-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tourze/wechat-work-staff-bundle

最新稳定版本:0.2.0

Composer 安装命令:

composer require tourze/wechat-work-staff-bundle

包简介

企业微信员工管理模块

README 文档

README

English | 中文

Latest Version Build Status Software License

Coverage Status PHP Version Symfony Total Downloads

A Symfony Bundle for enterprise WeChat (DingTalk) staff management, providing comprehensive APIs for user, department, and tag management.

Features

  • User Management: Create, update, delete, and sync enterprise WeChat users
  • Department Management: Handle department structure and hierarchies
  • Tag Management: Create and manage user tags for organization
  • Avatar Management: Automatic user avatar synchronization and storage
  • Authentication: OAuth integration with enterprise WeChat
  • Cron Jobs: Automated data synchronization tasks
  • JSON-RPC API: RESTful API endpoints for external integration

Installation

composer require tourze/wechat-work-staff-bundle

Quick Start

Basic Configuration

<?php
// config/packages/wechat_work_staff.yaml
wechat_work_staff:
    # Configuration will be loaded from other bundles

User Management

<?php

use WechatWorkStaffBundle\Service\BizUserService;
use WechatWorkStaffBundle\Repository\UserRepository;

// Inject the service
public function __construct(
    private BizUserService $userService,
    private UserRepository $userRepository
) {}

// Get user by ID
$user = $this->userRepository->findByUserId('user123');

// Sync user data from WeChat Work
$this->userService->syncUserData($agentId);

Console Commands

The bundle provides several console commands for data synchronization:

User Management Commands

# Sync user list for specific agent
php bin/console wechat-work:sync-user-list <agentId>

# Check and update user avatars (runs automatically every 8 hours)
php bin/console wechat-work:check-user-avatar

Tag Management Commands

# Sync user tags (runs automatically every 8 hours)
php bin/console wechat-work:sync-user-tags

# Sync users associated with tags (runs automatically every 20 minutes)
php bin/console wechat-work:sync-tag-users

API Endpoints

The bundle provides several controller endpoints:

  • Authentication: /wechat-work/auth/* - OAuth flow handling
  • User Connection: /wechat-work/connect/* - User account linking
  • Testing Endpoints: Various test endpoints for development

JSON-RPC Procedures

Available JSON-RPC procedures:

  • GetWechatWorkDepartmentTree - Retrieve department hierarchy
  • GetWechatWorkUserByAuthCode - Get user information by auth code

Entities

  • User: Enterprise WeChat user entity
  • Department: Department/organization structure
  • UserTag: User categorization tags
  • AgentUser: Association between agents and users

Advanced Usage

Cron Jobs

Automated tasks (configured via AsCronTask attribute):

  • Avatar Check: Every 8 hours at minute 14
  • Tag Sync: Every 8 hours at minute 30
  • Tag Users Sync: Every 20 minutes

Custom Event Listeners

The bundle dispatches events that you can listen to:

<?php

use WechatWorkStaffBundle\EventSubscriber\UserTagListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class CustomUserTagListener implements EventSubscriberInterface
{
    // Your custom logic
}

Dependencies

This bundle requires:

  • PHP 8.1 or higher
  • Symfony 6.4 or higher
  • Doctrine ORM
  • Bundle Dependency Bundle
  • HTTP Client Bundle
  • WeChat Work Contracts Bundle
  • League Flysystem (for avatar storage)

Contributing

Please see CONTRIBUTING.md for details.

Security

Security Considerations

  • All external API calls include audit logging
  • User data is properly validated and sanitized
  • OAuth flows follow security best practices
  • Sensitive information is properly encrypted

Reporting Security Issues

Please report security vulnerabilities to security@example.com.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固