tourze / wechat-work-external-contact-stats-bundle
企业微信外部联系人行为数据统计管理束包
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/tourze/wechat-work-external-contact-stats-bundle
Requires
- php: ^8.1
- doctrine/collections: ^2.3
- doctrine/dbal: ^4.0
- doctrine/doctrine-bundle: ^2.13
- doctrine/orm: ^3.0
- doctrine/persistence: ^3.1 || ^4
- nesbot/carbon: ^2.72 || ^3
- symfony/config: ^6.4
- symfony/console: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/doctrine-bridge: ^6.4
- symfony/framework-bundle: ^6.4
- symfony/http-kernel: ^6.4
- symfony/routing: ^6.4
- symfony/yaml: ^6.4 || ^7.1
- tourze/doctrine-indexed-bundle: 0.0.*
- tourze/doctrine-timestamp-bundle: 0.0.*
- tourze/easy-admin-attribute: 0.1.*
- tourze/http-client-bundle: 0.1.*
- tourze/symfony-cron-job-bundle: 0.1.*
- tourze/wechat-work-bundle: 0.1.*
- tourze/wechat-work-contracts: 0.0.*
- tourze/wechat-work-external-contact-bundle: 0.0.*
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-11-01 19:33:13 UTC
README
[]
(https://packagist.org/packages/tourze/wechat-work-external-contact-stats-bundle)
[
]
(https://github.com/tourze/php-monorepo/actions)
[
]
(https://codecov.io/gh/tourze/php-monorepo)
[
]
(https://packagist.org/packages/tourze/wechat-work-external-contact-stats-bundle)
[
]
(https://packagist.org/packages/tourze/wechat-work-external-contact-stats-bundle)
A Symfony bundle for collecting and managing WeChat Work external contact statistics data.
Features
- Collect user behavior statistics for WeChat Work external contacts
- Support both user-level and department-level statistics
- Automatic data synchronization via cron jobs
- Comprehensive data entities and repositories
- Statistical analysis for contact applications, messages, and reply rates
Requirements
- PHP 8.1+
- Symfony 6.4+
- Doctrine ORM 3.0+
- WeChat Work API access
Installation
composer require tourze/wechat-work-external-contact-stats-bundle
Configuration
Add the bundle to your config/bundles.php:
<?php return [ // ... other bundles WechatWorkExternalContactStatsBundle\WechatWorkExternalContactStatsBundle::class => ['all' => true], ];
Usage
Entities
The bundle provides two main entities:
UserBehaviorDataByUser
Tracks individual user behavior statistics:
- New application count
- New contact count
- Chat count
- Message count
- Average reply time
- Negative feedback count
- Reply percentage
UserBehaviorDataByParty
Tracks department-level behavior statistics with the same metrics as user-level data.
Commands
Sync User Behavior Data
# Sync user behavior statistics data
php bin/console wechat-work:sync-user-behavior-by-user
This command runs automatically via cron job at 6:14 AM daily.
Repository Usage
use WechatWorkExternalContactStatsBundle\Entity\UserBehaviorDataByUser; use WechatWorkExternalContactStatsBundle\Entity\UserBehaviorDataByParty; use WechatWorkExternalContactStatsBundle\Repository\UserBehaviorDataByUserRepository; use WechatWorkExternalContactStatsBundle\Repository\UserBehaviorDataByPartyRepository; // Get user behavior data $userRepository = $entityManager->getRepository(UserBehaviorDataByUser::class); $userStats = $userRepository->findBy(['user' => $user]); // Get department behavior data $partyRepository = $entityManager->getRepository(UserBehaviorDataByParty::class); $departmentStats = $partyRepository->findBy(['party' => $department]);
Advanced Usage
API Integration
The bundle integrates with WeChat Work API to fetch:
- Follow user lists
- User behavior statistics
- Contact interaction data
Custom Queries
You can create custom queries using the repository methods:
// Find statistics for a specific date range $stats = $userRepository->createQueryBuilder('u') ->where('u.date BETWEEN :start AND :end') ->setParameter('start', $startDate) ->setParameter('end', $endDate) ->getQuery() ->getResult();
Dependencies
tourze/wechat-work-bundle- Core WeChat Work functionalitytourze/wechat-work-external-contact-bundle- External contact managementtourze/symfony-cron-job-bundle- Cron job scheduling
Contributing
Please see CONTRIBUTING.md for details.
Security
If you discover any security related issues, please email security@tourze.com instead of using the issue tracker.
License
This bundle is released under the MIT license. See the LICENSE file for details.