groovy RESTClient的POST、GET、DELETE 用法

groovy 的常用操作 groovy全局变量、json操作、sql操作、http操作、多线程、集合 阅读详情


RESTClient is an extension of HTTPBuilder, which makes a few concessions in HTTPBuilder's flexibility in order to make REST operations as simple as possible.

RESTClient makes great use of the automatic content-type parsing and encoding which makes working with XML and JSON extremely easy, both in the request and response side. It also adds some additional convenience methods for response header parsing.

The main advantages of RESTClient are:

  1. RESTClient has convenience methods for get, put post delete, head
  2. The response data is always parsed and buffered in-memory
  3. The returned HttpResponseDecorator instance gives convenient access to headers and the parsed response data
  4. No user-defined closure is needed

Test a URL using the HEAD method

import groovyx.net.http.RESTClient
import groovy.util.slurpersupport.GPathResult
import static groovyx.net.http.ContentType.URLENC
 
twitter = new RESTClient( 'https://twitter.com/statuses/' )
// twitter auth omitted
 
try { // expect an exception from a 404 response:
    twitter.head path : 'public_timeline'
    assert false, 'Expected exception'
}
// The exception is used for flow control but has access to the response as well:
catch( ex ) { assert ex.response.status == 404 }
 
assert twitter.head( path : 'public_timeline.json' ).status == 200


The above example takes advantage of HTTPBuilder's default failure handler, which will cause an exception to be thrown for any 'failed' response. That exception will still allow access to details of the response (e.g. the response status or message).

GET our friends' timeline
def resp = twitter.get( path : 'friends_timeline.json' )
assert resp.status == 200
assert resp.contentType == JSON.toString()
assert ( resp.data instanceof net.sf.json.JSON )
assert resp.data.status.size() > 0

All request parameters are defined here.

The resp field in the above example is an instance of HttpResponseDecorator. Calling resp.getData() returns the parsed response content. This is the same parsed response that you would get passed to HTTPBuilder's response handler closure, but it is always buffered in-memory and the response stream is automatically closed.


POST a status update to Twitter!
def msg = "I'm using HTTPBuilder's RESTClient on ${new Date()}"
 
resp = twitter.post( path : 'update.xml',
                     body : [ status:msg, source:'httpbuilder' ],
                     requestContentType : URLENC )
 
assert resp.status == 200
assert ( resp.data instanceof GPathResult ) // parsed using XmlSlurper
assert resp.data.text == msg
assert resp.data.user.screen_name == userName
def postID = resp.data.id.toInteger()

Note that the above example is posting the request data as application/x-www-form-urlencoded. (The twitter API doesn't support XML or JSON POST requests.) For this reason, a requestContentType parameter must be specified in order to identify how the request body should be serialized.

Also note that we're requesting update.xml, not update.json. Since we never set a default content-type on the RESTClient instance or pass a contentType argument in this request, RESTClient will put Accept: */* in the request header, and parse the response based on whatever is given in the response content-type header. So because Twitter correctly identifies its response as application/xml, it will automatically be parsed by the default XML parser.


Now DELETE that post
resp = twitter.delete( path : "destroy/${postID}.json" )
assert resp.status == 200
assert resp.data.id == postID
println "Test tweet ID ${resp.data.id} was deleted."

原文地址: http://groovy.codehaus.org/modules/http-builder/doc/rest.html
Java 开发 2_0 通过 CouchDB 和 Groovy 的 RESTClient 实现 REST 立即下载

相关推荐

通过CouchDB和Groovy的RESTClient实现REST

在过去数年中,开源世界的创新发展将Java?开发人员的生产力提升了一个层次。免费的工具、框架和解决方案弥补了曾经一度匮乏的空缺。其中,被一些人认为是Web2.0数据库的ApacheCouchDB是非常有潜力的。全面掌握CouchDB并不困难,使用它就像使用Web浏览器一样简单。本期Java开发2.0专栏将介绍CouchDB并向您展示如何发挥Groovy的RESTClient的强大功能目前为止,本专栏系列已经探究了Google和Amazon平台中的云计算。虽然它们在实现和结构上存在不同,但两种平台都支持快速和可扩展的部署方式。它们可以快速经济地组装、测试、运行和维护Java应用程序,这无疑是前所

16-Groovy-GET/POST请求

Groovy-GET/POST请求

小白的博客 2638

【研究生学术英语读写教程翻译 中国科学院大学Unit9】

Unit 9 If Humble People Make the Best Leaders,Why Do We Fall for Charismatic Narcissists? 如果谦逊的人是最好的领导者,为什么我们会爱上魅力型自恋者?

fuhanghang的博客 4110

Groovy 发送 HTTP 请求

build.gradle里面想进行网络请求应该如何操作 get非常的简单 def res1 = new URL('https://httpbin.org/ip').text // or def res2 = 'https://httpbin.org/ip'.toURL().text post可以这么用 import groovy.json.JsonOutput import groovy.json.JsonSlurper /** * 发送 HTTP POST 请求 * @param ur

丿灬安之若死 6620

数字摄影与摄像中的图像信号处理器(ISP):流程与经典算法详解

图像信号处理器(Image Signal Processor, ISP)是现代数字成像系统(如智能手机、数码相机、网络摄像头等)中的核心组件,扮演着将图像传感器(如CMOS或CCD)捕获的原始光电信号转换为高质量、可供观看或进一步处理的数字图像的关键角色。在数字摄影和摄像的整个链路中,光线首先通过镜头(Lens)聚焦到图像传感器上,传感器将光信号转换为模拟电信号,随后经过模数转换(A/D转换)变为原始的数字图像信号。

qq_44682523的博客 3741

解决ADS1.2报错Cannot obtain license

报错如下 将licenses文件下的license内容进行修改: 修改为如下内容即可。 # # Generated on 2021-dec-1 by licwizard # PACKAGE ads armlmd 1.200 E32F0DE5161D COMPONENTS="armasm compiler bats armulate axd adwu fromelf armlink codewarrior armsd" INCREMENT ads armlmd 1.200 permanent uncounte

qq_46110320的博客 3469

Java httpClient发送post请求工具类

Java httpClient发送post请求工具类 public static String send(String url, JSONObject jsonObject, String encoding) throws IOException { String body = ""; //创建httpclient对象 CloseableHttpClient client = HttpClients.createDefault(); //创

weixin_44021888的博客 1463

SAR成像系列:【3】合成孔径雷达(SAR)的二维回波信号与简单距离多普勒(RD)算法 (附matlab代码)

二维回波信号分析

zr2006_7的专栏 2万+

Groovy RestClient 流自动关闭的问题

Groovy RestClient 自动关闭流的问题问题描述问题代码源码分析问题解决扩展 问题描述 groovy 中使用http-builder-0.72.jar读取图片字节流,遇到 Attempted read from closed stream异常。 问题代码 import groovyx.net.http.HTTPBuilder import groovyx.net.http.Method...

lg409966136的博客 613

基于激光雷达的目标跟随功能移植到自己的ROS机器人小车上

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录前言一、下载目标跟随的源码二、修改话题名称1.修改/cmd_vel话题名称2.修改/scan话题名称3.修改双电机正反转4.目标跟随功能测试 前言 本人尝试把github上的一个目标跟随项目移植到自己的机器人小车上,并且成功了,最终小车可以跟着人移动,在这里分享一下心得。基于激光雷达的目标跟随,通过获取激光雷达的信息,跟随最近的物体。 提示:以下是本篇文章正文内容,下面案例可供参考 一、下载目标跟随的源码 源码地址:https:

weixin_44574633的博客 4466

从零搭建智能视觉小车:OpenART图像处理+增强现实避坑指南

本文详细指导如何从零搭建智能视觉小车,重点介绍OpenART图像处理与增强现实技术在AprilTag识别中的应用。涵盖硬件选型、环境配置、算法优化及实战调试全流程,特别分享智能汽车竞赛中的避坑技巧和优化方案,帮助开发者构建稳定高效的视觉系统。

yhn456789的博客 1058

RESTClient使用

import groovy.json.JsonOutput import groovyx.net.http.ContentType import groovyx.net.http.RESTClientRESTClient http = new RESTClient("http://localhost:8080/") def response = http.get(contentType : Cont

大山 4239

Xiaojie雷达之路---毫米波雷达基础知识---角度估计

本篇文章主要介绍毫米波雷达的基础知识中的角度估计,对于本篇文章主要回答5个问题 1.在雷达的前方,如何估计前方一个物体的角度 2.角度测量的准确性 3.如何测量多个物体的角度 4.雷达可测的角度的视场最大值为多少 5.角度分辨率取决于什么因素 文章目录估计雷达前面一个物体的角度角度测量的准确性雷达的最大角视场测量雷达前方多个距离和速度相同的物体角度分辨率角度估计的流程 估计雷达前面一个物体的角度 估计一个物体的角度,最少需要两根接收天线 发射天线发送一个chirp,经过物体发射后信号,信号分别被第一根天

XiaoJie的博客 1万+

http接口测试工具——RESTClient

https://www.cnblogs.com/jing1617/p/6430137.html   摘要: RESTClient是用java Swing编写的基于http协议的接口测试工具,工具比较灵巧,便于做接口的调试,源码在官网上可以下到,感兴趣的可以研究一下 WizTools.org RESTClient is a Java Swing application for testing ...

EminentBoy的博客 1411

在ABAQUS中使用VUMAT子程序实现Hashin失效准则的详细解析与实践:深入探讨复合材料模拟仿真的高级编程技巧

Hashin失效准则是由材料科学家Shlomo Hashin于1962年提出的一种基于能量方法的多向失效理论,主要用于预测复合材料的破坏行为。与传统的单向失效理论不同,Hashin准则考虑了材料内部的多种独立破坏机制,如基体断裂、界面脱粘、纤维断裂等,这些机制在不同应力状态下可能同时或分别发生。通过计算各个机制的能量释放率,Hashin失效准则能够更为准确地预测复合材料在复杂应力状态下的破坏行为。

qq_38334677的博客 1953

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

测试就是这么简单,rest-assured

关于rest-assuredrest-assured 是一个能够简化测试rest服务的Java DSL,像ruby或者python一样的动态语言去测试和验证http服务。基于java并且兼容了groovy动态语言的特性,使我们像写脚本语言一样去测试http服务。例如:你的http服务( http://localhost:8080/lotto/{id})返回一个如下json:{ "lotto":

u012516914的专栏 1万+

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

18、Camunda Script Task Groovy 发送POST请求

Groovy 发送POST Rest接口请求引入依赖流程Groovy脚本 发送POST请求开启流程案例Rest接口2、groovy 案例22.1、流程和groovy脚本2.2、流程开启设置变量 引入依赖 <!--Spring boot 集成camunda--> <dependency> <groupId>org.camunda.bpm.springboot</groupId> <artifa

红鹰 2059

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

使用GROOVY脚本语言发送get和post请求

使用GROOVY脚本语言发送get和post请求 2018年9月10日 用到的包 import org.apache.http.NameValuePair import org.apache.http.client.entity.UrlEncodedFormEntity import org.apache.http.client.methods.CloseableHttpRespons...

qq_38924181的博客 1万+

groovy的HttpUtils工具类post和get请求

import groovy.json.JsonOutput import org.apache.commons.lang.StringUtils import org.apache.http.HttpResponse import org.apache.http.NameValuePair import org.apache.http.client.HttpClient import org.a...

Xiazhiyu_whu的博客 3840

hbase和couchdb_使用CouchDB和Groovy的RESTClient进行REST

到目前为止,本专栏文章系列已经探索了使用Google和Amazon平台的云计算。 尽管它们的实现和结构不同,但这两个平台都可以实现快速且可扩展的部署。 它们使前所未有的快速,廉价地组装,测试,运行和维护Java应用程序成为可能。 但是,云并不是当今影响Java开发速度的唯一因素。 开源解决方案还使您能够快速组装软件应用程序,因为您不再需要编写太多代码。 编写自己的对象关系映射(ORM),日志记...

cusi77914的博客 345

Groovy和HTTP

本文最初发表在GroovyMag的 2012年12月号上。 Groovy使与Web交互更容易的一些不同方式 Groovy的主要好处之一是它简化了我们在Java中处理的一些常见方案。 带有条件,错误处理和许多其他问题的复杂代码可以非常简洁易懂的方式表示。 本文将介绍一些与通过HTTP与内容进行交互有关的便捷Groovy主义。 首先,我们将研究一些添加到标准Java类中的语法糖,这些语法可以...

1156

基于Groovy+HttpRestful的超轻量级的接口测试用例配置的设计方案及DEMO实现

目标 设计一个轻量级测试用例框架,接口测试编写者只需要编写测试用例相关的内容(入参及结果校验),不需要理会系统的实现,不需要写跟测试校验无关的内容。 思路 测试用例分析 一个用例由以下部分组成: (1) 测试用例名称 ; (2) 接口名及URL/Path; (3) 接口入参; (4) 接口返回结果校验。 测试框架需要读取用例配置信息,根据指定接口及入参调用服务,并根据指定校验函数来对接...

weixin_30588827的博客 360

groovy 操作http请求

话不多说,先上一段代码,如果你使用过jquery,看到这样的代码是不是很亲切呢? [code="java"] def http = new HTTPBuilder('http://www.baidu.com') http.request(GET,TEXT) { //设置url相关信息 uri.path='/' uri.query=[a:'1',b:2] //设置请求头信息...

给生活加点盐 3471

nGrinder中快速编写groovy脚本04-发送POST请求

POST请求分类:1、根据是否修改代码,分为两种方式:一种是在UI界面添加后自动生成脚本,一种是直接在脚本中添加2、根据请求参数的不同,主要可以分为两种:param为key value格式body为json格式一、通过UI方式发送POST请求–key/value参数通过 UI 设置:脚本 -> 新建脚本 -> 显示高级配置当选择了请求方法为POST后,在高级配置中...

weixin_33937913的博客 502

用 groovy post 数据到页面

下面的代码修改url, vars之后可以直接运行def encode = utf8;def url = ... //TODO: change here!def vars = [uid, 12345, name:myname] //TODO: change here!def en = {k,v->   return URLEncoder.encode(k, encode) + "="

explorers的专栏 2174
上一篇: 2011 程序员薪资调查报告全文发布
下一篇: Apache Solr 概念、安装与导入数据库中表格的数据到索引(适合新手)
欧德曼
博客等级 码龄19年 63粉丝 82原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值