jsp+servlet基本增删改查

新增

package com.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.registry.infomodel.User;

import com.dao.UserDao;
import com.entity.TblUser;

public class add extends HttpServlet {

    /**
     * The doGet method of the servlet. <br>
     *
     * This method is called when a form has its tag value method equals to get.
     * 
     * @param request the request send by the client to the server
     * @param response the response send by the server to the client
     * @throws ServletException if an error occurred
     * @throws IOException if an error occurred
     */
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        request.setCharacterEncoding("UTF-8");
        response.setCharacterEncoding("UTF-8");
        PrintWriter out = response.getWriter();
        
        String name=request.getParameter("name");
        UserDao ud=new UserDao();
        TblUser u=ud.getUserByName(name);
        if(u!=null){
            request.setAttribute("msg", "该用户名已经存在");
            request.getRequestDispatcher("add.jsp").forward(request, response);        
        }else{
            String pass=request.getParameter("password");
            String status=request.getParameter("status");
            u=new TblUser();
            u.setName(name);
            u.setPassword(pass);
            u.setStatus(Integer.parseInt(status));
            int r=ud.add(u);
            if(r>0){
                out.print("<script>alert('恭喜你,用户添加成功!');close();</script>");
            }else{
                out.print("<script>alert('对不起,用户添加失败,请稍后重试!');close();</script>");
            }
        }
    }

    /**
     * The doPost method of the servlet. <br>
     *
     * This method is called when a form has its tag value method equals to post.
     * 
     * @param request the request send by the client to the server
     * @param response the response send by the server to the client
     * @throws ServletException if an error occurred
     * @throws IOException if an error occurred
     */
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        doGet(request, response);
//        response.setContentType("text/html");
//        PrintWriter out = response.getWriter();
//        out
//                .println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
//        out.println("<HTML>");
//        out.println("  <HEAD><TITLE>A Servlet</TITLE></HEAD>");
//        out.println("  <BODY>");
//        out.print("    This is ");
//        out.print(this.getClass());
//        out.println(", using the POST method");
//        out.println("  </BODY>");
//        out.println("</HTML>");
//        out.flush();
//        out.close();
    }

}
 

 删除 

package com.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dao.UserDao;

public class delete extends HttpServlet {

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		String id=request.getParameter("id");
		int r=new UserDao().delById(Integer.parseInt(id));
		
		
		
		
		
		response.sendRedirect("getall");
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
//		response.setContentType("text/html");
//		PrintWriter out = response.getWriter();
//		out
//				.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
//		out.println("<HTML>");
//		out.println("  <HEAD><TITLE>A Servlet</TITLE></HEAD>");
//		out.println("  <BODY>");
//		out.print("    This is ");
//		out.print(this.getClass());
//		out.println(", using the POST method");
//		out.println("  </BODY>");
//		out.println("</HTML>");
//		out.flush();
//		out.close();
	}

}

查询

package com.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.dao.UserDao;
import com.entity.TblUser;

public class getall extends HttpServlet {

	/**
	 * The doGet method of the servlet. <br>
	 * 
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request
	 *            the request send by the client to the server
	 * @param response
	 *            the response send by the server to the client
	 * @throws ServletException
	 *             if an error occurred
	 * @throws IOException
	 *             if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		HttpSession session = request.getSession();
		Cookie[] cookies=request.getCookies();
		Cookie ckUname;
		Cookie ckUpass;
		String uname="";
		String upass="";
		if(cookies!=null){
			for (int i = 0; i < cookies.length; i++) {
				ckUname=cookies[i];
				if(ckUname.getName().equals("uname")  ){
					uname=ckUname.getValue();
				}
				else if(ckUname.getName().equals("upass")  ){
					upass=ckUname.getValue();
				}
			}
		}
		if ("abc".equals(uname) && "123".equals(upass)) {
			session.setAttribute("uname", uname);
		}else{
			uname = request.getParameter("uname");
			upass = request.getParameter("upass");
			if ("abc".equals(uname) && "123".equals(upass)) {
				session.setAttribute("uname", uname);
				
				ckUname=new Cookie("uname",uname);
				ckUpass=new Cookie("upass",upass);
				ckUname.setMaxAge(24*60*60);
				ckUpass.setMaxAge(24*60*60);
				response.addCookie(ckUname);
				response.addCookie(ckUpass);
				
			}else{
				response.sendRedirect("index.jsp");
				return;
			}
		}
		TblUser user = new TblUser();
		user.setName(request.getParameter("name"));
		String sts = request.getParameter("status");
		if (sts != null && !sts.equals("")) {
			user.setStatus(Integer.parseInt(sts));
		}
		System.out.println(sts);
		List list = new UserDao().getAll(user);
		request.setAttribute("list", list);
		request.getRequestDispatcher("getall.jsp").forward(request, response);

	}

	/**
	 * The doPost method of the servlet. <br>
	 * 
	 * This method is called when a form has its tag value method equals to
	 * post.
	 * 
	 * @param request
	 *            the request send by the client to the server
	 * @param response
	 *            the response send by the server to the client
	 * @throws ServletException
	 *             if an error occurred
	 * @throws IOException
	 *             if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
		/*
		 * response.setContentType("text/html"); PrintWriter out =
		 * response.getWriter(); out .println("<!DOCTYPE HTML PUBLIC
		 * \"-//W3C//DTD HTML 4.01 Transitional//EN\">"); out.println("<HTML>");
		 * out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
		 * out.println(" <BODY>"); out.print(" This is ");
		 * out.print(this.getClass()); out.println(", using the POST method");
		 * out.println(" </BODY>"); out.println("</HTML>"); out.flush();
		 * out.close();
		 */
	}

}

更新

package com.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.dao.UserDao;
import com.entity.TblUser;

public class update extends HttpServlet {

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		HttpSession session=request.getSession();
		if(session.getAttribute("uname")==null){
			response.sendRedirect("index.jsp");
			return ;
		}
			
		String id=request.getParameter("id");
		TblUser user=new UserDao().getUserById(id);
		session.setAttribute("user", user);
		PrintWriter out = response.getWriter();
		out.print("<script>open('update.jsp','update','width=200, height=300');history.go(-1)</script>");
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
//		response.setContentType("text/html");
//		PrintWriter out = response.getWriter();
//		out
//				.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
//		out.println("<HTML>");
//		out.println("  <HEAD><TITLE>A Servlet</TITLE></HEAD>");
//		out.println("  <BODY>");
//		out.print("    This is ");
//		out.print(this.getClass());
//		out.println(", using the POST method");
//		out.println("  </BODY>");
//		out.println("</HTML>");
//		out.flush();
//		out.close();
	}

}

数据库配置呢

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class BaseDao {

    static {
        try{
            Class.forName("com.mysql.cj.jdbc.Driver");
        }catch(ClassNotFoundException e){
            e.printStackTrace();
        }
    }


    /**
     * 连接mysql数据库
     */
    public static Connection getConnection(){
        Connection conn = null;
        try {
            //    driver-class-name: com.mysql.cj.jdbc.Driver
            conn = java.sql.DriverManager.getConnection("jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC", "root", "root");

        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        return conn;

    }


    /**
     * 关闭数据库连接
     */
    public static void closeConnection(Connection conn, PreparedStatement pstmt, ResultSet rs) {
        if (conn != null) {
            try {
             if(rs!=null){
                 rs.close();
                    }
                if(pstmt!=null){
                    pstmt.close();
                }
                conn.close();

            } catch (SQLException e) {
                throw new RuntimeException(e);
            }

        }
    }
}

userDao

package com.dao;

import java.util.ArrayList;
import java.util.List;

import com.entity.TblUser;

public class UserDao extends BaseDao {
	public List getAll(TblUser u){
		List list=new ArrayList();
		String sql="SELECT * FROM [njry].[dbo].[tbl_user] where 1=1 ";
		if(u!=null){
			if(u.getName()!=null && !u.getName().trim().equals("")){
				sql+=" and name like '%" +u.getName()+"%'";
			}
			if(u.getStatus()!=null){
				sql+=" and status =" +u.getStatus();
			}
		}
		System.out.println(sql);
		try {
			conn=getConn();
			pstmt=conn.prepareStatement(sql);
			rs=pstmt.executeQuery();
			while (rs.next()) {
				TblUser user = new TblUser();
				user.setName(rs.getString("name"));
				user.setOperator_id(rs.getInt("operator_id"));
				user.setPassword(rs.getString("password"));
				user.setStatus(rs.getInt("status"));
				list.add(user);
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return list;
	}
	

	public TblUser getUserByName(String name){

		TblUser user = null;
		String sql="SELECT * FROM [njry].[dbo].[tbl_user] where name = '" +name+"'";
	
		try {
			conn=getConn();
			pstmt=conn.prepareStatement(sql);
			rs=pstmt.executeQuery();
			if (rs.next()) {
				user=new TblUser();
				user.setName(rs.getString("name"));
				user.setOperator_id(rs.getInt("operator_id"));
				user.setPassword(rs.getString("password"));
				user.setStatus(rs.getInt("status"));
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return user;
	}

	public TblUser getUserById(String id){

		TblUser user = null;
		String sql="SELECT * FROM [njry].[dbo].[tbl_user] where operator_id = '" +id+"'";
	
		try {
			conn=getConn();
			pstmt=conn.prepareStatement(sql);
			rs=pstmt.executeQuery();
			if (rs.next()) {
				user=new TblUser();
				user.setName(rs.getString("name"));
				user.setOperator_id(rs.getInt("operator_id"));
				user.setPassword(rs.getString("password"));
				user.setStatus(rs.getInt("status"));
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return user;
	}

	public int add(TblUser u){

		int r = 0;
		String sql="insert into tbl_user values(?,?,?)";
	
		try {
			conn=getConn();
			pstmt=conn.prepareStatement(sql);
			pstmt.setString(1, u.getName());
			pstmt.setString(2, u.getPassword());
			pstmt.setInt(3, u.getStatus());
			r=pstmt.executeUpdate();
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return r;
	}

	public int delById(int id){

		int r = 0;
		String sql="delete from tbl_user where operator_id=?";
	
		try {
			conn=getConn();
			pstmt=conn.prepareStatement(sql);
			pstmt.setInt(1, id);
			r=pstmt.executeUpdate();
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return r;
	}
	
	public static void main(String[] args) {
		System.out.println(new UserDao().getUserById("2").getName());
	}

	public int update(TblUser u) {
		// TODO Auto-generated method stub
		int r = 0;
		String sql="update tbl_user set password=?,status=? where operator_id=?";
	
		try {
			conn=getConn();
			pstmt=conn.prepareStatement(sql);
			pstmt.setString(1, u.getPassword());
			pstmt.setInt(2, u.getStatus());
			pstmt.setInt(3, u.getOperator_id());
			r=pstmt.executeUpdate();
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return r;
	}
}

前端页面有

新增

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>add</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript">
	function cheAll(){
		var name=document.form1.name.value;
		var password=document.form1.password.value;
		if(name.length==0 || password.length==0){
			alert("用户名密码必填");
			return false;
		}
		return true;
	}
	</script>
  </head>
  
  <body>
  <span style="color: red">${requestScope.msg }</span>
<form id="form1" name="form1" method="post" action="add" onsubmit="return cheAll()">
<table width="200" border="0" align="center" cellpadding="10">
  <tr> 
    <td align="left"><strong>姓名</strong></td>
    <td><input name="name"> </td>
  </tr>
  <tr> 
    <td align="left"><strong>密码</strong></td>
    <td><input name="password"></td>
  </tr>
  <tr> 
    <td align="left"><strong>状态</strong></td> 
    <td>
      <select name="status" id="select">      
        <option value="1">有效</option>
        <option value="0">无效</option>
      </select>
    </td>
  </tr>
  <tr> 
    <td align="left"><input type="submit" value="提交"/> </td> 
    <td>&nbsp;</td>
  </tr>


</table>	
</form>
  </body>
</html>

查询

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript">
	function toadd(){
		open('add.jsp','add','width=200, height=300');
	}
	function dodel(op,id){
		if(confirm("确认删除用户"+op)){
			location.href('delete?id='+id);
		}
	}
	</script>
  </head>
  
  <body>
  <a href="javascript:toadd()">创建用户</a>
<form id="form1" name="form1" method="post" action="getall">
<table width="600" border="0" align="center" cellpadding="10">
  <tr>
    <td>按姓名查找:</td>
    <td><input name="name" type="text" /></td>
    <td>
      <select name="status" id="select">      
        <option value="">请选择</option>
        <option value="1">有效</option>
        <option value="0">无效</option>
      </select></td>
    <td><input type="submit" name="button" id="button" value="提交" /></td>
  </tr> 
</table>
</form>

<table width="600" border="0" align="center" cellpadding="10">
  <tr>
    <td align="left"><strong>帐号</strong></td>
    <td align="left"><strong>姓名</strong></td>
    <td align="left"><strong>密码</strong></td>
    <td align="left"><strong>状态</strong></td>
    <td align="left"><strong>删除</strong></td>
    <td align="left"><strong>修改</strong></td>
  </tr>
  <c:forEach var="user" items="${requestScope.list}">
  <tr>
    <td>${user.operator_id }</td>
    <td>${user.name }</td>
    <td>${user.password }</td>
    <td>${user.status }</td>
    <td><a href="javascript:dodel('${user.name }','${user.operator_id }')">删除</a> </td>
    <td><a href="update?id=${user.operator_id }">修改</a> </td>
  </tr>
  </c:forEach>
</table>	

  </body>
</html>

 首页

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>  
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  <body>
<form action="getall" method="post">
   用户名:<input name="uname"> <br>
   密码:<input name="upass" ><br>
   <input type="submit" value="提交">
<form>
  </body>
</html>

更新

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>update</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript">
	function cheAll(){
		var name=document.form1.name.value;
		var password=document.form1.password.value;
		if(name.length==0 || password.length==0){
			alert("用户名密码必填");
			return false;
		}
		return true;
	}
	</script>
  </head>
  
  <body> 
<form id="form1" name="form1" method="post" action="doupdate" onsubmit="return cheAll()">
<input type="hidden" name="id" value="${user.operator_id }">
<table width="200" border="0" align="center" cellpadding="10">
  <tr> 
    <td align="left"><strong>姓名</strong></td>
    <td><input name="name" value="${sessionScope.user.name }" readonly="readonly" style="border: 0"> </td>
  </tr>
  <tr> 
    <td align="left"><strong>密码</strong></td>
    <td><input name="password" value="${user.password }"></td>
  </tr>
  <tr> 
    <td align="left"><strong>状态</strong></td> 
    <td>
      <select name="status" id="select">      
        <option value="1" <c:if test="${user.status==1 }" >selected</c:if>>有效</option>
        <option value="0" <c:if test="${user.status==0 }" >selected</c:if>>无效</option>
      </select>
    </td>
  </tr>
  <tr> 
    <td align="left"><input type="submit" value="提交"/> </td> 
    <td>&nbsp;</td>
  </tr>


</table>	
</form>
  </body>
</html>

如果是pom项目,pom文件如下

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>demo2</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>demo2</name>
    <packaging>war</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
        <junit.version>5.9.1</junit.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.13</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.2</version>
            </plugin>
        </plugins>
    </build>
</project>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值