1.背景
1.1 多商户支付,未使用支付服务商–获取shopId问题
2.请求微信
2.1 回调地址 https://abc.com/mini/notify/2 –2就是商户id
2.2 密钥等信息
'mch_secret_cert' => app()->getRootPath() . 'cert/wx/shop/' . $shopId . '_key.pem', 'mch_public_cert_path' => app()->getRootPath() . 'cert/wx/shop/' . $shopId . '_cert.pem',
3.回调接收
3.1 路由写法
Route::rule('shopNotify/:shopId', 'shopNotify');
3.2 接受shopId
function getShopId() { $url = getFullUrl(); $pattern = '/notify\/(\d+)/'; if (!preg_match($pattern, $url, $matches)) { throw new CustomerException("获取商户信息失败"); } return $matches[1]; }
3.3 第二种接受shopId的方式
$shopId = input('shopId');