service = WxThemeService::getInstance(); } /** * 当前主题 * @Method GET */ public function theme(): JsonResponse { return jok($this->service->current((string) request()->get('code', ''))); } /** * 可选风格 * @Method GET */ public function themeGallery(): JsonResponse { return jok($this->service->gallery()); } /** * 微信支付回调 * * 必须用原始报文验签:先 json_decode 再 encode 回去,字节顺序变了签名就对不上。 * @Method POST */ public function payNotify(): JsonResponse { $headers = []; foreach (['wechatpay-timestamp', 'wechatpay-nonce', 'wechatpay-signature', 'wechatpay-serial'] as $key) { $headers[$key] = (string) request()->header($key, ''); } $result = WxPayService::getInstance()->handleNotify($headers, request()->getContent()); return response()->json($result); } }