fix: 修改微信订单传参

This commit is contained in:
Gosowong 2023-05-11 09:47:12 +08:00
parent 76af1381ff
commit 573b6c703e
2 changed files with 13 additions and 2 deletions

View File

@ -3,6 +3,7 @@
namespace crmeb\services\easywechat\orderShipping;
use crmeb\services\easywechat\Application;
use crmeb\services\SystemConfigService;
class MiniOrderService
{
@ -21,10 +22,12 @@ class MiniOrderService
*/
protected static function options(array $config = [])
{
$payment = SystemConfigService::more(['routine_appId', 'routine_appsecret', 'pay_weixin_mchid', 'pay_new_weixin_open', 'pay_new_weixin_mchid']);
return [
'order_shipping' => [
'appid' => sys_config('routine_appId'),
'merchant_id' => sys_config('pay_new_weixin_open') ? sys_config('pay_weixin_mchid') : sys_config('pay_new_weixin_mchid'),
'appid' => $payment['routine_appId'] ?? '',
'secret' => $payment['routine_appsecret'] ?? '',
'merchant_id' => empty($payment['pay_new_weixin_open']) ? trim($payment['pay_weixin_mchid']) : trim($payment['pay_new_weixin_mchid']),
]
];
}

View File

@ -29,6 +29,14 @@ class ServiceProvider implements ServiceProviderInterface
*/
public function register(Container $pimple)
{
$pimple['mini_program.access_token'] = function ($pimple) {
return new AccessToken(
$pimple['config']['order_shipping']['app_id'],
$pimple['config']['order_shipping']['secret'],
$pimple['cache']
);
};
$pimple['order_ship'] = function ($pimple) {
return new OrderClient($pimple['access_token'], $pimple);
};