container->get(UserRequest::class); $request->scene('putUserAvatar')->validateResolved(); $UserService = new UserService(); $data = $UserService->putUserAvatar(); return $this->response->json($data); } /** * 修改用户名 * @return ResponseInterface * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function putUserName(): ResponseInterface { $request = $this->container->get(UserRequest::class); $request->scene('putUserName')->validateResolved(); $UserService = new UserService(); $data = $UserService->putUserName(); return $this->response->json($data); } /** * 退出登陆 * @return ResponseInterface * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function putLoginout(): ResponseInterface { $UserService = new UserService(); $data = $UserService->putLoginout(); return $this->response->json($data); } // 支付测试 public function testpay(){ $generator = $this->container->get(IdGeneratorInterface::class); $WechatPay = new WechatPay(2); // 获取预支付交易会话标识 $total = 0.01 * 100; $prepay = $WechatPay->getJsapiPrepayId("123457",$total,"o9gYG441zEAHuYoNX7lwFKiQBzKE"); if (empty($prepay)){ return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败"); } // 获取小程序支付配置 $pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']); return $this->response->json($pay_config); } }