tourze / pinduoduo-api-bundle
拼多多API接口集成包,提供商品、订单、物流等功能的完整API封装
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/tourze/pinduoduo-api-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
- hanson/foundation-sdk: ^5.0
- justmd5/pinduoduo-sdk: ^1.8.3
- nesbot/carbon: ^2.72 || ^3
- psr/log: ^3|^2|^1
- 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-foundation: ^6.4
- symfony/http-kernel: ^6.4
- symfony/messenger: ^6.4
- symfony/routing: ^6.4
- symfony/serializer: ^6.4
- symfony/var-dumper: ^6.4
- symfony/yaml: ^6.4 || ^7.1
- tourze/arrayable: 0.0.*
- tourze/async-command-bundle: 0.0.*
- tourze/doctrine-indexed-bundle: 0.0.*
- tourze/doctrine-snowflake-bundle: 0.1.*
- tourze/doctrine-timestamp-bundle: 0.0.*
- tourze/doctrine-user-bundle: 0.0.*
- tourze/easy-admin-attribute: 0.1.*
- tourze/enum-extra: 0.1.*
- tourze/json-rpc-core: 0.0.*
- tourze/json-rpc-lock-bundle: 0.1.*
- tourze/json-rpc-log-bundle: 0.1.*
- tourze/symfony-cron-job-bundle: 0.1.*
- tourze/symfony-lock-command-bundle: 0.0.*
- tourze/symfony-temp-file-bundle: 0.0.*
- tourze/weui-bundle: 0.0.*
- yiisoft/json: ^1.0
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-11-01 19:21:12 UTC
README
A Symfony bundle for integrating with Pinduoduo (PDD) API, providing comprehensive e-commerce functionality including product management, order processing, and logistics integration.
Features
- Product Management: Sync product details, categories, specifications, and measurements
- Order Processing: Full order lifecycle management with real-time synchronization
- Mall Management: Multi-store support with access token management
- Logistics Integration: Shipping templates and logistics coordination
- Console Commands: 16 comprehensive CLI commands for automation
- Cron Job Integration: Automated background tasks with scheduling
- Entity Management: Doctrine ORM entities for all PDD data structures
Installation
composer require tourze/pinduoduo-api-bundle
Quick Start
1. Basic Configuration
<?php // config/services.yaml parameters: pinduoduo_api.app_id: '%env(PINDUODUO_APP_ID)%' pinduoduo_api.app_secret: '%env(PINDUODUO_APP_SECRET)%'
2. Usage Example
<?php use PinduoduoApiBundle\Service\PinduoduoClient; use PinduoduoApiBundle\Repository\MallRepository; class YourController { public function __construct( private PinduoduoClient $pinduoduoClient, private MallRepository $mallRepository ) {} public function syncProducts(): void { $mall = $this->mallRepository->findOneBy(['name' => 'Your Mall']); $response = $this->pinduoduoClient->requestByMall($mall, 'pdd.goods.list.get'); // Handle response... } }
Console Commands
This bundle provides 16 console commands for various PDD operations:
Access Token Management
- pdd:refresh-access-token - Refresh access tokens (runs every 5 minutes)
- pdd:refresh-cps-protocol-status - Update CPS protocol status
Product Management
- pdd:sync-goods-detail - Sync specific product details
- pdd:sync-mall-goods-list - Sync mall product list
- pdd:loop-sync-goods-category - Loop sync product categories
- pdd:get-category-rule - Get category rules
- pdd:sync-spec-list - Sync product specifications
- pdd:sync-measurement-list - Sync measurement units
Order Management
- pdd:sync-full-order-list - Sync full order list (runs every 6 hours)
- pdd:sync-basic-order-list - Sync basic order information
- pdd:sync-increment-order-list - Sync incremental order updates
System Data
- pdd:sync-country-list - Sync country/region data (runs every 2 hours)
- pdd:sync-auth-categories - Sync authorized categories
- pdd:sync-logistics-template-list - Sync logistics templates
- pdd:sync-mall-info-list - Sync mall information
Utilities
- pdd:upload-image - Test image upload functionality
Advanced Usage
Custom API Requests
<?php use PinduoduoApiBundle\Service\PinduoduoClient; use PinduoduoApiBundle\Repository\MallRepository; // Direct API call with parameters $response = $this->pinduoduoClient->requestByMall($mall, 'pdd.goods.list.get', [ 'page' => 1, 'page_size' => 100 ]);
Cron Job Configuration
The bundle includes automatic cron job scheduling:
# These commands run automatically: # */5 * * * * - Access token refresh # 20 */2 * * * - Country sync # 45 */6 * * * - Order sync
Entity Structure
The bundle provides comprehensive Doctrine entities:
Mall- Store informationAuthLog- Authentication logsGoods\Goods- Product informationGoods\Sku- Product variantsGoods\Category- Product categoriesOrder\Order- Order informationCountry- Geographic dataLogisticsTemplate- Shipping templates
Dependencies
This bundle requires:
- PHP 8.1 or higher
- Symfony 6.4 or higher
- Doctrine ORM 3.0 or higher
- tourze/http-client-bundle (internal HTTP client)
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
Security
This bundle handles sensitive API credentials and merchant data. Please ensure:
- Store API credentials securely using environment variables
- Use HTTPS for all API communications
- Implement proper access controls for admin operations
- Regularly update dependencies to address security vulnerabilities
- Follow OWASP guidelines for web application security
If you discover a security vulnerability, please report it via email to security@tourze.com instead of using the public issue tracker.
License
The MIT License (MIT). Please see License File for more information.
Support
For issues and questions:
- GitHub Issues: https://github.com/tourze/pinduoduo-api-bundle/issues
- Documentation: https://docs.tourze.com/pinduoduo-api-bundle