fix some bugs

This commit is contained in:
yansongda 2018-03-08 16:53:32 +08:00
parent eeb1719792
commit df34300b10
5 changed files with 6 additions and 14 deletions

View File

@ -25,9 +25,7 @@ class AppGateway extends Gateway
$payload['appid'] = $this->config->get('appid');
$payload['trade_type'] = $this->getTradeType();
if ($this->mode === Wechat::MODE_SERVICE) {
$payload['sub_appid'] = $this->config->get('sub_appid');
}
$this->mode !== Wechat::MODE_SERVICE ?: $payload['sub_appid'] = $this->config->get('sub_appid');
$payRequest = [
'appid' => $payload['appid'],

View File

@ -23,9 +23,7 @@ class GroupRedpackGateway extends Gateway
$payload['wxappid'] = $payload['appid'];
$payload['amt_type'] = 'ALL_RAND';
if ($this->mode === Wechat::MODE_SERVICE) {
$payload['msgappid'] = $payload['appid'];
}
$this->mode !== Wechat::MODE_SERVICE ?: $payload['msgappid'] = $payload['appid'];
unset($payload['appid'], $payload['trade_type'], $payload['notify_url'], $payload['spbill_create_ip']);

View File

@ -21,9 +21,7 @@ class MiniappGateway extends MpGateway
{
$payload['appid'] = $this->config->get('miniapp_id');
if ($this->mode === Wechat::MODE_SERVICE) {
$payload['sub_appid'] = $this->config->get('sub_miniapp_id');
}
$this->mode !== Wechat::MODE_SERVICE ?: $payload['sub_appid'] = $this->config->get('sub_miniapp_id');
return parent::pay($endpoint, $payload);
}

View File

@ -22,11 +22,9 @@ class RedpackGateway extends Gateway
public function pay($endpoint, array $payload): Collection
{
$payload['wxappid'] = $payload['appid'];
$payload['client_ip'] = php_sapi_name() === 'cli' ?: Request::createFromGlobals()->server->get('SERVER_ADDR');
php_sapi_name() === 'cli' ?: $payload['client_ip'] = Request::createFromGlobals()->server->get('SERVER_ADDR');
if ($this->mode === Wechat::MODE_SERVICE) {
$payload['msgappid'] = $payload['appid'];
}
$this->mode !== Wechat::MODE_SERVICE ?: $payload['msgappid'] = $payload['appid'];
unset($payload['appid'], $payload['trade_type'], $payload['notify_url'], $payload['spbill_create_ip']);

View File

@ -28,7 +28,7 @@ class TransferGateway extends Gateway
$payload['mch_appid'] = $this->config->get($type, '');
$payload['mchid'] = $payload['mch_id'];
$payload['spbill_create_ip'] = php_sapi_name() === 'cli' ?: Request::createFromGlobals()->server->get('SERVER_ADDR');
php_sapi_name() === 'cli' ?: $payload['spbill_create_ip'] = Request::createFromGlobals()->server->get('SERVER_ADDR');
unset($payload['appid'], $payload['mch_id'], $payload['trade_type'],
$payload['notify_url'], $payload['type']);