|
@@ -106,13 +106,28 @@ class Base
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 转换平台名称格式
|
|
|
|
+ * 将前端驼峰命名转换为后端下划线格式
|
|
|
|
+ *
|
|
|
|
+ * @param string $platform
|
|
|
|
+ * @return string
|
|
|
|
+ */
|
|
|
|
+ protected function convertPlatformName($platform)
|
|
|
|
+ {
|
|
|
|
+ // 将驼峰命名转换为下划线格式
|
|
|
|
+ return strtolower(preg_replace('/([A-Z])/', '_$1', lcfirst($platform)));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 获取平台配置参数
|
|
* 获取平台配置参数
|
|
*
|
|
*
|
|
* @return array
|
|
* @return array
|
|
*/
|
|
*/
|
|
protected function getPlatformConfig()
|
|
protected function getPlatformConfig()
|
|
{
|
|
{
|
|
- $platformConfig = ShopConfigService::getConfigs('shop.platform.' . $this->platform);
|
|
|
|
|
|
+ // 需要转换 前段穿 DouyinMiniProgram 后端配置是 douyin_mini_program
|
|
|
|
+ $platformKey = $this->convertPlatformName($this->platform);
|
|
|
|
+ $platformConfig = ShopConfigService::getConfigs('shop.platform.' . $platformKey);
|
|
|
|
|
|
$paymentConfig = $platformConfig['payment'] ?? [];
|
|
$paymentConfig = $platformConfig['payment'] ?? [];
|
|
$app_id = $platformConfig['app_id'] ?? '';
|
|
$app_id = $platformConfig['app_id'] ?? '';
|
|
@@ -167,7 +182,7 @@ class Base
|
|
'App' => 'app' //APP 支付 JsonResponse
|
|
'App' => 'app' //APP 支付 JsonResponse
|
|
],
|
|
],
|
|
'douyin' => [
|
|
'douyin' => [
|
|
- 'douyin_mini_program' => 'mini', //小程序支付 Collection
|
|
|
|
|
|
+ 'DouyinMiniProgram' => 'mini', //小程序支付 Collection
|
|
],
|
|
],
|
|
];
|
|
];
|
|
return $method[$payment][$this->platform];
|
|
return $method[$payment][$this->platform];
|