tourze/pinduoduo-api-bundle
最新稳定版本:0.0.1
Composer 安装命令:
composer require tourze/pinduoduo-api-bundle
包简介
拼多多API接口集成包,提供商品、订单、物流等功能的完整API封装
README 文档
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
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-03