This commit is contained in:
2023-03-07 10:57:39 +08:00
parent 13cf4e9085
commit f6da754cc2
3 changed files with 11 additions and 4 deletions
+7 -2
View File
@@ -70,14 +70,19 @@ class UserController extends AbstractController
// 支付测试
public function testpay(){
// $weChat = new Wechat(1);
//
// $wx_info_data = $weChat->codeToSession("0219AIFa1ROoUE0e4lIa1bO27I29AIF9");
// dump($wx_info_data);die;
$out_trade_no = $this->request->input('out_trade_no');
$generator = $this->container->get(IdGeneratorInterface::class);
$WechatPay = new WechatPay(2);
$WechatPay = new WechatPay(1);
// 获取预支付交易会话标识
$total = 0.01 * 100;
$prepay = $WechatPay->getJsapiPrepayId($out_trade_no,$total,"o9gYG441zEAHuYoNX7lwFKiQBzKE");
$prepay = $WechatPay->getJsapiPrepayId($out_trade_no,$total,"omgU35DlE-rxTAGgcBjOuc4xdcX8");
if (empty($prepay)){
return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败");
}