# think-withdraw **Repository Path**: qqqqqqqqw/think-withdraw ## Basic Information - **Project Name**: think-withdraw - **Description**: No description available - **Primary Language**: PHP - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-01 - **Last Updated**: 2026-03-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 出款渠道对接 > 如果觉得 `think-withdraw` 不错,欢迎给个 star,谢谢。 ## 目录结构 ```php src/config/withdraw.php // 渠道配置文件,写好每个厂商的配置参数模版,记住是模版,不要把真实参数提交 src/dto/ // 接口数据传输对象 src/exception/ // 接口异常,不细分不需要再定义 src/extend/ // 接口扩展,你在对接时定义的工具类 src/provider/ // 接口服务提供者,一个厂商一个包,每个包里新建 `README.md` 文件,里面写厂商的接口文档 src/phpmate/ // 该目录下的文件未来将独立出去进行单独维护的,你不可以在此包下添加文件 ``` ## 使用方法 ```php // 1. 在你的 tp 项目下面安装 `yaoliyong/think-withdraw` 包 composer require yaoliyong/think-withdraw // 2. 构建 withdraw 策略业务 $configParams = [];// 服务商配置参数(参数请参考各个渠道的配置类公共属性);notifyUrl + channelId 用来配置回调地址,订单回调路由 = {notifyUrl}/channel/{channelId};签约回调路由 = {notifyUrl}/channel/{channelId}/type/h5Sign $WithdrawStrategy = WithdrawStrategyFactory::create('yunzhanghu', $configParams); $requestDto = new CreateOrderRequestDto(); // 省略Dto设置参数 $WithdrawStrategy->createOrder($requestDto); ``` ## 测试 vendor/bin/phpunit --filter "XzbPayTest::testQueryBalance" --configuration phpunit.xml vendor/bin/phpunit --filter "XzbPayTest::testUserSign" --configuration phpunit.xml vendor/bin/phpunit --filter "XzbPayTest::testCreateOrder" --configuration phpunit.xml vendor/bin/phpunit --filter "XzbPayTest::testQueryOrder" --configuration phpunit.xml vendor/bin/phpunit --filter "XzbPayTest::testHandleCallbackOfWithdraw" --configuration phpunit.xml