一齐学习,NHibernate开发范例。

发贴心情转:基于NHibernate的三层结构应用程序开发初步

本文并不是去详细的介绍如何使用NHibernate,而是通过一个简单的例子来演示基于NHibernate的三层结构应用程序开发过程。关于NHibernate的有关文档,DDL已经做了汉化,但是由于英文文档自身就不完善,所以汉化后也是不全。菩提树在一篇《NHibernate学习之路》随笔中谈到了学习NHibernate遇到的困难,也希望大家把自己在使用NHibernate中的经验和心得能够共享出来,与大家分享。另外我也是刚开始接触NHiernate,有错误之处还请大家指点。

第一步:准备数据表

在这里用一个最简单的例子,有一张关于的用户的表,有编号,姓名,密码,Email地址和最后一次的登录时间几个字段。

None.gifCreate Table Users(
None.gif
None.gif    LogonID varchar(20) Primary key,
None.gif
None.gif    Name varchar(40),
None.gif
None.gif    Password varchar(20),
None.gif
None.gif    EmailAddress varchar(40) ,
None.gif
None.gif    LastLogon datetime
None.gif
None.gif)

第二步:创建需要被持久化的类

在.NET中创建一个NHibernateWebDemo.Model的工程,添加User实体类。

None.gif//User.cs
None.gif
None.gifusing System;
None.gif
None.gifnamespace NHibernateWebDemo.Model
None.gif
ExpandedBlockStart.gif ContractedBlock.gif dot.gif{
InBlock.gif
InBlock.gif    public class User
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif     dot.gif{
InBlock.gif
InBlock.gif        public User()
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{  
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        private string id;
InBlock.gif
InBlock.gif        private string userName;
InBlock.gif
InBlock.gif        private string password;
InBlock.gif
InBlock.gif        private string emailAddress;
InBlock.gif
InBlock.gif        private DateTime lastLogon;
InBlock.gif
InBlock.gif        public string Id
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif            get dot.gif{ return id; }
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif            set dot.gif{ id = value; }
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public string UserName
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif            get dot.gif{ return userName; }
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif            set dot.gif{ userName = value; }
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public string Password
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif            get dot.gif{ return password; }
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif            set dot.gif{ password = value; }
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public string EmailAddress
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif            get dot.gif{ return emailAddress; }
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif            set dot.gif{ emailAddress = value; }
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public DateTime LastLogon
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif            get dot.gif{ return lastLogon; }
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif            set dot.gif{ lastLogon = value; }
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
ExpandedSubBlockEnd.gif    }
InBlock.gif
ExpandedBlockEnd.gif}

第三步:创建持久化映射文件

该文件的命名为User.hbm.xml,并且与User.cs放在同一个目录里。设置该文件的生成操作属性为“嵌入的资源”,这一点要切记。另外,使用编号当作主键,由用户输入,所以在映射文件中用assigned。

None.gif<?xml version="1.0" encoding="utf-8" ?>
None.gif
None.gif<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
None.gif
None.gif        <class name="NHibernateWebDemo.Model.User, NHibernateWebDemo.Model" table="users">
None.gif
None.gif               <id name="Id" column="LogonId" type="String" length="20">
None.gif
None.gif                       <generator class="assigned" />
None.gif
None.gif               </id>
None.gif
None.gif               <property name="UserName" column= "Name" type="String" length="40"/>
None.gif
None.gif               <property name="Password" type="String" length="20"/>
None.gif
None.gif               <property name="EmailAddress" type="String" length="40"/>
None.gif
None.gif               <property name="LastLogon" type="DateTime"/>
None.gif
None.gif        </class>
None.gif
None.gif</hibernate-mapping>

 

   编辑  帖子管理  顶部
帅哥哟,离线,有人找我吗? mark
    image1.gif
    level0.gif
    等级:游手好闲
    文章:58
    积分:568
    魅力:422
    股票:0
    存款:0
    总资金:8341
    登陆:4
    注册:2007-01-31
    状态:[正常]
  点击查看mark的家

发贴IP已设置保密 2007-01-31 12:21·短信 ·好友 ·资料 ·搜索 ·邮箱 ·引用 ·回复2
发贴心情

第四步:进行配置文件的设置

在配置文件中,我们要告诉NHibernate所使用的数据库是什么,以及如何连接该数据库。

None.gif<configSections>
None.gif
None.gif    <section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
None.gif
None.gif  </configSections>
None.gif
None.gif<nhibernate>
None.gif
None.gif               <add key="hibernate.connection.provider"          
None.gif
None.gif                       value="NHibernate.Connection.DriverConnectionProvider"/>
None.gif
None.gif               <add key="hibernate.dialect"                      
None.gif
None.gif                       value="NHibernate.Dialect.MsSql2000Dialect"/>
None.gif
None.gif               <add key="hibernate.connection.driver_class"          
None.gif
None.gif                       value="NHibernate.Driver.SqlClientDriver"/>
None.gif
None.gif               <add key="hibernate.connection.connection_string"
None.gif
None.gif                       value="server=.;uid=sa;pwd=sa;database=test"/>
None.gif
None.gif        </nhibernate>

第五步:编写数据访问层的公用类

在这里,编写了两个公用的类,分别进行Session的创建和实体的操作。在这两个类中用单件模式,来限制Session的创建。为了做到与具体的应用程序无关,在这里把程序集的名称作为参数,传递给OpenSession()方法。可以把这两个类单独放在一个名为Common的工程下,这里先把它们放在DAL层中。这两个类只是个人的一种写法,大家可以自行去编写。

None.gif//SessionFactory.cs
None.gif
None.gifusing System;
None.gif
None.gifusing System.Reflection;
None.gif
None.gifusing System.Data;
None.gif
None.gifusing NHibernate;
None.gif
None.gifusing NHibernate.Cfg;
None.gif
None.gifusing NHibernate.Tool.hbm2ddl;
None.gif
None.gifnamespace NHibernateWebDemo.DAL
None.gif
ExpandedBlockStart.gif ContractedBlock.gif dot.gif{
InBlock.gif
InBlock.gif    public class SessionFactory
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif     dot.gif{
InBlock.gif
InBlock.gif        public SessionFactory()
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
InBlock.gif            
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        private static ISessionFactory sessions;
InBlock.gif
InBlock.gif        private static Configuration cfg;
InBlock.gif
InBlock.gif        static readonly object padlock = new object();
InBlock.gif
InBlock.gif        public static ISession OpenSession(string AssemblyName)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
InBlock.gif            if(sessions == null)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif             dot.gif{
InBlock.gif
InBlock.gif                lock(padlock)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif                 dot.gif{
InBlock.gif
InBlock.gif                    if(sessions == null)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif                     dot.gif{
InBlock.gif
InBlock.gif                        BuildSessionFactory(AssemblyName);
InBlock.gif
ExpandedSubBlockEnd.gif                    }
InBlock.gif
ExpandedSubBlockEnd.gif                }
InBlock.gif
ExpandedSubBlockEnd.gif            }
InBlock.gif
InBlock.gif            return sessions.OpenSession();
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        private static void BuildSessionFactory(string AssemblyName)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
   收藏到天极网摘 编辑  帖子管理  顶部
帅哥哟,离线,有人找我吗? mark
    image1.gif
    level0.gif
    等级:游手好闲
    文章:58
    积分:568
    魅力:422
    股票:0
    存款:0
    总资金:8341
    登陆:4
    注册:2007-01-31
    状态:[正常]
  点击查看mark的家

发贴IP已设置保密 2007-01-31 12:21·短信 ·好友 ·资料 ·搜索 ·邮箱 ·引用 ·回复3
发贴心情
cfg = new Configuration();
InBlock.gif
InBlock.gif            cfg.AddAssembly(AssemblyName);
InBlock.gif
InBlock.gif            sessions = cfg.BuildSessionFactory();
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
ExpandedSubBlockEnd.gif    }
InBlock.gif
ExpandedBlockEnd.gif}

None.gif//EntityControl.cs
None.gif
None.gifusing System;
None.gif
None.gifusing System.Collections;
None.gif
None.gifusing NHibernate;
None.gif
None.gif
None.gif
None.gifnamespace NHibernateWebDemo.DAL
None.gif
ExpandedBlockStart.gif ContractedBlock.gif dot.gif{
InBlock.gif
InBlock.gif    public class EntityControl
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif     dot.gif{
InBlock.gif
InBlock.gif        private static EntityControl entity;
InBlock.gif
InBlock.gif        private string _AssemblyName;
InBlock.gif
InBlock.gif        static readonly object padlock = new object();
InBlock.gif
InBlock.gif        public static EntityControl CreateEntityControl(string AssemblyName)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
InBlock.gif            if(entity == null)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif             dot.gif{
InBlock.gif
InBlock.gif                lock(padlock)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif                 dot.gif{
InBlock.gif
InBlock.gif                    if(entity == null)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif                     dot.gif{
InBlock.gif
InBlock.gif                        entity = new EntityControl();
InBlock.gif
InBlock.gif                        entity._AssemblyName = AssemblyName;
InBlock.gif
ExpandedSubBlockEnd.gif                    }
InBlock.gif
ExpandedSubBlockEnd.gif                }
InBlock.gif
ExpandedSubBlockEnd.gif            }
InBlock.gif
InBlock.gif            return entity;
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public void AddEntity(Object entity)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
InBlock.gif            ISession session = SessionFactory.OpenSession(_AssemblyName);
InBlock.gif
InBlock.gif            ITransaction transaction = session.BeginTransaction();
InBlock.gif
InBlock.gif            try
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif             dot.gif{
InBlock.gif
InBlock.gif                session.Save(entity);
InBlock.gif
InBlock.gif                transaction.Commit();
InBlock.gif
ExpandedSubBlockEnd.gif            }
InBlock.gif
InBlock.gif            catch(Exception ex)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif             dot.gif{
InBlock.gif
InBlock.gif                transaction.Rollback();
InBlock.gif
InBlock.gif                throw ex;
InBlock.gif
ExpandedSubBlockEnd.gif            }
InBlock.gif
InBlock.gif            finally
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif             dot.gif{
InBlock.gif
InBlock.gif                session.Close();
InBlock.gif
ExpandedSubBlockEnd.gif            }
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public void UpdateEntity(Object entity,Object key)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
InBlock.gif            ISession session = SessionFactory.OpenSession(_AssemblyName);
InBlock.gif
InBlock.gif            ITransaction transaction = session.BeginTransaction();
InBlock.gif
InBlock.gif            try
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif             dot.gif{
InBlock.gif
InBlock.gif                session.Update(entity,key);
InBlock.gif
InBlock.gif                transaction.Commit();
InBlock.gif
ExpandedSubBlockEnd.gif            }
InBlock.gif
InBlock.gif            catch(Exception ex)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif             dot.gif{
InBlock.gif
InBlock.gif                transaction.Rollback();
InBlock.gif
InBlock.gif                throw ex;
InBlock.gif
ExpandedSubBlockEnd.gif            }
InBlock.gif
InBlock.gif            finally
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif             dot.gif{
InBlock.gif
InBlock.gif                session.Close();
InBlock.gif
   编辑  帖子管理  顶部
帅哥哟,离线,有人找我吗? mark
    image1.gif
    level0.gif
    等级:游手好闲
    文章:58
    积分:568
    魅力:422
    股票:0
    存款:0
    总资金:8341
    登陆:4
    注册:2007-01-31
    状态:[正常]
  点击查看mark的家

发贴IP已设置保密 2007-01-31 12:21·短信 ·好友 ·资料 ·搜索 ·邮箱 ·引用 ·回复4
发贴心情
ExpandedSubBlockEnd.gif            }
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public void DeleteEntity(object entity)
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif
InBlock.gif            ISession session = SessionFactory.OpenSession(_AssemblyName);
InBlock.gif
InBlock.gif            ITransaction transaction = session.BeginTransaction();
InBlock.gif
InBlock.gif            try
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
InBlock.gif
InBlock.gif                session.Delete(entity);
InBlock.gif
InBlock.gif                transaction.Commit();
InBlock.gif
ExpandedSubBlockEnd.gif            }
InBlock.gif
InBlock.gif            catch(Exception ex)
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
InBlock.gif
InBlock.gif                transaction.Rollback();
InBlock.gif
InBlock.gif                throw ex;
InBlock.gif
ExpandedSubBlockEnd.gif            }
InBlock.gif
InBlock.gif            finally
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
InBlock.gif
InBlock.gif                session.Close();
InBlock.gif
ExpandedSubBlockEnd.gif            }
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public IList GetEntities(string strHQL)
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif
InBlock.gif            IList lst;
InBlock.gif
InBlock.gif            ISession session = SessionFactory.OpenSession(_AssemblyName);
InBlock.gif
InBlock.gif            ITransaction transaction = session.BeginTransaction();
InBlock.gif
InBlock.gif
InBlock.gif
InBlock.gif            lst=session.Find(strHQL);
InBlock.gif
InBlock.gif            transaction.Commit();
InBlock.gif
InBlock.gif            session.Close();
InBlock.gif
InBlock.gif            return lst;
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
ExpandedSubBlockEnd.gif    }
InBlock.gif
ExpandedBlockEnd.gif}

 

   编辑  帖子管理  顶部
帅哥哟,离线,有人找我吗? mark
    image1.gif
    level0.gif
    等级:游手好闲
    文章:58
    积分:568
    魅力:422
    股票:0
    存款:0
    总资金:8341
    登陆:4
    注册:2007-01-31
    状态:[正常]
  点击查看mark的家

发贴IP已设置保密 2007-01-31 12:21·短信 ·好友 ·资料 ·搜索 ·邮箱 ·引用 ·回复5
发贴心情

第六步:编写数据访问层

创建一个名为NHibernateWebDemo.DAL的工程,数据访问层的代码编写非常简单,在创建EntityControl的实例时,需要把Model的程序集名称作为参数传入,可以通过配置文件来避免程序集名称的硬编码。

None.gif//UserDAL.cs
None.gif
None.gifusing System;
None.gif
None.gifusing System.Collections;
None.gif
None.gifusing NHibernateWebDemo.Model;
None.gif
None.gifnamespace NHibernateWebDemo.DAL
None.gif
ExpandedBlockStart.gif ContractedBlock.gif dot.gif{
InBlock.gif
InBlock.gif    public class UserDAL
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif     dot.gif{
InBlock.gif
InBlock.gif        private EntityControl control;
InBlock.gif
InBlock.gif        public UserDAL()
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
InBlock.gif            control = EntityControl.CreateEntityControl("NHibernateWebDemo.Model");
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public void AddUser(User user)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
InBlock.gif            control.AddEntity(user);
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public void UpdateUser(User user,string Id)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
InBlock.gif            control.UpdateEntity(user,user.Id);
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public void DeleteUser(User user)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
InBlock.gif            control.DeleteEntity(user);
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public IList GetAllUsers(string strHQL)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
InBlock.gif            return control.GetEntities(strHQL);
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
ExpandedSubBlockEnd.gif    }
InBlock.gif
ExpandedBlockEnd.gif}

第七步:编写业务逻辑层

建立NHibernateWebDemo.BLL工程,为了简单期间,在业务逻辑层中我没有做任何的业务检测。

None.gif//UserBLL.cs
None.gif
None.gifusing System;
None.gif
None.gifusing System.Collections;
None.gif
None.gifusing NHibernateWebDemo.DAL;
None.gif
None.gifusing NHibernateWebDemo.Model;
None.gif
None.gifnamespace NHibernateWebDemo.BLL
None.gif
ExpandedBlockStart.gif ContractedBlock.gif dot.gif{
InBlock.gif
InBlock.gif    public class UserBLL
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif     dot.gif{
InBlock.gif
InBlock.gif        public void AddUser(User user)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
InBlock.gif            UserDAL dal = new UserDAL();        
InBlock.gif
InBlock.gif            dal.AddUser(user);
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public void UpdateUser(User user,string Id)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
InBlock.gif            UserDAL dal = new UserDAL();
InBlock.gif
InBlock.gif            dal.UpdateUser(user,Id);
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public void DeleletUser(User user)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
InBlock.gif            UserDAL dal = new UserDAL();
InBlock.gif
InBlock.gif            dal.DeleteUser(user);
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
InBlock.gif        public IList GetAllUsers(string strHQL)
InBlock.gif
ExpandedSubBlockStart.gif ContractedSubBlock.gif         dot.gif{
InBlock.gif
InBlock.gif            UserDAL dal = new UserDAL();
InBlock.gif
InBlock.gif            return dal.GetAllUsers(strHQL);
InBlock.gif
ExpandedSubBlockEnd.gif        }
InBlock.gif
ExpandedSubBlockEnd.gif    }
InBlock.gif
ExpandedBlockEnd.gif}

第八步:实现用户界面

用户界面很简单,这里就不给出代码了,完成后的用户界面:

PIC087.gif

完整代码下载:/Files/Terrylee/NHibernateWebDemo.rar

转载于:https://www.cnblogs.com/erichzhou/archive/2007/04/13/711788.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值