Showing preview only (487K chars total). Download the full file or copy to clipboard to get everything.
Repository: RojerAlone/shop
Branch: master
Commit: 1161b7b7ad35
Files: 167
Total size: 422.6 KB
Directory structure:
gitextract_t46sxuk1/
├── .gitignore
├── LICENSE.txt
├── README.md
├── pom.xml
└── src/
├── main/
│ ├── java/
│ │ └── cn/
│ │ └── cie/
│ │ ├── aop/
│ │ │ └── LogAspectj.java
│ │ ├── controller/
│ │ │ ├── AbstractController.java
│ │ │ ├── AdminController.java
│ │ │ ├── CommonController.java
│ │ │ ├── GameController.java
│ │ │ ├── KindController.java
│ │ │ ├── OrderController.java
│ │ │ ├── TagController.java
│ │ │ └── UserController.java
│ │ ├── entity/
│ │ │ ├── Code.java
│ │ │ ├── Game.java
│ │ │ ├── Img.java
│ │ │ ├── Kind.java
│ │ │ ├── Kindmapper.java
│ │ │ ├── Order.java
│ │ │ ├── Orderitem.java
│ │ │ ├── Ordermapper.java
│ │ │ ├── Tag.java
│ │ │ ├── Tagmapper.java
│ │ │ ├── Token.java
│ │ │ ├── User.java
│ │ │ ├── Validatecode.java
│ │ │ └── dto/
│ │ │ ├── GameDTO.java
│ │ │ ├── OrderDTO.java
│ │ │ └── OrderItemDTO.java
│ │ ├── event/
│ │ │ ├── EventConsumer.java
│ │ │ ├── EventModel.java
│ │ │ ├── EventProducer.java
│ │ │ ├── EventType.java
│ │ │ └── handler/
│ │ │ ├── EventHandler.java
│ │ │ ├── SendFindPwdMailHandler.java
│ │ │ └── SendValidateMailHandler.java
│ │ ├── exception/
│ │ │ └── NotFoundException.java
│ │ ├── interceptor/
│ │ │ ├── AdminInterceptor.java
│ │ │ ├── AuthInterceptor.java
│ │ │ └── LoginInterceptor.java
│ │ ├── mapper/
│ │ │ ├── CodeMapper.java
│ │ │ ├── GameMapper.java
│ │ │ ├── ImgMapper.java
│ │ │ ├── KindMapper.java
│ │ │ ├── KindmapperMapper.java
│ │ │ ├── OrderMapper.java
│ │ │ ├── OrderitemMapper.java
│ │ │ ├── OrdermapperMapper.java
│ │ │ ├── TagMapper.java
│ │ │ ├── TagmapperMapper.java
│ │ │ ├── TokenMapper.java
│ │ │ └── UserMapper.java
│ │ ├── schedule/
│ │ │ └── Scheduler.java
│ │ ├── services/
│ │ │ ├── AdminService.java
│ │ │ ├── GameService.java
│ │ │ ├── KindService.java
│ │ │ ├── OrderService.java
│ │ │ ├── TagService.java
│ │ │ ├── UserService.java
│ │ │ └── impl/
│ │ │ ├── AdminServiceImpl.java
│ │ │ ├── GameServiceImpl.java
│ │ │ ├── KindServiceImpl.java
│ │ │ ├── OrderServiceImpl.java
│ │ │ ├── TagServiceImpl.java
│ │ │ └── UserServiceImpl.java
│ │ └── utils/
│ │ ├── MailUtil.java
│ │ ├── MsgCenter.java
│ │ ├── PageUtil.java
│ │ ├── PasswordUtil.java
│ │ ├── RedisUtil.java
│ │ ├── Result.java
│ │ └── UserHolder.java
│ ├── resources/
│ │ ├── dbdata.sql
│ │ ├── generator/
│ │ │ └── generatorConfig.xml
│ │ ├── jdbc.properties
│ │ ├── log4j-acc.properties
│ │ ├── log4j-error.properties
│ │ ├── mapper/
│ │ │ ├── CodeMapper.xml
│ │ │ ├── GameMapper.xml
│ │ │ ├── ImgMapper.xml
│ │ │ ├── KindMapper.xml
│ │ │ ├── KindmapperMapper.xml
│ │ │ ├── OrderMapper.xml
│ │ │ ├── OrderitemMapper.xml
│ │ │ ├── OrdermapperMapper.xml
│ │ │ ├── TagMapper.xml
│ │ │ ├── TagmapperMapper.xml
│ │ │ ├── TokenMapper.xml
│ │ │ └── UserMapper.xml
│ │ ├── mybatis-config.xml
│ │ ├── schema.sql
│ │ ├── spring-dao.xml
│ │ ├── spring-mvc.xml
│ │ └── spring-service.xml
│ └── webapp/
│ └── WEB-INF/
│ ├── css/
│ │ ├── adminlogin.css
│ │ ├── adminpage.css
│ │ ├── base.css
│ │ ├── fenleixiangqing.css
│ │ ├── login.css
│ │ ├── order.css
│ │ ├── personal.css
│ │ ├── regist.css
│ │ ├── sanji.css
│ │ ├── self.css
│ │ └── shoppingcart.css
│ ├── js/
│ │ ├── adminlogin.js
│ │ ├── adminpage.js
│ │ ├── biaoqian.js
│ │ ├── fenlei.js
│ │ ├── findpassword.js
│ │ ├── fishjs/
│ │ │ ├── ane.js
│ │ │ ├── baby.js
│ │ │ ├── background.js
│ │ │ ├── collision.js
│ │ │ ├── commonFunctions.js
│ │ │ ├── data.js
│ │ │ ├── dust.js
│ │ │ ├── fruit.js
│ │ │ ├── halo.js
│ │ │ ├── main.js
│ │ │ ├── mom.js
│ │ │ └── wave.js
│ │ ├── index.js
│ │ ├── login.js
│ │ ├── order.js
│ │ ├── personal.js
│ │ ├── regist.js
│ │ ├── sanji.js
│ │ ├── search.js
│ │ ├── shoppingcart.js
│ │ ├── top.js
│ │ ├── updateUserInfo.js
│ │ └── updatepassword.js
│ ├── jsp/
│ │ ├── adminlogin.jsp
│ │ ├── adminpage.jsp
│ │ ├── checkemail.jsp
│ │ ├── common/
│ │ │ ├── bottom.jsp
│ │ │ ├── head.jsp
│ │ │ └── top.jsp
│ │ ├── error/
│ │ │ ├── ErrorCode400.jsp
│ │ │ ├── ErrorCode404.jsp
│ │ │ └── ErrorCode500.jsp
│ │ ├── findpassword.jsp
│ │ ├── fishjs.jsp
│ │ ├── gameInfo.jsp
│ │ ├── index.jsp
│ │ ├── kinds.jsp
│ │ ├── login.jsp
│ │ ├── order.jsp
│ │ ├── order_1.jsp
│ │ ├── order_2.jsp
│ │ ├── personal.jsp
│ │ ├── register.jsp
│ │ ├── search.jsp
│ │ ├── shoppingcart.jsp
│ │ ├── taggames.jsp
│ │ ├── updateUserInfo.jsp
│ │ ├── updatepassword.jsp
│ │ └── validate.jsp
│ └── web.xml
└── test/
└── java/
└── cn/
└── cie/
├── common/
│ └── CommonTest.java
├── mapper/
│ ├── GameMapperTest.java
│ ├── KindmapperMapperTest.java
│ └── UserMapperTest.java
├── services/
│ ├── KindServiceTest.java
│ └── UserServiceTest.java
└── utils/
└── RedisUtilTest.java
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Compiled class file
*.class
# Log file
*.log
# IDEA file
.idea/
*.iml
target/
upload/
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
================================================
FILE: LICENSE.txt
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
================================================
FILE: README.md
================================================
# Shop SSM框架搭建的网上游戏商城
## 项目信息
- 项目名字:WePlay
- 项目描述:基于SSM框架的网上游戏商城
## 环境配置
- JDK 1.8
- Spring 5.1.7
- MyBatis 3.4
- MySQL 5.7.18
- Maven 3
- Redis 3.0
- Tomcat 8.5.15
### maven 阿里云仓库
```xml
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
```
# 一些问题及解决方案
## 跨域请求
在`Controller`控制器中添加了`@CrossOrigin`注解。
## 用`token`验证用户身份
使用唯一识别码`token`来识别每一个用户,用户登陆后生成一个`token`写入数据库和缓存中,同时写入到response中的cookie中,这样以后每次请求都会带上这个`token`,用`AuthInterceptor`对所有的请求进行拦截,根据`token`从缓存中查取对应的`uid`,再从数据库中查取对应的用户详情,并存到[`UserHolder`](https://github.com/RojerAlone/shop/blob/master/src/main/java/cn/cie/utils/UserHolder.java)这个工具类中。
## 拦截器进行权限处理
很多接口只有用户验证了才能进行下一步操作,写了一个拦截器对特定的请求进行拦截,如果用户没有登录,就跳转到登陆页面,登陆成功后跳转到之前的页面。
## 使用`Redis`
几乎所有的页面都会加载商品种类,因此将商品的种类信息放入缓存中;网站首页有一个每日推荐,是每天零时随机生成5个商品,由于这些商品访问频率高,因此将这5个商品放入缓存中,可将访问速度由10\~20ms 缩减到3\~5ms。
同时用户`token`也放入了缓存中,并设置过期时间为1天,如果用户选择了保持登陆状态7天,那么`token`过期后再从数据库中取出放入缓存中。
用户注册后需要验证邮箱,将验证码放入缓存中,15分钟过期。
将重量型事件抽取出来,用Redis模拟消息队列,创建多线程添加到线程池中,线程从队列中获取消息并执行,比如发送邮件操作。
================================================
FILE: pom.xml
================================================
<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 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.cie</groupId>
<artifactId>shop</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>shop Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<spring.version>5.3.14</spring.version>
<aop.version>1.8.10</aop.version>
<mybatis.version>3.5.6</mybatis.version>
<log4j.version>1.2.17</log4j.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<!-- spring核心包 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<!--aspectj依赖-->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aop.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aop.version}</version>
</dependency>
<!--jackson包,没有这个包无法用ajax请求-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.10.0.pr1</version>
</dependency>
<!-- mybatis核心包 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<!-- mybatis/spring包 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.1</version>
</dependency>
<!-- 导入MySQL数据库连接jar包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version>
</dependency>
<!-- 用来配置数据库 -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<!-- JSTL标签类 -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!--log4j-->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.24</version>
</dependency>
<!--邮件发送-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.3.1</version>
</dependency>
<!--jedis-->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.25</version>
</dependency>
<!--protostuff,用于序列化和反序列化-->
<!--<dependency>-->
<!--<groupId>com.dyuproject.protostuff</groupId>-->
<!--<artifactId>protostuff-core</artifactId>-->
<!--<version>1.1.1</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>com.dyuproject.protostuff</groupId>-->
<!--<artifactId>protostuff-runtime</artifactId>-->
<!--<version>1.1.1</version>-->
<!--</dependency>-->
<!--apache common工具集-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<!--文件上传-->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.3</version>
</dependency>
</dependencies>
<build>
<finalName>shop</finalName>
<plugins>
<!--<plugin>-->
<!--<groupId>org.apahce.maven.plugins</groupId>-->
<!--<artifactId>maven-surefire-plugin</artifactId>-->
<!--<version>2.19.1</version>-->
<!--<configuration>-->
<!--<skipTests>true</skipTests>-->
<!--</configuration>-->
<!--</plugin>-->
<!--mybatis自动生成mapper-->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.5</version>
<configuration>
<configurationFile>${basedir}/src/main/resources/generator/generatorConfig.xml</configurationFile>
<overwrite>true</overwrite>
<verbose>true</verbose>
</configuration>
</plugin>
</plugins>
</build>
</project>
================================================
FILE: src/main/java/cn/cie/aop/LogAspectj.java
================================================
package cn.cie.aop;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
/**
* Created by RojerAlone on 2017/6/8.
* 日志记录,包括请求日志和错误日志
*/
@Component
@Aspect
public class LogAspectj {
private final Logger logger = Logger.getLogger(this.getClass());
@Before("execution(* cn.cie.controller.*Controller.*(..)) && !execution( * cn.cie.controller.AbstractController.*(..))")
// 切面为controller中的所有方法
public void logAccess(JoinPoint joinPoint) {
PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("/").getPath() + "log4j-acc.properties");
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
StringBuilder sb = new StringBuilder();
String token = "";
if (request.getCookies() != null && request.getCookies().length > 0) {
for (Cookie cookie : request.getCookies()) {
if (cookie.getName().equals("token")) {
token = cookie.getValue();
}
}
}
sb.append("token: " + token);
sb.append("\tip: " + request.getRemoteAddr());
sb.append("\tmethod: " + request.getMethod());
sb.append("\turl: " + request.getRequestURI());
sb.append("\tparams: ");
for (Object object : joinPoint.getArgs()) {
if (object != null) {
sb.append("\t" + object.getClass().getSimpleName() + " " + object.toString());
}
}
logger.info(sb.toString());
}
@AfterThrowing(value = "execution(* cn.cie.controller.*Controller.*(..)) && !execution( * cn.cie.controller.AbstractController.*(..))", throwing = "e")
// 切面为controller中的所有方法
public void errorAccess(Throwable e) {
PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("/").getPath() + "log4j-error.properties");
if (e instanceof Exception) {
logger.error("", e);
}
}
}
================================================
FILE: src/main/java/cn/cie/controller/AbstractController.java
================================================
/*
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.cie.controller;
import org.apache.log4j.Logger;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
/**
* 从左潇龙博客源码复制过来
* 基础controller,各个web项目应该在此基础上扩展自己的基础controller.
*
* @author Boren You
* @date 2016/5/12 21:28
* @since 1.0.0
*/
public abstract class AbstractController {
/**
* 日志对象
*/
protected Logger logger = Logger.getLogger(this.getClass());
/**
* 存放当前线程的HttpServletRequest对象
*/
private static ThreadLocal<HttpServletRequest> httpServletRequestThreadLocal = new ThreadLocal<HttpServletRequest>();
/**
* 存放当前线程的Model对象
*/
private static ThreadLocal<Model> modelThreadLocal = new ThreadLocal<Model>();
/**
* 使用@ModelAttribute注解标识的方法会在每个控制器中的方法访问之前先调用
*
* @param request
* @param model
*/
@ModelAttribute
protected void setThreadLocal(HttpServletRequest request, Model model) {
httpServletRequestThreadLocal.set(request);
modelThreadLocal.set(model);
}
/**
* 获取当前线程的HttpServletRequest对象
*
* @return 当前线程的HttpServletRequest对象
*/
protected HttpServletRequest getRequest() {
return httpServletRequestThreadLocal.get();
}
/**
* 获取当前线程的HttpSession对象
*
* @return 当前线程的HttpSession对象
*/
protected HttpSession getSession() {
return getRequest().getSession();
}
/**
* 获取当前线程的Model对象
*
* @return 当前线程的Model对象
*/
protected Model getModel() {
return modelThreadLocal.get();
}
/**
* 获取当前的ServletContext对象
*
* @return 当前的ServletContext对象
*/
protected ServletContext getContext() {
return getRequest().getServletContext();
}
/**
* 向 Model 设置属性值
*
* @param name 属性名
* @param value 属性值
*/
protected void setModelAttribute(String name, Object value) {
getModel().addAttribute(name, value);
}
/**
* 向 HttpServletRequest 设置属性值
*
* @param name 属性名
* @param value 属性值
*/
protected void setRequestAttribute(String name, Object value) {
HttpServletRequest request = this.getRequest();
request.setAttribute(name, value);
}
/**
* 向 HttpSession 设置属性值
*
* @param name 属性名
* @param value 属性值
*/
public void setSessionAttribute(String name, Object value) {
HttpSession session = this.getSession();
session.setAttribute(name, value);
}
/**
* 从 HttpSession 中获取属性值
*
* @param name 属性名
* @return 属性值
*/
protected Object getSessionAttribute(String name) {
HttpSession session = this.getSession();
Object value = session.getAttribute(name);
return value;
}
/**
* 从 HttpServletRequest 中获取属性值
*
* @param name 属性名
* @return 属性值
*/
protected Object getRequestAttribute(String name) {
HttpServletRequest request = this.getRequest();
Object value = request.getAttribute(name);
return value;
}
protected String getUserAgent() {
return this.getRequest().getHeader("User-Agent");
}
protected String getRemoteIp() {
String remoteIp;
remoteIp = this.getRequest().getHeader("x-forwarded-for");
if (remoteIp == null || remoteIp.length() == 0 || "unknown".equalsIgnoreCase(remoteIp)) {
remoteIp = this.getRequest().getHeader("Proxy-Client-IP");
}
if (remoteIp == null || remoteIp.length() == 0 || "unknown".equalsIgnoreCase(remoteIp)) {
remoteIp = this.getRequest().getHeader("WL-Proxy-Client-IP");
}
if (remoteIp == null || remoteIp.length() == 0 || "unknown".equalsIgnoreCase(remoteIp)) {
remoteIp = this.getRequest().getHeader("HTTP_CLIENT_IP");
}
if (remoteIp == null || remoteIp.length() == 0 || "unknown".equalsIgnoreCase(remoteIp)) {
remoteIp = this.getRequest().getHeader("HTTP_X_FORWARDED-FOR");
}
if (remoteIp == null || remoteIp.length() == 0 || "unknown".equalsIgnoreCase(remoteIp)) {
remoteIp = this.getRequest().getRemoteAddr();
}
//对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
if (remoteIp != null && remoteIp.length() > 15) { //"***.***.***.***".length() = 15
if (remoteIp.indexOf(",") > 0) {
remoteIp = remoteIp.substring(0, remoteIp.indexOf(","));
}
}
return remoteIp;
}
}
================================================
FILE: src/main/java/cn/cie/controller/AdminController.java
================================================
package cn.cie.controller;
import cn.cie.entity.Game;
import cn.cie.services.AdminService;
import cn.cie.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
/**
* Created by RojerAlone on 2017/6/15.
*/
@CrossOrigin
@Controller
@RequestMapping(value = "admin")
public class AdminController extends AbstractController {
@Autowired
private AdminService adminService;
@GetMapping(value = "login")
public String login() {
return "adminlogin";
}
@PostMapping(value = "login")
@ResponseBody
public Result login(String username, String password, HttpServletResponse response) {
Result result = adminService.login(username, password);
if (result.isSuccess()) {
Cookie cookie = new Cookie("token", (String) result.getData());
cookie.setPath("/");
response.addCookie(cookie);
return Result.success();
}
return result;
}
@GetMapping(value = "home")
public String adminPage() {
return "adminpage";
}
@PostMapping(value = "getuser")
@ResponseBody
public Result getUser(@RequestParam(value = "page", required = false, defaultValue = "1") Integer page) {
return adminService.getUser(page);
}
@PostMapping(value = "restrictuser")
@ResponseBody
public Result restrict(Integer uid) {
return adminService.restrict(uid);
}
@PostMapping(value = "relieveuser")
@ResponseBody
public Result relieve(Integer uid) {
return adminService.relieve(uid);
}
@PostMapping(value = "deluser")
@ResponseBody
public Result delUser(Integer uid) {
return adminService.delete(uid);
}
@PostMapping(value = "getgames")
@ResponseBody
public Result getGames(@RequestParam(value = "page", required = false, defaultValue = "1") Integer page) {
return adminService.getGames(page);
}
@PostMapping(value = "addgame")
@ResponseBody
public Result addGame(Game game, Integer[] kinds, MultipartFile header,
@RequestParam(value = "pics") MultipartFile[] pics) throws IOException {
return adminService.addGame(game, kinds, header, pics,
this.getSession().getServletContext().getRealPath("/WEB-INF/image").replaceAll("\\\\", "/"));
}
@PostMapping(value = "updategameinfo")
@ResponseBody
public Result updateGameInfo(Game game) {
return adminService.updateGameInfo(game);
}
@PostMapping(value = "getgamekind")
@ResponseBody
public Result getGameKind(Integer game) {
return adminService.getGameKind(game);
}
@PostMapping(value = "updategamekind")
@ResponseBody
public Result updateGameKind(Integer game, Integer[] kinds) {
return adminService.updateGameKind(game, Arrays.asList(kinds));
}
@PostMapping(value = "upgame")
@ResponseBody
public Result upGame(Integer game, @RequestParam(value = "date", required = false) Date date) {
return adminService.upGame(game, date);
}
@PostMapping(value = "downgame")
@ResponseBody
public Result downGame(Integer game) {
return adminService.downGame(game);
}
@PostMapping(value = "addkind")
@ResponseBody
public Result addKind(String kind) {
return adminService.addKind(kind);
}
@PostMapping(value = "getallgames")
@ResponseBody
public Result getAllGames() {
return adminService.getAllGames();
}
@PostMapping(value = "managerkind")
@ResponseBody
public Result managerKind(Integer kind, Integer[] games) {
return adminService.managerKind(kind, Arrays.asList(games));
}
}
================================================
FILE: src/main/java/cn/cie/controller/CommonController.java
================================================
package cn.cie.controller;
import cn.cie.entity.User;
import cn.cie.services.GameService;
import cn.cie.services.UserService;
import cn.cie.utils.MsgCenter;
import cn.cie.utils.Result;
import cn.cie.utils.UserHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
/**
* Created by RojerAlone on 2017/6/9.
*/
@CrossOrigin
@Controller
public class CommonController extends AbstractController {
@Autowired
private UserHolder userHolder;
@Autowired
private UserService userService;
@Autowired
private GameService gameService;
@RequestMapping(value = {"/", "/index"})
public String index() {
return "index";
}
@GetMapping(value = "login")
public String login() {
String referer = getReferer();
// 如果用户已经登陆并且状态正常,那么跳转到之前的页面
if (userHolder.getUser() != null && userHolder.getUser().getStat().equals(User.STAT_OK)) {
return "redirect:" + referer;
}
return "login";
}
@PostMapping(value = "login")
@ResponseBody
public Result login(String username, String password,
@RequestParam(value = "remember", defaultValue = "false", required = false) boolean remember,
HttpServletResponse response) {
String referer = getReferer();
// 如果用户已经登陆,那么跳转到之前的页面
if (userHolder.getUser() != null && userHolder.getUser().getStat().equals(User.STAT_OK)) {
return Result.fail(MsgCenter.OK, referer);
}
Result result = userService.login(username, password, remember, this.getRemoteIp(), this.getUserAgent());
if (result.isSuccess()) {
Map<String, String> data = new HashMap<String, String>();
data.put("referer", referer);
// response中添加cookie,以后每次请求都会带上cookie
Cookie cookie = new Cookie("token", (String) result.getData());
cookie.setPath("/");
if (remember) {
cookie.setMaxAge(60 * 60 * 24 * 7);
} else {
cookie.setMaxAge(60 * 60 * 24);
}
response.addCookie(cookie);
return Result.success(data);
} else {
return result;
}
}
@PostMapping(value = "logout")
@ResponseBody
public Result logout() {
String token = null;
// 从请求中获取token
if (this.getRequest().getCookies() != null) {
for (Cookie cookie : this.getRequest().getCookies()) {
if (cookie.getName().equals("token")) {
token = cookie.getValue();
}
}
}
return userService.logout(token);
}
@GetMapping(value = "register")
public String register() {
String referer = getReferer();
if (userHolder.getUser() != null) {
return "redirect:" + referer;
}
return "register";
}
@PostMapping(value = "register")
@ResponseBody
public Result register(User user, HttpServletResponse response) {
Result result = userService.register(user);
String pwd = user.getPassword();
// 注册成功就自动登录,前台跳转到验证页面
if (result.isSuccess()) {
login(user.getUsername(), pwd, false, response);
return Result.success();
}
return result;
}
/**
* 获取每日推荐,随机选取5个游戏,每日生成一次
*
* @return
*/
@PostMapping(value = "everyday")
@ResponseBody
public Result everyday() {
return gameService.getRandomGames();
}
@GetMapping(value = "shoppingcart")
public String shoppingcart() {
return "shoppingcart";
}
/**
* 最新的5个游戏,根据上架时间排序,放在缓存中
*
* @return
*/
@PostMapping(value = "newestgames")
@ResponseBody
public Result newestGames() {
return gameService.newestGames();
}
/**
* 最新的5个未上架游戏,根据时间排序,放在缓存中
*
* @return
*/
@PostMapping(value = "preupgames")
@ResponseBody
public Result preUpGames() {
return gameService.preUpGames();
}
@PostMapping(value = "freegames")
@ResponseBody
public Result getFreeGames() {
return gameService.getFreeGames();
}
@GetMapping(value = "search")
public String search() {
return "search";
}
@PostMapping(value = "search")
@ResponseBody
public Result search(String info) {
return gameService.search(info);
}
/**
* 检查用户是否登陆,如果登陆就返回应该跳转到的页面,否则执行接下来的逻辑
* 每次登陆之前都从request的header中获取跳转之前的链接referer
* 如果为空(从别的网站跳转过来的),那么应该跳转到首页
* 登陆流程中第一次登陆就会调用本方法获取跳转链接,登陆失败将referer写入session中
* 如果是从登录页跳转过来的,可能是登陆出错了,但是跳转到登录页之前的referer在session存着,从session中获取
* 如果sesson中有referer,那么登陆成功跳转到referer,并且从session中删除referer
*
* @return
*/
private String getReferer() {
String referer = null;
String tmp = this.getRequest().getHeader("Referer");
// 如果为空,不是从本站跳转过来的,应该跳转到首页
if (tmp == null) {
referer = "/";
} else if (tmp.endsWith("/login")) {
referer = (String) this.getSession().getAttribute("Referer");
} else {
referer = tmp;
}
this.getSession().setAttribute("Referer", referer);
return referer;
}
}
================================================
FILE: src/main/java/cn/cie/controller/GameController.java
================================================
package cn.cie.controller;
import cn.cie.exception.NotFoundException;
import cn.cie.services.GameService;
import cn.cie.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
/**
* Created by RojerAlone on 2017/6/8.
*/
@CrossOrigin
@Controller
@RequestMapping(value = "game")
public class GameController extends AbstractController {
@Autowired
private GameService gameService;
@GetMapping(value = "{id}")
public String gameInfo(@PathVariable(value = "id") Integer id) {
if (!gameService.exists(id)) {
throw new NotFoundException();
}
this.getModel().addAttribute("id", id);
return "gameInfo";
}
@PostMapping(value = "{id}")
@ResponseBody
public Result selectById(@PathVariable(value = "id") Integer id) {
return gameService.getById(id);
}
}
================================================
FILE: src/main/java/cn/cie/controller/KindController.java
================================================
package cn.cie.controller;
import cn.cie.exception.NotFoundException;
import cn.cie.services.KindService;
import cn.cie.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
/**
* Created by RojerAlone on 2017/6/6.
*/
@CrossOrigin
@Controller
@RequestMapping(value = "kind")
public class KindController extends AbstractController {
@Autowired
private KindService kindService;
@PostMapping(value = "all")
@ResponseBody
public Result allkinds(HttpServletResponse response) {
Result result = kindService.getAll();
return result;
}
@GetMapping(value = "{kind}/games")
public String getGames(@PathVariable(value = "kind") Integer kind) {
String name = kindService.getNameById(kind);
if (name == null) {
throw new NotFoundException();
}
this.getModel().addAttribute("id", kind);
this.getModel().addAttribute("name", name);
return "kinds";
}
@PostMapping(value = "{kind}/games")
@ResponseBody
public Result getGamesByKind(@PathVariable(value = "kind") Integer kind, @RequestParam(value = "page",
required = false, defaultValue = "1") Integer page) {
return kindService.getGamesByKind(kind, page);
}
}
================================================
FILE: src/main/java/cn/cie/controller/OrderController.java
================================================
package cn.cie.controller;
import cn.cie.exception.NotFoundException;
import cn.cie.services.OrderService;
import cn.cie.utils.Result;
import cn.cie.utils.UserHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
/**
* Created by RojerAlone on 2017/6/12.
*/
@CrossOrigin
@Controller
@RequestMapping(value = "/order")
public class OrderController extends AbstractController {
@Autowired
private OrderService orderService;
@Autowired
private UserHolder userHolder;
@GetMapping(value = "orders")
public String orders() {
return "order";
}
@PostMapping(value = "order")
@ResponseBody
public Result order(@RequestParam(value = "games") Integer[] games) {
return orderService.addOrders(userHolder.getUser().getId(), Arrays.asList(games));
}
@PostMapping(value = "{orderid}/cancel")
@ResponseBody
public Result cancelOrder(@PathVariable(value = "orderid") Integer orderid) {
return orderService.cancelOrder(userHolder.getUser().getId(), orderid);
}
@GetMapping(value = "{orderid}/payway")
public String payway(@PathVariable(value = "orderid") Integer orderid) {
if (!orderService.exists(orderid)) {
throw new NotFoundException();
}
this.getModel().addAttribute("id", orderid);
return "order_1";
}
@GetMapping(value = "{orderid}/pay")
public String pay(@PathVariable(value = "orderid") Integer orderid) {
if (!orderService.exists(orderid)) {
throw new NotFoundException();
}
this.getModel().addAttribute("id", orderid);
return "order_2";
}
@PostMapping(value = "{orderid}/pay")
@ResponseBody
public Result payOrder(@PathVariable(value = "orderid") Integer orderid) {
return orderService.pay(userHolder.getUser().getId(), orderid);
}
@PostMapping(value = "notpay/{page}")
@ResponseBody
public Result getNotPayOrders(@PathVariable(value = "page") Integer page) {
return orderService.getNotPayOrders(userHolder.getUser().getId(), page);
}
@PostMapping(value = "paid/{page}")
@ResponseBody
public Result getPaidOrders(@PathVariable(value = "page") Integer page) {
return orderService.getPaidOrders(userHolder.getUser().getId(), page);
}
@PostMapping(value = "cancel/{page}")
@ResponseBody
public Result getCancelOrders(@PathVariable(value = "page") Integer page) {
return orderService.getCancelOrders(userHolder.getUser().getId(), page);
}
}
================================================
FILE: src/main/java/cn/cie/controller/TagController.java
================================================
package cn.cie.controller;
import cn.cie.entity.dto.GameDTO;
import cn.cie.exception.NotFoundException;
import cn.cie.services.TagService;
import cn.cie.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Created by RojerAlone on 2017/6/7.
*/
@CrossOrigin
@Controller
@RequestMapping(value = "tag")
public class TagController extends AbstractController {
@Autowired
private TagService tagService;
@GetMapping(value = "/{tag}/games")
public String getGames(@PathVariable(value = "tag") Integer tag) {
String name = tagService.getNameById(tag);
if (name == null) {
throw new NotFoundException();
}
this.getModel().addAttribute("id", tag);
this.getModel().addAttribute("name", name);
return "taggames";
}
@PostMapping(value = "/{tag}/games")
@ResponseBody
public Result<List<GameDTO>> getGamesByTag(@PathVariable(value = "tag") Integer tag,
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page) {
return tagService.getGamesByTag(tag, page);
}
}
================================================
FILE: src/main/java/cn/cie/controller/UserController.java
================================================
package cn.cie.controller;
import cn.cie.entity.User;
import cn.cie.services.UserService;
import cn.cie.utils.MsgCenter;
import cn.cie.utils.Result;
import cn.cie.utils.UserHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
/**
* Created by RojerAlone on 2017/6/6.
*/
@CrossOrigin
@Controller
@RequestMapping(value = "user")
public class UserController extends AbstractController {
@Autowired
private UserService userService;
@Autowired
private UserHolder userHolder;
@GetMapping(value = "validate")
public String validate() {
String referer = getReferer();
if (userHolder.getUser().getStat().equals(User.STAT_OK)) {
return "redirect:" + referer;
}
return "validate";
}
@PostMapping(value = "validate")
@ResponseBody
public Result validate(String code) {
if (userHolder.getUser() == null) {
return Result.fail(MsgCenter.USER_NOT_LOGIN);
}
if (userHolder.getUser().getStat().equals(User.STAT_OK)) { // 用户已经验证过了
return Result.fail(MsgCenter.USER_VALIDATED);
}
Result result = userService.validate(userHolder.getUser().getId(), code);
if (result.isSuccess()) {
return Result.success("/");
}
return result;
}
@PostMapping(value = "sendMail")
@ResponseBody
public Result sendMail() {
if (userHolder.getUser() == null) {
return Result.fail(MsgCenter.USER_NOT_LOGIN);
}
return userService.sendMail(userHolder.getUser());
}
@GetMapping(value = "personal")
public String personal() {
return "personal";
}
@PostMapping(value = "personal")
@ResponseBody
public Result getPersonInfo() {
User user = userHolder.getUser();
if (user == null) {
return Result.fail(MsgCenter.USER_NOT_LOGIN);
}
user.setPassword(null);
return Result.success(user);
}
@GetMapping(value = "update")
public String update() {
return "updateUserInfo";
}
@PostMapping(value = "update")
@ResponseBody
public Result update(User user) {
return userService.updateUserInfo(user);
}
@GetMapping(value = "updatepassword")
public String updatePassword() {
return "updatepassword";
}
@PostMapping(value = "updatepassword")
@ResponseBody
public Result updatePassword(String password) {
return userService.updatePassword(password);
}
@GetMapping(value = "findpassword")
public String findPassword() {
return "findpassword";
}
@PostMapping(value = "sendfetchpwdmail")
@ResponseBody
public Result sendFetchPwdMail(String email) {
return userService.sendFetchPwdMail(email);
}
@PostMapping(value = "findpassword")
@ResponseBody
public Result findPassword(String password, String email, String code) {
return userService.forgetPassword(password, email, code);
}
/**
* 检查用户是否登陆,如果登陆就返回应该跳转到的页面,否则执行接下来的逻辑
* 每次登陆之前都从request的header中获取跳转之前的链接referer
* 如果为空(从别的网站跳转过来的),那么应该跳转到首页
* 登陆流程中第一次登陆就会调用本方法获取跳转链接,登陆失败将referer写入session中
* 如果是从登录页跳转过来的,可能是登陆出错了,但是跳转到登录页之前的referer在session存着,从session中获取
* 如果sesson中有referer,那么登陆成功跳转到referer,并且从session中删除referer
*
* @return
*/
private String getReferer() {
String referer = null;
String tmp = this.getRequest().getHeader("Referer");
// 如果为空,不是从本站跳转过来的,应该跳转到首页
if (tmp == null) {
referer = "/";
} else if (tmp.endsWith("/login")) {
referer = (String) this.getSession().getAttribute("Referer");
} else {
referer = tmp;
}
this.getSession().setAttribute("Referer", referer);
return referer;
}
}
================================================
FILE: src/main/java/cn/cie/entity/Code.java
================================================
package cn.cie.entity;
/**
* 游戏激活码
*/
public class Code {
/**
* 未使用
*/
public static final Byte STAT_NOT_USED = 0;
/**
* 已使用
*/
public static final Byte STAT_USED = 1;
private Integer id;
private Integer item;
private Integer uid;
private String code;
private Byte stat;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getItem() {
return item;
}
public void setItem(Integer item) {
this.item = item;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Byte getStat() {
return stat;
}
public void setStat(Byte stat) {
this.stat = stat;
}
}
================================================
FILE: src/main/java/cn/cie/entity/Game.java
================================================
package cn.cie.entity;
import java.util.Date;
/**
* 游戏
*/
public class Game {
/**
* 未上架
*/
public static final Byte STAT_PRE = 0;
/**
* 已上架
*/
public static final Byte STAT_OK = 1;
/**
* 已下架
*/
public static final Byte STAT_DEL = 2;
private Integer id;
private String creater;
private String name;
private String desc;
private String systemcfg;
private Double price;
private Double discount;
private Date ctime;
private Date utime;
private Byte stat;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCreater() {
return creater;
}
public void setCreater(String creater) {
this.creater = creater;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getSystemcfg() {
return systemcfg;
}
public void setSystemcfg(String systemcfg) {
this.systemcfg = systemcfg;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public Double getDiscount() {
return discount;
}
public void setDiscount(Double discount) {
this.discount = discount;
}
public Date getCtime() {
return ctime;
}
public void setCtime(Date ctime) {
this.ctime = ctime;
}
public Date getUtime() {
return utime;
}
public void setUtime(Date utime) {
this.utime = utime;
}
public Byte getStat() {
return stat;
}
public void setStat(Byte stat) {
this.stat = stat;
}
}
================================================
FILE: src/main/java/cn/cie/entity/Img.java
================================================
package cn.cie.entity;
/**
* 游戏图片
*/
public class Img {
private Integer game;
private String img;
public Integer getGame() {
return game;
}
public void setGame(Integer game) {
this.game = game;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
}
================================================
FILE: src/main/java/cn/cie/entity/Kind.java
================================================
package cn.cie.entity;
public class Kind {
private Integer id;
private String name;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
================================================
FILE: src/main/java/cn/cie/entity/Kindmapper.java
================================================
package cn.cie.entity;
/**
* 游戏和种类映射
*/
public class Kindmapper {
private Integer game;
private Integer kind;
public Integer getGame() {
return game;
}
public void setGame(Integer game) {
this.game = game;
}
public Integer getKind() {
return kind;
}
public void setKind(Integer kind) {
this.kind = kind;
}
}
================================================
FILE: src/main/java/cn/cie/entity/Order.java
================================================
package cn.cie.entity;
import java.util.Date;
/**
* 订单
*/
public class Order {
/**
* 未支付
*/
public static final Byte STAT_NOT_PAY = 0;
/**
* 已支付
*/
public static final Byte STAT_PAY = 1;
/**
* 取消
*/
public static final Byte STAT_CANCEL = 2;
private Integer id;
private Integer uid;
private Double price;
private Date ctime;
private Date utime;
private Byte stat;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public Date getCtime() {
return ctime;
}
public void setCtime(Date ctime) {
this.ctime = ctime;
}
public Date getUtime() {
return utime;
}
public void setUtime(Date utime) {
this.utime = utime;
}
public Byte getStat() {
return stat;
}
public void setStat(Byte stat) {
this.stat = stat;
}
}
================================================
FILE: src/main/java/cn/cie/entity/Orderitem.java
================================================
package cn.cie.entity;
import java.util.Date;
/**
* 订单详情
*/
public class Orderitem {
private Integer id;
private Integer gid;
private Double price;
private Integer code;
private Date ctime;
private Date utime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getGid() {
return gid;
}
public void setGid(Integer gid) {
this.gid = gid;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public Date getCtime() {
return ctime;
}
public void setCtime(Date ctime) {
this.ctime = ctime;
}
public Date getUtime() {
return utime;
}
public void setUtime(Date utime) {
this.utime = utime;
}
}
================================================
FILE: src/main/java/cn/cie/entity/Ordermapper.java
================================================
package cn.cie.entity;
/**
* 订单-订单详情映射
*/
public class Ordermapper {
private Integer order;
private Integer item;
public Integer getOrder() {
return order;
}
public void setOrder(Integer order) {
this.order = order;
}
public Integer getItem() {
return item;
}
public void setItem(Integer item) {
this.item = item;
}
}
================================================
FILE: src/main/java/cn/cie/entity/Tag.java
================================================
package cn.cie.entity;
/**
* 游戏标签
*/
public class Tag {
private Integer id;
private String name;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
================================================
FILE: src/main/java/cn/cie/entity/Tagmapper.java
================================================
package cn.cie.entity;
/**
* 游戏游戏标签映射
*/
public class Tagmapper {
private Integer game;
private Integer tag;
public Integer getGame() {
return game;
}
public void setGame(Integer game) {
this.game = game;
}
public Integer getTag() {
return tag;
}
public void setTag(Integer tag) {
this.tag = tag;
}
}
================================================
FILE: src/main/java/cn/cie/entity/Token.java
================================================
package cn.cie.entity;
import java.util.Date;
/**
* token,用来标识一个用户
*/
public class Token {
/**
* 正常状态
*/
public static final Byte STAT_OK = 0;
/**
* token已过期
*/
public static final Byte STAT_EXPIRED = 1;
private Integer uid;
private String token;
private Date expiredTime;
private String ip;
private String device;
private Date ctime;
private Byte stat;
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public Date getExpiredTime() {
return expiredTime;
}
public void setExpiredTime(Date expiredTime) {
this.expiredTime = expiredTime;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getDevice() {
return device;
}
public void setDevice(String device) {
this.device = device;
}
public Date getCtime() {
return ctime;
}
public void setCtime(Date ctime) {
this.ctime = ctime;
}
public Byte getStat() {
return stat;
}
public void setStat(Byte stat) {
this.stat = stat;
}
}
================================================
FILE: src/main/java/cn/cie/entity/User.java
================================================
package cn.cie.entity;
import java.util.Date;
public class User {
/**
* 未验证,需要邮箱验证
*/
public static final Byte STAT_NOT_VALIDATE = 0;
/**
* 正常
*/
public static final Byte STAT_OK = 1;
/**
* 受限
*/
public static final Byte STAT_RESTRICT = 2;
/**
* 已删除
*/
public static final Byte STAT_DEL = 3;
private Integer id;
private String username;
private String password;
private String nickname;
private String email;
private Long phone;
private Date ctime;
private Date utime;
private Byte stat;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Long getPhone() {
return phone;
}
public void setPhone(Long phone) {
this.phone = phone;
}
public Date getCtime() {
return ctime;
}
public void setCtime(Date ctime) {
this.ctime = ctime;
}
public Date getUtime() {
return utime;
}
public void setUtime(Date utime) {
this.utime = utime;
}
public Byte getStat() {
return stat;
}
public void setStat(Byte stat) {
this.stat = stat;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", username='" + username + '\'' +
", password='" + password + '\'' +
", nickname='" + nickname + '\'' +
", email='" + email + '\'' +
", phone=" + phone +
", ctime=" + ctime +
", utime=" + utime +
", stat=" + stat +
'}';
}
}
================================================
FILE: src/main/java/cn/cie/entity/Validatecode.java
================================================
package cn.cie.entity;
/**
* 注册时发送到邮箱的验证码,用来验证用户邮箱
*/
public class Validatecode {
/**
* 验证码有效期,默认为10分钟
*/
public static final int TIMEOUT = 60 * 10;
}
================================================
FILE: src/main/java/cn/cie/entity/dto/GameDTO.java
================================================
package cn.cie.entity.dto;
import cn.cie.entity.Game;
import cn.cie.entity.Kind;
import cn.cie.entity.Tag;
import java.util.Date;
import java.util.List;
/**
* Created by RojerAlone on 2017/6/6.
*/
public class GameDTO {
private Integer id;
private String creater;
private String name;
private String desc;
private String systemcfg;
private Double price;
private Double discount;
private Date ctime;
private Date utime;
private Byte stat;
private List<Kind> kinds;
private List<Tag> tags;
private List<String> img;
public GameDTO() {}
public GameDTO(Game game, List<Tag> tags, List<String> img) {
this.id = game.getId();
this.creater = game.getCreater();
this.name = game.getName();
this.desc = game.getDesc();
this.systemcfg = game.getSystemcfg();
this.price = game.getPrice();
this.discount = game.getDiscount();
this.ctime = game.getCtime();
this.utime = game.getUtime();
this.stat = game.getStat();
this.tags = tags;
this.img = img;
}
public GameDTO(Game game, List<Kind> kinds, List<Tag> tags, List<String> img) {
this.id = game.getId();
this.creater = game.getCreater();
this.name = game.getName();
this.desc = game.getDesc();
this.systemcfg = game.getSystemcfg();
this.price = game.getPrice();
this.discount = game.getDiscount();
this.ctime = game.getCtime();
this.utime = game.getUtime();
this.stat = game.getStat();
this.kinds = kinds;
this.tags = tags;
this.img = img;
}
public Integer getId() {
return id;
}
public String getCreater() {
return creater;
}
public String getName() {
return name;
}
public String getDesc() {
return desc;
}
public String getSystemcfg() {
return systemcfg;
}
public Double getPrice() {
return price;
}
public Double getDiscount() {
return discount;
}
public Date getCtime() {
return ctime;
}
public Date getUtime() {
return utime;
}
public Byte getStat() {
return stat;
}
public List<Kind> getKinds() {
return kinds;
}
public List<Tag> getTags() {
return tags;
}
public List<String> getImg() {
return img;
}
}
================================================
FILE: src/main/java/cn/cie/entity/dto/OrderDTO.java
================================================
package cn.cie.entity.dto;
import cn.cie.entity.Order;
import cn.cie.entity.Orderitem;
import java.util.Date;
import java.util.List;
/**
* Created by RojerAlone on 2017/6/12.
*/
public class OrderDTO {
/**
* 订单id
*/
private Integer id;
/**
* 订单所属用户id
*/
private Integer uid;
/**
* 订单的总价格
*/
private Double total;
/**
* 订单创建时间
*/
private Date ctime;
/**
* 订单更新时间
*/
private Date utime;
/**
* 订单状态
*/
private Byte stat;
/**
* 订单详细信息
*/
private List<OrderItemDTO> orderitems;
public OrderDTO(Order order, List<OrderItemDTO> orderitems) {
this.id = order.getId();
this.uid = order.getUid();
this.total = order.getPrice();
this.ctime = order.getCtime();
this.utime = order.getUtime();
this.stat = order.getStat();
this.orderitems = orderitems;
}
public Integer getId() {
return id;
}
public Integer getUid() {
return uid;
}
public Double getTotal() {
return total;
}
public Date getCtime() {
return ctime;
}
public Date getUtime() {
return utime;
}
public Byte getStat() {
return stat;
}
public List<OrderItemDTO> getOrderitems() {
return orderitems;
}
}
================================================
FILE: src/main/java/cn/cie/entity/dto/OrderItemDTO.java
================================================
package cn.cie.entity.dto;
import cn.cie.entity.Code;
import cn.cie.entity.Game;
import cn.cie.entity.Orderitem;
import java.util.Date;
/**
* Created by RojerAlone on 2017/6/12.
*/
public class OrderItemDTO {
private Integer id;
private Double price;
private String code;
private Byte codeStat;
private Date ctime;
private Date utime;
private Game game;
public OrderItemDTO(Orderitem orderitem, Game game, Code code) {
this.id = orderitem.getId();
this.price = orderitem.getPrice();
this.game = game;
this.ctime = orderitem.getCtime();
this.utime = orderitem.getUtime();
if (code != null) {
this.code = code.getCode();
this.codeStat = code.getStat();
}
}
public Integer getId() {
return id;
}
public Double getPrice() {
return price;
}
public String getCode() {
return code;
}
public Byte getCodeStat() {
return codeStat;
}
public Date getCtime() {
return ctime;
}
public Date getUtime() {
return utime;
}
public Game getGame() {
return game;
}
}
================================================
FILE: src/main/java/cn/cie/event/EventConsumer.java
================================================
package cn.cie.event;
import cn.cie.event.handler.EventHandler;
import cn.cie.utils.RedisUtil;
import org.apache.log4j.Logger;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
/**
* Created by RojerAlone on 2017/6/25.
* 事件消费者,不断从事件队列中获取事件,根据事件类型处理不同的事件
*/
@Service
public class EventConsumer implements InitializingBean, ApplicationContextAware, DisposableBean {
private final Logger logger = Logger.getLogger(this.getClass());
private ApplicationContext applicationContext;
@Autowired
private RedisUtil<EventModel> redisUtil;
private ThreadPoolExecutor threadPool;
/**
* 事件类型以及执行这些事件的handler
*/
private Map<EventType, List<EventHandler>> handlers = new HashMap<EventType, List<EventHandler>>();
public void afterPropertiesSet() throws Exception {
// 从上下文中获取所有的handler
Map<String, EventHandler> beans = applicationContext.getBeansOfType(EventHandler.class);
if (beans != null) {
for (Map.Entry<String, EventHandler> entry : beans.entrySet()) {
// 遍历所有的 hander ,将 event-handler 的映射加入 handlers 中
List<EventType> types = entry.getValue().getSupportEvent();
for (EventType type : types) {
if (!handlers.containsKey(type)) {
handlers.put(type, new ArrayList<EventHandler>());
}
handlers.get(type).add(entry.getValue());
}
}
}
// 设置线程池的大小为 CPU 的核数 * 2
threadPool = (ThreadPoolExecutor) Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() + 2);
new Thread(new Runnable() {
public void run() {
while (true) {
EventModel event = redisUtil.lpopObject(EventModel.EVENT_KEY, EventModel.class);
if (event == null) {
continue;
}
if (!handlers.containsKey(event.getEventType())) {
logger.error("error event type");
continue;
}
for (EventHandler handler : handlers.get(event.getEventType())) {
threadPool.execute(new EventConsumerThread(handler, event));
}
}
}
}).start();
}
class EventConsumerThread implements Runnable {
private EventHandler handler;
private EventModel event;
public EventConsumerThread(EventHandler handler, EventModel event) {
this.handler = handler;
this.event = event;
}
public void run() {
handler.doHandler(event);
}
}
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
public void destroy() throws Exception {
if (threadPool != null) {
while (threadPool.getQueue().size() != 0 || threadPool.getActiveCount() != 0) {
// 等待所有任务执行完毕
}
threadPool.shutdownNow();
}
}
}
================================================
FILE: src/main/java/cn/cie/event/EventModel.java
================================================
package cn.cie.event;
import java.util.HashMap;
import java.util.Map;
/**
* Created by RojerAlone on 2017/6/25.
* 事件实体
*/
public class EventModel {
/**
* 在缓存中事件队列的key
*/
public static final String EVENT_KEY = "event";
/**
* 事件类型
*/
private EventType eventType;
/**
* 事件发出者id
*/
private int fromId;
/**
* 事件接受者id
*/
private int toId;
/**
* 触发事件的实体,比如评论点赞
*/
private int entityId;
/**
* 实体拥有者
*/
private int entityOwnerId;
/**
* 可能会有的额外信息
*/
private Map<String ,String> exts = new HashMap<String, String>();
public EventModel() {
}
public EventModel(EventType eventType) {
this.eventType = eventType;
}
public EventType getEventType() {
return eventType;
}
public EventModel setEventType(EventType eventType) {
this.eventType = eventType;
return this;
}
public int getFromId() {
return fromId;
}
public EventModel setFromId(int fromId) {
this.fromId = fromId;
return this;
}
public int getToId() {
return toId;
}
public EventModel setToId(int toId) {
this.toId = toId;
return this;
}
public int getEntityId() {
return entityId;
}
public EventModel setEntityId(int entityId) {
this.entityId = entityId;
return this;
}
public int getEntityOwnerId() {
return entityOwnerId;
}
public EventModel setEntityOwnerId(int entityOwnerId) {
this.entityOwnerId = entityOwnerId;
return this;
}
public String getExts(String key) {
return exts.get(key);
}
public EventModel setExts(String key, String value) {
this.exts.put(key, value);
return this;
}
public Map<String, String> getExts() {
return exts;
}
public void setExts(Map<String, String> exts) {
this.exts = exts;
}
}
================================================
FILE: src/main/java/cn/cie/event/EventProducer.java
================================================
package cn.cie.event;
import cn.cie.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Created by RojerAlone on 2017/6/25.
* 事件生产者
*/
@Component
public class EventProducer {
@Autowired
private RedisUtil redisUtil;
public long product(EventModel model) {
return redisUtil.rpushObject(EventModel.EVENT_KEY, EventModel.class, model);
}
}
================================================
FILE: src/main/java/cn/cie/event/EventType.java
================================================
package cn.cie.event;
/**
* Created by RojerAlone on 2017/6/25.
* 异步事件类型
*/
public enum EventType {
SEND_VALIDATE_EMAIL(1),
SEND_FIND_PWD_EMAIL(2);
private int value;
EventType(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
================================================
FILE: src/main/java/cn/cie/event/handler/EventHandler.java
================================================
package cn.cie.event.handler;
import cn.cie.event.EventModel;
import cn.cie.event.EventType;
import java.util.List;
/**
* Created by RojerAlone on 2017/6/25.
* 事件处理接口,包含了事件处理以及关心的所有事件
*/
public interface EventHandler {
/**
* 处理事件
*/
void doHandler(EventModel eventModel);
/**
* 获取支持的事件类型
* @return
*/
List<EventType> getSupportEvent();
}
================================================
FILE: src/main/java/cn/cie/event/handler/SendFindPwdMailHandler.java
================================================
package cn.cie.event.handler;
import cn.cie.event.EventModel;
import cn.cie.event.EventType;
import cn.cie.utils.MailUtil;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
/**
* Created by RojerAlone on 2017/6/25.
* 发送找回密码邮件事件
*/
@Service
public class SendFindPwdMailHandler implements EventHandler {
public void doHandler(EventModel model) {
MailUtil.sendFetchPwdMail(model.getExts("mail"), model.getExts("code"));
}
public List<EventType> getSupportEvent() {
return Arrays.asList(EventType.SEND_FIND_PWD_EMAIL);
}
}
================================================
FILE: src/main/java/cn/cie/event/handler/SendValidateMailHandler.java
================================================
package cn.cie.event.handler;
import cn.cie.event.EventModel;
import cn.cie.event.EventType;
import cn.cie.utils.MailUtil;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
/**
* Created by RojerAlone on 2017/6/25.
* 发送注册用户时邮箱验证码事件
*/
@Service
public class SendValidateMailHandler implements EventHandler {
public void doHandler(EventModel model) {
MailUtil.sendValidateMail(model.getExts("mail"), model.getExts("code"));
}
public List<EventType> getSupportEvent() {
return Arrays.asList(EventType.SEND_VALIDATE_EMAIL);
}
}
================================================
FILE: src/main/java/cn/cie/exception/NotFoundException.java
================================================
package cn.cie.exception;
import cn.cie.utils.MsgCenter;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
/**
* Created by RojerAlone on 2017/6/8.
* 自定义异常
*/
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class NotFoundException extends RuntimeException {
public NotFoundException() {
super(MsgCenter.NOT_FOUND);
}
}
================================================
FILE: src/main/java/cn/cie/interceptor/AdminInterceptor.java
================================================
package cn.cie.interceptor;
import cn.cie.utils.UserHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Created by RojerAlone on 2017/6/21.
* 管理员权限拦截,如果用户不是管理员,那么跳转到管理员的登陆页面
*/
public class AdminInterceptor implements HandlerInterceptor {
@Autowired
private UserHolder userHolder;
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if (request.getRequestURI().equals("/admin/login")) {
return true;
}
if (userHolder.getUser() != null && userHolder.getUser().getUsername().equals("admin")) {
return true;
}
response.sendRedirect("/admin/login");
return false;
}
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
}
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
}
}
================================================
FILE: src/main/java/cn/cie/interceptor/AuthInterceptor.java
================================================
package cn.cie.interceptor;
import cn.cie.entity.Token;
import cn.cie.entity.User;
import cn.cie.mapper.TokenMapper;
import cn.cie.mapper.UserMapper;
import cn.cie.utils.RedisUtil;
import cn.cie.utils.UserHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
/**
* Created by RojerAlone on 2017/6/11.
* 拦截器,根据token获取用户身份
* 先从缓存中查找,如果找不到再从数据库中找
*/
@Component
public class AuthInterceptor implements HandlerInterceptor {
@Autowired
private TokenMapper tokenMapper;
@Autowired
private UserMapper userMapper;
@Autowired
private RedisUtil redisUtil;
@Autowired
private UserHolder userHolder;
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
// 如果请求静态资源直接pass
if (httpServletRequest.getRequestURI().matches("^/img/[\\S]+\\.(png|jpg)$") || httpServletRequest.getRequestURI().matches("^/css/[\\S]+\\.css$")
|| httpServletRequest.getRequestURI().matches("^/js/[\\S]+\\.js$")) {
return true;
}
String token = null;
// 从请求中获取token
if (httpServletRequest.getCookies() != null) {
for (Cookie cookie : httpServletRequest.getCookies()) {
if (cookie.getName().equals("token")) {
token = cookie.getValue();
}
}
}
// 如果获取到了token
if (token != null) {
String userid = redisUtil.get(token);
int uid = 0;
// 缓存中没有token,从数据库中查找
if (userid == null) {
Token t = tokenMapper.selectByTokenAndStat(token, Token.STAT_OK);
// 如果token为空或者已经过期但是定时任务还没有来得及更改状态
Date now = new Date();
if (t == null || t.getExpiredTime().before(now)) {
return true;
}
// token不为空,但是缓存中没有了,将token加入缓存中
uid = t.getUid();
long oneday = 86400000L;
long expired = t.getExpiredTime().getTime() - now.getTime();
// 如果token剩余有效期大于1天,加入缓存中的token有效期为1天
if (expired > oneday) {
redisUtil.putEx(token, String.valueOf(uid), 60 * 60 * 24);
} else { // 否则有效期为剩下的时间
redisUtil.putEx(token, String.valueOf(uid), (int) (expired / 1000));
}
} else {
uid = Integer.valueOf(userid);
}
// token有效,将当前用户暂时存放起来,之后在所有的地方都可以通过依赖注入的UserHolder获取当前用户
User user = userMapper.selectById(uid);
if (user == null) {
return true;
}
userHolder.setUser(user);
// 跳过post方法
if (httpServletRequest.getMethod().equals("POST")) {
return true;
}
// 如果用户登陆成功但是没有验证邮箱,跳转到邮箱验证页面(防止请求的url就是验证页时会循环跳转)
if (user.getStat().equals(User.STAT_NOT_VALIDATE) && !httpServletRequest.getRequestURI().equals("/user/validate")) {
httpServletResponse.sendRedirect("/user/validate");
return false;
} else if (user.getStat().equals(User.STAT_DEL)) { // 用户被删除
userHolder.remove();
}
}
return true;
}
public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
if (modelAndView == null) {
return;
}
if (httpServletRequest.getMethod().equals("GET") && userHolder.getUser() != null) {
modelAndView.getModel().put("user", userHolder.getUser().getNickname());
}
}
public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
userHolder.remove();
}
}
================================================
FILE: src/main/java/cn/cie/interceptor/LoginInterceptor.java
================================================
package cn.cie.interceptor;
import cn.cie.utils.UserHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Created by RojerAlone on 2017/6/12.
* 拦截器,某些功能需要登录才能继续,如果没有登录会被拦截,跳转到登录页
*/
@Component
public class LoginInterceptor implements HandlerInterceptor {
@Autowired
private UserHolder userHolder;
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
if (userHolder.getUser() == null) {
httpServletResponse.sendRedirect("/login");
return false;
}
return true;
}
public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
}
public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
}
}
================================================
FILE: src/main/java/cn/cie/mapper/CodeMapper.java
================================================
package cn.cie.mapper;
import cn.cie.entity.Code;
public interface CodeMapper {
int insert(Code record);
Code selectById(Integer id);
int update(Code record);
}
================================================
FILE: src/main/java/cn/cie/mapper/GameMapper.java
================================================
package cn.cie.mapper;
import cn.cie.entity.Game;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface GameMapper {
int insert(Game record);
Game selectById(Integer id);
int selectNums();
List<Game> selectAll();
List<Game> selectByPage(@Param(value = "startPos") Integer startPos, @Param(value = "size") Integer size);
List<Game> selectByIds(@Param(value = "ids") List<Integer> ids);
List<Game> selectByIdsAndStat(@Param(value = "ids") List<Integer> ids, @Param(value = "stat") Byte stat);
List<Game> selectByIdsAndStatAndPage(@Param(value = "ids") List<Integer> ids, @Param(value = "stat") Byte stat,
@Param(value = "startPos") Integer startPos, @Param(value = "size") Integer size);
List<Game> selectByStat(Byte stat);
List<Game> selectByStatOrderByDate(Byte stat);
List<Game> selectByIdsAndInfo(@Param(value = "ids") List<Integer> ids, @Param(value = "info") String info);
List<Game> selectByInfo(String info);
List<Game> selectFreeGames();
int update(Game record);
}
================================================
FILE: src/main/java/cn/cie/mapper/ImgMapper.java
================================================
package cn.cie.mapper;
import cn.cie.entity.Img;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ImgMapper {
int insert(Img record);
int insertBatch(@Param(value = "game") Integer game, @Param(value = "imgs") List<String> imgs);
List<String> selectByGame(Integer game);
}
================================================
FILE: src/main/java/cn/cie/mapper/KindMapper.java
================================================
package cn.cie.mapper;
import cn.cie.entity.Kind;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface KindMapper {
int insert(Kind record);
Kind selectById(Integer id);
List<Kind> selectAll();
List<Kind> selectByIds(@Param(value = "ids") List<Integer> ids);
Kind selectByName(String name);
List<Integer> selectIdByLikeName(String name);
int delete(Integer id);
int update(Kind record);
}
================================================
FILE: src/main/java/cn/cie/mapper/KindmapperMapper.java
================================================
package cn.cie.mapper;
import cn.cie.entity.Kindmapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface KindmapperMapper {
int insert(Kindmapper record);
int insertKindBatch(@Param(value = "game") Integer game, @Param(value = "kinds") List<Integer> kinds);
int insertGameBatch(@Param(value = "kind") Integer kind, @Param(value = "games") List<Integer> games);
List<Integer> selectByKind(Integer kind);
List<Integer> selectByGame(Integer game);
List<Integer> selectBatchByKinds(@Param(value = "kinds") List<Integer> kinds);
int deleteByGame(Integer game);
int deleteByKind(Integer kind);
}
================================================
FILE: src/main/java/cn/cie/mapper/OrderMapper.java
================================================
package cn.cie.mapper;
import cn.cie.entity.Order;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface OrderMapper {
int insert(Order record);
Order selectById(Integer id);
List<Order> selectByUidAndStat(@Param(value = "uid") Integer uid, @Param(value = "stat") Byte stat);
List<Order> selectByUidAndStatAndPage(@Param(value = "uid") Integer uid, @Param(value = "stat") Byte stat,
@Param(value = "startPos") Integer startPos, @Param(value = "size") Integer size);
int getOrderNumsByUidAndStat(@Param(value = "uid") Integer uid, @Param(value = "stat") Byte stat);
int updateStatByDate(@Param(value = "oldstat") Byte oldstat, @Param(value = "newstat") Byte newstat, @Param(value = "date") Date date);
int update(Order record);
}
================================================
FILE: src/main/java/cn/cie/mapper/OrderitemMapper.java
================================================
package cn.cie.mapper;
import cn.cie.entity.Orderitem;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface OrderitemMapper {
int insert(Orderitem record);
List<Orderitem> selectByIds(@Param(value = "ids") List<Integer> ids);
int update(Orderitem record);
}
================================================
FILE: src/main/java/cn/cie/mapper/OrdermapperMapper.java
================================================
package cn.cie.mapper;
import cn.cie.entity.Order;
import cn.cie.entity.Ordermapper;
import java.util.List;
public interface OrdermapperMapper {
int insert(Ordermapper record);
List<Integer> selectByOrder(Integer order);
}
================================================
FILE: src/main/java/cn/cie/mapper/TagMapper.java
================================================
package cn.cie.mapper;
import cn.cie.entity.Tag;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TagMapper {
int insert(Tag record);
Tag selectById(Integer id);
List<Tag> selectByIds(@Param(value = "ids") List<Integer> ids);
List<Integer> selectIdByLikeName(String info);
List<Tag> selectAll();
int update(Tag record);
}
================================================
FILE: src/main/java/cn/cie/mapper/TagmapperMapper.java
================================================
package cn.cie.mapper;
import cn.cie.entity.Tagmapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TagmapperMapper {
int insert(Tagmapper record);
List<Integer> selectByTag(Integer tag);
List<Integer> selectByGame(Integer game);
List<Integer> selectBatchByTags(@Param(value = "tags") List<Integer> tags);
}
================================================
FILE: src/main/java/cn/cie/mapper/TokenMapper.java
================================================
package cn.cie.mapper;
import cn.cie.entity.Token;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface TokenMapper {
int insert(Token record);
Token selectByToken(String token);
Token selectByTokenAndStat(@Param(value = "token") String token, @Param(value = "stat") Byte stat);
List<Token> selectByUid(Integer uid);
int updateStatByDate(@Param(value = "date") Date date, @Param(value = "stat") Byte stat);
int updateStatByToken(@Param(value = "stat") Byte stat, @Param(value = "token") String token);
}
================================================
FILE: src/main/java/cn/cie/mapper/UserMapper.java
================================================
package cn.cie.mapper;
import cn.cie.entity.User;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface UserMapper {
int insert(User record);
User selectById(Integer id);
User selectByName(String username);
User selectByEmail(String email);
int selectAllNums();
List<User> selectByPage(@Param(value = "startPos") Integer startPos, @Param(value = "size") Integer size);
List<User> selectByStat(Byte stat);
int update(User record);
int deleteById(Integer id);
}
================================================
FILE: src/main/java/cn/cie/schedule/Scheduler.java
================================================
package cn.cie.schedule;
import cn.cie.services.OrderService;
import cn.cie.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* Created by RojerAlone on 2017/6/9.
* 定时任务
* http://blog.csdn.net/sd4000784/article/details/7745947
*/
@Component
public class Scheduler {
@Autowired
private UserService userService;
@Autowired
private OrderService orderService;
@Scheduled(fixedRate = 1000 * 60 * 3)
public void delNotValidateUser() {
userService.delNotValidateUser();
}
@Scheduled(fixedRate = 1000 * 60 * 10)
public void expireToken() {
userService.expireToken();
}
@Scheduled(fixedRate = 1000 * 60)
public void cancelOrder() {
orderService.autoCancelOrder();
}
}
================================================
FILE: src/main/java/cn/cie/services/AdminService.java
================================================
package cn.cie.services;
import cn.cie.entity.Game;
import cn.cie.utils.Result;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.Date;
import java.util.List;
/**
* Created by RojerAlone on 2017/6/15.
* 管理员相关
*/
public interface AdminService {
/**
* 管理员登陆
* @param username
* @param password
* @return
*/
Result login(String username, String password);
/**
* 获取所有的用户
* @param page 当前的页数
* @return User Page
*/
Result getUser(int page);
/**
* 限制账户操作
* @param uid
* @return
*/
Result restrict(Integer uid);
/**
* 解除账户限制
* @param uid
* @return
*/
Result relieve(Integer uid);
/**
* 删除用户
* @param uid
* @return
*/
Result delete(Integer uid);
/**
* 获取所有游戏
* @param page 获取游戏的页数
* @return GameDTO Page
*/
Result getGames(int page);
/**
* 添加游戏
* @param game 游戏实体,需要游戏名字、开发者、描述、配置、价格
* @param kind 游戏种类,数组类型
* @param header 游戏图片
* @param pics 至少5张游戏截图
* @param path 图片存储路径
* @return
*/
Result addGame(Game game, Integer[] kind, MultipartFile header, MultipartFile[] pics, String path) throws IOException;
/**
* 更新游戏信息
* @param game
* @return
*/
Result updateGameInfo(Game game);
/**
* 获取游戏种类
* @param game
* @return
*/
Result getGameKind(Integer game);
/**
* 更新游戏的种类
* @param game
* @param kinds
* @return
*/
Result updateGameKind(Integer game, List<Integer> kinds);
/**
* 将游戏上架
* @param id
* @param date 上架时间
* @return
*/
Result upGame(Integer id, Date date);
/**
* 下架游戏
* @param id
* @return
*/
Result downGame(Integer id);
/**
* 添加游戏种类
* @param name
* @return
*/
Result addKind(String name);
/**
* 管理种类对应的游戏
* @param kind
* @param games
* @return
*/
Result managerKind(Integer kind, List<Integer> games);
/**
* 获取所有的游戏
* @return
*/
Result getAllGames();
}
================================================
FILE: src/main/java/cn/cie/services/GameService.java
================================================
package cn.cie.services;
import cn.cie.entity.dto.GameDTO;
import cn.cie.utils.Result;
import java.util.List;
/**
* Created by RojerAlone on 2017/6/8.
*/
public interface GameService {
/**
* 根据游戏id获取游戏详细信息
* @param id
* @return
*/
Result<GameDTO> getById(Integer id);
/**
* 获取随机图片,用于每日推荐
* @return
*/
Result<List<GameDTO>> getRandomGames();
/**
* 从缓存中获取最新的5个游戏,如果没有就从数据库中获取
* @return
*/
Result<List<GameDTO>> newestGames();
/**
* 从缓存中获取最新的5个准备上架的游戏,如果没有就从数据库中获取
* @return
*/
Result<List<GameDTO>> preUpGames();
/**
* 搜索,从种类、标签、游戏信息中搜索
* @param info
* @return
*/
Result<List<GameDTO>> search(String info);
/**
* 获取免费游戏
* @return
*/
Result getFreeGames();
/**
* 判断游戏是否存在
* @param id
* @return
*/
boolean exists(Integer id);
}
================================================
FILE: src/main/java/cn/cie/services/KindService.java
================================================
package cn.cie.services;
import cn.cie.entity.Kind;
import cn.cie.entity.dto.GameDTO;
import cn.cie.utils.Result;
import java.util.List;
/**
* Created by RojerAlone on 2017/6/6.
*/
public interface KindService {
/**
* 根据种类id获取种类名字,如果不存在返回null
* @param id
* @return
*/
String getNameById(Integer id);
/**
* 获取所有的种类
* @return
*/
Result<Kind> getAll();
/**
* 根据种类获取所有的游戏,包括游戏信息和游戏的种类、标签
* @param kind
* @param page
* @return
*/
Result<List<GameDTO>> getGamesByKind(int kind, int page);
}
================================================
FILE: src/main/java/cn/cie/services/OrderService.java
================================================
package cn.cie.services;
import cn.cie.utils.Result;
import java.util.List;
/**
* Created by RojerAlone on 2017/6/8.
*/
public interface OrderService {
/**
* 创建新订单
* @param uid
* @param gids
* @return
*/
Result addOrders(int uid, List<Integer> gids);
/**
* 取消订单
* @param orderid
* @return
*/
Result cancelOrder(int uid, int orderid);
/**
* 支付订单
* @param uid
* @param orderid
* @return
*/
Result pay(int uid, int orderid);
/**
* 判断订单是否存在
* @param orderid
* @return
*/
boolean exists(int orderid);
/**
* 获取待支付订单
* @param uid
* @return
*/
Result getNotPayOrders(int uid, int page);
/**
* 获取支付过的订单
* @param uid
* @return
*/
Result getPaidOrders(int uid, int page);
/**
* 获取取消的订单
* @param uid
* @return
*/
Result getCancelOrders(int uid, int page);
/**
* 自动取消15分钟还未支付的订单,定时器每1分钟检查一次
*/
void autoCancelOrder();
}
================================================
FILE: src/main/java/cn/cie/services/TagService.java
================================================
package cn.cie.services;
import cn.cie.entity.Tag;
import cn.cie.entity.dto.GameDTO;
import cn.cie.utils.Result;
import java.util.List;
/**
* Created by RojerAlone on 2017/6/7.
*/
public interface TagService {
/**
* 根据标签id获取标签名字,如果不存在返回null
* @param id
* @return
*/
String getNameById(Integer id);
/**
* 获取所有的标签
* @return
*/
Result<List<Tag>> getAll();
/**
* 添加标签,不绑定到游戏
* @param name
* @return
*/
Result<Tag> addTag(String name);
/**
* 添加标签并绑定到游戏
* @param name
* @param game
* @return
*/
Result addTag(String name, Integer game);
/**
* 绑定标签到游戏
* @param tag
* @param game
* @return
*/
Result addTag(Integer tag, Integer game);
/**
* 根据标签获取所有游戏
* @param tag
* @param page
* @return
*/
Result<List<GameDTO>> getGamesByTag(Integer tag, Integer page);
}
================================================
FILE: src/main/java/cn/cie/services/UserService.java
================================================
package cn.cie.services;
import cn.cie.entity.User;
import cn.cie.utils.Result;
/**
* Created by RojerAlone on 2017/5/31.
*/
public interface UserService {
/**
* 注册
* @param user
* @return
*/
Result register(User user);
/**
* 给用户注册的邮箱发送验证码
* @param user
* @return
*/
Result sendMail(User user);
/**
* 邮箱验证
* @param uid
* @param code
* @return
*/
Result validate(Integer uid, String code);
/**
* 登录
* 登陆时如果选择了“记住我”选项,那么token保持7天,否则保存1天
* 登陆成功,将token存在数据库中记录,同时存入缓存,过期时间为1天
* 每次请求时拦截器先从缓存中查找,如果没有再去数据库中查找
* @param username 用户名
* @param password 密码
* @param remember 是否保持登陆(token生存周期为7天)
* @return
*/
Result login(String username, String password, boolean remember, String ip, String device);
/**
* 登出
* @return
*/
Result logout(String token);
/**
* 更新用户信息
* @param user
* @return
*/
Result updateUserInfo(User user);
/**
* 更新密码
* @param password
* @return
*/
Result updatePassword(String password);
/**
* 忘记密码
* @param password
* @param code
* @return
*/
Result forgetPassword(String password, String email, String code);
/**
* 忘记密码时需要给邮箱发送验证码
* @param email
* @return
*/
Result sendFetchPwdMail(String email);
/**
* 删除没有验证的用户
*/
void delNotValidateUser();
/**
* 删除已经过期的token
*/
void expireToken();
}
================================================
FILE: src/main/java/cn/cie/services/impl/AdminServiceImpl.java
================================================
package cn.cie.services.impl;
import cn.cie.entity.*;
import cn.cie.entity.dto.GameDTO;
import cn.cie.mapper.*;
import cn.cie.services.AdminService;
import cn.cie.utils.*;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.*;
/**
* Created by RojerAlone on 2017/6/15.
*/
@Service
public class AdminServiceImpl implements AdminService {
@Autowired
private UserMapper userMapper;
@Autowired
private GameMapper gameMapper;
@Autowired
private KindMapper kindMapper;
@Autowired
private KindmapperMapper kindmapperMapper;
@Autowired
private TagMapper tagMapper;
@Autowired
private TagmapperMapper tagmapperMapper;
@Autowired
private ImgMapper imgMapper;
@Autowired
private RedisUtil redisUtil;
public Result login(String username, String password) {
if (username == null || password == null) {
return Result.fail(MsgCenter.EMPTY_LOGIN);
} else if (username.equals("admin") == false) {
return Result.fail(MsgCenter.LOGIN_NOT_ALLOW);
}
User user = userMapper.selectByName(username);
// 用户名不存在或者密码错误或者用户已经被删除
if (user == null || !user.getPassword().equals(PasswordUtil.pwd2Md5(password))
|| user.getStat().equals(User.STAT_DEL)) {
return Result.fail(MsgCenter.ERROR_LOGIN);
} else if (user.getStat().equals(User.STAT_RESTRICT)) {
return Result.fail(MsgCenter.USER_RESTRICT);
} else {
String token = UUID.randomUUID().toString().replaceAll("-", "");
redisUtil.putEx(token, String.valueOf(user.getId()), 60 * 60 * 24);
return Result.success(token);
}
}
public Result getUser(int page) {
PageUtil pageUtil = new PageUtil(userMapper.selectAllNums(), page);
Map<String, Object> map = new HashMap<String, Object>();
map.put("user", userMapper.selectByPage(pageUtil.getStartPos(), pageUtil.getSize()));
map.put("page", pageUtil);
return Result.success(map);
}
public Result restrict(Integer uid) {
User user = new User();
user.setId(uid);
user.setStat(User.STAT_RESTRICT);
if (1 == userMapper.update(user)) {
return Result.success();
} else {
return Result.fail("");
}
}
public Result relieve(Integer uid) {
User user = new User();
user.setId(uid);
user.setStat(User.STAT_OK);
if (1 == userMapper.update(user)) {
return Result.success();
} else {
return Result.fail("");
}
}
public Result delete(Integer uid) {
User user = new User();
user.setId(uid);
user.setStat(User.STAT_DEL);
if (1 == userMapper.update(user)) {
return Result.success();
} else {
return Result.fail("");
}
}
public Result getGames(int page) {
PageUtil pageUtil = new PageUtil(gameMapper.selectNums(), page);
List<Game> games = gameMapper.selectByPage(pageUtil.getStartPos(), pageUtil.getSize());
Map<String, Object> map = new HashMap<String, Object>();
map.put("game", paresGameDTO(games));
map.put("page", pageUtil);
return Result.success(map);
}
@Transactional
public Result addGame(Game game, Integer[] kind, MultipartFile header, MultipartFile[] pics, String path) throws IOException {
// 判断游戏信息
if (StringUtils.isBlank(game.getCreater()) || StringUtils.isBlank(game.getName())
|| StringUtils.isBlank(game.getDesc()) || StringUtils.isBlank(game.getSystemcfg())
|| game.getPrice() == null || game.getPrice() < 0) {
return Result.fail(MsgCenter.ERROR_PARAMS);
}
// 判断文件类型是否合法
if (!header.getContentType().equalsIgnoreCase("image/jpeg") && !header.getContentType().equalsIgnoreCase("image/png")) {
return Result.fail(MsgCenter.ERROR_FILE_TYPE);
}
for (MultipartFile pic : pics) {
if (!pic.getContentType().equalsIgnoreCase("image/jpeg") && !pic.getContentType().equalsIgnoreCase("image/png")) {
return Result.fail(MsgCenter.ERROR_FILE_TYPE);
}
}
gameMapper.insert(game);
if (kind != null && kind.length > 0) {
kindmapperMapper.insertKindBatch(game.getId(), Arrays.asList(kind));
}
Img image = new Img();
image.setGame(game.getId());
String headertype = null;
if (header.getContentType().equalsIgnoreCase("image/jpeg")) {
headertype = "jpg";
} else if (header.getContentType().equalsIgnoreCase("image/png")) {
headertype = "png";
}
image.setImg("/" + game.getId() + "/header." + headertype);
imgMapper.insert(image);
FileUtils.copyInputStreamToFile(header.getInputStream(), new File(path + "/" + game.getId(), "header." + headertype));
int index = 1;
List<String> imgs = new ArrayList<String>();
for (MultipartFile pic : pics) {
String type = null;
if (pic.getContentType().equalsIgnoreCase("image/jpeg")) {
type = "jpg";
} else if (pic.getContentType().equalsIgnoreCase("image/png")) {
type = "png";
}
// 拼接写入数据库的图片信息
String img = "/" + game.getId() + "/" + index + "." + type;
imgs.add(img);
FileUtils.copyInputStreamToFile(pic.getInputStream(), new File(path + "/" + game.getId(), index + "." + type));
index++;
}
imgMapper.insertBatch(game.getId(), imgs);
return Result.success();
}
public Result updateGameInfo(Game game) {
if (game.getId() == null) {
return Result.fail(MsgCenter.ERROR_PARAMS);
}
gameMapper.update(game);
return Result.success();
}
public Result getGameKind(Integer game) {
if (gameMapper.selectById(game) == null) {
return Result.fail(MsgCenter.ERROR_PARAMS);
}
List<Integer> kindIds = kindmapperMapper.selectByGame(game);
List<Kind> kinds = kindMapper.selectByIds(kindIds);
return Result.success(kinds);
}
@Transactional
public Result updateGameKind(Integer game, List<Integer> kinds) {
kindmapperMapper.deleteByGame(game);
kindmapperMapper.insertKindBatch(game, kinds);
return Result.success();
}
public Result upGame(Integer id, Date date) {
Game game = gameMapper.selectById(id);
// 如果没有这个游戏返回参数错误
if (game == null) {
return Result.fail(MsgCenter.ERROR_PARAMS);
}
game.setStat(Game.STAT_OK);
if (date == null) {
game.setUtime(new Date());
} else {
game.setUtime(date);
}
if (1 == gameMapper.update(game)) {
redisUtil.delete(RedisUtil.NEWESTGAME); // 上架游戏后将缓存中的最新游戏清空
return Result.success();
}
return Result.fail(MsgCenter.ERROR);
}
public Result downGame(Integer id) {
Game game = gameMapper.selectById(id);
// 如果没有这个游戏返回参数错误
if (game == null) {
return Result.fail(MsgCenter.ERROR_PARAMS);
}
game.setStat(Game.STAT_DEL);
if (1 == gameMapper.update(game)) {
redisUtil.delete(RedisUtil.NEWESTGAME); // 下架游戏后将缓存中的最新游戏清空
return Result.success();
}
return Result.fail(MsgCenter.ERROR);
}
@Transactional
public Result addKind(String name) {
Kind kind = kindMapper.selectByName(name);
if (kind != null) {
return Result.fail(MsgCenter.NAME_EXISTS);
}
kind = new Kind();
kind.setName(name);
if (1 == kindMapper.insert(kind)) {
redisUtil.rpushObject("kinds", Kind.class, kind); // 添加到缓存中
return Result.success();
} else {
return Result.fail(MsgCenter.ERROR);
}
}
@Transactional
public Result managerKind(Integer kind, List<Integer> games) {
kindmapperMapper.deleteByKind(kind);
kindmapperMapper.insertGameBatch(kind, games);
return Result.success();
}
public Result getAllGames() {
List<Game> games = gameMapper.selectAll();
List<GameDTO> gameDTOS = new ArrayList<GameDTO>();
for (Game game : games) {
List<Kind> kinds = null;
List<Integer> kindIds = kindmapperMapper.selectByGame(game.getId()); // 根据游戏id获取所有的种类id
if (kindIds.size() != 0) {
kinds = kindMapper.selectByIds(kindIds); // 根据种类id获取种类信息
}
GameDTO dto = new GameDTO(game, kinds, null, null);
gameDTOS.add(dto);
}
return Result.success(gameDTOS);
}
private List<GameDTO> paresGameDTO(List<Game> games) {
List<GameDTO> gameDTOS = new ArrayList<GameDTO>();
for (Game game : games) {
List<Tag> tags = null;
List<Kind> kinds = null;
List<Integer> tagIds = tagmapperMapper.selectByGame(game.getId()); // 获取游戏的标签id
if (tagIds.size() != 0) {
tags = tagMapper.selectByIds(tagIds); // 根据id获取所有的标签信息
}
List<String> img = imgMapper.selectByGame(game.getId()); // 获取所有的图片
List<Integer> kindIds = kindmapperMapper.selectByGame(game.getId()); // 根据游戏id获取所有的种类id
if (kindIds.size() != 0) {
kinds = kindMapper.selectByIds(kindIds); // 根据种类id获取种类信息
}
GameDTO dto = new GameDTO(game, kinds, tags, img);
gameDTOS.add(dto);
}
return gameDTOS;
}
}
================================================
FILE: src/main/java/cn/cie/services/impl/GameServiceImpl.java
================================================
package cn.cie.services.impl;
import cn.cie.entity.Game;
import cn.cie.entity.Kind;
import cn.cie.entity.Tag;
import cn.cie.entity.dto.GameDTO;
import cn.cie.mapper.*;
import cn.cie.services.GameService;
import cn.cie.utils.MsgCenter;
import cn.cie.utils.RedisUtil;
import cn.cie.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.*;
/**
* Created by RojerAlone on 2017/6/8.
*/
@Service
public class GameServiceImpl implements GameService {
@Autowired
private GameMapper gameMapper;
@Autowired
private KindMapper kindMapper;
@Autowired
private KindmapperMapper kindmapperMapper;
@Autowired
private TagmapperMapper tagmapperMapper;
@Autowired
private TagMapper tagMapper;
@Autowired
private ImgMapper imgMapper;
@Autowired
private RedisUtil<GameDTO> redisUtil;
public Result<GameDTO> getById(Integer id) {
Game game = gameMapper.selectById(id);
if (game == null) {
return Result.fail(MsgCenter.ERROR_PARAMS);
}
List<Integer> tagIds = tagmapperMapper.selectByGame(id);
List<Tag> tags = null;
if (tagIds.size() != 0) {
tags = tagMapper.selectByIds(tagIds);
}
List<String> img = imgMapper.selectByGame(game.getId());
GameDTO res = new GameDTO(game, tags, img);
return Result.success(res);
}
public Result<List<GameDTO>> getRandomGames() {
// 先从缓存中取数据,如果没有再自动生成
List<GameDTO> res = redisUtil.lall("everyday", GameDTO.class);
if (res == null || res.size() == 0) {
List<Game> allgames = gameMapper.selectByStat(Game.STAT_OK);
int count = allgames.size();
Set<Integer> numSet = new HashSet<Integer>();
Random random = new Random();
List<Game> games = new ArrayList<Game>();
// 如果游戏数量大于5个就随机取5个,否则取全部的
if (count > 5) {
while (numSet.size() < 5) {
numSet.add(random.nextInt(count));
}
Iterator i = numSet.iterator();
while (i.hasNext()) {
games.add(allgames.get((Integer) i.next()));
}
} else {
games = allgames;
}
res = paresGameDTO(games);
// 将数据存入缓存中
int tmp = 1000 * 3600 * 24;
long zero = (System.currentTimeMillis() / tmp * tmp + tmp - TimeZone.getDefault().getRawOffset()) / 1000; //明天零点零分零秒的unix时间戳
redisUtil.rpushObjectExAtTime(RedisUtil.EVERYDAY, GameDTO.class, zero, res.toArray());
}
return Result.success(res);
}
public Result<List<GameDTO>> newestGames() {
List<GameDTO> res = redisUtil.lall(RedisUtil.NEWESTGAME, GameDTO.class);
if (res == null || res.size() == 0) {
List<Game> games = gameMapper.selectByStatOrderByDate(Game.STAT_OK);
res = paresGameDTO(games);
redisUtil.rpushObjectEx(RedisUtil.NEWESTGAME, GameDTO.class, 60 * 10, res.toArray());
}
return Result.success(res);
}
public Result<List<GameDTO>> preUpGames() {
List<GameDTO> res = redisUtil.lall(RedisUtil.PRE_UP_GAMES, GameDTO.class);
if (res == null || res.size() == 0) {
List<Game> games = gameMapper.selectByStatOrderByDate(Game.STAT_PRE);
res = paresGameDTO(games);
redisUtil.rpushObjectEx(RedisUtil.PRE_UP_GAMES, GameDTO.class, 60 * 10, res.toArray());
}
return Result.success(res);
}
public Result<List<GameDTO>> search(String info) {
List<Integer> kindIds = kindMapper.selectIdByLikeName(info);
List<Integer> tagIds = tagMapper.selectIdByLikeName(info);
List<Integer> gameIdsOfKind = null;
if (kindIds != null && kindIds.size() > 0) {
gameIdsOfKind = kindmapperMapper.selectBatchByKinds(kindIds);
}
List<Integer> gameIdsOfTag = null;
if (tagIds != null && tagIds.size() > 0) {
gameIdsOfTag = tagmapperMapper.selectBatchByTags(tagIds);
}
Set<Integer> tmpGameIds = new HashSet<Integer>();
if (gameIdsOfKind != null && gameIdsOfKind.size() > 0) {
tmpGameIds.addAll(gameIdsOfKind);
}
if (gameIdsOfTag != null && gameIdsOfTag.size() > 0) {
tmpGameIds.addAll(gameIdsOfTag);
}
List<Game> games = null;
if (tmpGameIds.size() > 0) {
List<Integer> gameIds = new ArrayList<Integer>(tmpGameIds);
games = gameMapper.selectByIdsAndInfo(gameIds, info);
} else {
games = gameMapper.selectByInfo(info);
}
return Result.success(paresGameDTO(games));
}
public Result getFreeGames() {
List<Game> games = gameMapper.selectFreeGames();
return Result.success(paresGameDTO(games));
}
public boolean exists(Integer id) {
return gameMapper.selectById(id) != null;
}
private List<GameDTO> paresGameDTO(List<Game> games) {
List<GameDTO> gameDTOS = new ArrayList<GameDTO>();
for (Game game : games) {
List<String> img = imgMapper.selectByGame(game.getId()); // 获取所有的图片
GameDTO dto = new GameDTO(game, null, img);
gameDTOS.add(dto);
}
return gameDTOS;
}
}
================================================
FILE: src/main/java/cn/cie/services/impl/KindServiceImpl.java
================================================
package cn.cie.services.impl;
import cn.cie.entity.Game;
import cn.cie.entity.Kind;
import cn.cie.entity.Tag;
import cn.cie.entity.dto.GameDTO;
import cn.cie.mapper.*;
import cn.cie.services.KindService;
import cn.cie.utils.MsgCenter;
import cn.cie.utils.PageUtil;
import cn.cie.utils.RedisUtil;
import cn.cie.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Array;
import java.util.*;
/**
* Created by RojerAlone on 2017/6/6.
*/
@Service
public class KindServiceImpl implements KindService {
@Autowired
private KindMapper kindMapper;
@Autowired
private KindmapperMapper kindmapperMapper;
@Autowired
private GameMapper gameMapper;
@Autowired
private ImgMapper imgMapper;
@Autowired
private TagMapper tagMapper;
@Autowired
private TagmapperMapper tagmapperMapper;
@Autowired
private RedisUtil<Kind> redisUtil;
public String getNameById(Integer id) {
Kind kind = kindMapper.selectById(id);
if (kind == null) {
return null;
}
return kind.getName();
}
public Result<Kind> getAll() {
List<Kind> kinds = redisUtil.lall(RedisUtil.KINDS, Kind.class);
// 如果缓存中没有,从数据库中查询,并且添加到缓存中
if (kinds == null || kinds.size() == 0) {
List<Kind> data = kindMapper.selectAll();
redisUtil.rpushObject(RedisUtil.KINDS, Kind.class, data.toArray());
return Result.success(data);
}
return Result.success(kinds);
}
public Result<List<GameDTO>> getGamesByKind(int kind, int page) {
if (kindMapper.selectById(kind) == null) {
return Result.fail(MsgCenter.NOT_FOUND);
}
List<Integer> gameIds = kindmapperMapper.selectByKind(kind);
// 如果没有就返回
if (gameIds == null || gameIds.size() == 0) {
return Result.success();
}
List<Game> games = gameMapper.selectByIdsAndStat(gameIds, Game.STAT_OK);
PageUtil pageUtil = new PageUtil(games.size(), page);
// 假分页
int size = pageUtil.getStartPos() + 10 > games.size() - 1 ? games.size() : pageUtil.getStartPos() + 10;
List<GameDTO> gameDTOS = paresGameDTO(games.subList(pageUtil.getStartPos(), size));
Map<String, Object> map = new HashMap<String, Object>();
map.put("game", gameDTOS);
map.put("page", pageUtil);
return Result.success(map);
}
private List<GameDTO> paresGameDTO(List<Game> games) {
List<GameDTO> gameDTOS = new ArrayList<GameDTO>();
for (Game game : games) {
List<Tag> tags = null;
List<Integer> tagIds = tagmapperMapper.selectByGame(game.getId()); // 获取游戏的标签id
if (tagIds.size() != 0) {
tags = tagMapper.selectByIds(tagIds); // 根据id获取所有的标签信息
}
List<String> img = imgMapper.selectByGame(game.getId()); // 获取所有的图片
GameDTO dto = new GameDTO(game, tags, img);
gameDTOS.add(dto);
}
return gameDTOS;
}
}
================================================
FILE: src/main/java/cn/cie/services/impl/OrderServiceImpl.java
================================================
package cn.cie.services.impl;
import cn.cie.entity.*;
import cn.cie.entity.dto.OrderDTO;
import cn.cie.entity.dto.OrderItemDTO;
import cn.cie.mapper.*;
import cn.cie.services.OrderService;
import cn.cie.utils.MsgCenter;
import cn.cie.utils.PageUtil;
import cn.cie.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
* Created by RojerAlone on 2017/6/12.
*/
@Service
public class OrderServiceImpl implements OrderService {
@Autowired
private OrderMapper orderMapper;
@Autowired
private OrderitemMapper orderitemMapper;
@Autowired
private GameMapper gameMapper;
@Autowired
private OrdermapperMapper ordermapperMapper;
@Autowired
private CodeMapper codeMapper;
@Transactional
public Result addOrders(int uid, List<Integer> gids) {
Order order = new Order();
order.setUid(uid);
orderMapper.insert(order);
double total = 0;
// 对所有的游戏进行存储、计价
for (Integer gid : gids) {
Game game = gameMapper.selectById(gid);
if (game.getStat() != Game.STAT_OK) {
return Result.fail(MsgCenter.ERROR_PARAMS);
}
Orderitem item = new Orderitem();
item.setGid(gid);
// 如果现价不为空,那么就计算现价
if (game.getDiscount() != null) {
total += game.getDiscount();
item.setPrice(game.getDiscount());
} else {
total += game.getPrice();
item.setPrice(game.getPrice());
}
orderitemMapper.insert(item);
Ordermapper mapper = new Ordermapper();
mapper.setItem(item.getId());
mapper.setOrder(order.getId());
ordermapperMapper.insert(mapper);
}
// 更新所有游戏的价格
order.setPrice(total);
orderMapper.update(order);
return Result.success(order);
}
public Result cancelOrder(int uid, int orderid) {
Order order = orderMapper.selectById(orderid);
// 如果orderid错误或者用户与订单不匹配,就返回错误
if (order == null || order.getUid() != uid) {
return Result.fail(MsgCenter.ERROR_PARAMS);
}
order.setStat(Order.STAT_CANCEL);
if (1 == orderMapper.update(order)) {
return Result.success();
}
return Result.fail(MsgCenter.ERROR);
}
@Transactional
public Result pay(int uid, int orderid) {
Order order = orderMapper.selectById(orderid);
// 如果orderid错误或者用户与订单不匹配,就返回错误
if (order == null || order.getUid() != uid) {
return Result.fail(MsgCenter.ERROR_PARAMS);
}
order.setStat(Order.STAT_PAY);
orderMapper.update(order);
List<Integer> orderitems = ordermapperMapper.selectByOrder(orderid);
List<Orderitem> orderitemList = orderitemMapper.selectByIds(orderitems);
for (Orderitem item : orderitemList) {
// 生产激活码并插入数据库
String uuid = UUID.randomUUID().toString();
Code code = new Code();
code.setItem(item.getId());
code.setUid(uid);
code.setCode(uuid);
codeMapper.insert(code);
// 插入code后更新orderitem的对应codeid
item.setCode(code.getId());
orderitemMapper.update(item);
}
return Result.success();
}
public boolean exists(int orderid) {
return orderMapper.selectById(orderid) != null;
}
public Result getNotPayOrders(int uid, int page) {
PageUtil pageUtil = new PageUtil(orderMapper.getOrderNumsByUidAndStat(uid, Order.STAT_NOT_PAY), page);
Map<String, Object> map = new HashMap<String, Object>();
map.put("order", parseOrderByStatAndPage(uid, Order.STAT_NOT_PAY, pageUtil));
map.put("page", pageUtil);
return Result.success(map);
}
public Result getPaidOrders(int uid, int page) {
PageUtil pageUtil = new PageUtil(orderMapper.getOrderNumsByUidAndStat(uid, Order.STAT_PAY), page);
Map<String, Object> map = new HashMap<String, Object>();
map.put("order", parseOrderByStatAndPage(uid, Order.STAT_PAY, pageUtil));
map.put("page", pageUtil);
return Result.success(map);
}
public Result getCancelOrders(int uid, int page) {
PageUtil pageUtil = new PageUtil(orderMapper.getOrderNumsByUidAndStat(uid, Order.STAT_CANCEL), page);
Map<String, Object> map = new HashMap<String, Object>();
map.put("order", parseOrderByStatAndPage(uid, Order.STAT_CANCEL, pageUtil));
map.put("page", pageUtil);
return Result.success(map);
}
public void autoCancelOrder() {
Date date = new Date();
date.setTime(date.getTime() - 1000 * 60 * 15); // 过期时间为15分钟
orderMapper.updateStatByDate(Order.STAT_NOT_PAY, Order.STAT_CANCEL, date);
}
private List<OrderDTO> parseOrderByStatAndPage(Integer uid, Byte stat, PageUtil pageUtil) {
List<OrderDTO> res = new ArrayList<OrderDTO>();
List<Order> orders = orderMapper.selectByUidAndStatAndPage(uid, stat, pageUtil.getStartPos(), pageUtil.getSize());
for (Order order : orders) {
List<Integer> orderids = ordermapperMapper.selectByOrder(order.getId()); // 获取订单内所有的订单详情id
List<Orderitem> orderitemList = orderitemMapper.selectByIds(orderids); // 根据订单详情id获取订单详情
List<OrderItemDTO> orderItemDTOList = new ArrayList<OrderItemDTO>();
// 拼接订单详情信息,包括订单对应的游戏和激活码
for (Orderitem orderitem : orderitemList) {
Game game = gameMapper.selectById(orderitem.getGid()); // 游戏信息
Code code;
// 如果code不为空那么获取code
if (orderitem.getCode() != null) {
code = codeMapper.selectById(orderitem.getCode()); // 激活码信息
} else {
code = null;
}
orderItemDTOList.add(new OrderItemDTO(orderitem, game, code));
}
res.add(new OrderDTO(order, orderItemDTOList));
}
return res;
}
}
================================================
FILE: src/main/java/cn/cie/services/impl/TagServiceImpl.java
================================================
package cn.cie.services.impl;
import cn.cie.entity.Game;
import cn.cie.entity.Tag;
import cn.cie.entity.Tagmapper;
import cn.cie.entity.dto.GameDTO;
import cn.cie.mapper.GameMapper;
import cn.cie.mapper.ImgMapper;
import cn.cie.mapper.TagMapper;
import cn.cie.mapper.TagmapperMapper;
import cn.cie.services.TagService;
import cn.cie.utils.MsgCenter;
import cn.cie.utils.PageUtil;
import cn.cie.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by RojerAlone on 2017/6/7.
*/
@Service
public class TagServiceImpl implements TagService {
@Autowired
private TagMapper tagMapper;
@Autowired
private TagmapperMapper tagmapperMapper;
@Autowired
private GameMapper gameMapper;
@Autowired
private ImgMapper imgMapper;
public String getNameById(Integer id) {
Tag tag = tagMapper.selectById(id);
if (tag == null) {
return null;
}
return tag.getName();
}
public Result<List<Tag>> getAll() {
return Result.success(tagMapper.selectAll());
}
public Result<Tag> addTag(String name) {
Tag tag = new Tag();
tag.setName(name);
if (1 == tagMapper.insert(tag)) {
return Result.success(tag);
} else {
return Result.fail(MsgCenter.ERROR);
}
}
@Transactional
public Result addTag(String name, Integer game) {
// 如果没有这个游戏,就返回404
if (gameMapper.selectById(game) == null) {
return Result.fail(MsgCenter.NOT_FOUND);
}
Result result = addTag(name);
if (result.isSuccess()) {
Tagmapper tagmapper = new Tagmapper();
tagmapper.setGame(game);
tagmapper.setTag(((Tag) result.getData()).getId());
if (1 == tagmapperMapper.insert(tagmapper)) {
return Result.success();
}
}
return Result.fail(MsgCenter.ERROR);
}
public Result addTag(Integer tag, Integer game) {
// 如果没有这个游戏,就返回404
if (gameMapper.selectById(game) == null) {
return Result.fail(MsgCenter.NOT_FOUND);
}
Tagmapper tagmapper = new Tagmapper();
tagmapper.setGame(game);
tagmapper.setTag(tag);
if (1 == tagmapperMapper.insert(tagmapper)) {
return Result.success();
} else {
return Result.fail(MsgCenter.ERROR);
}
}
public Result<List<GameDTO>> getGamesByTag(Integer tag, Integer page) {
// 没有这个标签,返回404
if (tagMapper.selectById(tag) == null) {
return Result.fail(MsgCenter.NOT_FOUND);
}
List<Integer> gameIds = tagmapperMapper.selectByTag(tag); // 根据标签获取所有的游戏ID
List<Game> games = gameMapper.selectByIdsAndStat(gameIds, Game.STAT_OK);
PageUtil pageUtil = new PageUtil(games.size(), page);
// 假分页
int size = pageUtil.getStartPos() + 10 > games.size() - 1 ? games.size() : pageUtil.getStartPos() + 10;
List<GameDTO> gameDTOS = paresGameDTO(games.subList(pageUtil.getStartPos(), size));
Map<String, Object> map = new HashMap<String, Object>();
map.put("game", gameDTOS);
map.put("page", pageUtil);
return Result.success(map);
}
private List<GameDTO> paresGameDTO(List<Game> games) {
List<GameDTO> gameDTOS = new ArrayList<GameDTO>();
for (Game game : games) {
List<Tag> tags = null;
List<Integer> tagIds = tagmapperMapper.selectByGame(game.getId()); // 获取游戏的标签id
if (tagIds.size() != 0) {
tags = tagMapper.selectByIds(tagIds); // 根据id获取所有的标签信息
}
List<String> img = imgMapper.selectByGame(game.getId()); // 获取所有的图片
GameDTO dto = new GameDTO(game, tags, img);
gameDTOS.add(dto);
}
return gameDTOS;
}
}
================================================
FILE: src/main/java/cn/cie/services/impl/UserServiceImpl.java
================================================
package cn.cie.services.impl;
import cn.cie.entity.Token;
import cn.cie.entity.User;
import cn.cie.event.EventModel;
import cn.cie.event.EventProducer;
import cn.cie.event.EventType;
import cn.cie.utils.UserHolder;
import cn.cie.entity.Validatecode;
import cn.cie.mapper.TokenMapper;
import cn.cie.mapper.UserMapper;
import cn.cie.services.UserService;
import cn.cie.utils.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.regex.Pattern;
/**
* Created by RojerAlone on 2017/5/31.
*/
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserMapper userMapper;
@Autowired
private TokenMapper tokenMapper;
@Autowired
private UserHolder userHolder;
@Autowired
private RedisUtil redisUtil;
@Autowired
private EventProducer eventProducer;
@Transactional
public Result register(User user) {
// 验证参数是否合法
if (StringUtils.isBlank(user.getUsername())) {
return Result.fail(MsgCenter.EMPTY_USERNAME);
} else if (StringUtils.isBlank(user.getNickname())) {
return Result.fail(MsgCenter.EMPTY_NICKNAME);
} else if (user.getNickname().length() > 10) {
return Result.fail(MsgCenter.ERROR_NICINAME);
} else if (StringUtils.isBlank(user.getPassword())) {
return Result.fail(MsgCenter.EMPTY_PASSWORD);
} else if (16 < user.getPassword().replaceAll(" ", "").length()
|| user.getPassword().replaceAll(" ", "").length() < 6) {
return Result.fail(MsgCenter.ERROR_PASSWORD_FORMAT);
} else if (StringUtils.isBlank(user.getEmail())) {
return Result.fail(MsgCenter.EMPTY_EMAIL);
} else if (Pattern.compile("^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$").
matcher(user.getEmail()).find() == false) { // 判断邮箱格式是否正确
return Result.fail(MsgCenter.ERROR_EMAIL);
} else if (user.getPhone() == null) {
return Result.fail(MsgCenter.EMPTY_PHONE);
} else if (Pattern.compile("1[3|5|7|8|]\\d{9}").matcher(user.getPhone().toString()).find() == false) { // 验证手机号码是否格式正确
return Result.fail(MsgCenter.ERROR_PHONE);
} else if (userMapper.selectByName(user.getUsername()) != null) { // 用户名已经被注册
return Result.fail(MsgCenter.USER_USERNAME_EXISTS);
} else if (userMapper.selectByEmail(user.getEmail()) != null) { // 邮箱已被注册
return Result.fail(MsgCenter.EMAIL_REGISTERED);
}
user.setPassword(PasswordUtil.pwd2Md5(user.getPassword().replaceAll(" ", ""))); // 加密密码
if (1 == userMapper.insert(user)) { // 注册成功
String uuid = UUID.randomUUID().toString();
redisUtil.putEx("validatecode_" + user.getId(), uuid, Validatecode.TIMEOUT); // 存入redis
eventProducer.product(new EventModel(EventType.SEND_VALIDATE_EMAIL).setExts("mail", user.getEmail()).setExts("code", uuid));
return Result.success(user.getId());
}
return Result.fail(MsgCenter.ERROR);
}
@Transactional
public Result sendMail(User user) {
if (user.getStat().equals(User.STAT_OK)) { // 用户已经验证过了
return Result.fail(MsgCenter.USER_VALIDATED);
}
String uuid = UUID.randomUUID().toString();
// 将数据存入redis中,固定时间后过期
redisUtil.putEx("validatecode_" + user.getId(), uuid, Validatecode.TIMEOUT);
// 将邮件发送事件添加到异步事件队列中去
eventProducer.product(new EventModel(EventType.SEND_VALIDATE_EMAIL).setExts("mail", user.getEmail()).setExts("code", uuid));
return Result.success();
}
@Transactional
public Result validate(Integer uid, String code) {
String uuid = redisUtil.get("validatecode_" + uid);
if (code != null && code.length() == 36 && code.equals(uuid)) {
User user = userHolder.getUser();
user.setStat(User.STAT_OK);
if (1 == userMapper.update(user)) {
redisUtil.delete("validatecode_" + uid); // 验证成功后删除验证码
return Result.success();
} else {
return Result.fail(MsgCenter.ERROR);
}
}
return Result.fail(MsgCenter.CODE_ERROR);
}
@Transactional
public Result login(String username, String password, boolean remember, String ip, String device) {
if (username == null || password == null) {
return Result.fail(MsgCenter.EMPTY_LOGIN);
}
User user = userMapper.selectByName(username);
// 用户名不存在或者密码错误或者用户已经被删除
if (user == null || !user.getPassword().equals(PasswordUtil.pwd2Md5(password))
|| user.getStat().equals(User.STAT_DEL)) {
return Result.fail(MsgCenter.ERROR_LOGIN);
} else if (user.getStat().equals(User.STAT_RESTRICT)) {
return Result.fail(MsgCenter.USER_RESTRICT);
} else {
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
Token token = new Token();
token.setUid(user.getId());
token.setToken(uuid);
token.setIp(ip);
token.setDevice(device);
// 如果保持登陆,过期时间就为7天,否则为1天
if (remember) {
token.setExpiredTime(new Date(1000 * 60 * 60 * 24 * 7 + System.currentTimeMillis()));
} else {
token.setExpiredTime(new Date(1000 * 60 * 60 * 24 + System.currentTimeMillis()));
}
tokenMapper.insert(token);
redisUtil.putEx(uuid, String.valueOf(user.getId()), 60 * 60 * 24);
return Result.success(uuid);
}
}
public Result logout(String token) {
if (token == null || token.length() != 32) {
return Result.fail(MsgCenter.ERROR_PARAMS);
}
redisUtil.delete(token);
tokenMapper.updateStatByToken(Token.STAT_EXPIRED, token);
return Result.success();
}
public Result updateUserInfo(User user) {
if (userHolder.getUser() == null) {
return Result.fail(MsgCenter.USER_NOT_LOGIN);
}
// 验证参数是否合法
if (StringUtils.isBlank(user.getNickname())) {
return Result.fail(MsgCenter.EMPTY_NICKNAME);
} else if (user.getNickname().length() > 10) {
return Result.fail(MsgCenter.ERROR_NICINAME);
} else if (StringUtils.isBlank(user.getEmail())) {
return Result.fail(MsgCenter.EMPTY_EMAIL);
} else if (Pattern.compile("^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$").
matcher(user.getEmail()).find() == false) { // 判断邮箱格式是否正确
return Result.fail(MsgCenter.ERROR_EMAIL);
} else if (user.getPhone() == null) {
return Result.fail(MsgCenter.EMPTY_PHONE);
} else if (Pattern.compile("1[3|5|7|8|]\\d{9}").matcher(user.getPhone().toString()).find() == false) { // 验证手机号码是否格式正确
return Result.fail(MsgCenter.ERROR_PHONE);
} else if (userMapper.selectByEmail(user.getEmail()) != null && !userHolder.getUser().getEmail().equals(user.getEmail())) { // 更改邮箱同时邮箱已被注册
return Result.fail(MsgCenter.EMAIL_REGISTERED);
}
user.setId(userHolder.getUser().getId());
user.setPassword(null);
user.setStat(null);
if (1 == userMapper.update(user)) {
return Result.success();
}
return Result.fail(MsgCenter.ERROR);
}
public Result updatePassword(String password) {
if (StringUtils.isBlank(password)) {
return Result.fail(MsgCenter.EMPTY_PASSWORD);
} else if (16 < password.replaceAll(" ", "").length()
|| password.replaceAll(" ", "").length() < 6) {
return Result.fail(MsgCenter.ERROR_PASSWORD_FORMAT);
}
User user = userHolder.getUser();
user.setPassword(PasswordUtil.pwd2Md5(password.replaceAll(" ", "")));
if (1 == userMapper.update(user)) {
return Result.success();
} else {
return Result.fail(MsgCenter.ERROR);
}
}
public Result forgetPassword(String password, String email, String code) {
User user = null;
if (StringUtils.isBlank(email)) {
return Result.fail(MsgCenter.EMPTY_EMAIL);
} else if (Pattern.compile("^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$").
matcher(email).find() == false || (user = userMapper.selectByEmail(email)) == null) { // 判断邮箱格式以及两次邮箱是否一致
return Result.fail(MsgCenter.ERROR_EMAIL);
} else if (StringUtils.isBlank(password)) {
return Result.fail(MsgCenter.EMPTY_PASSWORD);
} else if (16 < password.replaceAll(" ", "").length()
|| password.replaceAll(" ", "").length() < 6) {
return Result.fail(MsgCenter.ERROR_PASSWORD_FORMAT);
}
String uuid = redisUtil.get(email);
if (code != null && code.length() == 36 && code.equals(uuid)) {
user.setPassword(PasswordUtil.pwd2Md5(password.replaceAll(" ", "")));
if (1 == userMapper.update(user)) {
redisUtil.delete(email); // 验证成功后删除验证码
return Result.success(user.getUsername());
} else {
return Result.fail(MsgCenter.ERROR);
}
}
return Result.fail(MsgCenter.CODE_ERROR);
}
public Result sendFetchPwdMail(String email) {
if (StringUtils.isBlank(email)) {
return Result.fail(MsgCenter.EMPTY_EMAIL);
} else if (Pattern.compile("^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$").
matcher(email).find() == false) { // 判断邮箱格式是否正确
return Result.fail(MsgCenter.ERROR_EMAIL);
}
User user = userMapper.selectByEmail(email);
if (user == null) {
return Result.fail(MsgCenter.EMAIL_NOT_REGISTERED);
}
String uuid = UUID.randomUUID().toString();
// 将数据存入redis中,固定时间后过期
redisUtil.putEx(email, uuid, Validatecode.TIMEOUT);
eventProducer.product(new EventModel(EventType.SEND_FIND_PWD_EMAIL).setExts("mail", user.getEmail()).setExts("code", uuid));
return Result.success();
}
public void delNotValidateUser() {
List<User> users = userMapper.selectByStat(User.STAT_NOT_VALIDATE);
Date date = new Date();
date.setTime(date.getTime() - 1000 * 60 * 60); // 删除一小时前注册但未验证的用户
for (User user : users) {
if (user.getCtime().before(date)) {
userMapper.deleteById(user.getId());
}
}
}
public void expireToken() {
Date date = new Date();
tokenMapper.updateStatByDate(date, Token.STAT_EXPIRED);
}
}
================================================
FILE: src/main/java/cn/cie/utils/MailUtil.java
================================================
package cn.cie.utils;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
/**
* Created by RojerAlone on 2017/6/2.
* 邮件工具
*/
public class MailUtil {
private final static String USERNAME = "rojeralone@163.com";
private final static String PASSWORD = "password"; // 需要打开SMTP并使用此授权码登录
/**
* 发送邮件给指定人,需要主题和内容
* @param user
* @param title
* @param content
*/
public static void sendMail(String user, String title, String content) {
SimpleEmail email = new SimpleEmail();
email.setCharset("UTF8");
email.setHostName("smtp.163.com");
email.setAuthentication(USERNAME, PASSWORD);
try {
email.setFrom(USERNAME);
email.addTo(user);
email.setSubject(title);
email.setMsg(content);
email.send();
} catch (EmailException e) {
e.printStackTrace();
}
}
/**
* 发送验证邮件给用户
* @param user
* @param code
*/
public static void sendValidateMail(String user, String code) {
String title = "WePlay注册验证码";
String content = "感谢您注册WePlay,您的验证码为 \n" + code + "\n,请注意保存,此验证码有效期为 10分钟 ,并且只能使用一次。";
sendMail(user, title, content);
}
/**
* 忘记密码时发送验证邮件给用户
* @param user
* @param code
*/
public static void sendFetchPwdMail(String user, String code) {
String title = "WePlay找回密码";
String content = "这封邮件是在验证您的WePlay邮箱,用来找回密码,如果不是您本人的操作,请忽略此邮件。\n您的验证码为 \n" + code + "\n请注意保存,此验证码有效期为 10分钟 ,并且只能使用一次。";
sendMail(user, title, content);
}
}
================================================
FILE: src/main/java/cn/cie/utils/MsgCenter.java
================================================
package cn.cie.utils;
/**
* Created by RojerAlone on 2017/6/6.
* 消息字典
*/
public class MsgCenter {
public static final String OK = "OK";
public static final String ERROR = "服务器内部错误";
public static final String ERROR_PARAMS = "参数错误";
public static final String NOT_FOUND = "没有找到请求的资源";
public static final String ERROR_LOGIN = "用户名或密码错误";
public static final String EMPTY_LOGIN = "用户名或密码不能为空";
public static final String EMPTY_NICKNAME = "昵称不能为空";
public static final String ERROR_NICINAME = "昵称长度不能大于10个字符且不能包含非法字符";
public static final String USER_NOT_VALIDATE = "请先验证邮箱";
public static final String USER_USERNAME_EXISTS = "该用户名已被注册";
public static final String USER_VALIDATED = "您的邮箱已经验证过了,无需再次验证";
public static final String USER_HAVE_LOGIN = "您已经登陆,无需再次登陆";
public static final String USER_NOT_LOGIN = "请先登陆";
public static final String USER_RESTRICT = "你已经被限制登陆,请联系管理员解除限制";
public static final String EMAIL_REGISTERED = "该邮箱已被注册";
public static final String EMAIL_NOT_REGISTERED = "该邮箱还未注册";
public static final String ERROR_EMAIL = "请输入正确的电子邮箱";
public static final String CODE_ERROR = "邮箱验证码错误";
public static final String EMPTY_USERNAME = "用户名不能为空";
public static final String EMPTY_PASSWORD = "密码不能为空";
public static final String EMPTY_PHONE = "手机号不能为空";
public static final String ERROR_PHONE = "请填入真实的手机号码";
public static final String EMPTY_EMAIL = "邮箱不能为空";
public static final String ERROR_PASSWORD_FORMAT = "密码应不少于6位且不大于16位";
public static final String NAME_EXISTS = "该名称已存在";
public static final String LOGIN_NOT_ALLOW = "没有权限,禁止登陆";
public static final String ERROR_FILE_TYPE = "不支持的文件类型";
}
================================================
FILE: src/main/java/cn/cie/utils/PageUtil.java
================================================
package cn.cie.utils;
/**
* Created by RojerAlone on 2017/6/21.
* 分页工具
*/
public class PageUtil {
private int num; // 记录的总数
private int pages; // 页数总数
private int current; // 当前页数
private int size; // 每页显示记录数
private int startPos; // 从数据库中查询时开始的条数
public PageUtil(int num, int current, int size) {
this.num = num;
this.size = size;
this.pages = num % size == 0 ? num / size : num / size + 1;
if (current <= 0) {
this.current = 1;
} else {
this.current = current > pages ? pages : current;
}
this.startPos = this.size * (this.current - 1) < 0 ? 0 : this.size * (this.current - 1);
}
/**
* 默认每页大小为10
* @param num
* @param current
*/
public PageUtil(int num, int current) {
this.num = num;
this.size = 10;
this.pages = num % size == 0 ? num / size : num / size + 1;
if (current <= 0) {
this.current = 1;
} else {
this.current = current > pages ? pages : current;
}
this.startPos = this.size * (this.current - 1) < 0 ? 0 : this.size * (this.current - 1);
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public int getPages() {
return pages;
}
public void setPages(int pages) {
this.pages = pages;
}
public int getCurrent() {
return current;
}
public void setCurrent(int current) {
this.current = current;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public int getStartPos() {
return startPos;
}
public void setStartPos(int startPos) {
this.startPos = startPos;
}
}
================================================
FILE: src/main/java/cn/cie/utils/PasswordUtil.java
================================================
package cn.cie.utils;
import org.springframework.util.DigestUtils;
/**
* Created by RojerAlone on 2017/6/6.
* 将密码进行MD5加密
*/
public class PasswordUtil {
private static final String SALT = "gp30#?>2a";
public static String pwd2Md5(String paswword) {
return DigestUtils.md5DigestAsHex((paswword + SALT).getBytes());
}
}
================================================
FILE: src/main/java/cn/cie/utils/RedisUtil.java
================================================
package cn.cie.utils;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import java.util.ArrayList;
import java.util.List;
/**
* Created by RojerAlone on 2017/6/13.
* 封装了redis操作,用protostuff进行序列化和反序列化
* 如果要插入对象,需要传入插入对象的Class类型
*/
@Component
public class RedisUtil<T> implements InitializingBean {
private JedisPool jedisPool;
private static final String REDIS_URL = "redis://localhost:6379/6";
public static final String EVERYDAY = "everyday";
public static final String KINDS = "kinds";
public static final String NEWESTGAME = "newestgame";
public static final String PRE_UP_GAMES = "preupgames";
/**
* 存放一条数据
*
* @param key
* @param value
* @return
*/
public String put(String key, String value) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return jedis.set(key, value);
} finally {
if (jedis != null) {
jedis.close();
}
}
}
/**
* 存放一条定时过期的数据
*
* @param key
* @param value
* @param timeout
* @return
*/
public String putEx(String key, String value, int timeout) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return jedis.setex(key, timeout, value);
} finally {
if (jedis != null) {
jedis.close();
}
}
}
/**
* 根据key获取value
*
* @param key
* @return
*/
public String get(String key) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return jedis.get(key);
} finally {
if (jedis != null) {
jedis.close();
}
}
}
/**
* 存放一个对象
*
* @param key
* @param value
* @return
*/
public String putObject(String key, T value) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return jedis.set(key, JSON.toJSONString(value));
} finally {
if (jedis != null) {
jedis.close();
}
}
}
/**
* 存放一个定时过期的对象
*
* @param key
* @param value
* @param timeout
* @return
*/
public String putObjectEx(String key, T value, int timeout) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return jedis.setex(key, timeout, JSON.toJSONString(value));
} finally {
if (jedis != null) {
jedis.close();
}
}
}
/**
* 根据key获取对应的对象
*
* @param key
* @return
*/
public T getObject(String key, Class clazz) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return (T) JSON.parseObject(jedis.get(key), clazz);
} finally {
if (jedis != null) {
jedis.close();
}
}
}
/**
* 根据key删除数据
*
* @param key
* @return
*/
public long delete(String key) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return jedis.del(key);
} finally {
if (jedis != null) {
jedis.close();
}
}
}
/**
* 从队列头部出队一个元素,如果没有,则会阻塞 timeout 秒后返回null
* 如果 timeout 为0,那么会一直阻塞直到有元素
*
* @param timeout 阻塞的时间,单位为秒
* @param key
* @param clazz
* @return
*/
public T blpopObject(int timeout, String key, Class clazz) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
List<String> list = jedis.blpop(timeout, key);
return (T) JSON.parseObject(list.get(0), clazz);
} finally {
if (jedis != null) {
jedis.close();
}
}
}
/**
* 从队列左边出队一个元素
*
* @param key
* @param clazz
* @return
*/
public T lpopObject(String key, Class clazz) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return (T) JSON.parseObject(jedis.lpop(key), clazz);
} finally {
if (jedis != null) {
jedis.close();
}
}
}
/**
* 向列表尾部添加数据
*
* @param key
* @param values
* @return
*/
public long rpushObject(String key, Class clazz, Object... values) {
if (values == null || values.length == 0) {
return 0;
}
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
String[] jsonStrs = new String[values.length];
int index = 0;
for (Object value : values) {
jsonStrs[index] = JSON.toJSONString(value);
++index;
}
return jedis.rpush(key, jsonStrs);
} finally {
if (jedis != null) {
jedis.close();
}
}
}
/**
* 向列表尾部添加某个时间点删除的数据
*
* @param key
* @param time unix时间戳
* @param values
* @return
*/
public long rpushObjectExAtTime(String key, Class clazz, long time, Object... values) {
if (values.length == 0) {
return 0;
}
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
String[] jsonStrs = new String[values.length];
int index = 0;
for (Object value : values) {
jsonStrs[index] = JSON.toJSONString(value);
++index;
}
long res = jedis.rpush(key, jsonStrs);
jedis.expireAt(key.getBytes(), time); // 手动设置过期时间
return res;
} finally {
if (jedis != null) {
jedis.close();
}
}
}
/**
* 在列表尾部添加一个定期删除的数据
*
* @param key
* @param clazz
* @param timeout
* @param values
* @return
*/
public long rpushObjectEx(String key, Class clazz, int timeout, Object... values) {
if (values.length == 0) {
return 0;
}
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
String[] jsonStrs = new String[values.length];
int index = 0;
for (Object value : values) {
jsonStrs[index] = JSON.toJSONString(value);
++index;
}
long res = jedis.rpush(key, jsonStrs);
jedis.expire(key, timeout);
return res;
} finally {
if (jedis != null) {
jedis.close();
}
}
}
/**
* 获取列表中所有数据,ruguo
*
* @param key
* @return
*/
public List<T> lall(String key, Class clazz) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
// 0表示第一个元素,-1表示最后一个元素
List<String> list = jedis.lrange(key, 0, -1);
List<T> res = new ArrayList<T>();
if (list == null || list.size() == 0) {
return res;
}
for (String str : list) {
res.add((T) JSON.parseObject(str, clazz));
}
return res;
} finally {
if (jedis != null) {
jedis.close();
}
}
}
/**
* spring注入之后会自动调用这个方法
*
* @throws Exception
*/
public void afterPropertiesSet() throws Exception {
jedisPool = new JedisPool(REDIS_URL);
}
}
================================================
FILE: src/main/java/cn/cie/utils/Result.java
================================================
package cn.cie.utils;
/**
* Created by RojerAlone on 2017/6/6.
* 后台接口返回结果,标识了是否成功、消息以及返回的数据
*/
public class Result<T> {
private boolean success;
private String msg;
private T data;
private Result(boolean success, String msg) {
this.success = success;
this.msg = msg;
}
private Result(boolean success, String msg, T data) {
this.success = success;
this.msg = msg;
this.data = data;
}
public static Result success() {
return new Result(true, MsgCenter.OK);
}
public static Result success(Object data) {
return new Result(true, MsgCenter.OK, data);
}
public static Result fail(String msg) {
return new Result(false, msg);
}
public static Result fail(String msg, Object data) {
return new Result(false, msg, data);
}
public boolean isSuccess() {
return success;
}
public String getMsg() {
return msg;
}
public T getData() {
return data;
}
}
================================================
FILE: src/main/java/cn/cie/utils/UserHolder.java
================================================
package cn.cie.utils;
import cn.cie.entity.User;
import org.springframework.stereotype.Component;
/**
* Created by RojerAlone on 2017/6/11.
* 每次请求时存放请求者的信息
*/
@Component
public class UserHolder {
private static ThreadLocal<User> users = new ThreadLocal<User>();
public User getUser() {
return users.get();
}
public void setUser(User user) {
users.set(user);
}
public void remove() {
users.remove();
}
}
================================================
FILE: src/main/resources/dbdata.sql
================================================
insert into `shop`.`game`(`creater`, `name`, `desc`, `systemcfg`, `price`) values
('Killerfish Games', 'Cold Waters', 'Spiritual Successor to the Microprose Classic “Red Storm Rising”.',
'操作系统: XP 处理器: Intel Atom
内存: 2 GB RAM
DirectX 版本: 9.0c
存储空间: 需要 2 GB 可用空间', 58),
('LR Studio', 'Confess My Love', '游戏发生在某一天的放学后,男生未宇打算向心仪的女生阑珊表明自己的心意,但又因为害怕被拒绝犹豫不决。',
'操作系统: Windows XP/ Vista/7/10
处理器: Intel Core 2 1.06Ghz
内存: 1 GB RAM
存储空间: 需要 50 MB 可用空间', 0),
('Motion Twin', 'Dead Cells', '欢迎来到《死亡细胞》,这是一款将Roguelite与银河战士恶魔城类特点融为一炉的2D平台动作游戏。游戏中并无检查点,玩家将体验魂味战斗,一路挑战诸多守卫,在杀戮与死亡的反复轮回中探索一座房间不断变化的巨大城堡。”.',
'操作系统: Windows 7+
处理器: Intel i5+
内存: 2 GB RAM
图形: Nvidia 450 GTS / Radeon HD 5750 or better
存储空间: 需要 500 MB 可用空间
附注事项: OpenGL 3.2+', 0),
('ROCKFISH Games', 'EVERSPACE', '《EVERSPACE™》是一款侧重于动作的单人太空射击游戏,结合了类Rogue元素和一流的视觉效果及引人入胜的故事。游戏将带领你在一个不断变化、制作精美且充满惊喜的宇宙中,展开一段富有挑战性的旅程。 你的技能、经验和随机应变的天赋都将持续受到考验;与此同时,通过遭遇其他有趣且各有奥秘的人物角色,你将了解自己的存在意义。每个回合都是激动人心的体验,每次航行都是全新的局势,让游戏的每一个部分都能长久地持续下去, 并从中创造大量独特而意味深长的体验时刻。然而,不管你的飞行技术多么高超,死亡都是不可避免的,而这只是一段更宏大旅程的开始。',
'操作系统: 32/64-bit Windows 7 / 8.1 / 10
处理器: Intel CPU Core i3
内存: 4 GB RAM
图形: Nvidia GTX 480 / AMD Radeon HD 5870
DirectX 版本: 10
存储空间: 需要 8 GB 可用空间', 49.9),
('Modern Visual Arts Laboratory', 'Lucy -The Eternity She Wished For', '如果世界上有机器人能够像人一样微笑,一样哭泣,一样悲伤。',
'操作系统: Microsoft Windows 2000/XP(SP3)/Vista
处理器: Intel Pentium 4 1.5Ghz/AMD Athlon 1800
内存: 128 MB RAM
DirectX 版本: 9.0c
存储空间: 需要 1 GB 可用空间
附注事项: Microsoft .Net Framework', 124),
('Klei Entertainment', 'Mark of the Ninja', 'In Mark of the Ninja, you''ll know what it is to truly be a ninja. You must be silent, agile and clever to outwit your opponents in a world of gorgeous scenery and flowing animation. Marked with cursed tattoos giving you heightened senses, every situation presents you with options.',
'OS:Windows XP SP3, Windows Vista SP2, Windows 7 SP1
Processor:AMD Phenom 9750 or Pentium D 800+
Memory:2 GB RAM
Graphics:NVIDIA® GeForce® 7800 GT or ATI Radeon™ HD 3000+ or better DirectX®:9.0c
Hard Drive:2.5 GB
HD space Sound:100% DirectX9.0c compatible sound card and drivers', 66),
('Klei Entertainment', 'Oxygen Not Included', 'Oxygen Not Included is a space-colony simulation game. Deep inside an alien space rock your industrious crew will need to master science, overcome strange new lifeforms, and harness incredible space tech to survive, and possibly, thrive.',
'操作系统: Windows 7 (64 bit)
处理器: Dual Core 2 GHz
内存: 4 GB RAM
图形: Intel HD 4600 (AMD or NVIDIA equivalent)
DirectX 版本: 11
存储空间: 需要 2 GB 可用空间', 76),
('ConcernedApe', 'Stardew Valley', '你继承了你爷爷在星露谷留下的老旧农场。带着爷爷留下的残旧工具和几枚硬币开始了你的新生活。你能适应这小镇上的生活并且将这个杂草丛生的老旧农场变成一个繁荣的家吗?',
'操作系统: Windows Vista or greater
处理器: 2 Ghz
内存: 2 GB RAM
图形: 256 mb video memory, shader model 3.0+
DirectX 版本: 10
存储空间: 需要 500 MB 可用空间', 21),
('Thekla, Inc.', 'The Witness', '你孤身一人醒来。这是一座充满挑战和惊奇、遍地谜题的奇怪小岛。',
'操作系统: Windows 7
处理器: 1.8GHz
内存: 4 GB RAM
图形: Intel HD 4000 series
DirectX 版本: 10
存储空间: 需要 5 GB 可用空间', 21),
('Illusion Ranger', 'Aeon', '我们把所有精力都注入在打击感的挖掘上,创造出一款顶级打击感的VR射击游戏。你将体验大口径火枪爽快的爆裂射击,同时用你的武士刀随心所欲地斩杀胆敢靠近的敌人。',
'操作系统: win7
处理器: intel i5
内存: 8000 MB RAM
图形: Nvidia 970
DirectX 版本: 11
存储空间: 需要 2000 MB 可用空间
附注事项: HTC vive only', 55),
('Reactive Drop Team', 'Alien Swarm Reactive Drop', 'Co-operative top-down shooter game available for free. An epic bug hunt featuring a unique blend of co-op play and squad-level tactics.',
'操作系统: Windows® XP or above
处理器: Pentium 4 3.0GHz
内存: 2 GB RAM
图形: DirectX 9 compatible video card with 128 MB, Shader model 2.0. ATI X800, NVidia 6600 or better
DirectX 版本: 9.0
存储空间: 需要 10 GB 可用空间
声卡: DirectX 9.0c compatible sound card', 76),
('Valve', 'Counter-Strike Global Offensive', '《反恐精英:全球攻势》(CS: GO)在团队竞技游戏模式的基础上加以开发,这一模式自 12 年前发布以来一直引领至今。 CS: GO 的特色是全新的地图、人物、武器以及最新版本的 CS 经典内容(de_dust 等)。此外,CS: GO 引入了全新的游戏模式、对战匹配、排行榜以及更多新的内容。',
'操作系统: Windows® 7/Vista/XP
处理器: Intel® Core™ 2 Duo E6600 or AMD Phenom™ X3 8750 processor or better
内存: 2 GB RAM
图形: Video card must be 256 MB or more and should be a DirectX 9-compatible with support for Pixel Shader 3.0
DirectX 版本: 9.0c
存储空间: 需要 15 GB 可用空间', 58),
('Sports Interactive', 'Football Manager 2017', '作为迄今为止最真实的足球经理类游戏,Football Manager 2017 让你操控自己最喜欢的球队征战绿茵赛场。',
'操作系统: Windows Vista (SP2), 7 (SP1), 8, 8.1, 10 (1607) – 64-bit or 32-bit
处理器: Intel Pentium 4, Intel Core or AMD Athlon – 2.2 GHz +
内存: 2 GB RAM
图形: Intel GMA X3100, NVIDIA GeForce 8600M GT or AMD/ATI Mobility Radeon HD 2400 – 256MB VRAM
DirectX 版本: 9.0c
存储空间: 需要 3 GB 可用空间', 75),
('Telltale Games', 'Marvel''s Guardians of the Galaxy The Telltale Series', '从地球到米兰号再到不毛之地以及更远的地方,伴随着超棒的音乐节奏,这个分为五章节的系列游戏将带你进入穿着火箭靴的星爵的全新Guardians历险。游戏故事由曾获奖的Telltale独特风格讲述,你的选择和动作将决定你所体验的故事轨迹。 ',
'操作系统: Windows 7 64Bit Service Pack 1 or higher
处理器: Intel Core 2 Duo 2.4GHz
内存: 3 GB RAM
图形: Nvidia GTS 450+ with 1024MB+ VRAM (excluding GT)
DirectX 版本: 11
存储空间: 需要 15 GB 可用空间
声卡: Direct X 11 sound device', 198),
('Bluehole, Inc.', 'PLAYERUNKNOWN''S BATTLEGROUNDS', '绝地求生(PLAYERUNKNOWN’S BATTLEGROUNDS)是大逃杀类型的游戏,每一局游戏将有100名玩家参与,他们将被投放在绝地岛(battlegrounds)的上空,游戏开始跳伞时所有人都一无所有。',
'操作系统: 64-bit Windows 7, Windows 8.1, Windows 10
处理器: Intel Core i3-4340 / AMD FX-6300
内存: 6 GB RAM
图形: nVidia GeForce GTX 660 2GB / AMD Radeon HD 7850 2GB
DirectX 版本: 11
网络: 宽带互联网连接
存储空间: 需要 30 GB 可用空间', 200),
('Keen Games', 'Portal Knights', '将熟悉的世界抛在身后,踏入 Portal Knights 这个奇妙的未知世界!在由古代传送门连接的众多沙盒岛屿上,和你的好友一起展开这场惊险刺激的制作冒险。没有人记得自从和平的世界因为碎裂分崩离析、陷入黑暗之后已经过了多久。是否还有勇者敢于将这片破碎之地复原?打造你的冒险之旅。',
'操作系统: 64bit Versions of Windows 7, Windows 8, Windows 10
处理器: AMD Phenom(tm) 8450 Triple-Core Processor (3 CPUs), ~2.1GHz or Intel Core 2 Duo E8400 @ 3.0 GHz
内存: 4 GB RAM
图形: Graphics: NVIDIA® GeForce GTX 470 (1Gb VRAM) / ATI Radeon TM HD 6870 (1Gb VRAM)
DirectX 版本: 11
网络: 宽带互联网连接
存储空间: 需要 2 GB 可用空间
声卡: On Board', 98),
('Arkane Studios', 'Prey', 'In Prey, you awaken aboard Talos I, a space station orbiting the moon in the year 2032. You are the key subject of an experiment meant to alter humanity forever – but things have gone terribly wrong. The space station has been overrun by hostile aliens and you are now being hunted. ',
'操作系统: Windows 7/8/10 (64-bit versions)
处理器: Intel i5-2400, AMD FX-8320
内存: 8 GB RAM
图形: GTX 660 2GB, AMD Radeon 7850 2GB
存储空间: 需要 20 GB 可用空间', 79),
('Eugen Systems', 'Steel Division Normandy 44', 'Steel Division: Normandy is a tactical real-time strategy (RTS) game that pits players against AI enemies in a single-player campaign -- or against several opponents in massive 10-on-10 multiplayer battles. ',
'操作系统: 64-bit Windows 10 / 8.1 / 7 with Service Pack 1
处理器: Intel Core i3-2100 (3.1 GHz) or equivalent
内存: 3 GB RAM
图形: 1 GB AMD 5570 or nVidia 450
DirectX 版本: 11
网络: 宽带互联网连接
存储空间: 需要 32 GB 可用空间
声卡: DirectX Compatible Sound Card', 66),
('SNK Playmore', 'THE KING OF FIGHTERS XIII STEAM EDITION', '“THE KING OF FIGHTERS XIII”, SNK PLAYMORE’s flagship 2D versus fighting title returns in an ultimate version on Steam!!The many features exclusive to the console version of the game, such as the ONLINE Mode that allows you to enjoy smooth online versus matches with rivals from around the world',
'操作系统: Windows XP
处理器: Intel Pentium4 2.0 GHz and up
内存: 1 GB RAM
图形: GeForce 9500 GT ,VRAM: 256MB and up
DirectX 版本: 9.0c
存储空间: 需要 5 GB 可用空间
声卡: DirectSound, DirectX9.0c Compatible Audio', 50),
('Rockstar North', 'GTA Online: Shark Cash Cards', '该内容需要在 Steam 拥有基础游戏 Grand Theft Auto V 才能运行。',
'操作系统: Windows 10 64 Bit, Windows 8.1 64 Bit, Windows 8 64 Bit, Windows 7 64 Bit Service Pack 1, Windows Vista 64 Bit Service Pack 2* (*NVIDIA video card recommended if running Vista OS)
处理器: Intel Core 2 Quad CPU Q6600 @ 2.40GHz (4 CPUs) / AMD Phenom 9850 Quad-Core Processor (4 CPUs) @ 2.5GHz
内存: 4 GB RAM
图形: NVIDIA 9800 GT 1GB / AMD HD 4870 1GB (DX 10, 10.1, 11)
存储空间: 需要 72 GB 可用空间
声卡: 100% DirectX 10 compatible', 148),
('Giant Squid', 'ABZU', '沿袭 Journey蕴含的艺术思想,ABZU 是一款能唤起潜水梦想的唯美海底冒险游戏。深入海洋中心,将自己沉浸在生机勃勃的隐秘世界中,这里色彩缤纷,生物繁多。但要注意,当你不断深入,危险就潜伏在深处。',
'操作系统: Windows 7, 64-bit
处理器: 3.0GHz CPU Dual Core
内存: 4 GB RAM
图形: Geforce GTX 750 / Radeon R7 260X
DirectX 版本: 11
存储空间: 需要 6 GB 可用空间
声卡: DirectX compatible sound card', 68),
('Rad Codex', 'Alvora Tactics', 'Alvora Tactics is an indie Tactics RPG that combines strategic combat with immersive exploration. Explore and conquer Great Serpent Alvora with your own customizable band of warriors!',
'操作系统: Windows XP
内存: 1 GB RAM
图形: Must support Shader Model 2.0
DirectX 版本: 9.0c
存储空间: 需要 1000 MB 可用空间', 32),
('Codemasters', 'DiRT 4', '世界领先的越野赛系列游戏回归了!《DiRT 4》让你驾驶有史以来最强的赛车去面对这个星球的拉力赛、rallycross 和 landrush 中危险重重的赛道。游戏改变了“你的赛段”系统,只要轻轻触摸一个按钮,即可创建无数条赛道。',
'操作系统: 64bit Versions of Windows 7, Windows 8, Windows 10
处理器: AMD FX Series or Intel Core i3 Series
内存: 4 GB RAM
图形: AMD HD5570 or NVIDIA GT440 with 1GB of VRAM (DirectX 11 graphics card required)
网络: 宽带互联网连接
存储空间: 需要 50 GB 可用空间
声卡: DirectX Compatible soundcard', 158),
('FromSoftware, Inc.', 'DARK SOULS III', 'Dark Souls即将推出极具话题性及代表性的系列新作。',
'操作系统: Windows 7 SP1 64bit, Windows 8.1 64bit Windows 10 64bit
处理器: Intel Core i3-2100 / AMD® FX-6300
内存: 4 GB RAM
图形: NVIDIA® GeForce GTX 750 Ti / ATI Radeon HD 7950
DirectX 版本: 11
网络: 宽带互联网连接
存储空间: 需要 25 GB 可用空间
声卡: DirectX 11 sound device', 268),
('Laser Unicorns', 'Kung Fury', 'Miami Police Department detective and martial artist Kung Fury time travels from the 1980s to World War II to kill Adolf Hitler, a.k.a. "Kung Führer", and revenge his friend''s death at the hands of the Nazi leader. An error in the time machine sends him further back to the Viking Age.',
'操作系统: Windows 7
处理器: 英特尔酷睿 2 处理器或相同性能的 AMD 处理器
内存: 1 GB RAM
网络: 宽带互联网连接
存储空间: 需要 200 MB 可用空间', 0),
('Rockstar North', 'Grand Theft Auto V', 'A young street hustler, a retired bank robber and a terrifying psychopath must pull off a series of dangerous heists to survive in a ruthless city in which they can trust nobody, least of all each other.',
'操作系统: Windows 10 64 Bit, Windows 8.1 64 Bit, Windows 8 64 Bit, Windows 7 64 Bit Service Pack 1, Windows Vista 64 Bit Service Pack 2* (*NVIDIA video card recommended if running Vista OS)
处理器: Intel Core 2 Quad CPU Q6600 @ 2.40GHz (4 CPUs) / AMD Phenom 9850 Quad-Core Processor (4 CPUs) @ 2.5GHz
内存: 4 GB RAM
图形: NVIDIA 9800 GT 1GB / AMD HD 4870 1GB (DX 10, 10.1, 11)
存储空间: 需要 72 GB 可用空间
声卡: 100% DirectX 10 compatible', 198),
('IMCGAMES Co.,Ltd.', 'Tree of Savior (English Ver.)', 'Tree of Savior(abbreviated as TOS thereafter) is an MMORPG in which you embark on a journey to search for the goddesses in the world of chaos. Fairy-tale like colors accompanied with beautiful graphics in TOS will have you reminiscing about precious moments all throughout the game.',
'操作系统: Windows XP
处理器: Intel Pentium Core 2
内存: 4 GB RAM
图形: NVIDIA Geforce 8600
DirectX 版本: 9.0c
网络: 宽带互联网连接
存储空间: 需要 4 GB 可用空间', 0),
('Daybreak Game Company', 'H1Z1 King of the Kill', '《杀戮之王》是一款单败淘汰制多人在线射击游戏,可容纳150名身经百战的玩家角逐于一个强大而复杂的世界。搜寻武器、弹药、盔甲、车辆和补给,在竞争中脱颖而出,并坚持到最后。',
'操作系统: Windows 7, 8, 8.1, 10 (64 bit only)
处理器: Intel i5 Quad-Core
内存: 6 GB RAM
图形: nVidia GeForce GTX 280 series or higher
DirectX 版本: 10
网络: 宽带互联网连接
存储空间: 需要 20 GB 可用空间
声卡: DirectX Compatible Sound Card', 68),
('Codemasters , Feral Interactive (Mac)', 'F1 2016', '在F1 2016中创造您自己的传奇。准备好全身心投入这场有史以来最著名的顶尖赛车赛事中。与您的代理人、工程师与团队共同合作,以十个赛季的丰富经验深度开发您的赛车。',
'操作系统: 64bit Versions of Windows 7, Windows 8, Windows 10
处理器: Intel Core i3 530 or AMD FX 4100
内存: 8 GB RAM
图形: Nvidia GTX 460 or AMD HD 5870
DirectX 版本: 11
网络: 宽带互联网连接
存储空间: 需要 30 GB 可用空间
声卡: DirectX Compatible Soundcard', 158),
('Piranha Bytes', 'ELEX', 'ELEX is a handcrafted action role-playing experience from the award-winning creators of the Gothic series, set in a brand new post-apocalyptic Science Fantasy universe that puts players into a huge seamless game world full of original characters, mutated creatures, deep moral choices and powerful action.',
'操作系统: Windows 7, 8, Windows 10 (64 bit)
处理器: Intel Core i5 at 2.5 GHz or better or AMD Phenom II x4 940 at 3.0 GHz
内存: 6 GB RAM
图形: NVIDIA GeForce GTX 570 or AMD Radeon HD 5870, 1 GB VRAM
DirectX 版本: 11
存储空间: 需要 20 GB 可用空间
声卡: DirectX compatible Sound card', 44.1),
('IllFonic', 'Friday the 13th: The Game', 'Jason is back! Jason Voorhees is unleashed and stalking the grounds of Camp Crystal Lake! Friday the 13th: The Game is one of the most highly-anticipated horror titles of all time. You will finally be able to take on the role as Jason Voorhees and Camp Crystal Lake counselors.',
'操作系统: Windows 7, Windows 8, Windows 10
处理器: Intel Core i3-530 (2 * 2930), AMD Athlon II X2 270 (2 * 3400)
内存: 4096 MB RAM
图形: GeForce GTX 650 Ti (1024 MB), Radeon HD 7770 (1024 MB)
DirectX 版本: 11
网络: 宽带互联网连接
存储空间: 需要 4 GB 可用空间', 39);
insert into `shop`.`kind`(name) values ('独立'), ('动作'), ('冒险'), ('休闲'), ('策略'), ('模拟'), ('角色扮演'), ('免费'), ('单人'), ('大型多人在线'), ('射击'), ('体育'), ('氛围'), ('暴力');
insert into `shop`.`kindmapper` values (1, 1), (2, 1), (3, 1), (4, 1), (5, 1), (6, 1), (7, 1), (8, 1), (9, 1), (10, 2), (11, 2), (12, 2), (13, 2), (14, 2), (15, 2), (16, 2), (17, 2), (18, 2), (19, 2),
(20, 3), (21, 4), (22, 5), (23, 6), (24, 7), (25, 8), (26, 9), (27, 10), (28, 11), (29, 12), (30, 13), (31, 14);
insert into `shop`.`tag`(`name`) values ('模拟'), ('独立'), ('海军'), ('策略'), ('冷战'), ('免费'), ('冒险'), ('角色扮演'), ('日本动画'), ('动作'), ('太空'), ('科幻'), ('单人'), ('剧情'),
('机器人'), ('潜行'), ('忍者'), ('多人'), ('二维'), ('建筑建造'), ('生存'), ('农业'), ('工业'), ('解密'), ('探索'), ('第一人称'), ('射击'), ('虚拟现实'), ('合作'), ('外星人'), ('体育'),
('足球'), ('恐怖'), ('即时战略'), ('街机'), ('格斗'), ('竞速'), ('困难'), ('女主人翁'), ('丧尸'), ('氛围'), ('暴力'), ('犯罪'), ('砍杀'), ('萝莉'), ('养成'), ('种植');
insert into `shop`.`tagmapper` values (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (2, 6), (2, 2), (2, 7), (2, 8), (2, 9), (2, 45), (2, 46), (3, 10), (3, 2), (4, 11), (4, 10), (4, 2), (4, 12), (4, 13),
(5, 9), (5, 14), (5, 1), (5, 15), (5, 45), (5, 46), (6, 16), (6, 17), (6, 13), (6, 19), (6, 10), (7, 20), (7, 21), (7, 1), (7, 13), (8, 8), (8, 1), (8, 22), (8, 23), (9, 24), (9, 25), (9, 26),
(9, 13), (10, 10), (10, 26), (10, 27), (10, 2), (10, 28), (11, 29), (11, 18), (11, 10), (11, 30), (12, 26), (12, 27), (12, 18), (12, 10), (12, 29), (13, 31), (13, 1), (13, 32), (13, 4), (13, 34),
(14, 7), (14, 14), (14, 10), (15, 21), (15, 27), (15, 18), (16, 7), (16, 18), (16, 8), (17, 12), (17, 10), (17, 11), (17, 26), (17, 27), (17, 33), (18, 4), (18, 34), (18, 1), (18, 10), (18, 18),
(19, 35), (19, 36), (19, 10), (19, 9), (19, 37), (19, 41), (19, 44), (20, 10), (20, 7), (20, 18), (20, 27), (20, 42), (20, 43), (20, 44), (21, 41), (21, 24), (21, 25), (22, 2), (22, 4), (22, 8),
(22, 47), (23, 37), (23, 1), (23, 31), (23, 18), (24, 41), (24, 38), (24, 8), (24, 25), (25, 10), (25, 35), (25, 36), (25, 12), (26, 18), (26, 27), (26, 37), (26, 42), (26, 43), (26, 44), (27, 1),
(27, 7), (27, 8), (27, 47), (28, 18), (28, 21), (28, 27), (28, 44), (29, 41), (29, 37), (30, 8), (30, 7), (30, 12), (30, 10), (31, 40), (31, 18), (31, 33), (31, 42);
insert into `shop`.`img` values (1, '/1/header.jpg'), (1, '/1/1.jpg'), (1, '/1/2.jpg'), (1, '/1/3.jpg'), (1, '/1/4.jpg'), (1, '/1/5.jpg'), (2, '/2/header.jpg'), (2, '/2/1.jpg'),
(2, '/2/2.jpg'), (2, '/2/3.jpg'), (2, '/2/4.jpg'), (2, '/2/5.jpg'), (3, '/3/header.jpg'), (3, '/3/1.jpg'), (3, '/3/2.jpg'), (3, '/3/3.jpg'), (3, '/3/4.jpg'), (3, '/3/5.jpg'),
(4, '/4/header.jpg'), (4, '/4/1.jpg'), (4, '/4/2.jpg'), (4, '/4/3.jpg'), (4, '/4/4.jpg'), (4, '/4/5.jpg'), (5, '/5/header.jpg'), (5, '/5/1.jpg'), (5, '/5/2.jpg'), (5, '/5/3.jpg'),
(5, '/5/4.jpg'), (5, '/5/5.jpg'), (6, '/6/header.jpg'), (6, '/6/1.jpg'), (6, '/6/2.jpg'), (6, '/6/3.jpg'), (6, '/6/4.jpg'), (6, '/6/5.jpg'), (7, '/7/header.jpg'), (7, '/7/1.jpg'),
(7, '/7/2.jpg'), (7, '/7/3.jpg'), (7, '/7/4.jpg'), (7, '/7/5.jpg'), (7, '/7/6.jpg'), (8, '/8/header.jpg'), (8, '/8/1.jpg'), (8, '/8/2.jpg'), (8, '/8/3.jpg'), (8, '/8/4.jpg'),
(8, '/8/5.jpg'), (9, '/9/header.jpg'), (9, '/9/1.jpg'), (9, '/9/2.jpg'), (9, '/9/3.jpg'), (9, '/9/4.jpg'), (9, '/9/5.jpg'), (10, '/10/header.jpg'), (10, '/10/1.jpg'), (10, '/10/2.jpg'),
(10, '/10/3.jpg'), (10, '/10/4.jpg'), (10, '/10/5.jpg'), (10, '/10/6.jpg'), (11, '/11/header.jpg'), (11, '/11/1.jpg'), (11, '/11/2.jpg'), (11, '/11/3.jpg'), (11, '/11/4.jpg'),
(11, '/11/5.jpg'), (11, '/11/6.jpg'), (12, '/12/header.jpg'), (12, '/12/1.jpg'), (12, '/12/2.jpg'), (12, '/12/3.jpg'), (12, '/12/4.jpg'), (12, '/12/5.jpg'), (12, '/12/6.jpg'),
(13, '/13/header.jpg'), (13, '/13/1.jpg'), (13, '/13/2.jpg'), (13, '/13/3.jpg'), (13, '/13/4.jpg'), (13, '/13/5.jpg'), (13, '/13/6.jpg'), (14, '/14/header.jpg'), (14, '/14/1.jpg'),
(14, '/14/2.jpg'), (14, '/14/3.jpg'), (14, '/14/4.jpg'), (14, '/14/5.jpg'), (15, '/15/header.jpg'), (15, '/15/1.jpg'), (15, '/15/2.jpg'), (15, '/15/3.jpg'), (15, '/15/4.jpg'),
(15, '/15/5.jpg'), (16, '/16/header.jpg'), (16, '/16/1.jpg'), (16, '/16/2.jpg'), (16, '/16/3.jpg'), (16, '/16/4.jpg'), (16, '/16/5.jpg'), (16, '/16/6.jpg'), (17, '/17/header.jpg'),
(17, '/17/1.jpg'), (17, '/17/2.jpg'), (17, '/17/3.jpg'), (17, '/17/4.jpg'), (17, '/17/5.jpg'), (17, '/17/6.jpg'), (18, '/18/header.jpg'), (18, '/18/1.jpg'), (18, '/18/2.jpg'),
(18, '/18/3.jpg'),
gitextract_t46sxuk1/
├── .gitignore
├── LICENSE.txt
├── README.md
├── pom.xml
└── src/
├── main/
│ ├── java/
│ │ └── cn/
│ │ └── cie/
│ │ ├── aop/
│ │ │ └── LogAspectj.java
│ │ ├── controller/
│ │ │ ├── AbstractController.java
│ │ │ ├── AdminController.java
│ │ │ ├── CommonController.java
│ │ │ ├── GameController.java
│ │ │ ├── KindController.java
│ │ │ ├── OrderController.java
│ │ │ ├── TagController.java
│ │ │ └── UserController.java
│ │ ├── entity/
│ │ │ ├── Code.java
│ │ │ ├── Game.java
│ │ │ ├── Img.java
│ │ │ ├── Kind.java
│ │ │ ├── Kindmapper.java
│ │ │ ├── Order.java
│ │ │ ├── Orderitem.java
│ │ │ ├── Ordermapper.java
│ │ │ ├── Tag.java
│ │ │ ├── Tagmapper.java
│ │ │ ├── Token.java
│ │ │ ├── User.java
│ │ │ ├── Validatecode.java
│ │ │ └── dto/
│ │ │ ├── GameDTO.java
│ │ │ ├── OrderDTO.java
│ │ │ └── OrderItemDTO.java
│ │ ├── event/
│ │ │ ├── EventConsumer.java
│ │ │ ├── EventModel.java
│ │ │ ├── EventProducer.java
│ │ │ ├── EventType.java
│ │ │ └── handler/
│ │ │ ├── EventHandler.java
│ │ │ ├── SendFindPwdMailHandler.java
│ │ │ └── SendValidateMailHandler.java
│ │ ├── exception/
│ │ │ └── NotFoundException.java
│ │ ├── interceptor/
│ │ │ ├── AdminInterceptor.java
│ │ │ ├── AuthInterceptor.java
│ │ │ └── LoginInterceptor.java
│ │ ├── mapper/
│ │ │ ├── CodeMapper.java
│ │ │ ├── GameMapper.java
│ │ │ ├── ImgMapper.java
│ │ │ ├── KindMapper.java
│ │ │ ├── KindmapperMapper.java
│ │ │ ├── OrderMapper.java
│ │ │ ├── OrderitemMapper.java
│ │ │ ├── OrdermapperMapper.java
│ │ │ ├── TagMapper.java
│ │ │ ├── TagmapperMapper.java
│ │ │ ├── TokenMapper.java
│ │ │ └── UserMapper.java
│ │ ├── schedule/
│ │ │ └── Scheduler.java
│ │ ├── services/
│ │ │ ├── AdminService.java
│ │ │ ├── GameService.java
│ │ │ ├── KindService.java
│ │ │ ├── OrderService.java
│ │ │ ├── TagService.java
│ │ │ ├── UserService.java
│ │ │ └── impl/
│ │ │ ├── AdminServiceImpl.java
│ │ │ ├── GameServiceImpl.java
│ │ │ ├── KindServiceImpl.java
│ │ │ ├── OrderServiceImpl.java
│ │ │ ├── TagServiceImpl.java
│ │ │ └── UserServiceImpl.java
│ │ └── utils/
│ │ ├── MailUtil.java
│ │ ├── MsgCenter.java
│ │ ├── PageUtil.java
│ │ ├── PasswordUtil.java
│ │ ├── RedisUtil.java
│ │ ├── Result.java
│ │ └── UserHolder.java
│ ├── resources/
│ │ ├── dbdata.sql
│ │ ├── generator/
│ │ │ └── generatorConfig.xml
│ │ ├── jdbc.properties
│ │ ├── log4j-acc.properties
│ │ ├── log4j-error.properties
│ │ ├── mapper/
│ │ │ ├── CodeMapper.xml
│ │ │ ├── GameMapper.xml
│ │ │ ├── ImgMapper.xml
│ │ │ ├── KindMapper.xml
│ │ │ ├── KindmapperMapper.xml
│ │ │ ├── OrderMapper.xml
│ │ │ ├── OrderitemMapper.xml
│ │ │ ├── OrdermapperMapper.xml
│ │ │ ├── TagMapper.xml
│ │ │ ├── TagmapperMapper.xml
│ │ │ ├── TokenMapper.xml
│ │ │ └── UserMapper.xml
│ │ ├── mybatis-config.xml
│ │ ├── schema.sql
│ │ ├── spring-dao.xml
│ │ ├── spring-mvc.xml
│ │ └── spring-service.xml
│ └── webapp/
│ └── WEB-INF/
│ ├── css/
│ │ ├── adminlogin.css
│ │ ├── adminpage.css
│ │ ├── base.css
│ │ ├── fenleixiangqing.css
│ │ ├── login.css
│ │ ├── order.css
│ │ ├── personal.css
│ │ ├── regist.css
│ │ ├── sanji.css
│ │ ├── self.css
│ │ └── shoppingcart.css
│ ├── js/
│ │ ├── adminlogin.js
│ │ ├── adminpage.js
│ │ ├── biaoqian.js
│ │ ├── fenlei.js
│ │ ├── findpassword.js
│ │ ├── fishjs/
│ │ │ ├── ane.js
│ │ │ ├── baby.js
│ │ │ ├── background.js
│ │ │ ├── collision.js
│ │ │ ├── commonFunctions.js
│ │ │ ├── data.js
│ │ │ ├── dust.js
│ │ │ ├── fruit.js
│ │ │ ├── halo.js
│ │ │ ├── main.js
│ │ │ ├── mom.js
│ │ │ └── wave.js
│ │ ├── index.js
│ │ ├── login.js
│ │ ├── order.js
│ │ ├── personal.js
│ │ ├── regist.js
│ │ ├── sanji.js
│ │ ├── search.js
│ │ ├── shoppingcart.js
│ │ ├── top.js
│ │ ├── updateUserInfo.js
│ │ └── updatepassword.js
│ ├── jsp/
│ │ ├── adminlogin.jsp
│ │ ├── adminpage.jsp
│ │ ├── checkemail.jsp
│ │ ├── common/
│ │ │ ├── bottom.jsp
│ │ │ ├── head.jsp
│ │ │ └── top.jsp
│ │ ├── error/
│ │ │ ├── ErrorCode400.jsp
│ │ │ ├── ErrorCode404.jsp
│ │ │ └── ErrorCode500.jsp
│ │ ├── findpassword.jsp
│ │ ├── fishjs.jsp
│ │ ├── gameInfo.jsp
│ │ ├── index.jsp
│ │ ├── kinds.jsp
│ │ ├── login.jsp
│ │ ├── order.jsp
│ │ ├── order_1.jsp
│ │ ├── order_2.jsp
│ │ ├── personal.jsp
│ │ ├── register.jsp
│ │ ├── search.jsp
│ │ ├── shoppingcart.jsp
│ │ ├── taggames.jsp
│ │ ├── updateUserInfo.jsp
│ │ ├── updatepassword.jsp
│ │ └── validate.jsp
│ └── web.xml
└── test/
└── java/
└── cn/
└── cie/
├── common/
│ └── CommonTest.java
├── mapper/
│ ├── GameMapperTest.java
│ ├── KindmapperMapperTest.java
│ └── UserMapperTest.java
├── services/
│ ├── KindServiceTest.java
│ └── UserServiceTest.java
└── utils/
└── RedisUtilTest.java
SYMBOL INDEX (671 symbols across 95 files)
FILE: src/main/java/cn/cie/aop/LogAspectj.java
class LogAspectj (line 20) | @Component
method logAccess (line 26) | @Before("execution(* cn.cie.controller.*Controller.*(..)) && !executio...
method errorAccess (line 54) | @AfterThrowing(value = "execution(* cn.cie.controller.*Controller.*(.....
FILE: src/main/java/cn/cie/controller/AbstractController.java
class AbstractController (line 34) | public abstract class AbstractController {
method setThreadLocal (line 57) | @ModelAttribute
method getRequest (line 68) | protected HttpServletRequest getRequest() {
method getSession (line 77) | protected HttpSession getSession() {
method getModel (line 86) | protected Model getModel() {
method getContext (line 95) | protected ServletContext getContext() {
method setModelAttribute (line 105) | protected void setModelAttribute(String name, Object value) {
method setRequestAttribute (line 115) | protected void setRequestAttribute(String name, Object value) {
method setSessionAttribute (line 126) | public void setSessionAttribute(String name, Object value) {
method getSessionAttribute (line 137) | protected Object getSessionAttribute(String name) {
method getRequestAttribute (line 149) | protected Object getRequestAttribute(String name) {
method getUserAgent (line 155) | protected String getUserAgent() {
method getRemoteIp (line 159) | protected String getRemoteIp() {
FILE: src/main/java/cn/cie/controller/AdminController.java
class AdminController (line 20) | @CrossOrigin
method login (line 28) | @GetMapping(value = "login")
method login (line 33) | @PostMapping(value = "login")
method adminPage (line 46) | @GetMapping(value = "home")
method getUser (line 51) | @PostMapping(value = "getuser")
method restrict (line 57) | @PostMapping(value = "restrictuser")
method relieve (line 63) | @PostMapping(value = "relieveuser")
method delUser (line 69) | @PostMapping(value = "deluser")
method getGames (line 75) | @PostMapping(value = "getgames")
method addGame (line 81) | @PostMapping(value = "addgame")
method updateGameInfo (line 89) | @PostMapping(value = "updategameinfo")
method getGameKind (line 95) | @PostMapping(value = "getgamekind")
method updateGameKind (line 101) | @PostMapping(value = "updategamekind")
method upGame (line 107) | @PostMapping(value = "upgame")
method downGame (line 113) | @PostMapping(value = "downgame")
method addKind (line 119) | @PostMapping(value = "addkind")
method getAllGames (line 125) | @PostMapping(value = "getallgames")
method managerKind (line 131) | @PostMapping(value = "managerkind")
FILE: src/main/java/cn/cie/controller/CommonController.java
class CommonController (line 21) | @CrossOrigin
method index (line 32) | @RequestMapping(value = {"/", "/index"})
method login (line 37) | @GetMapping(value = "login")
method login (line 47) | @PostMapping(value = "login")
method logout (line 76) | @PostMapping(value = "logout")
method register (line 91) | @GetMapping(value = "register")
method register (line 100) | @PostMapping(value = "register")
method everyday (line 118) | @PostMapping(value = "everyday")
method shoppingcart (line 125) | @GetMapping(value = "shoppingcart")
method newestGames (line 135) | @PostMapping(value = "newestgames")
method preUpGames (line 146) | @PostMapping(value = "preupgames")
method getFreeGames (line 152) | @PostMapping(value = "freegames")
method search (line 158) | @GetMapping(value = "search")
method search (line 163) | @PostMapping(value = "search")
method getReferer (line 179) | private String getReferer() {
FILE: src/main/java/cn/cie/controller/GameController.java
class GameController (line 13) | @CrossOrigin
method gameInfo (line 21) | @GetMapping(value = "{id}")
method selectById (line 30) | @PostMapping(value = "{id}")
FILE: src/main/java/cn/cie/controller/KindController.java
class KindController (line 15) | @CrossOrigin
method allkinds (line 23) | @PostMapping(value = "all")
method getGames (line 30) | @GetMapping(value = "{kind}/games")
method getGamesByKind (line 41) | @PostMapping(value = "{kind}/games")
FILE: src/main/java/cn/cie/controller/OrderController.java
class OrderController (line 16) | @CrossOrigin
method orders (line 26) | @GetMapping(value = "orders")
method order (line 31) | @PostMapping(value = "order")
method cancelOrder (line 37) | @PostMapping(value = "{orderid}/cancel")
method payway (line 43) | @GetMapping(value = "{orderid}/payway")
method pay (line 52) | @GetMapping(value = "{orderid}/pay")
method payOrder (line 61) | @PostMapping(value = "{orderid}/pay")
method getNotPayOrders (line 67) | @PostMapping(value = "notpay/{page}")
method getPaidOrders (line 73) | @PostMapping(value = "paid/{page}")
method getCancelOrders (line 79) | @PostMapping(value = "cancel/{page}")
FILE: src/main/java/cn/cie/controller/TagController.java
class TagController (line 16) | @CrossOrigin
method getGames (line 24) | @GetMapping(value = "/{tag}/games")
method getGamesByTag (line 35) | @PostMapping(value = "/{tag}/games")
FILE: src/main/java/cn/cie/controller/UserController.java
class UserController (line 15) | @CrossOrigin
method validate (line 25) | @GetMapping(value = "validate")
method validate (line 34) | @PostMapping(value = "validate")
method sendMail (line 50) | @PostMapping(value = "sendMail")
method personal (line 59) | @GetMapping(value = "personal")
method getPersonInfo (line 64) | @PostMapping(value = "personal")
method update (line 75) | @GetMapping(value = "update")
method update (line 80) | @PostMapping(value = "update")
method updatePassword (line 86) | @GetMapping(value = "updatepassword")
method updatePassword (line 91) | @PostMapping(value = "updatepassword")
method findPassword (line 97) | @GetMapping(value = "findpassword")
method sendFetchPwdMail (line 102) | @PostMapping(value = "sendfetchpwdmail")
method findPassword (line 108) | @PostMapping(value = "findpassword")
method getReferer (line 124) | private String getReferer() {
FILE: src/main/java/cn/cie/entity/Code.java
class Code (line 6) | public class Code {
method getId (line 27) | public Integer getId() {
method setId (line 31) | public void setId(Integer id) {
method getItem (line 35) | public Integer getItem() {
method setItem (line 39) | public void setItem(Integer item) {
method getUid (line 43) | public Integer getUid() {
method setUid (line 47) | public void setUid(Integer uid) {
method getCode (line 51) | public String getCode() {
method setCode (line 55) | public void setCode(String code) {
method getStat (line 59) | public Byte getStat() {
method setStat (line 63) | public void setStat(Byte stat) {
FILE: src/main/java/cn/cie/entity/Game.java
class Game (line 8) | public class Game {
method getId (line 43) | public Integer getId() {
method setId (line 47) | public void setId(Integer id) {
method getCreater (line 51) | public String getCreater() {
method setCreater (line 55) | public void setCreater(String creater) {
method getName (line 59) | public String getName() {
method setName (line 63) | public void setName(String name) {
method getDesc (line 67) | public String getDesc() {
method setDesc (line 71) | public void setDesc(String desc) {
method getSystemcfg (line 75) | public String getSystemcfg() {
method setSystemcfg (line 79) | public void setSystemcfg(String systemcfg) {
method getPrice (line 83) | public Double getPrice() {
method setPrice (line 87) | public void setPrice(Double price) {
method getDiscount (line 91) | public Double getDiscount() {
method setDiscount (line 95) | public void setDiscount(Double discount) {
method getCtime (line 99) | public Date getCtime() {
method setCtime (line 103) | public void setCtime(Date ctime) {
method getUtime (line 107) | public Date getUtime() {
method setUtime (line 111) | public void setUtime(Date utime) {
method getStat (line 115) | public Byte getStat() {
method setStat (line 119) | public void setStat(Byte stat) {
FILE: src/main/java/cn/cie/entity/Img.java
class Img (line 6) | public class Img {
method getGame (line 11) | public Integer getGame() {
method setGame (line 15) | public void setGame(Integer game) {
method getImg (line 19) | public String getImg() {
method setImg (line 23) | public void setImg(String img) {
FILE: src/main/java/cn/cie/entity/Kind.java
class Kind (line 3) | public class Kind {
method getId (line 8) | public Integer getId() {
method setId (line 12) | public void setId(Integer id) {
method getName (line 16) | public String getName() {
method setName (line 20) | public void setName(String name) {
FILE: src/main/java/cn/cie/entity/Kindmapper.java
class Kindmapper (line 6) | public class Kindmapper {
method getGame (line 11) | public Integer getGame() {
method setGame (line 15) | public void setGame(Integer game) {
method getKind (line 19) | public Integer getKind() {
method setKind (line 23) | public void setKind(Integer kind) {
FILE: src/main/java/cn/cie/entity/Order.java
class Order (line 8) | public class Order {
method getId (line 35) | public Integer getId() {
method setId (line 39) | public void setId(Integer id) {
method getUid (line 43) | public Integer getUid() {
method setUid (line 47) | public void setUid(Integer uid) {
method getPrice (line 51) | public Double getPrice() {
method setPrice (line 55) | public void setPrice(Double price) {
method getCtime (line 59) | public Date getCtime() {
method setCtime (line 63) | public void setCtime(Date ctime) {
method getUtime (line 67) | public Date getUtime() {
method setUtime (line 71) | public void setUtime(Date utime) {
method getStat (line 75) | public Byte getStat() {
method setStat (line 79) | public void setStat(Byte stat) {
FILE: src/main/java/cn/cie/entity/Orderitem.java
class Orderitem (line 8) | public class Orderitem {
method getId (line 21) | public Integer getId() {
method setId (line 25) | public void setId(Integer id) {
method getGid (line 29) | public Integer getGid() {
method setGid (line 33) | public void setGid(Integer gid) {
method getPrice (line 37) | public Double getPrice() {
method setPrice (line 41) | public void setPrice(Double price) {
method getCode (line 45) | public Integer getCode() {
method setCode (line 49) | public void setCode(Integer code) {
method getCtime (line 53) | public Date getCtime() {
method setCtime (line 57) | public void setCtime(Date ctime) {
method getUtime (line 61) | public Date getUtime() {
method setUtime (line 65) | public void setUtime(Date utime) {
FILE: src/main/java/cn/cie/entity/Ordermapper.java
class Ordermapper (line 6) | public class Ordermapper {
method getOrder (line 11) | public Integer getOrder() {
method setOrder (line 15) | public void setOrder(Integer order) {
method getItem (line 19) | public Integer getItem() {
method setItem (line 23) | public void setItem(Integer item) {
FILE: src/main/java/cn/cie/entity/Tag.java
class Tag (line 6) | public class Tag {
method getId (line 11) | public Integer getId() {
method setId (line 15) | public void setId(Integer id) {
method getName (line 19) | public String getName() {
method setName (line 23) | public void setName(String name) {
FILE: src/main/java/cn/cie/entity/Tagmapper.java
class Tagmapper (line 6) | public class Tagmapper {
method getGame (line 11) | public Integer getGame() {
method setGame (line 15) | public void setGame(Integer game) {
method getTag (line 19) | public Integer getTag() {
method setTag (line 23) | public void setTag(Integer tag) {
FILE: src/main/java/cn/cie/entity/Token.java
class Token (line 8) | public class Token {
method getUid (line 33) | public Integer getUid() {
method setUid (line 37) | public void setUid(Integer uid) {
method getToken (line 41) | public String getToken() {
method setToken (line 45) | public void setToken(String token) {
method getExpiredTime (line 49) | public Date getExpiredTime() {
method setExpiredTime (line 53) | public void setExpiredTime(Date expiredTime) {
method getIp (line 57) | public String getIp() {
method setIp (line 61) | public void setIp(String ip) {
method getDevice (line 65) | public String getDevice() {
method setDevice (line 69) | public void setDevice(String device) {
method getCtime (line 73) | public Date getCtime() {
method setCtime (line 77) | public void setCtime(Date ctime) {
method getStat (line 81) | public Byte getStat() {
method setStat (line 85) | public void setStat(Byte stat) {
FILE: src/main/java/cn/cie/entity/User.java
class User (line 5) | public class User {
method getId (line 42) | public Integer getId() {
method setId (line 46) | public void setId(Integer id) {
method getUsername (line 50) | public String getUsername() {
method setUsername (line 54) | public void setUsername(String username) {
method getPassword (line 58) | public String getPassword() {
method setPassword (line 62) | public void setPassword(String password) {
method getNickname (line 66) | public String getNickname() {
method setNickname (line 70) | public void setNickname(String nickname) {
method getEmail (line 74) | public String getEmail() {
method setEmail (line 78) | public void setEmail(String email) {
method getPhone (line 82) | public Long getPhone() {
method setPhone (line 86) | public void setPhone(Long phone) {
method getCtime (line 90) | public Date getCtime() {
method setCtime (line 94) | public void setCtime(Date ctime) {
method getUtime (line 98) | public Date getUtime() {
method setUtime (line 102) | public void setUtime(Date utime) {
method getStat (line 106) | public Byte getStat() {
method setStat (line 110) | public void setStat(Byte stat) {
method toString (line 114) | @Override
FILE: src/main/java/cn/cie/entity/Validatecode.java
class Validatecode (line 6) | public class Validatecode {
FILE: src/main/java/cn/cie/entity/dto/GameDTO.java
class GameDTO (line 13) | public class GameDTO {
method GameDTO (line 41) | public GameDTO() {}
method GameDTO (line 43) | public GameDTO(Game game, List<Tag> tags, List<String> img) {
method GameDTO (line 58) | public GameDTO(Game game, List<Kind> kinds, List<Tag> tags, List<Strin...
method getId (line 74) | public Integer getId() {
method getCreater (line 78) | public String getCreater() {
method getName (line 82) | public String getName() {
method getDesc (line 86) | public String getDesc() {
method getSystemcfg (line 90) | public String getSystemcfg() {
method getPrice (line 94) | public Double getPrice() {
method getDiscount (line 98) | public Double getDiscount() {
method getCtime (line 102) | public Date getCtime() {
method getUtime (line 106) | public Date getUtime() {
method getStat (line 110) | public Byte getStat() {
method getKinds (line 114) | public List<Kind> getKinds() {
method getTags (line 118) | public List<Tag> getTags() {
method getImg (line 122) | public List<String> getImg() {
FILE: src/main/java/cn/cie/entity/dto/OrderDTO.java
class OrderDTO (line 12) | public class OrderDTO {
method OrderDTO (line 49) | public OrderDTO(Order order, List<OrderItemDTO> orderitems) {
method getId (line 59) | public Integer getId() {
method getUid (line 63) | public Integer getUid() {
method getTotal (line 67) | public Double getTotal() {
method getCtime (line 71) | public Date getCtime() {
method getUtime (line 75) | public Date getUtime() {
method getStat (line 79) | public Byte getStat() {
method getOrderitems (line 83) | public List<OrderItemDTO> getOrderitems() {
FILE: src/main/java/cn/cie/entity/dto/OrderItemDTO.java
class OrderItemDTO (line 12) | public class OrderItemDTO {
method OrderItemDTO (line 28) | public OrderItemDTO(Orderitem orderitem, Game game, Code code) {
method getId (line 40) | public Integer getId() {
method getPrice (line 44) | public Double getPrice() {
method getCode (line 48) | public String getCode() {
method getCodeStat (line 52) | public Byte getCodeStat() {
method getCtime (line 56) | public Date getCtime() {
method getUtime (line 60) | public Date getUtime() {
method getGame (line 64) | public Game getGame() {
FILE: src/main/java/cn/cie/event/EventConsumer.java
class EventConsumer (line 25) | @Service
method afterPropertiesSet (line 42) | public void afterPropertiesSet() throws Exception {
class EventConsumerThread (line 78) | class EventConsumerThread implements Runnable {
method EventConsumerThread (line 84) | public EventConsumerThread(EventHandler handler, EventModel event) {
method run (line 89) | public void run() {
method setApplicationContext (line 94) | public void setApplicationContext(ApplicationContext applicationContex...
method destroy (line 98) | public void destroy() throws Exception {
FILE: src/main/java/cn/cie/event/EventModel.java
class EventModel (line 10) | public class EventModel {
method EventModel (line 42) | public EventModel() {
method EventModel (line 46) | public EventModel(EventType eventType) {
method getEventType (line 50) | public EventType getEventType() {
method setEventType (line 54) | public EventModel setEventType(EventType eventType) {
method getFromId (line 59) | public int getFromId() {
method setFromId (line 63) | public EventModel setFromId(int fromId) {
method getToId (line 68) | public int getToId() {
method setToId (line 72) | public EventModel setToId(int toId) {
method getEntityId (line 77) | public int getEntityId() {
method setEntityId (line 81) | public EventModel setEntityId(int entityId) {
method getEntityOwnerId (line 86) | public int getEntityOwnerId() {
method setEntityOwnerId (line 90) | public EventModel setEntityOwnerId(int entityOwnerId) {
method getExts (line 95) | public String getExts(String key) {
method setExts (line 99) | public EventModel setExts(String key, String value) {
method getExts (line 104) | public Map<String, String> getExts() {
method setExts (line 108) | public void setExts(Map<String, String> exts) {
FILE: src/main/java/cn/cie/event/EventProducer.java
class EventProducer (line 11) | @Component
method product (line 17) | public long product(EventModel model) {
FILE: src/main/java/cn/cie/event/EventType.java
type EventType (line 7) | public enum EventType {
method EventType (line 14) | EventType(int value) {
method getValue (line 18) | public int getValue() {
FILE: src/main/java/cn/cie/event/handler/EventHandler.java
type EventHandler (line 12) | public interface EventHandler {
method doHandler (line 17) | void doHandler(EventModel eventModel);
method getSupportEvent (line 23) | List<EventType> getSupportEvent();
FILE: src/main/java/cn/cie/event/handler/SendFindPwdMailHandler.java
class SendFindPwdMailHandler (line 15) | @Service
method doHandler (line 18) | public void doHandler(EventModel model) {
method getSupportEvent (line 22) | public List<EventType> getSupportEvent() {
FILE: src/main/java/cn/cie/event/handler/SendValidateMailHandler.java
class SendValidateMailHandler (line 15) | @Service
method doHandler (line 18) | public void doHandler(EventModel model) {
method getSupportEvent (line 22) | public List<EventType> getSupportEvent() {
FILE: src/main/java/cn/cie/exception/NotFoundException.java
class NotFoundException (line 11) | @ResponseStatus(value = HttpStatus.NOT_FOUND)
method NotFoundException (line 14) | public NotFoundException() {
FILE: src/main/java/cn/cie/interceptor/AdminInterceptor.java
class AdminInterceptor (line 15) | public class AdminInterceptor implements HandlerInterceptor {
method preHandle (line 20) | public boolean preHandle(HttpServletRequest request, HttpServletRespon...
method postHandle (line 31) | public void postHandle(HttpServletRequest request, HttpServletResponse...
method afterCompletion (line 35) | public void afterCompletion(HttpServletRequest request, HttpServletRes...
FILE: src/main/java/cn/cie/interceptor/AuthInterceptor.java
class AuthInterceptor (line 25) | @Component
method preHandle (line 37) | public boolean preHandle(HttpServletRequest httpServletRequest, HttpSe...
method postHandle (line 98) | public void postHandle(HttpServletRequest httpServletRequest, HttpServ...
method afterCompletion (line 107) | public void afterCompletion(HttpServletRequest httpServletRequest, Htt...
FILE: src/main/java/cn/cie/interceptor/LoginInterceptor.java
class LoginInterceptor (line 16) | @Component
method preHandle (line 22) | public boolean preHandle(HttpServletRequest httpServletRequest, HttpSe...
method postHandle (line 30) | public void postHandle(HttpServletRequest httpServletRequest, HttpServ...
method afterCompletion (line 34) | public void afterCompletion(HttpServletRequest httpServletRequest, Htt...
FILE: src/main/java/cn/cie/mapper/CodeMapper.java
type CodeMapper (line 5) | public interface CodeMapper {
method insert (line 7) | int insert(Code record);
method selectById (line 9) | Code selectById(Integer id);
method update (line 11) | int update(Code record);
FILE: src/main/java/cn/cie/mapper/GameMapper.java
type GameMapper (line 8) | public interface GameMapper {
method insert (line 10) | int insert(Game record);
method selectById (line 12) | Game selectById(Integer id);
method selectNums (line 14) | int selectNums();
method selectAll (line 16) | List<Game> selectAll();
method selectByPage (line 18) | List<Game> selectByPage(@Param(value = "startPos") Integer startPos, @...
method selectByIds (line 20) | List<Game> selectByIds(@Param(value = "ids") List<Integer> ids);
method selectByIdsAndStat (line 22) | List<Game> selectByIdsAndStat(@Param(value = "ids") List<Integer> ids,...
method selectByIdsAndStatAndPage (line 24) | List<Game> selectByIdsAndStatAndPage(@Param(value = "ids") List<Intege...
method selectByStat (line 27) | List<Game> selectByStat(Byte stat);
method selectByStatOrderByDate (line 29) | List<Game> selectByStatOrderByDate(Byte stat);
method selectByIdsAndInfo (line 31) | List<Game> selectByIdsAndInfo(@Param(value = "ids") List<Integer> ids,...
method selectByInfo (line 33) | List<Game> selectByInfo(String info);
method selectFreeGames (line 35) | List<Game> selectFreeGames();
method update (line 37) | int update(Game record);
FILE: src/main/java/cn/cie/mapper/ImgMapper.java
type ImgMapper (line 8) | public interface ImgMapper {
method insert (line 9) | int insert(Img record);
method insertBatch (line 11) | int insertBatch(@Param(value = "game") Integer game, @Param(value = "i...
method selectByGame (line 13) | List<String> selectByGame(Integer game);
FILE: src/main/java/cn/cie/mapper/KindMapper.java
type KindMapper (line 8) | public interface KindMapper {
method insert (line 10) | int insert(Kind record);
method selectById (line 12) | Kind selectById(Integer id);
method selectAll (line 14) | List<Kind> selectAll();
method selectByIds (line 16) | List<Kind> selectByIds(@Param(value = "ids") List<Integer> ids);
method selectByName (line 18) | Kind selectByName(String name);
method selectIdByLikeName (line 20) | List<Integer> selectIdByLikeName(String name);
method delete (line 22) | int delete(Integer id);
method update (line 24) | int update(Kind record);
FILE: src/main/java/cn/cie/mapper/KindmapperMapper.java
type KindmapperMapper (line 8) | public interface KindmapperMapper {
method insert (line 10) | int insert(Kindmapper record);
method insertKindBatch (line 12) | int insertKindBatch(@Param(value = "game") Integer game, @Param(value ...
method insertGameBatch (line 14) | int insertGameBatch(@Param(value = "kind") Integer kind, @Param(value ...
method selectByKind (line 16) | List<Integer> selectByKind(Integer kind);
method selectByGame (line 18) | List<Integer> selectByGame(Integer game);
method selectBatchByKinds (line 20) | List<Integer> selectBatchByKinds(@Param(value = "kinds") List<Integer>...
method deleteByGame (line 22) | int deleteByGame(Integer game);
method deleteByKind (line 24) | int deleteByKind(Integer kind);
FILE: src/main/java/cn/cie/mapper/OrderMapper.java
type OrderMapper (line 9) | public interface OrderMapper {
method insert (line 11) | int insert(Order record);
method selectById (line 13) | Order selectById(Integer id);
method selectByUidAndStat (line 15) | List<Order> selectByUidAndStat(@Param(value = "uid") Integer uid, @Par...
method selectByUidAndStatAndPage (line 17) | List<Order> selectByUidAndStatAndPage(@Param(value = "uid") Integer ui...
method getOrderNumsByUidAndStat (line 20) | int getOrderNumsByUidAndStat(@Param(value = "uid") Integer uid, @Param...
method updateStatByDate (line 22) | int updateStatByDate(@Param(value = "oldstat") Byte oldstat, @Param(va...
method update (line 24) | int update(Order record);
FILE: src/main/java/cn/cie/mapper/OrderitemMapper.java
type OrderitemMapper (line 8) | public interface OrderitemMapper {
method insert (line 10) | int insert(Orderitem record);
method selectByIds (line 12) | List<Orderitem> selectByIds(@Param(value = "ids") List<Integer> ids);
method update (line 14) | int update(Orderitem record);
FILE: src/main/java/cn/cie/mapper/OrdermapperMapper.java
type OrdermapperMapper (line 8) | public interface OrdermapperMapper {
method insert (line 9) | int insert(Ordermapper record);
method selectByOrder (line 11) | List<Integer> selectByOrder(Integer order);
FILE: src/main/java/cn/cie/mapper/TagMapper.java
type TagMapper (line 8) | public interface TagMapper {
method insert (line 10) | int insert(Tag record);
method selectById (line 12) | Tag selectById(Integer id);
method selectByIds (line 14) | List<Tag> selectByIds(@Param(value = "ids") List<Integer> ids);
method selectIdByLikeName (line 16) | List<Integer> selectIdByLikeName(String info);
method selectAll (line 18) | List<Tag> selectAll();
method update (line 20) | int update(Tag record);
FILE: src/main/java/cn/cie/mapper/TagmapperMapper.java
type TagmapperMapper (line 8) | public interface TagmapperMapper {
method insert (line 9) | int insert(Tagmapper record);
method selectByTag (line 11) | List<Integer> selectByTag(Integer tag);
method selectByGame (line 13) | List<Integer> selectByGame(Integer game);
method selectBatchByTags (line 15) | List<Integer> selectBatchByTags(@Param(value = "tags") List<Integer> t...
FILE: src/main/java/cn/cie/mapper/TokenMapper.java
type TokenMapper (line 9) | public interface TokenMapper {
method insert (line 11) | int insert(Token record);
method selectByToken (line 13) | Token selectByToken(String token);
method selectByTokenAndStat (line 15) | Token selectByTokenAndStat(@Param(value = "token") String token, @Para...
method selectByUid (line 17) | List<Token> selectByUid(Integer uid);
method updateStatByDate (line 19) | int updateStatByDate(@Param(value = "date") Date date, @Param(value = ...
method updateStatByToken (line 21) | int updateStatByToken(@Param(value = "stat") Byte stat, @Param(value =...
FILE: src/main/java/cn/cie/mapper/UserMapper.java
type UserMapper (line 8) | public interface UserMapper {
method insert (line 10) | int insert(User record);
method selectById (line 12) | User selectById(Integer id);
method selectByName (line 14) | User selectByName(String username);
method selectByEmail (line 16) | User selectByEmail(String email);
method selectAllNums (line 18) | int selectAllNums();
method selectByPage (line 20) | List<User> selectByPage(@Param(value = "startPos") Integer startPos, @...
method selectByStat (line 22) | List<User> selectByStat(Byte stat);
method update (line 24) | int update(User record);
method deleteById (line 26) | int deleteById(Integer id);
FILE: src/main/java/cn/cie/schedule/Scheduler.java
class Scheduler (line 14) | @Component
method delNotValidateUser (line 22) | @Scheduled(fixedRate = 1000 * 60 * 3)
method expireToken (line 27) | @Scheduled(fixedRate = 1000 * 60 * 10)
method cancelOrder (line 32) | @Scheduled(fixedRate = 1000 * 60)
FILE: src/main/java/cn/cie/services/AdminService.java
type AdminService (line 15) | public interface AdminService {
method login (line 23) | Result login(String username, String password);
method getUser (line 30) | Result getUser(int page);
method restrict (line 37) | Result restrict(Integer uid);
method relieve (line 44) | Result relieve(Integer uid);
method delete (line 51) | Result delete(Integer uid);
method getGames (line 58) | Result getGames(int page);
method addGame (line 69) | Result addGame(Game game, Integer[] kind, MultipartFile header, Multip...
method updateGameInfo (line 76) | Result updateGameInfo(Game game);
method getGameKind (line 83) | Result getGameKind(Integer game);
method updateGameKind (line 91) | Result updateGameKind(Integer game, List<Integer> kinds);
method upGame (line 99) | Result upGame(Integer id, Date date);
method downGame (line 106) | Result downGame(Integer id);
method addKind (line 113) | Result addKind(String name);
method managerKind (line 121) | Result managerKind(Integer kind, List<Integer> games);
method getAllGames (line 127) | Result getAllGames();
FILE: src/main/java/cn/cie/services/GameService.java
type GameService (line 11) | public interface GameService {
method getById (line 18) | Result<GameDTO> getById(Integer id);
method getRandomGames (line 24) | Result<List<GameDTO>> getRandomGames();
method newestGames (line 30) | Result<List<GameDTO>> newestGames();
method preUpGames (line 36) | Result<List<GameDTO>> preUpGames();
method search (line 43) | Result<List<GameDTO>> search(String info);
method getFreeGames (line 49) | Result getFreeGames();
method exists (line 56) | boolean exists(Integer id);
FILE: src/main/java/cn/cie/services/KindService.java
type KindService (line 12) | public interface KindService {
method getNameById (line 19) | String getNameById(Integer id);
method getAll (line 25) | Result<Kind> getAll();
method getGamesByKind (line 33) | Result<List<GameDTO>> getGamesByKind(int kind, int page);
FILE: src/main/java/cn/cie/services/OrderService.java
type OrderService (line 10) | public interface OrderService {
method addOrders (line 18) | Result addOrders(int uid, List<Integer> gids);
method cancelOrder (line 25) | Result cancelOrder(int uid, int orderid);
method pay (line 33) | Result pay(int uid, int orderid);
method exists (line 40) | boolean exists(int orderid);
method getNotPayOrders (line 47) | Result getNotPayOrders(int uid, int page);
method getPaidOrders (line 54) | Result getPaidOrders(int uid, int page);
method getCancelOrders (line 61) | Result getCancelOrders(int uid, int page);
method autoCancelOrder (line 66) | void autoCancelOrder();
FILE: src/main/java/cn/cie/services/TagService.java
type TagService (line 12) | public interface TagService {
method getNameById (line 19) | String getNameById(Integer id);
method getAll (line 25) | Result<List<Tag>> getAll();
method addTag (line 32) | Result<Tag> addTag(String name);
method addTag (line 40) | Result addTag(String name, Integer game);
method addTag (line 48) | Result addTag(Integer tag, Integer game);
method getGamesByTag (line 56) | Result<List<GameDTO>> getGamesByTag(Integer tag, Integer page);
FILE: src/main/java/cn/cie/services/UserService.java
type UserService (line 9) | public interface UserService {
method register (line 16) | Result register(User user);
method sendMail (line 23) | Result sendMail(User user);
method validate (line 31) | Result validate(Integer uid, String code);
method login (line 43) | Result login(String username, String password, boolean remember, Strin...
method logout (line 49) | Result logout(String token);
method updateUserInfo (line 56) | Result updateUserInfo(User user);
method updatePassword (line 63) | Result updatePassword(String password);
method forgetPassword (line 71) | Result forgetPassword(String password, String email, String code);
method sendFetchPwdMail (line 78) | Result sendFetchPwdMail(String email);
method delNotValidateUser (line 83) | void delNotValidateUser();
method expireToken (line 88) | void expireToken();
FILE: src/main/java/cn/cie/services/impl/AdminServiceImpl.java
class AdminServiceImpl (line 22) | @Service
method login (line 43) | public Result login(String username, String password) {
method getUser (line 63) | public Result getUser(int page) {
method restrict (line 71) | public Result restrict(Integer uid) {
method relieve (line 82) | public Result relieve(Integer uid) {
method delete (line 93) | public Result delete(Integer uid) {
method getGames (line 104) | public Result getGames(int page) {
method addGame (line 113) | @Transactional
method updateGameInfo (line 165) | public Result updateGameInfo(Game game) {
method getGameKind (line 173) | public Result getGameKind(Integer game) {
method updateGameKind (line 182) | @Transactional
method upGame (line 189) | public Result upGame(Integer id, Date date) {
method downGame (line 208) | public Result downGame(Integer id) {
method addKind (line 222) | @Transactional
method managerKind (line 238) | @Transactional
method getAllGames (line 245) | public Result getAllGames() {
method paresGameDTO (line 260) | private List<GameDTO> paresGameDTO(List<Game> games) {
FILE: src/main/java/cn/cie/services/impl/GameServiceImpl.java
class GameServiceImpl (line 21) | @Service
method getById (line 39) | public Result<GameDTO> getById(Integer id) {
method getRandomGames (line 54) | public Result<List<GameDTO>> getRandomGames() {
method newestGames (line 84) | public Result<List<GameDTO>> newestGames() {
method preUpGames (line 94) | public Result<List<GameDTO>> preUpGames() {
method search (line 104) | public Result<List<GameDTO>> search(String info) {
method getFreeGames (line 132) | public Result getFreeGames() {
method exists (line 137) | public boolean exists(Integer id) {
method paresGameDTO (line 141) | private List<GameDTO> paresGameDTO(List<Game> games) {
FILE: src/main/java/cn/cie/services/impl/KindServiceImpl.java
class KindServiceImpl (line 22) | @Service
method getNameById (line 40) | public String getNameById(Integer id) {
method getAll (line 48) | public Result<Kind> getAll() {
method getGamesByKind (line 59) | public Result<List<GameDTO>> getGamesByKind(int kind, int page) {
method paresGameDTO (line 79) | private List<GameDTO> paresGameDTO(List<Game> games) {
FILE: src/main/java/cn/cie/services/impl/OrderServiceImpl.java
class OrderServiceImpl (line 20) | @Service
method addOrders (line 34) | @Transactional
method cancelOrder (line 68) | public Result cancelOrder(int uid, int orderid) {
method pay (line 81) | @Transactional
method exists (line 107) | public boolean exists(int orderid) {
method getNotPayOrders (line 112) | public Result getNotPayOrders(int uid, int page) {
method getPaidOrders (line 120) | public Result getPaidOrders(int uid, int page) {
method getCancelOrders (line 128) | public Result getCancelOrders(int uid, int page) {
method autoCancelOrder (line 136) | public void autoCancelOrder() {
method parseOrderByStatAndPage (line 142) | private List<OrderDTO> parseOrderByStatAndPage(Integer uid, Byte stat,...
FILE: src/main/java/cn/cie/services/impl/TagServiceImpl.java
class TagServiceImpl (line 27) | @Service
method getNameById (line 39) | public String getNameById(Integer id) {
method getAll (line 47) | public Result<List<Tag>> getAll() {
method addTag (line 51) | public Result<Tag> addTag(String name) {
method addTag (line 61) | @Transactional
method addTag (line 79) | public Result addTag(Integer tag, Integer game) {
method getGamesByTag (line 94) | public Result<List<GameDTO>> getGamesByTag(Integer tag, Integer page) {
method paresGameDTO (line 111) | private List<GameDTO> paresGameDTO(List<Game> games) {
FILE: src/main/java/cn/cie/services/impl/UserServiceImpl.java
class UserServiceImpl (line 25) | @Service
method register (line 39) | @Transactional
method sendMail (line 78) | @Transactional
method validate (line 91) | @Transactional
method login (line 107) | @Transactional
method logout (line 138) | public Result logout(String token) {
method updateUserInfo (line 147) | public Result updateUserInfo(User user) {
method updatePassword (line 177) | public Result updatePassword(String password) {
method forgetPassword (line 193) | public Result forgetPassword(String password, String email, String cod...
method sendFetchPwdMail (line 219) | public Result sendFetchPwdMail(String email) {
method delNotValidateUser (line 237) | public void delNotValidateUser() {
method expireToken (line 248) | public void expireToken() {
FILE: src/main/java/cn/cie/utils/MailUtil.java
class MailUtil (line 10) | public class MailUtil {
method sendMail (line 21) | public static void sendMail(String user, String title, String content) {
method sendValidateMail (line 42) | public static void sendValidateMail(String user, String code) {
method sendFetchPwdMail (line 55) | public static void sendFetchPwdMail(String user, String code) {
FILE: src/main/java/cn/cie/utils/MsgCenter.java
class MsgCenter (line 7) | public class MsgCenter {
FILE: src/main/java/cn/cie/utils/PageUtil.java
class PageUtil (line 7) | public class PageUtil {
method PageUtil (line 15) | public PageUtil(int num, int current, int size) {
method PageUtil (line 32) | public PageUtil(int num, int current) {
method getNum (line 44) | public int getNum() {
method setNum (line 48) | public void setNum(int num) {
method getPages (line 52) | public int getPages() {
method setPages (line 56) | public void setPages(int pages) {
method getCurrent (line 60) | public int getCurrent() {
method setCurrent (line 64) | public void setCurrent(int current) {
method getSize (line 68) | public int getSize() {
method setSize (line 72) | public void setSize(int size) {
method getStartPos (line 76) | public int getStartPos() {
method setStartPos (line 80) | public void setStartPos(int startPos) {
FILE: src/main/java/cn/cie/utils/PasswordUtil.java
class PasswordUtil (line 9) | public class PasswordUtil {
method pwd2Md5 (line 13) | public static String pwd2Md5(String paswword) {
FILE: src/main/java/cn/cie/utils/RedisUtil.java
class RedisUtil (line 17) | @Component
method put (line 39) | public String put(String key, String value) {
method putEx (line 59) | public String putEx(String key, String value, int timeout) {
method get (line 77) | public String get(String key) {
method putObject (line 96) | public String putObject(String key, T value) {
method putObjectEx (line 116) | public String putObjectEx(String key, T value, int timeout) {
method getObject (line 134) | public T getObject(String key, Class clazz) {
method delete (line 152) | public long delete(String key) {
method blpopObject (line 173) | public T blpopObject(int timeout, String key, Class clazz) {
method lpopObject (line 193) | public T lpopObject(String key, Class clazz) {
method rpushObject (line 212) | public long rpushObject(String key, Class clazz, Object... values) {
method rpushObjectExAtTime (line 241) | public long rpushObjectExAtTime(String key, Class clazz, long time, Ob...
method rpushObjectEx (line 273) | public long rpushObjectEx(String key, Class clazz, int timeout, Object...
method lall (line 302) | public List<T> lall(String key, Class clazz) {
method afterPropertiesSet (line 328) | public void afterPropertiesSet() throws Exception {
FILE: src/main/java/cn/cie/utils/Result.java
class Result (line 7) | public class Result<T> {
method Result (line 13) | private Result(boolean success, String msg) {
method Result (line 18) | private Result(boolean success, String msg, T data) {
method success (line 24) | public static Result success() {
method success (line 28) | public static Result success(Object data) {
method fail (line 32) | public static Result fail(String msg) {
method fail (line 36) | public static Result fail(String msg, Object data) {
method isSuccess (line 40) | public boolean isSuccess() {
method getMsg (line 44) | public String getMsg() {
method getData (line 48) | public T getData() {
FILE: src/main/java/cn/cie/utils/UserHolder.java
class UserHolder (line 10) | @Component
method getUser (line 15) | public User getUser() {
method setUser (line 19) | public void setUser(User user) {
method remove (line 23) | public void remove() {
FILE: src/main/resources/schema.sql
type `shop` (line 2) | CREATE TABLE IF NOT EXISTS `shop`.`user` (
type `shop` (line 16) | CREATE TABLE IF NOT EXISTS `shop`.`token` (
type `shop` (line 27) | CREATE TABLE IF NOT EXISTS `shop`.`game` (
type `shop` (line 41) | CREATE TABLE IF NOT EXISTS `shop`.`img` (
type `shop` (line 46) | CREATE TABLE IF NOT EXISTS `shop`.`code` (
type `shop` (line 55) | CREATE TABLE IF NOT EXISTS `shop`.`order` (
type `shop` (line 65) | CREATE TABLE IF NOT EXISTS `shop`.`orderitem` (
type `shop` (line 75) | CREATE TABLE IF NOT EXISTS `shop`.`ordermapper` (
type `shop` (line 80) | CREATE TABLE IF NOT EXISTS `shop`.`kind` (
type `shop` (line 86) | CREATE TABLE IF NOT EXISTS `shop`.`kindmapper` (
type `shop` (line 91) | CREATE TABLE IF NOT EXISTS `shop`.`tag` (
type `shop` (line 97) | CREATE TABLE IF NOT EXISTS `shop`.`tagmapper` (
FILE: src/main/webapp/WEB-INF/js/adminlogin.js
function login (line 1) | function login() {
FILE: src/main/webapp/WEB-INF/js/adminpage.js
function getgeame (line 173) | function getgeame(pagenum) {
function restrict (line 269) | function restrict(uid, j) {
function relieve (line 281) | function relieve(uid, j) {
function del (line 293) | function del(uid, j) {
function upgame (line 305) | function upgame(gid, j) {
function downgame (line 317) | function downgame(gid, j) {
function getgamekind (line 329) | function getgamekind(gid) {
function savekinds (line 358) | function savekinds() {
function managekind (line 388) | function managekind(kid) {
function savekindsgames (line 419) | function savekindsgames() {
function showright_0 (line 447) | function showright_0() {
function showright_1 (line 453) | function showright_1() {
function showright_2 (line 459) | function showright_2() {
function showright_3 (line 465) | function showright_3() {
function navList (line 473) | function navList(id) {
function getgameinfo (line 551) | function getgameinfo(gid) {
function savegameupdate (line 562) | function savegameupdate() {
function setImagePreviews (line 589) | function setImagePreviews(avalue) {
function setImagePreviews_0 (line 637) | function setImagePreviews_0(avalue) {
function addgame (line 686) | function addgame() {
function call (line 713) | function call() {
function cleartext (line 736) | function cleartext() {
function addkind (line 751) | function addkind() {
FILE: src/main/webapp/WEB-INF/js/fenlei.js
function getgame (line 8) | function getgame(page) {
function xianshitupian (line 108) | function xianshitupian(k) {
function yingcangtupian (line 113) | function yingcangtupian(k) {
FILE: src/main/webapp/WEB-INF/js/findpassword.js
function schedule (line 7) | function schedule() {
function time (line 13) | function time() {
function sendMail (line 26) | function sendMail() {
function findpassword (line 38) | function findpassword() {
FILE: src/main/webapp/WEB-INF/js/fishjs/background.js
function drawBackground (line 1) | function drawBackground(){
FILE: src/main/webapp/WEB-INF/js/fishjs/collision.js
function momFruitsCollision (line 2) | function momFruitsCollision() {
function momBabyCollision (line 25) | function momBabyCollision() {
FILE: src/main/webapp/WEB-INF/js/fishjs/commonFunctions.js
function calLength2 (line 9) | function calLength2(x1, y1, x2, y2) {
function randomColor (line 14) | function randomColor() {
function lerpAngle (line 28) | function lerpAngle(a, b, t) {
function lerpDistance (line 35) | function lerpDistance(aim, cur, ratio) {
function inOboundary (line 40) | function inOboundary(arrX, arrY, l, r, t, b) { //在l r t b范围内的检测
function rgbColor (line 44) | function rgbColor(r, g, b) {
function rgbNum (line 51) | function rgbNum(r, g, b) {
function rnd (line 58) | function rnd(m) {
function rateRandom (line 63) | function rateRandom(m, n) {
function distance (line 80) | function distance(x1, y1, x2, y2, l) {
function AABBbox (line 89) | function AABBbox(object1, w1, h1, object2, w2, h2, overlap) {
function dis2 (line 105) | function dis2(x, y, x0, y0) {
function rndi2 (line 111) | function rndi2(m, n) {
FILE: src/main/webapp/WEB-INF/js/fishjs/fruit.js
function fruitMonitor (line 69) | function fruitMonitor() {
function sendFruit (line 81) | function sendFruit() {
FILE: src/main/webapp/WEB-INF/js/fishjs/main.js
function game (line 46) | function game() {
function init (line 54) | function init() {
function gameloop (line 130) | function gameloop() {
function onmouseMove (line 156) | function onmouseMove(e) {
FILE: src/main/webapp/WEB-INF/js/index.js
function hoverShowDiv_1 (line 110) | function hoverShowDiv_1(i) {
function hoverShowDiv_2 (line 125) | function hoverShowDiv_2(i) {
FILE: src/main/webapp/WEB-INF/js/login.js
function login (line 1) | function login() {
FILE: src/main/webapp/WEB-INF/js/order.js
function getpaid (line 8) | function getpaid(pagenum) {
function getnotpay (line 84) | function getnotpay(pagenum) {
function getcancel (line 165) | function getcancel(pagenum) {
function cancel (line 241) | function cancel(oid) {
function topay (line 246) | function topay(oid) {
FILE: src/main/webapp/WEB-INF/js/regist.js
function schedule (line 7) | function schedule() {
function regist (line 14) | function regist() {
function time (line 34) | function time() {
function sendMail (line 47) | function sendMail() {
function validate (line 57) | function validate() {
FILE: src/main/webapp/WEB-INF/js/sanji.js
function change (line 138) | function change(i) {
function move (line 143) | function move(to) {
function addshopingcar (line 149) | function addshopingcar() {
FILE: src/main/webapp/WEB-INF/js/search.js
function xianshitupian (line 70) | function xianshitupian(k) {
function yingcangtupian (line 75) | function yingcangtupian(k) {
FILE: src/main/webapp/WEB-INF/js/shoppingcart.js
function del (line 25) | function del(i) {
function orderadd (line 35) | function orderadd() {
FILE: src/main/webapp/WEB-INF/js/top.js
function outlogin (line 1) | function outlogin() {
function search (line 11) | function search() {
FILE: src/main/webapp/WEB-INF/js/updateUserInfo.js
function updateUserInfo (line 8) | function updateUserInfo() {
FILE: src/main/webapp/WEB-INF/js/updatepassword.js
function updatepassword (line 1) | function updatepassword() {
FILE: src/test/java/cn/cie/common/CommonTest.java
class CommonTest (line 19) | public class CommonTest {
method createSql (line 23) | @Test
method random (line 52) | @Test
method zeroTime (line 59) | @Test
method strlength (line 68) | @Test
method equals (line 73) | @Test
method jsonTest (line 83) | @Test
FILE: src/test/java/cn/cie/mapper/GameMapperTest.java
class GameMapperTest (line 15) | @RunWith(SpringJUnit4ClassRunner.class)
method selectByStat (line 24) | @Test
FILE: src/test/java/cn/cie/mapper/KindmapperMapperTest.java
class KindmapperMapperTest (line 18) | @RunWith(SpringJUnit4ClassRunner.class)
method insertBatch (line 29) | @Test
method selectIdByLikeName (line 45) | @Test
FILE: src/test/java/cn/cie/mapper/UserMapperTest.java
class UserMapperTest (line 16) | @RunWith(SpringJUnit4ClassRunner.class)
method selectByPage (line 25) | @Test
FILE: src/test/java/cn/cie/services/KindServiceTest.java
class KindServiceTest (line 18) | @RunWith(SpringJUnit4ClassRunner.class)
method getAll (line 27) | @Test
method getGamesByKind (line 31) | @Test
FILE: src/test/java/cn/cie/services/UserServiceTest.java
class UserServiceTest (line 17) | @RunWith(SpringJUnit4ClassRunner.class)
method register (line 28) | @Test
method validate (line 48) | @Test
method login (line 64) | @Test
method updateUserInfo (line 68) | @Test
method restrict (line 82) | @Test
method relieve (line 86) | @Test
FILE: src/test/java/cn/cie/utils/RedisUtilTest.java
class RedisUtilTest (line 15) | @RunWith(SpringJUnit4ClassRunner.class)
method put (line 24) | @Test
method putEx (line 29) | @Test
method get (line 34) | @Test
method putObject (line 41) | @Test
method putObjectEx (line 50) | @Test
method getObject (line 54) | @Test
method delete (line 60) | @Test
method lall (line 65) | @Test
Condensed preview — 167 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (485K chars).
[
{
"path": ".gitignore",
"chars": 313,
"preview": "# Compiled class file\n*.class\n\n# Log file\n*.log\n\n# IDEA file\n.idea/\n*.iml\ntarget/\nupload/\n\n# BlueJ files\n*.ctxt\n\n# Mobil"
},
{
"path": "LICENSE.txt",
"chars": 35141,
"preview": " GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
},
{
"path": "README.md",
"chars": 1118,
"preview": "# Shop SSM框架搭建的网上游戏商城\n## 项目信息\n- 项目名字:WePlay\n- 项目描述:基于SSM框架的网上游戏商城\n## 环境配置\n- JDK 1.8\n- Spring 5.1.7\n- MyBatis 3.4\n- MySQL"
},
{
"path": "pom.xml",
"chars": 6485,
"preview": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLoc"
},
{
"path": "src/main/java/cn/cie/aop/LogAspectj.java",
"chars": 2517,
"preview": "package cn.cie.aop;\n\nimport org.apache.log4j.Logger;\nimport org.apache.log4j.PropertyConfigurator;\nimport org.aspectj.la"
},
{
"path": "src/main/java/cn/cie/controller/AbstractController.java",
"chars": 5265,
"preview": "/*\n * Copyright 2002-2016 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "src/main/java/cn/cie/controller/AdminController.java",
"chars": 4031,
"preview": "package cn.cie.controller;\n\nimport cn.cie.entity.Game;\nimport cn.cie.services.AdminService;\nimport cn.cie.utils.Result;\n"
},
{
"path": "src/main/java/cn/cie/controller/CommonController.java",
"chars": 5512,
"preview": "package cn.cie.controller;\n\nimport cn.cie.entity.User;\nimport cn.cie.services.GameService;\nimport cn.cie.services.UserSe"
},
{
"path": "src/main/java/cn/cie/controller/GameController.java",
"chars": 959,
"preview": "package cn.cie.controller;\n\nimport cn.cie.exception.NotFoundException;\nimport cn.cie.services.GameService;\nimport cn.cie"
},
{
"path": "src/main/java/cn/cie/controller/KindController.java",
"chars": 1422,
"preview": "package cn.cie.controller;\n\nimport cn.cie.exception.NotFoundException;\nimport cn.cie.services.KindService;\nimport cn.cie"
},
{
"path": "src/main/java/cn/cie/controller/OrderController.java",
"chars": 2680,
"preview": "package cn.cie.controller;\n\nimport cn.cie.exception.NotFoundException;\nimport cn.cie.services.OrderService;\nimport cn.ci"
},
{
"path": "src/main/java/cn/cie/controller/TagController.java",
"chars": 1284,
"preview": "package cn.cie.controller;\n\nimport cn.cie.entity.dto.GameDTO;\nimport cn.cie.exception.NotFoundException;\nimport cn.cie.s"
},
{
"path": "src/main/java/cn/cie/controller/UserController.java",
"chars": 3961,
"preview": "package cn.cie.controller;\n\nimport cn.cie.entity.User;\nimport cn.cie.services.UserService;\nimport cn.cie.utils.MsgCenter"
},
{
"path": "src/main/java/cn/cie/entity/Code.java",
"chars": 971,
"preview": "package cn.cie.entity;\n\n/**\n * 游戏激活码\n */\npublic class Code {\n\n /**\n * 未使用\n */\n public static final Byte ST"
},
{
"path": "src/main/java/cn/cie/entity/Game.java",
"chars": 1929,
"preview": "package cn.cie.entity;\n\nimport java.util.Date;\n\n/**\n * 游戏\n */\npublic class Game {\n\n /**\n * 未上架\n */\n public"
},
{
"path": "src/main/java/cn/cie/entity/Img.java",
"chars": 367,
"preview": "package cn.cie.entity;\n\n/**\n * 游戏图片\n */\npublic class Img {\n private Integer game;\n\n private String img;\n\n publi"
},
{
"path": "src/main/java/cn/cie/entity/Kind.java",
"chars": 345,
"preview": "package cn.cie.entity;\n\npublic class Kind {\n private Integer id;\n\n private String name;\n\n public Integer getId("
},
{
"path": "src/main/java/cn/cie/entity/Kindmapper.java",
"chars": 387,
"preview": "package cn.cie.entity;\n\n/**\n * 游戏和种类映射\n */\npublic class Kindmapper {\n private Integer game;\n\n private Integer kind"
},
{
"path": "src/main/java/cn/cie/entity/Order.java",
"chars": 1225,
"preview": "package cn.cie.entity;\n\nimport java.util.Date;\n\n/**\n * 订单\n */\npublic class Order {\n\n /**\n * 未支付\n */\n publi"
},
{
"path": "src/main/java/cn/cie/entity/Orderitem.java",
"chars": 1022,
"preview": "package cn.cie.entity;\n\nimport java.util.Date;\n\n/**\n * 订单详情\n */\npublic class Orderitem {\n private Integer id;\n\n pr"
},
{
"path": "src/main/java/cn/cie/entity/Ordermapper.java",
"chars": 397,
"preview": "package cn.cie.entity;\n\n/**\n * 订单-订单详情映射\n */\npublic class Ordermapper {\n private Integer order;\n\n private Integer "
},
{
"path": "src/main/java/cn/cie/entity/Tag.java",
"chars": 360,
"preview": "package cn.cie.entity;\n\n/**\n * 游戏标签\n */\npublic class Tag {\n private Integer id;\n\n private String name;\n\n public"
},
{
"path": "src/main/java/cn/cie/entity/Tagmapper.java",
"chars": 380,
"preview": "package cn.cie.entity;\n\n/**\n * 游戏游戏标签映射\n */\npublic class Tagmapper {\n private Integer game;\n\n private Integer tag;"
},
{
"path": "src/main/java/cn/cie/entity/Token.java",
"chars": 1379,
"preview": "package cn.cie.entity;\n\nimport java.util.Date;\n\n/**\n * token,用来标识一个用户\n */\npublic class Token {\n\n /**\n * 正常状态\n "
},
{
"path": "src/main/java/cn/cie/entity/User.java",
"chars": 2320,
"preview": "package cn.cie.entity;\n\nimport java.util.Date;\n\npublic class User {\n\n /**\n * 未验证,需要邮箱验证\n */\n public static"
},
{
"path": "src/main/java/cn/cie/entity/Validatecode.java",
"chars": 173,
"preview": "package cn.cie.entity;\n\n/**\n * 注册时发送到邮箱的验证码,用来验证用户邮箱\n */\npublic class Validatecode {\n\n /**\n * 验证码有效期,默认为10分钟\n "
},
{
"path": "src/main/java/cn/cie/entity/dto/GameDTO.java",
"chars": 2463,
"preview": "package cn.cie.entity.dto;\n\nimport cn.cie.entity.Game;\nimport cn.cie.entity.Kind;\nimport cn.cie.entity.Tag;\n\nimport java"
},
{
"path": "src/main/java/cn/cie/entity/dto/OrderDTO.java",
"chars": 1372,
"preview": "package cn.cie.entity.dto;\n\nimport cn.cie.entity.Order;\nimport cn.cie.entity.Orderitem;\n\nimport java.util.Date;\nimport j"
},
{
"path": "src/main/java/cn/cie/entity/dto/OrderItemDTO.java",
"chars": 1195,
"preview": "package cn.cie.entity.dto;\n\nimport cn.cie.entity.Code;\nimport cn.cie.entity.Game;\nimport cn.cie.entity.Orderitem;\n\nimpor"
},
{
"path": "src/main/java/cn/cie/event/EventConsumer.java",
"chars": 3692,
"preview": "package cn.cie.event;\n\nimport cn.cie.event.handler.EventHandler;\nimport cn.cie.utils.RedisUtil;\nimport org.apache.log4j."
},
{
"path": "src/main/java/cn/cie/event/EventModel.java",
"chars": 2004,
"preview": "package cn.cie.event;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\n/**\n * Created by RojerAlone on 2017/6/25.\n * 事件"
},
{
"path": "src/main/java/cn/cie/event/EventProducer.java",
"chars": 451,
"preview": "package cn.cie.event;\n\nimport cn.cie.utils.RedisUtil;\nimport org.springframework.beans.factory.annotation.Autowired;\nimp"
},
{
"path": "src/main/java/cn/cie/event/EventType.java",
"chars": 306,
"preview": "package cn.cie.event;\n\n/**\n * Created by RojerAlone on 2017/6/25.\n * 异步事件类型\n */\npublic enum EventType {\n\n SEND_VALIDA"
},
{
"path": "src/main/java/cn/cie/event/handler/EventHandler.java",
"chars": 388,
"preview": "package cn.cie.event.handler;\n\nimport cn.cie.event.EventModel;\nimport cn.cie.event.EventType;\n\nimport java.util.List;\n\n/"
},
{
"path": "src/main/java/cn/cie/event/handler/SendFindPwdMailHandler.java",
"chars": 604,
"preview": "package cn.cie.event.handler;\n\nimport cn.cie.event.EventModel;\nimport cn.cie.event.EventType;\nimport cn.cie.utils.MailUt"
},
{
"path": "src/main/java/cn/cie/event/handler/SendValidateMailHandler.java",
"chars": 609,
"preview": "package cn.cie.event.handler;\n\nimport cn.cie.event.EventModel;\nimport cn.cie.event.EventType;\nimport cn.cie.utils.MailUt"
},
{
"path": "src/main/java/cn/cie/exception/NotFoundException.java",
"chars": 403,
"preview": "package cn.cie.exception;\n\nimport cn.cie.utils.MsgCenter;\nimport org.springframework.http.HttpStatus;\nimport org.springf"
},
{
"path": "src/main/java/cn/cie/interceptor/AdminInterceptor.java",
"chars": 1258,
"preview": "package cn.cie.interceptor;\n\nimport cn.cie.utils.UserHolder;\nimport org.springframework.beans.factory.annotation.Autowir"
},
{
"path": "src/main/java/cn/cie/interceptor/AuthInterceptor.java",
"chars": 4286,
"preview": "package cn.cie.interceptor;\n\nimport cn.cie.entity.Token;\nimport cn.cie.entity.User;\nimport cn.cie.mapper.TokenMapper;\nim"
},
{
"path": "src/main/java/cn/cie/interceptor/LoginInterceptor.java",
"chars": 1226,
"preview": "package cn.cie.interceptor;\n\nimport cn.cie.utils.UserHolder;\nimport org.springframework.beans.factory.annotation.Autowir"
},
{
"path": "src/main/java/cn/cie/mapper/CodeMapper.java",
"chars": 178,
"preview": "package cn.cie.mapper;\n\nimport cn.cie.entity.Code;\n\npublic interface CodeMapper {\n\n int insert(Code record);\n\n Cod"
},
{
"path": "src/main/java/cn/cie/mapper/GameMapper.java",
"chars": 1115,
"preview": "package cn.cie.mapper;\n\nimport cn.cie.entity.Game;\nimport org.apache.ibatis.annotations.Param;\n\nimport java.util.List;\n\n"
},
{
"path": "src/main/java/cn/cie/mapper/ImgMapper.java",
"chars": 324,
"preview": "package cn.cie.mapper;\n\nimport cn.cie.entity.Img;\nimport org.apache.ibatis.annotations.Param;\n\nimport java.util.List;\n\np"
},
{
"path": "src/main/java/cn/cie/mapper/KindMapper.java",
"chars": 463,
"preview": "package cn.cie.mapper;\n\nimport cn.cie.entity.Kind;\nimport org.apache.ibatis.annotations.Param;\n\nimport java.util.List;\n\n"
},
{
"path": "src/main/java/cn/cie/mapper/KindmapperMapper.java",
"chars": 668,
"preview": "package cn.cie.mapper;\n\nimport cn.cie.entity.Kindmapper;\nimport org.apache.ibatis.annotations.Param;\n\nimport java.util.L"
},
{
"path": "src/main/java/cn/cie/mapper/OrderMapper.java",
"chars": 862,
"preview": "package cn.cie.mapper;\n\nimport cn.cie.entity.Order;\nimport org.apache.ibatis.annotations.Param;\n\nimport java.util.Date;\n"
},
{
"path": "src/main/java/cn/cie/mapper/OrderitemMapper.java",
"chars": 307,
"preview": "package cn.cie.mapper;\n\nimport cn.cie.entity.Orderitem;\nimport org.apache.ibatis.annotations.Param;\n\nimport java.util.Li"
},
{
"path": "src/main/java/cn/cie/mapper/OrdermapperMapper.java",
"chars": 234,
"preview": "package cn.cie.mapper;\n\nimport cn.cie.entity.Order;\nimport cn.cie.entity.Ordermapper;\n\nimport java.util.List;\n\npublic in"
},
{
"path": "src/main/java/cn/cie/mapper/TagMapper.java",
"chars": 390,
"preview": "package cn.cie.mapper;\n\nimport cn.cie.entity.Tag;\nimport org.apache.ibatis.annotations.Param;\n\nimport java.util.List;\n\np"
},
{
"path": "src/main/java/cn/cie/mapper/TagmapperMapper.java",
"chars": 368,
"preview": "package cn.cie.mapper;\n\nimport cn.cie.entity.Tagmapper;\nimport org.apache.ibatis.annotations.Param;\n\nimport java.util.Li"
},
{
"path": "src/main/java/cn/cie/mapper/TokenMapper.java",
"chars": 590,
"preview": "package cn.cie.mapper;\n\nimport cn.cie.entity.Token;\nimport org.apache.ibatis.annotations.Param;\n\nimport java.util.Date;\n"
},
{
"path": "src/main/java/cn/cie/mapper/UserMapper.java",
"chars": 538,
"preview": "package cn.cie.mapper;\n\nimport cn.cie.entity.User;\nimport org.apache.ibatis.annotations.Param;\n\nimport java.util.List;\n\n"
},
{
"path": "src/main/java/cn/cie/schedule/Scheduler.java",
"chars": 894,
"preview": "package cn.cie.schedule;\n\nimport cn.cie.services.OrderService;\nimport cn.cie.services.UserService;\nimport org.springfram"
},
{
"path": "src/main/java/cn/cie/services/AdminService.java",
"chars": 2178,
"preview": "package cn.cie.services;\n\nimport cn.cie.entity.Game;\nimport cn.cie.utils.Result;\nimport org.springframework.web.multipar"
},
{
"path": "src/main/java/cn/cie/services/GameService.java",
"chars": 912,
"preview": "package cn.cie.services;\n\nimport cn.cie.entity.dto.GameDTO;\nimport cn.cie.utils.Result;\n\nimport java.util.List;\n\n/**\n * "
},
{
"path": "src/main/java/cn/cie/services/KindService.java",
"chars": 578,
"preview": "package cn.cie.services;\n\nimport cn.cie.entity.Kind;\nimport cn.cie.entity.dto.GameDTO;\nimport cn.cie.utils.Result;\n\nimpo"
},
{
"path": "src/main/java/cn/cie/services/OrderService.java",
"chars": 1045,
"preview": "package cn.cie.services;\n\nimport cn.cie.utils.Result;\n\nimport java.util.List;\n\n/**\n * Created by RojerAlone on 2017/6/8."
},
{
"path": "src/main/java/cn/cie/services/TagService.java",
"chars": 940,
"preview": "package cn.cie.services;\n\nimport cn.cie.entity.Tag;\nimport cn.cie.entity.dto.GameDTO;\nimport cn.cie.utils.Result;\n\nimpor"
},
{
"path": "src/main/java/cn/cie/services/UserService.java",
"chars": 1535,
"preview": "package cn.cie.services;\n\nimport cn.cie.entity.User;\nimport cn.cie.utils.Result;\n\n/**\n * Created by RojerAlone on 2017/5"
},
{
"path": "src/main/java/cn/cie/services/impl/AdminServiceImpl.java",
"chars": 10226,
"preview": "package cn.cie.services.impl;\n\nimport cn.cie.entity.*;\nimport cn.cie.entity.dto.GameDTO;\nimport cn.cie.mapper.*;\nimport "
},
{
"path": "src/main/java/cn/cie/services/impl/GameServiceImpl.java",
"chars": 5512,
"preview": "package cn.cie.services.impl;\n\nimport cn.cie.entity.Game;\nimport cn.cie.entity.Kind;\nimport cn.cie.entity.Tag;\nimport cn"
},
{
"path": "src/main/java/cn/cie/services/impl/KindServiceImpl.java",
"chars": 3162,
"preview": "package cn.cie.services.impl;\n\nimport cn.cie.entity.Game;\nimport cn.cie.entity.Kind;\nimport cn.cie.entity.Tag;\nimport cn"
},
{
"path": "src/main/java/cn/cie/services/impl/OrderServiceImpl.java",
"chars": 6245,
"preview": "package cn.cie.services.impl;\n\nimport cn.cie.entity.*;\nimport cn.cie.entity.dto.OrderDTO;\nimport cn.cie.entity.dto.Order"
},
{
"path": "src/main/java/cn/cie/services/impl/TagServiceImpl.java",
"chars": 4154,
"preview": "package cn.cie.services.impl;\n\nimport cn.cie.entity.Game;\nimport cn.cie.entity.Tag;\nimport cn.cie.entity.Tagmapper;\nimpo"
},
{
"path": "src/main/java/cn/cie/services/impl/UserServiceImpl.java",
"chars": 11162,
"preview": "package cn.cie.services.impl;\n\nimport cn.cie.entity.Token;\nimport cn.cie.entity.User;\nimport cn.cie.event.EventModel;\nim"
},
{
"path": "src/main/java/cn/cie/utils/MailUtil.java",
"chars": 1649,
"preview": "package cn.cie.utils;\n\nimport org.apache.commons.mail.EmailException;\nimport org.apache.commons.mail.SimpleEmail;\n\n/**\n "
},
{
"path": "src/main/java/cn/cie/utils/MsgCenter.java",
"chars": 1748,
"preview": "package cn.cie.utils;\n\n/**\n * Created by RojerAlone on 2017/6/6.\n * 消息字典\n */\npublic class MsgCenter {\n\n public static"
},
{
"path": "src/main/java/cn/cie/utils/PageUtil.java",
"chars": 1866,
"preview": "package cn.cie.utils;\n\n/**\n * Created by RojerAlone on 2017/6/21.\n * 分页工具\n */\npublic class PageUtil {\n\n private int n"
},
{
"path": "src/main/java/cn/cie/utils/PasswordUtil.java",
"chars": 345,
"preview": "package cn.cie.utils;\n\nimport org.springframework.util.DigestUtils;\n\n/**\n * Created by RojerAlone on 2017/6/6.\n * 将密码进行M"
},
{
"path": "src/main/java/cn/cie/utils/RedisUtil.java",
"chars": 7872,
"preview": "package cn.cie.utils;\n\nimport com.alibaba.fastjson.JSON;\nimport org.springframework.beans.factory.InitializingBean;\nimpo"
},
{
"path": "src/main/java/cn/cie/utils/Result.java",
"chars": 1031,
"preview": "package cn.cie.utils;\n\n/**\n * Created by RojerAlone on 2017/6/6.\n * 后台接口返回结果,标识了是否成功、消息以及返回的数据\n */\npublic class Result<T"
},
{
"path": "src/main/java/cn/cie/utils/UserHolder.java",
"chars": 465,
"preview": "package cn.cie.utils;\n\nimport cn.cie.entity.User;\nimport org.springframework.stereotype.Component;\n\n/**\n * Created by Ro"
},
{
"path": "src/main/resources/dbdata.sql",
"chars": 18893,
"preview": "insert into `shop`.`game`(`creater`, `name`, `desc`, `systemcfg`, `price`) values\n ('Killerfish Games', 'Cold Waters', '"
},
{
"path": "src/main/resources/generator/generatorConfig.xml",
"chars": 4981,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE generatorConfiguration\n PUBLIC \"-//mybatis.org//DTD MyBatis Gene"
},
{
"path": "src/main/resources/jdbc.properties",
"chars": 254,
"preview": "jdbc.driver=com.mysql.jdbc.Driver\njdbc.url=jdbc:mysql://localhost:3306/shop?useUnicode=true&characterEncoding=utf8&useSS"
},
{
"path": "src/main/resources/log4j-acc.properties",
"chars": 418,
"preview": "log4j.rootLogger=INFO,LOGFILE\n\nlog4j.appender.LOGFILE = org.apache.log4j.RollingFileAppender\nlog4j.appender.LOGFILE.File"
},
{
"path": "src/main/resources/log4j-error.properties",
"chars": 372,
"preview": "log4j.rootLogger=ERROR,LOGFILE\n\nlog4j.appender.LOGFILE = org.apache.log4j.RollingFileAppender\nlog4j.appender.LOGFILE.Fil"
},
{
"path": "src/main/resources/mapper/CodeMapper.xml",
"chars": 1758,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/"
},
{
"path": "src/main/resources/mapper/GameMapper.xml",
"chars": 6079,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/"
},
{
"path": "src/main/resources/mapper/ImgMapper.xml",
"chars": 1276,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/"
},
{
"path": "src/main/resources/mapper/KindMapper.xml",
"chars": 2199,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/"
},
{
"path": "src/main/resources/mapper/KindmapperMapper.xml",
"chars": 2011,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/"
},
{
"path": "src/main/resources/mapper/OrderMapper.xml",
"chars": 2724,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/"
},
{
"path": "src/main/resources/mapper/OrderitemMapper.xml",
"chars": 2057,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/"
},
{
"path": "src/main/resources/mapper/OrdermapperMapper.xml",
"chars": 791,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/"
},
{
"path": "src/main/resources/mapper/TagMapper.xml",
"chars": 1699,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/"
},
{
"path": "src/main/resources/mapper/TagmapperMapper.xml",
"chars": 1214,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/"
},
{
"path": "src/main/resources/mapper/TokenMapper.xml",
"chars": 2704,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/"
},
{
"path": "src/main/resources/mapper/UserMapper.xml",
"chars": 3961,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/"
},
{
"path": "src/main/resources/mybatis-config.xml",
"chars": 674,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<!DOCTYPE configuration\n PUBLIC \"-//mybatis.org//DTD Config 3.0//EN\"\n "
},
{
"path": "src/main/resources/schema.sql",
"chars": 4510,
"preview": "CREATE DATABASE IF NOT EXISTS `shop` DEFAULT CHARACTER SET UTF8;\nCREATE TABLE IF NOT EXISTS `shop`.`user` (\n `id` INT N"
},
{
"path": "src/main/resources/spring-dao.xml",
"chars": 2340,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://www.springframework.org/schema/beans\"\n xmlns:xsi=\"http"
},
{
"path": "src/main/resources/spring-mvc.xml",
"chars": 2498,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://www.springframework.org/schema/beans\"\n xmlns:xsi=\"http"
},
{
"path": "src/main/resources/spring-service.xml",
"chars": 1295,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://www.springframework.org/schema/beans\"\n xmlns:xsi=\"http"
},
{
"path": "src/main/webapp/WEB-INF/css/adminlogin.css",
"chars": 8632,
"preview": "html {\n font-family: sans-serif;\n -ms-text-size-adjust: 100%;\n -webkit-text-size-adjust: 100%\n}\n\nbody {\n mar"
},
{
"path": "src/main/webapp/WEB-INF/css/adminpage.css",
"chars": 5432,
"preview": "@charset \"utf-8\";\n/* CSS Document */\nhtml, body, div, p, form, label, ul, li, dl, dt, dd, ol, img, button, h1, h2, h3, h"
},
{
"path": "src/main/webapp/WEB-INF/css/base.css",
"chars": 1151,
"preview": "@charset \"utf-8\";\n/* CSS Document */\n\nbody {\n background-color: #183F59;\n}\n\n.headheight {\n padding-top: 20px;\n "
},
{
"path": "src/main/webapp/WEB-INF/css/fenleixiangqing.css",
"chars": 1215,
"preview": ".clx {\n color: #FFF;\n font-size: 34px;\n font-family: \"Motiva Sans\", Sans-serif;\n}\n\n#fenleixiangqing {\n paddi"
},
{
"path": "src/main/webapp/WEB-INF/css/login.css",
"chars": 492,
"preview": "@charset \"utf-8\";\n/* CSS Document */\n.logowz {\n margin-right: 100px;\n margin-left: 350px;\n}\n\n.logoztdx {\n font-"
},
{
"path": "src/main/webapp/WEB-INF/css/order.css",
"chars": 477,
"preview": "@charset \"utf-8\";\n/* CSS Document */\n.container {\n width: 970px !important\n}\n\nbody {\n background-color: #183F59;\n}"
},
{
"path": "src/main/webapp/WEB-INF/css/personal.css",
"chars": 999,
"preview": "body {\n background-color: #1B2839;\n}\n\n.divcolor {\n background-image: url(/img/static/personalbackground_1.jpg);\n "
},
{
"path": "src/main/webapp/WEB-INF/css/regist.css",
"chars": 259,
"preview": "@charset \"utf-8\";\n/* CSS Document */\n.zczt {\n color: #c6d4df;\n margin-bottom: 20px;\n}\n\n.inputcolor {\n backgroun"
},
{
"path": "src/main/webapp/WEB-INF/css/sanji.css",
"chars": 1976,
"preview": "@charset \"utf-8\";\n/* CSS Document */\n\nbody {\n background-color: #183F59;\n}\n\n.headheight {\n padding-top: 20px;\n "
},
{
"path": "src/main/webapp/WEB-INF/css/self.css",
"chars": 4436,
"preview": "@charset \"utf-8\";\n/* CSS Document */\nbody {\n background-color: #183F59;\n}\n\n.headheight {\n padding-top: 20px;\n p"
},
{
"path": "src/main/webapp/WEB-INF/css/shoppingcart.css",
"chars": 1228,
"preview": "@charset \"utf-8\";\n/* CSS Document */\n\nbody {\n background-color: #1B2839;\n}\n\n.headheight {\n padding-top: 20px;\n}\n\n."
},
{
"path": "src/main/webapp/WEB-INF/js/adminlogin.js",
"chars": 378,
"preview": "function login() {\n var username = document.getElementById(\"username\").value;\n var password = document.getElementB"
},
{
"path": "src/main/webapp/WEB-INF/js/adminpage.js",
"chars": 30109,
"preview": "// JavaScript Document\n$(\n function () {\n // 获取用户信息\n var userInfo = document.getElementById(\"userInfo\")"
},
{
"path": "src/main/webapp/WEB-INF/js/biaoqian.js",
"chars": 721,
"preview": "$(\n function () {\n var ul = document.getElementById(\"leixing\");\n $.post(\"/kind/all\",\n functi"
},
{
"path": "src/main/webapp/WEB-INF/js/fenlei.js",
"chars": 4947,
"preview": "var url;\n$(\n function () {\n getgame(1);\n }\n);\n\nfunction getgame(page) {\n var ul = document.getElementByI"
},
{
"path": "src/main/webapp/WEB-INF/js/findpassword.js",
"chars": 1507,
"preview": "var wait;\n$(function () {\n wait = 0;\n time();\n})\n\nfunction schedule() {\n setTimeout(function () {\n time("
},
{
"path": "src/main/webapp/WEB-INF/js/fishjs/ane.js",
"chars": 1004,
"preview": "var aneObj = function () {\n this.rootx = [];\n this.headx = [];\n this.heady = [];\n this.amp = [];\n this.al"
},
{
"path": "src/main/webapp/WEB-INF/js/fishjs/baby.js",
"chars": 2236,
"preview": "var babyObj = function () {\n this.x;\n this.y;\n this.angle;\n this.babyBody = new Image();\n\n this.babyTailT"
},
{
"path": "src/main/webapp/WEB-INF/js/fishjs/background.js",
"chars": 78,
"preview": "function drawBackground(){\n ctx2.drawImage(bgPic,0,0,canWidth,canHeight);\n}"
},
{
"path": "src/main/webapp/WEB-INF/js/fishjs/collision.js",
"chars": 1030,
"preview": "//判断大鱼和果实的距离\nfunction momFruitsCollision() {\n if (!data.gameOver) {\n for (var i = 0; i < fruit.num; i++) {\n "
},
{
"path": "src/main/webapp/WEB-INF/js/fishjs/commonFunctions.js",
"chars": 2746,
"preview": "window.requestAnimFrame = (function () {\n return window.requestAnimationFrame || window.webkitRequestAnimationFrame |"
},
{
"path": "src/main/webapp/WEB-INF/js/fishjs/data.js",
"chars": 915,
"preview": "var dataObj = function () {\n this.fruitNum = 0;\n this.double = 1;\n this.score = 0;\n this.gameOver = false;\n "
},
{
"path": "src/main/webapp/WEB-INF/js/fishjs/dust.js",
"chars": 710,
"preview": "var dustObj = function () {\n this.x = [];\n this.y = [];\n this.amp = [];\n this.NO = [];\n this.alpha;\n}\ndus"
},
{
"path": "src/main/webapp/WEB-INF/js/fishjs/fruit.js",
"chars": 2309,
"preview": "var fruitObj = function () {\n this.alive = [];\n this.x = [];\n this.y = [];\n this.l = [];\n this.spd = [];\n"
},
{
"path": "src/main/webapp/WEB-INF/js/fishjs/halo.js",
"chars": 1245,
"preview": "var haloObj = function () {\n this.x = [];\n this.y = [];\n this.alive = [];\n this.r = [];\n}\nhaloObj.prototype."
},
{
"path": "src/main/webapp/WEB-INF/js/fishjs/main.js",
"chars": 3233,
"preview": "var can1;\nvar can2;\n\nvar canWidth;\nvar canHeight;\n\nvar ctx1;\nvar ctx2;\n\nvar lastTime;\nvar deltaTime;\n\nvar bgPic = new Im"
},
{
"path": "src/main/webapp/WEB-INF/js/fishjs/mom.js",
"chars": 1949,
"preview": "var momObj = function () {\n this.x;\n this.y;\n this.angle;\n\n this.momTailTimer = 0;\n this.momTailcount = 0"
},
{
"path": "src/main/webapp/WEB-INF/js/fishjs/wave.js",
"chars": 1208,
"preview": "var waveObj = function () {\n this.x = [];\n this.y = [];\n this.alive = [];\n this.r = [];\n}\nwaveObj.prototype."
},
{
"path": "src/main/webapp/WEB-INF/js/index.js",
"chars": 6481,
"preview": "$(\n function () {\n var j = 1;\n $.post(\"/everyday\", function (result) {\n for (i = 0; i < 5; i"
},
{
"path": "src/main/webapp/WEB-INF/js/login.js",
"chars": 639,
"preview": "function login() {\n var name = document.getElementById(\"name\").value;\n var password = document.getElementById(\"pas"
},
{
"path": "src/main/webapp/WEB-INF/js/order.js",
"chars": 13111,
"preview": "$(\n function () {\n getpaid(1);\n getcancel(1);\n getnotpay(1);\n }\n)\nfunction getpaid(pagenum) {"
},
{
"path": "src/main/webapp/WEB-INF/js/personal.js",
"chars": 2070,
"preview": "$(\n function () {\n $.post(\"/user/personal\", function (result) {\n document.getElementById(\"userinfo_"
},
{
"path": "src/main/webapp/WEB-INF/js/regist.js",
"chars": 1743,
"preview": "var wait;\n$(function () {\n wait = 0;\n time();\n})\n\nfunction schedule() {\n setTimeout(function () {\n time("
},
{
"path": "src/main/webapp/WEB-INF/js/sanji.js",
"chars": 6610,
"preview": "// JavaScript Document\nvar url;\nvar ggid;\n$(\n function () {\n var loc = location.href;\n var n4 = loc.ind"
},
{
"path": "src/main/webapp/WEB-INF/js/search.js",
"chars": 3471,
"preview": "$(\n function () {\n var prtW = window.opener;\n var info = prtW.document.getElementById(\"searchbox\").valu"
},
{
"path": "src/main/webapp/WEB-INF/js/shoppingcart.js",
"chars": 1853,
"preview": "$(\n function () {\n var spcar = document.getElementById(\"spcar\");\n var i = JSON.parse(localStorage.getIt"
},
{
"path": "src/main/webapp/WEB-INF/js/top.js",
"chars": 493,
"preview": "function outlogin() {\n $.post(\"/logout\", function (result) {\n if (result.success) {\n locati"
},
{
"path": "src/main/webapp/WEB-INF/js/updateUserInfo.js",
"chars": 860,
"preview": "$.post(\"/user/personal\", function (result) {\n document.getElementById(\"userInfo_0\").value = result.data.nickname;\n "
},
{
"path": "src/main/webapp/WEB-INF/js/updatepassword.js",
"chars": 515,
"preview": "function updatepassword() {\n var password = document.getElementById(\"newpassword\").value;\n var password_1 = docume"
},
{
"path": "src/main/webapp/WEB-INF/jsp/adminlogin.jsp",
"chars": 682,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n<head>\n <title>后台管理登陆</title>\n <link rel="
},
{
"path": "src/main/webapp/WEB-INF/jsp/adminpage.jsp",
"chars": 8844,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n<head>\n <title>Weplay后台管理系统</title>\n <lin"
},
{
"path": "src/main/webapp/WEB-INF/jsp/checkemail.jsp",
"chars": 2798,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n<head>\n <%@ include file=\"common/head.jsp\" %"
},
{
"path": "src/main/webapp/WEB-INF/jsp/common/bottom.jsp",
"chars": 442,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<footer class=\"footer\" style=\"margin-top: 180px;\">\n "
},
{
"path": "src/main/webapp/WEB-INF/jsp/common/head.jsp",
"chars": 885,
"preview": "<!DOCTYPE html>\n<meta charset=\"UTF-8\">\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\">\n<meta name=\"viewport\" conte"
},
{
"path": "src/main/webapp/WEB-INF/jsp/common/top.jsp",
"chars": 1855,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" isELIgnored=\"false\" %>\n<%@ taglib prefix=\"c\" uri=\"http://"
},
{
"path": "src/main/webapp/WEB-INF/jsp/error/ErrorCode400.jsp",
"chars": 310,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n<head>\n <%@ include file=\"../common/head.jsp"
},
{
"path": "src/main/webapp/WEB-INF/jsp/error/ErrorCode404.jsp",
"chars": 481,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n<head>\n <%@ include file=\"../common/head.jsp"
},
{
"path": "src/main/webapp/WEB-INF/jsp/error/ErrorCode500.jsp",
"chars": 332,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n<head>\n <%@ include file=\"../common/head.jsp"
},
{
"path": "src/main/webapp/WEB-INF/jsp/findpassword.jsp",
"chars": 2878,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n<head>\n <%@ include file=\"common/head.jsp\" %"
},
{
"path": "src/main/webapp/WEB-INF/jsp/fishjs.jsp",
"chars": 830,
"preview": "<!DOCTYPE html>\n<script type=\"text/javascript\" src=\"/js/fishjs/main.js\"></script>\n<script type=\"text/javascript\" src=\"/j"
},
{
"path": "src/main/webapp/WEB-INF/jsp/gameInfo.jsp",
"chars": 6897,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n<head>\n <%@ include file=\"common/head.jsp\" %"
},
{
"path": "src/main/webapp/WEB-INF/jsp/index.jsp",
"chars": 6626,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" isELIgnored=\"false\" %>\n<%@ taglib prefix=\"c\" uri=\"http://"
},
{
"path": "src/main/webapp/WEB-INF/jsp/kinds.jsp",
"chars": 1418,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" isELIgnored=\"false\" %>\n<%@ taglib prefix=\"c\" uri=\"http://"
},
{
"path": "src/main/webapp/WEB-INF/jsp/login.jsp",
"chars": 2036,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n<head>\n <%@ include file=\"common/head.jsp\" %"
},
{
"path": "src/main/webapp/WEB-INF/jsp/order.jsp",
"chars": 2214,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n\n<head>\n <%@ include file=\"common/head.jsp\" "
},
{
"path": "src/main/webapp/WEB-INF/jsp/order_1.jsp",
"chars": 4435,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" isELIgnored=\"false\" %>\n<html>\n<head>\n <%@ include fil"
},
{
"path": "src/main/webapp/WEB-INF/jsp/order_2.jsp",
"chars": 2234,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" isELIgnored=\"false\" %>\n<html xmlns=\"http://www.w3.org/199"
},
{
"path": "src/main/webapp/WEB-INF/jsp/personal.jsp",
"chars": 2035,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n<head>\n <%@ include file=\"common/head.jsp\" %"
},
{
"path": "src/main/webapp/WEB-INF/jsp/register.jsp",
"chars": 2951,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n<head>\n <%@ include file=\"common/head.jsp\" %"
},
{
"path": "src/main/webapp/WEB-INF/jsp/search.jsp",
"chars": 1422,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" isELIgnored=\"false\" %>\n<%@ taglib prefix=\"c\" uri=\"http://"
},
{
"path": "src/main/webapp/WEB-INF/jsp/shoppingcart.jsp",
"chars": 2438,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n<head>\n <%@ include file=\"common/head.jsp\" %"
},
{
"path": "src/main/webapp/WEB-INF/jsp/taggames.jsp",
"chars": 1287,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" isELIgnored=\"false\" %>\n<%@ taglib prefix=\"c\" uri=\"http://"
},
{
"path": "src/main/webapp/WEB-INF/jsp/updateUserInfo.jsp",
"chars": 1554,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n\n<head>\n <%@ include file=\"common/head.jsp\" "
},
{
"path": "src/main/webapp/WEB-INF/jsp/updatepassword.jsp",
"chars": 2252,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n<head>\n <%@ include file=\"common/head.jsp\" %"
},
{
"path": "src/main/webapp/WEB-INF/jsp/validate.jsp",
"chars": 2381,
"preview": "<%@ page contentType=\"text/html;charset=UTF-8\" language=\"java\" %>\n<html>\n<head>\n <%@ include file=\"common/head.jsp\" %"
},
{
"path": "src/main/webapp/WEB-INF/web.xml",
"chars": 1706,
"preview": "<!DOCTYPE web-app PUBLIC\n \"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN\"\n \"http://java.sun.com/d"
},
{
"path": "src/test/java/cn/cie/common/CommonTest.java",
"chars": 2917,
"preview": "package cn.cie.common;\n\nimport cn.cie.event.EventModel;\nimport cn.cie.event.EventType;\nimport com.alibaba.fastjson.JSON;"
},
{
"path": "src/test/java/cn/cie/mapper/GameMapperTest.java",
"chars": 842,
"preview": "package cn.cie.mapper;\n\nimport cn.cie.entity.Game;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.sl"
},
{
"path": "src/test/java/cn/cie/mapper/KindmapperMapperTest.java",
"chars": 1464,
"preview": "package cn.cie.mapper;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.slf4j.Logger;\nimport org.slf4"
},
{
"path": "src/test/java/cn/cie/mapper/UserMapperTest.java",
"chars": 816,
"preview": "package cn.cie.mapper;\n\nimport cn.cie.entity.User;\nimport org.apache.log4j.Logger;\nimport org.junit.Test;\nimport org.jun"
},
{
"path": "src/test/java/cn/cie/services/KindServiceTest.java",
"chars": 1259,
"preview": "package cn.cie.services;\n\nimport cn.cie.utils.Result;\nimport cn.cie.entity.dto.GameDTO;\nimport org.junit.Test;\nimport or"
},
{
"path": "src/test/java/cn/cie/services/UserServiceTest.java",
"chars": 2473,
"preview": "package cn.cie.services;\n\nimport cn.cie.mapper.UserMapper;\nimport cn.cie.utils.Result;\nimport cn.cie.entity.User;\nimport"
},
{
"path": "src/test/java/cn/cie/utils/RedisUtilTest.java",
"chars": 1783,
"preview": "package cn.cie.utils;\n\nimport cn.cie.entity.User;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.slf"
}
]
About this extraction
This page contains the full source code of the RojerAlone/shop GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 167 files (422.6 KB), approximately 118.6k tokens, and a symbol index with 671 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.