Commit 8a31b18b by yeran

update some bugs

1 parent 9d5b9d71
...@@ -15,6 +15,8 @@ $config = json_decode($configStr,true); ...@@ -15,6 +15,8 @@ $config = json_decode($configStr,true);
$payDataStr = "{\"terminal_trace\":\"20190327151722366145505357545320\",\"total_fee\":1,\"order_body\":\"支付测试\",\"open_id\":\"oUlAM0Wp1K1rJEGJ0t__Ls5-qFKE\",\"attach\":\"10054c238f670a2e9649a8b100f20562\"}"; $payDataStr = "{\"terminal_trace\":\"20190327151722366145505357545320\",\"total_fee\":1,\"order_body\":\"支付测试\",\"open_id\":\"oUlAM0Wp1K1rJEGJ0t__Ls5-qFKE\",\"attach\":\"10054c238f670a2e9649a8b100f20562\"}";
$payData = json_decode($payDataStr,true); $payData = json_decode($payDataStr,true);
$config['base_url'] = 'https://pay.lcsw.cn/lcsw';
try { try {
$ret = Charge::run(Config::SW_CHANNEL_LITE, $config, $payData); $ret = Charge::run(Config::SW_CHANNEL_LITE, $config, $payData);
} catch (PayException $e) { } catch (PayException $e) {
......
...@@ -61,7 +61,6 @@ abstract class BaseData ...@@ -61,7 +61,6 @@ abstract class BaseData
$this->data = array_merge($config->toArray(), $reqData);//配置信息合并 $this->data = array_merge($config->toArray(), $reqData);//配置信息合并
try { try {
$this->checkDataParam(); $this->checkDataParam();
} catch (PayException $e) { } catch (PayException $e) {
......
...@@ -91,11 +91,13 @@ abstract class SwBaseStrategy implements BaseStrategy ...@@ -91,11 +91,13 @@ abstract class SwBaseStrategy implements BaseStrategy
*/ */
protected function getReqUrl($url=null) protected function getReqUrl($url=null)
{ {
if(!empty($this->base_url)){ if(isset($this->config->base_url) && !empty($this->config->base_url)){
$_pre = $this->base_url; $_pre = $this->config->base_url;
}else{ }else{
$_pre = SwConfig::BASE_URL; $_pre = SwConfig::BASE_URL;
} }
die($_pre);
return $_pre.($url??SwConfig::UNIFIED_URL); return $_pre.($url??SwConfig::UNIFIED_URL);
} }
......
...@@ -31,7 +31,7 @@ final class SwConfig extends ConfigInterface ...@@ -31,7 +31,7 @@ final class SwConfig extends ConfigInterface
public $notify_url; public $notify_url;
const BASE_URL = 'http://test.lcsw.cn:8045/lcsw'; const BASE_URL = 'https://pay.lcsw.cn/lcsw';// 'http://test.lcsw.cn:8045/lcsw';
const UNIFIED_URL = '/pay/100/jspay'; // 公众号支付统一下单url const UNIFIED_URL = '/pay/100/jspay'; // 公众号支付统一下单url
...@@ -136,6 +136,10 @@ final class SwConfig extends ConfigInterface ...@@ -136,6 +136,10 @@ final class SwConfig extends ConfigInterface
$this->access_token = trim($config['access_token']); $this->access_token = trim($config['access_token']);
} }
if (key_exists('base_url', $config)) {
$this->base_url = trim($config['base_url']);
}
// 设置交易开始时间 格式为yyyyMMddHHmmss,在次之前一定要设置时区 // 设置交易开始时间 格式为yyyyMMddHHmmss,在次之前一定要设置时区
$startTime = time(); $startTime = time();
$this->terminal_time = date('YmdHis', $startTime); $this->terminal_time = date('YmdHis', $startTime);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!