Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
limingxinleo committed Apr 5, 2023
1 parent 7486260 commit fd42a38
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Plugin/Wechat/Pay/Common/InvokePrepayV2Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ protected function getSign(Collection $invokeConfig, array $params): string

$data = $invokeConfig->toArray();
ksort($data);
$contents = http_build_query($data) . '&key=' . $secret;
$contents = '';
foreach ($data as $key => $datum) {
$contents .= $key.'='.$datum.'&';
}
$contents .= 'key='.$secret;

return md5($contents);
}
Expand Down Expand Up @@ -103,11 +107,13 @@ protected function getAppId(Rocket $rocket): string
return $payload->get('sub_appid', '');
}

return $config[$this->getConfigKey()] ?? '';
return $config[$this->getConfigKey($rocket->getParams())] ?? '';
}

protected function getConfigKey(): string
protected function getConfigKey(array $params): string
{
return 'mp_app_id';
$type = $params['_type'] ?? 'mp_';

return $type.'app_id';
}
}

0 comments on commit fd42a38

Please sign in to comment.