定制 tourze/wechat-work-external-contact-stats-bundle 二次开发

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

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

tourze/wechat-work-external-contact-stats-bundle

最新稳定版本:0.0.1

Composer 安装命令:

composer require tourze/wechat-work-external-contact-stats-bundle

包简介

企业微信外部联系人行为数据统计管理束包

README 文档

README

English | 中文

[Latest Version] (https://packagist.org/packages/tourze/wechat-work-external-contact-stats-bundle) License [Build Status] (https://github.com/tourze/php-monorepo/actions) [Code Coverage] (https://codecov.io/gh/tourze/php-monorepo) [PHP Version Require] (https://packagist.org/packages/tourze/wechat-work-external-contact-stats-bundle) [Total Downloads] (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 functionality
  • tourze/wechat-work-external-contact-bundle - External contact management
  • tourze/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.

统计信息

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

GitHub 信息

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

其他信息

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