This commit is contained in:
yansongda 2018-03-08 16:27:55 +08:00
parent 2809f3af38
commit 48186e4dd1
5 changed files with 7 additions and 3 deletions

View File

@ -24,6 +24,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');
}

View File

@ -21,10 +21,11 @@ class GroupRedpackGateway extends Gateway
public function pay($endpoint, array $payload): Collection
{
$payload['wxappid'] = $payload['appid'];
$payload['amt_type'] = 'ALL_RAND';
if ($this->mode === Wechat::MODE_SERVICE) {
$payload['msgappid'] = $payload['appid'];
}
$payload['amt_type'] = 'ALL_RAND';
unset($payload['appid'], $payload['trade_type'], $payload['notify_url'], $payload['spbill_create_ip']);

View File

@ -20,6 +20,7 @@ class MiniappGateway extends MpGateway
public function pay($endpoint, array $payload): Collection
{
$payload['appid'] = $this->config->get('miniapp_id');
if ($this->mode === Wechat::MODE_SERVICE) {
$payload['sub_appid'] = $this->config->get('sub_miniapp_id');
}

View File

@ -22,10 +22,11 @@ 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');
if ($this->mode === Wechat::MODE_SERVICE) {
$payload['msgappid'] = $payload['appid'];
}
$payload['client_ip'] = Request::createFromGlobals()->server->get('SERVER_ADDR');
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'] = Request::createFromGlobals()->server->get('SERVER_ADDR');
$payload['spbill_create_ip'] = php_sapi_name() === 'cli' ?: Request::createFromGlobals()->server->get('SERVER_ADDR');
unset($payload['appid'], $payload['mch_id'], $payload['trade_type'],
$payload['notify_url'], $payload['type']);