```
feat(shopro_huifu): 新增汇付商户分账配置查询命令 新增 QuerySplitConfig 命令用于查询汇付商户分账配置, 包括 rule_origin、div_flag、apply_ratio 等字段信息。 - 添加了命令行工具 shopro_huifu:query-split-config - 实现了商户分账配置查询功能 v2/merchant/split/query - 支持输出完整API数据JSON格式 - 提供分账配置详情展示和规则说明 - 在 application/command.php 中注册新命令 ```
这个提交包含在:
@@ -561,6 +561,78 @@ class HuifuClient
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 商户分账配置查询 v2/merchant/split/query(含 rule_origin、div_flag、apply_ratio)
|
||||
*/
|
||||
public function queryMerchantSplitConfig($huifuId = '')
|
||||
{
|
||||
$huifuId = trim((string) $huifuId);
|
||||
if ($huifuId === '') {
|
||||
$huifuId = trim((string) $this->config->get('huifu_id'));
|
||||
}
|
||||
if ($huifuId === '') {
|
||||
return ['ok' => false, 'message' => '缺少 huifu_id', 'data' => null];
|
||||
}
|
||||
|
||||
SdkLoader::requireRequest('V2MerchantSplitQueryRequest.php');
|
||||
$request = new \BsPaySdk\request\V2MerchantSplitQueryRequest();
|
||||
$request->setHuifuId($huifuId);
|
||||
$request->setReqDate(date('Ymd'));
|
||||
$request->setReqSeqId('SPLQ' . date('YmdHis') . mt_rand(1000, 9999));
|
||||
|
||||
return $this->safeApiResult($this->postRequest($request));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 解析 split_bill_result(可能是 array 或 JSON 字符串)
|
||||
*
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
public static function parseSplitBillResult($raw)
|
||||
{
|
||||
if ($raw === null || $raw === '') {
|
||||
return [];
|
||||
}
|
||||
if (is_string($raw)) {
|
||||
$decoded = json_decode($raw, true);
|
||||
if (!is_array($decoded)) {
|
||||
return [];
|
||||
}
|
||||
$raw = $decoded;
|
||||
}
|
||||
if (!is_array($raw)) {
|
||||
return [];
|
||||
}
|
||||
if (isset($raw['rule_origin']) || isset($raw['div_flag'])) {
|
||||
return [$raw];
|
||||
}
|
||||
$list = [];
|
||||
foreach ($raw as $item) {
|
||||
if (is_array($item)) {
|
||||
$list[] = $item;
|
||||
}
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function describeRuleOrigin($code)
|
||||
{
|
||||
$code = trim((string) $code);
|
||||
if ($code === '01') {
|
||||
return '01 接口发起(交易确认可传 acct_split_bunch)';
|
||||
}
|
||||
if ($code === '02') {
|
||||
return '02 控台配置(接口带分账串易 22000002,以控台规则为准)';
|
||||
}
|
||||
return $code !== '' ? $code : '(未返回)';
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function probeMiniAppCreate($subOpenid, $subAppid = '', $amount = '0.01')
|
||||
|
||||
{
|
||||
|
||||
在新工单中引用
屏蔽一个用户