更新开源4.1版本

This commit is contained in:
evoxwht 2021-07-13 16:49:21 +08:00
parent 19bdb3ac84
commit 9e8bd7f814
9093 changed files with 307334 additions and 199853 deletions

13
.gitignore vendored
View File

@ -1,8 +1,9 @@
# Windows thumbnail cache files
/.idea
/.vscode
*.log
/.env
**/*.pid
runtime/
public/install/install.lock
.constant
.env
public/.htaccess
public/uploads/
install.lock
public/uploads
remarks.txt

759
LICENSE
View File

@ -1,165 +1,674 @@
GNU LESSER GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
0. Additional Definitions.
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.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
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.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
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.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
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.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
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.
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
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.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
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.
1. Exception to Section 3 of the GNU GPL.
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.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
The precise terms and conditions for copying, distribution and
modification follow.
2. Conveying Modified Versions.
TERMS AND CONDITIONS
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
0. Definitions.
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
"This License" refers to version 3 of the GNU General Public License.
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
3. Object Code Incorporating Material from Library Header Files.
"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.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
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) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
A "covered work" means either the unmodified Program or a work based
on the Program.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
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.
4. Combined Works.
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.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
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.
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
1. Source Code.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
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.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
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.
d) Do one of the following:
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.
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
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.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
The Corresponding Source for a work in source code form is that
same work.
5. Combined Libraries.
2. Basic Permissions.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
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.
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
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.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
6. Revised Versions of the GNU Lesser General Public License.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser 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.
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.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
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.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
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 <https://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:
<program> Copyright (C) <2017> <西安众邦网络科技有限公司>
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
<https://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
<https://www.gnu.org/licenses/why-not-lgpl.html>.

375
README.md
View File

@ -1,199 +1,274 @@
<p align="center">
<p align="center" >
<img src="https://images.gitee.com/uploads/images/2018/1214/151026_2299df23_892944.gif" />
</p>
<h2 align="center"> CRMEB客户管理+电商营销系统v4开源版</h2>
<h1 align="center"> CRMEB客户管理+电商营销系统</h1>
<p align="center">
<a href="http://www.crmeb.com">
<img src="https://img.shields.io/badge/OfficialWebsite-CRMEB-yellow.svg" />
</a>
<a href="http://www.crmeb.com">
<img src="https://img.shields.io/badge/Licence-LGPL3.0-green.svg?style=flat" />
<img src="https://img.shields.io/badge/Licence-GPL3.0-green.svg?style=flat" />
</a>
<a href="http://www.crmeb.com">
<img src="https://img.shields.io/badge/Edition-4.0-blue.svg" />
<img src="https://img.shields.io/badge/Edition-4.1-blue.svg" />
</a>
<a href="https://gitee.com/ZhongBangKeJi/CRMEB/repository/archive/master.zip">
<img src="https://img.shields.io/badge/download-180m-red.svg" />
<img src="https://img.shields.io/badge/download-80m-red.svg" />
</a>
</p>
<p align="center">
<b>如果对您有帮助,您可以点右上角 "Star" 支持一下 谢谢!</b>
<b>喜欢的话就点右上角 "Star" 支持一下吧,下次就不会迷路了,谢谢!</b>
</p>
<p align="center">
<img src="https://images.gitee.com/uploads/images/2021/0125/103649_af3113ca_1491977.png" />
</p>
## 导航栏目
================================================================
[使用手册](https://help.crmeb.net)
| [论坛地址](http://bbs.crmeb.net)
| [官网地址](https://www.crmeb.com)
## 项目介绍
码云开源项目php语言排名第一的开源GVP项目感谢码云提供的平台
CRMEB就是客户关系管理+营销电商系统CRMEB打通版系统实现公众号端、微信小程序端、H5端、PC端用户账号同步能够快速积累客户、会员数据分析、智能转化客户、有效提高销售、会员维护、网络营销的一款企业应用包含商城、拼团、砍价、秒杀、优惠券、积分、分销、客服等功能。我们历经4年时间精心研发让更多企业快速实现公域流量转私有流量让企业经营更简单CRMEB系统赋能更多技术帮助中小企业实现互联网转型发展减少重复造轮子。我们系统目前服务了几十万家企业覆盖全球各地被多所知名大学作为教学课件荣获“2020年度开源中国最具价值开源项目”“2021年度TOP20优秀Gitee组织”奖当然最宝贵的是收获大量用户/企业的认可和支持,感谢大家!!!
系统采用TP6+uni-app+iview核心技术十几个开发交流群论坛交流全面系统文档专业技术服务团队让您二开/运营无忧。
努力成为你的最爱,还有什么不满意的请留下您宝贵的建议[点击留言](https://gitee.com/ZhongBangKeJi/CRMEB#%E7%89%88%E6%9D%83%E4%BF%A1%E6%81%AF)
- - -
:fa-th-list: [导航](https://gitee.com/ZhongBangKeJi/CRMEB)
| [系统功能](https://gitee.com/ZhongBangKeJi/CRMEB#%E7%B3%BB%E7%BB%9F%E5%8A%9F%E8%83%BD)
| [系统演示](https://gitee.com/ZhongBangKeJi/CRMEB#%E7%B3%BB%E7%BB%9F%E6%BC%94%E7%A4%BA)
| [程序下载](https://gitee.com/ZhongBangKeJi/CRMEB#%E7%A8%8B%E5%BA%8F%E4%B8%8B%E8%BD%BD)
| [使用手册](https://help.crmeb.net/crmeb-v4/1863402)
| [二开手册](https://gitee.com/ZhongBangKeJi/CRMEB/wikis/%E5%BA%8F%E8%A8%80?sort_id=4100490)
| [论坛地址](http://q.crmeb.net)
| [TP6开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content)
| [推荐服务器配置](https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=dligum2z)
| [二开文档](https://gitee.com/ZhongBangKeJi/CRMEB-Min/wikis)
| [推荐服务器](https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=dligum2z)
| [评论](https://gitee.com/ZhongBangKeJi/CRMEB#%E7%89%88%E6%9D%83%E4%BF%A1%E6%81%AF)
- - -
================================================================
## 经典老版
## 项目介绍
CRMEB v3.2.9 版本的请访问https://gitee.com/ZhongBangKeJi/CRMEB/tree/v3.2.9/
~~~
//喜欢v3.2.9的朋友下载方式
CRMEB Min是CRMEB品牌全新推出的一款轻量级、高性能、前后端分离的开源电商系统完善的后台权限管理、会员管理、订单管理、产品管理、CMS管理、多端管理、页面DIY、数据统计、系统配置、组合数据管理、日志管理、数据库管理一键开通短信、产品采集、物流查询等接口系统采用TP6+Mysql+Uniapp+iView+Redis+workerman+form-builder等最流行热门的技术支持队列、PHP快速生成表单、长链接、定时任务、事件订阅、图表统计、表格导出、自动接口文档完善的使用文档、接口文档和二开文档十几个开发交流群CRMEB Min是您学习交流和二开项目开发的不二选择。
CRMEB赋能开发者助力企业发展
git clone -b v3.2.9 https://gitee.com/ZhongBangKeJi/CRMEB.git
~~~
## 页面展示图
## 技术亮点
~~~
1.自主研发独立客服系统;
2.管理端页面使用iviewUI开发
3.PHPExcel数据导出,导出表格更加美观,可视;
4.EasyWeChat部署微信开发,微信接入更加快捷,简单;
5.使用强大的workerman实现定时任务和长连接
6.内置强大灵活的权限管理,可以控制到每一个菜单;
7.内置组合数据,系统配置,管理碎片化数据;
8.客户端完善的交互效果和动画;
9.对接公众号和小程序,并且数据同步;
10.后台应用form-builder PHP快速生成现代化表单
11.高频数据缓存支持高并发;
12.数据备份和恢复让数据更安全;
13.Restful标准接口、前后端分离内部预留钩子,二次开发更方便;
14.长连接减少CPU及内存使用及网络堵塞减少请求响应时长
15.支持队列降低流量高峰,解除耦合,高可用;
16.一键安装自动检查系统环境一键安装;
17.移动端使用uni-app进行开发方便编译成各种格式的代码
~~~
![演示1](https://images.gitee.com/uploads/images/2020/1230/162518_97b85596_892944.jpeg "11")
![演示2](https://images.gitee.com/uploads/images/2020/1230/162554_62736ab6_892944.jpeg "页面展示_02.jpg")
![演示3](https://images.gitee.com/uploads/images/2020/1230/162613_8aebb26f_892944.jpeg "页面展示_03.jpg")
![演示4](https://images.gitee.com/uploads/images/2020/1230/162640_6b82fcf4_892944.jpeg "开源版_01.jpg")
![演示5](https://images.gitee.com/uploads/images/2020/1230/162703_5aa76d04_892944.jpeg "开源版_02.jpg")
![演示6](https://images.gitee.com/uploads/images/2020/1230/162716_a285935c_892944.png "houtaishouye.png")
![演示7](https://images.gitee.com/uploads/images/2020/1230/162840_4f4ed1f8_892944.png "houtaiyemiansheji.png")
## QQ群 CRMEB微信开发11群 (824195682)
## 推荐服务器(虚拟空间不支持)
阿里云领取2000元代金劵[<a href="https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=dligum2z">https://www.aliyun.com</a>]
<table><tr><td>
入门级配置
```
CPU1核
内存2G
实例规格ECS共享型 n4
带宽1M
系统CentOS 7.4 64位(推荐)
价格79.6元/年 226.5元/三年
```
<a href="https://www.aliyun.com/activity/new?spm=5176.23165873.J_5244793720.1.6d3a5420ptDH93&userCode=dligum2z">学生6.6/月</a>
</td>
<td>
标准级配置
```
CPU2核
内存4G
实例规格突发性能t5实例
带宽5M
系统CentOS 7.4 64位(推荐)
价格936元/年 2386.8元/三年
```
<a href="https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=dligum2z">新用户半价</a>
</td>
<td>
企业级配置
```
CPU4核
内存8G
实例规格突发性能t6实例
带宽5M
系统CentOS 7.4 64位(推荐)
价格2786.64元/年 5389.20元/三年
```
<a href="https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=dligum2z">领取¥2000红包</a>
</td>
</tr></table>
服务器环境推荐要求
* Nignx
* PHP 7.1 ~ 7.3
* MySQL 5.7
* Redis
推荐使用bt宝塔面板简单易用。
服务器推荐阿里云ecs或腾讯云cvm 云服务器。
## 系统说明
系统功能https://help.crmeb.net/crmeb-v4/1863404
系统脑图https://help.crmeb.net/crmeb-v4/1863405
目录结构https://help.crmeb.net/crmeb-v4/2034387
数据字典https://help.crmeb.net/crmeb-v4/1863569
后端接口http://bbs.crmeb.net/doc/datongadminapi.html
前端接口http://bbs.crmeb.net/doc/datongapi.html
安装教程https://help.crmeb.net/crmeb-v4/1876709
二开教程https://www.bilibili.com/video/BV1GX4y1T7Wd
二开文档https://gitee.com/ZhongBangKeJi/CRMEB-Min/wikis/%E5%BA%8F%E8%A8%80?sort_id=3303670
## 技术交流
#### 技术交流社区https://q.crmeb.net
#### CRMEB微信开发10群8623167583000人群可加
## 页面展示
![输入图片说明](readme/images/1主图.jpg)
![输入图片说明](readme/images/2首页.jpg)
![输入图片说明](readme/images/3可视化.jpg)
![输入图片说明](readme/images/4商品.jpg)
![输入图片说明](readme/images/5订单.jpg)
![输入图片说明](readme/images/6用户.jpg)
![输入图片说明](readme/images/7分销.jpg)
![输入图片说明](readme/images/8客服.jpg)
![输入图片说明](readme/images/9砍价.jpg)
![输入图片说明](readme/images/10拼团.jpg)
![输入图片说明](readme/images/11秒杀.jpg)
![输入图片说明](readme/images/12签到.jpg)
![输入图片说明](readme/images/13余额.jpg)
![输入图片说明](readme/images/14积分.jpg)
![输入图片说明](readme/images/15优惠券.jpg)
![输入图片说明](readme/images/16后台管理.jpg)
![输入图片说明](readme/images/17后台管理.jpg)
![输入图片说明](readme/images/18模版.jpg)
![输入图片说明](readme/images/19奖项.jpg)
## 系统演示
![前端演示](https://images.gitee.com/uploads/images/2020/1103/161837_52d08017_1491977.png "屏幕截图.png")
![输入图片说明](readme/images/20公众号.jpg)
min演示站 http://demomin.crmeb.net/admin 账号demo 密码crmeb.com
演示站: http://v4.crmeb.net/admin
## 主要特性
账号demo
### 开源无加密
源码开源无加密,有详细的代码注释,有完整系统手册
### 系统框架
使用最新的 ThinkPHP6.0 + Mysql + iview + uni-app + Redis + workerman
### 标准接口
标准接口、前后端分离,二次开发更方便
### 支持队列
降低流量高峰,解除耦合,高可用
### 长连接
减少CPU及内存使用及网络堵塞减少请求响应时长
### 无缝事件机制
行为扩展更方便,方便二次开发
### 后台快速生成表单
后台应用form-builder 无需写页面快速增删改查
### 数据表格导出
PHPExcel数据导出,导出表格更加美观可视;
### 强大的后台权限管理
后台多种角色、多重身份权限管理,权限可以控制到每一步操作,每个按钮都可以控制权限
密码crmeb.com
## 安装
一、一键安装
## 程序下载
上传你的代码,站点入口目录设置/public
在浏览器中输入你的域名或IP例如www.crmeb.com,
安装程序会自动执行安装。
期间系统会提醒你输入数据库信息以完成安装安装完成后建议删除install目录下index.php文件或将其改名。
后台访问地址:
1.域名/admin
2.域名/index.php/admin
3.域名/index.php?s=/admin
公众号和H5首页访问地址
1.域名/
提示:正常访问是第一中模式,第一种访问不了请检测[URL重写](http://help.crmeb.net/895486)是否配置好
安装过程中请牢记您的账号密码!
重新安装
1. 清除数据库
2. 删除/public/install/install.lock 文件
二、 手动安装
1.创建数据库,倒入数据库文件
数据库文件目录/public/install/crmeb.sql
2.修改数据库连接文件
配置文件路径/.env
~~~
APP_DEBUG = true
[APP]
DEFAULT_TIMEZONE = Asia/Shanghai
[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1 #数据库连接地址
DATABASE = test #数据库名称
USERNAME = username #数据库登录账号
PASSWORD = password #数据库登录密码
HOSTPORT = 3306 #数据库端口
CHARSET = utf8
DEBUG = true
[LANG]
default_lang = zh-cn
[REDIS]
REDIS_HOSTNAME = 127.0.0.1 # redis链接地址
PORT = 6379 #端口号
REDIS_PASSWORD = 123456 #密码
SELECT = 0 #数据库
~~~
3.修改目录权限linux系统777
/public
/runtime
4.后台登录:
http://域名/admin
默认账号admin 密码crmeb.com
三、URLOS一键安装
[URLOS一键安装文档](https://gitee.com/ZhongBangKeJi/CRMEB-Min/wikis/URLOS%E4%B8%80%E9%94%AE%E5%AE%89%E8%A3%85?sort_id=3418661)
## 定时任务
在自动收货,库存预警等功能使用到
```sh
php think timer [ status ] [ --d ]
```
参数
- status: 状态
- start: 启动
- stop: 关闭
- restart: 重启
- --d : 后台执行
## 长连接服务
在h5聊天,后台管理员消息通知等功能使用到
```sh
php think workerman [ status ] [ server ] [ --d ]
老版本v3.2.9 下载(功能全,后台非前后端分离,适合二开)
git clone -b v3.2.9 https://gitee.com/ZhongBangKeJi/CRMEB.git
新版v4.1.0 下载(当前开源版功能全,前后台分离版,适合二开)
git clone https://gitee.com/ZhongBangKeJi/CRMEB.git
精简版Min下载(基础商城框架,适合精简需求的客户,适合二开)
git clone https://gitee.com/ZhongBangKeJi/CRMEB-Min.git
```
windows环境下需要分三步执行
```sh
# 后台管理员通知
php think workerman start admin
```
参数
- status: 状态
- start: 启动
- stop: 关闭
- restart: 重启
- server: 服务 (windows)
- admin: 后台消息提醒
## 相关项目
- --d : 后台执行
JAVA版商城https://gitee.com/ZhongBangKeJi/crmeb_java
## 使用文档
CRMEB商城JAVA版SpringBoot + Maven + Swagger + Mybatis Plus + Redis + Uniapp +Vue+elementUI 包含移动端、小程序、PC后台、Api接口有产品、用户、购物车、订单、积分、优惠券、营销、余额、权限、角色、系统设置、组合数据、可拖拉拽的form表单等模块大量的减少了二开的成本。
[使用手册](https://help.crmeb.net/crmeb-v4/1863402)
知识付费https://gitee.com/ZhongBangKeJi/crmeb_zzff_class
## 开发文档
CRMEB知识付费系统是基于ThinkPhp5.0+Vue开发的全开源知识付费系统。功能包含直播课堂、付费视频、付费音频、付费阅读、会员系统、课程分销、课程拼团、直播带货、直播打赏、商城系统等。能够快速积学员、学员数据分析、智能转化客户、有效提高销售、吸引流量、网络营销、品牌推广的一款应用且更适合企业二次开发
请参阅 [CRMEB v4开发文档](https://gitee.com/ZhongBangKeJi/CRMEB-Min/wikis/SUMMARY?sort_id=3303636) [TP6开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content)
form-builder : https://github.com/xaboy/form-builder
tp PHP表单生成器快速生成现代化的form表单。包含复选框、单选框、输入框、下拉选择框等元素以及,省市区三级联动,时间选择,日期选择,颜色选择,文件/图片上传等功能。
CRMEB Min版商城https://gitee.com/ZhongBangKeJi/CRMEB-Min
CRMEB Min是一款轻量级、高性能开源电商商城系统采用TP6+Mysql+Uniapp+iView+Redis等最流行热门技术语言支持队列、表单生成、长链接、定时任务等完善的权限管理、会员管理、产品订单管理、CMS管理、支持多端、一键开通短信、产品采集、物流查询等接口。快速简单高效
## 联系我们
![有问题联系CRMEB官方客服](https://images.gitee.com/uploads/images/2020/1128/154416_441805ca_1491977.png "屏幕截图.png")
官方网站http://www.crmeb.com
交流社区https://q.crmeb.net
## 特别鸣谢
排名不分先后感谢这些软件的开发者thinkphp、iview、vue、mysql、redis、uniapp、echarts、tree-table-vue、swiper、form-create等如有遗漏请联系我
## 参与开发
感谢大神们提交代码(排名不分先后)
### @yizhisamoye@bys1123@xaboy@youngxj0@jacklincheung@392256866
欢迎反馈问题 [反馈问题](https://gitee.com/ZhongBangKeJi/CRMEB/issues)。
欢迎提交代码 [提交代码](https://gitee.com/ZhongBangKeJi/CRMEB/pulls)。
## 开源版使用须知
1.允许用于个人学习、毕业设计、教学案例、公益事业;
2.如果商用必须保留版权信息,请自觉遵守;
3.禁止将本项目的代码和资源进行任何形式的出售,产生的一切任何后果责任由侵权者自负。
## 版权信息
本项目包含的第三方源码和二进制文件之版权信息另行标注。
版权所有Copyright © 2017-2021 by CRMEB (http://www.crmeb.com)
@ -202,6 +277,4 @@ All rights reserved。
CRMEB® 商标和著作权所有者为西安众邦网络科技有限公司。
## 评论
欢迎大家参与评论有问题或者bug请 issues参与开发请 Pull Requests,谢谢大家的支持!
[返回顶部 :fa-arrow-circle-up: ](https://gitee.com/ZhongBangKeJi/CRMEB#%E9%A1%B9%E7%9B%AE%E4%BB%8B%E7%BB%8D)

3
crmeb/.constant Normal file
View File

@ -0,0 +1,3 @@
<?php
define('INSTALL_DATE',1567993973);
define('SERIALNUMBER','BaoWxF');

1
crmeb/.env Executable file
View File

@ -0,0 +1 @@
APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = HOSTPORT = USERNAME = PASSWORD = DATABASE = PREFIX = CHARSET = utf8 DEBUG = true [LANG] default_lang = zh-cn [REDIS] REDIS_HOSTNAME = PORT = REDIS_PASSWORD = SELECT = [QUEUE] QUEUE_NAME =

8
crmeb/.htaccess Normal file
View File

@ -0,0 +1,8 @@
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

2
crmeb/.version Normal file
View File

@ -0,0 +1,2 @@
version=CRMEB-KY-v4.1.0
version_code=410

33
crmeb/LICENSE.txt Normal file
View File

@ -0,0 +1,33 @@
版权所有 (c)2017-2027西安众邦网络科技有限公司 保留所有权利。
感谢您选择CrmEb开源客户管理+电商系统简称CRMEBCRMEB是国内最稳定、最强大、最先进的互联网电商平台解决方案之一CRMEB基于 PHP + MySQL 的技术采用ThinkPHP5.0框架开发。
为了使你正确并合法的使用本软件,请你在使用前务必阅读清楚下面的协议条款:
本授权协议适用且仅适用于CRMEB任何版本CRMEB官方对本授权协议的最终解释权和修改权。
一、协议许可的权利
1、您可以在完全遵守本最终用户授权协议的基础上将本软件应用于非商业用途而不必支付软件版权授权费用。
2、您可以在协议规定的约束和限制范围内修改 CRMEB 源代码或界面风格以适应您的网站要求。
3、您拥有使用本软件构建的网站全部内容所有权并独立承担与这些内容的相关法律义务。
4、获得商业授权之后您可以将本软件应用于商业用途同时依据所购买的授权类型中确定的技术支持内容。商业授权用户享有反映和提出意见的权力相关意见将被作为首要考虑但没有一定被采纳的承诺或保证。
二、协议许可的权利和限制
1、未获商业授权之前不得删除网站底部及相应的官方版权信息和链接。购买商业授权请联系西安众邦网络科技有限公司了解最新说明。CRMEB著作权已在中华人民共和国国家版权局注册(中国国家版权局著作权登记号 2018SR024463),著作权受到法律和国际公约保护。
2、未经官方许可不得对本软件或与之关联的商业授权进行出租、出售、抵押或发放子许可证。
3、不管你的网站是否整体使用 CRMEB ,还是部份栏目使用 CRMEB在你使用了 CRMEB 的网站主页上必须加上 CRMEB 官方网址(www.crmeb.com)的链接。
4、未经官方许可禁止在 CRMEB 的整体或任何部分基础上以发展任何派生版本、修改版本或第三方版本用于重新分发。
5、如果您未能遵守本协议的条款您的授权将被终止所被许可的权利将被收回并承担相应法律责任。
三、有限担保和免责声明
1、本软件及所附带的文件是作为不提供任何明确的或隐含的赔偿或担保的形式提供的。
2、用户出于自愿而使用本软件您必须了解使用本软件的风险在尚未购买产品技术服务之前我们不承诺对免费用户提供任何形式的技术支持、使用担保也不承担任何因使用本软件而产生问题的相关责任。
3、电子文本形式的授权协议如同双方书面签署的协议一样具有完全的和等同的法律效力。您一旦开始确认本协议并安装 CRMEB即被视为完全理解并接受本协议的各项条款在享有上述条款授予的权力的同时受到相关的约束和限制。协议许可范围以外的行为将直接违反本授权协议并构成侵权我们有权随时终止授权责令停止损害并保留追究相关责任的权力。
协议发布时间: 2017年8月01日
版本最新更新: 2019年8月15日 By CRMEB
CRMEB官方网站http://www.crmeb.com
CRMEB演示站http://demo.crmeb.com
-----------------------------------------------------
运营团队: 众邦科技
电 话: 400-8888-794
邮 箱: admin@xazbkj.com
网 址: http://www.xazbkj.com

146
crmeb/README.md Normal file
View File

@ -0,0 +1,146 @@
CRMEB v4.x
===============
> 运行环境要求PHP7.1+。
## 主要特性
### 开源无加密
源码开源无加密,有详细的代码注释,有完整系统手册
### TP6框架
使用最新的 ThinkPHP 6.0框架开发
### 前端采用Vue CLI框架
前端使用Vue CLI框架nodejs打包页面加载更流畅用户体验更好
### 标准接口
标准接口、前后端分离,二次开发更方便
### 支持队列
降低流量高峰,解除耦合,高可用
### 长连接
减少CPU及内存使用及网络堵塞减少请求响应时长
### 无缝事件机制
行为扩展更方便,方便二次开发
### 后台快速生成表单
后台应用form-builder 无需写页面快速增删改查
### 数据表格导出
PHPExcel数据导出,导出表格更加美观可视;
### 数据统计分析
后台使用ECharts图表统计实现用户、产品、订单、资金等统计分析
### 强大的后台权限管理
后台多种角色、多重身份权限管理,权限可以控制到每一步操作
### 一件安装
自动检查系统环境一键安装
## 安装
## 一键安装
上传你的代码,站点入口目录设置/public
在浏览器中输入你的域名或IP例如www.yourdomain.com,
安装程序会自动执行安装。期间系统会提醒你输入数据库信息以完成安装安装完成后建议删除install目录下index.php文件或将其改名。
后台访问地址:
1.域名/admin
2.域名/index.php/admin
3.域名/index.php?s=/admin
公众号和H5首页访问地址
1.域名/
提示:正常访问是第一中模式,第一种访问不了请检测[URL重写](http://help.crmeb.net/895486)是否配置好
安装过程中请牢记您的账号密码!
## 重新安装
1. 清除数据库
2. 删除/public/install/install.lock 文件
## 手动安装
1.创建数据库,倒入数据库文件
数据库文件目录/public/install/crmeb.sql
2.修改数据库连接文件
配置文件路径/.env
~~~
APP_DEBUG = true
[APP]
DEFAULT_TIMEZONE = Asia/Shanghai
[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1 #数据库连接地址
DATABASE = test #数据库名称
USERNAME = username #数据库登录账号
PASSWORD = password #数据库登录密码
HOSTPORT = 3306 #数据库端口
CHARSET = utf8
DEBUG = true
[LANG]
default_lang = zh-cn
[REDIS]
REDIS_HOSTNAME = 127.0.0.1 # redis链接地址
PORT = 6379 #端口号
REDIS_PASSWORD = 123456 #密码
SELECT = 0 #数据库
~~~
3.修改目录权限linux系统777
/public
/runtime
4.后台登录:
http://域名/admin
默认账号admin 密码crmeb.com
## 定时任务
在自动收货,库存预警等功能使用到
```sh
php think timer [ status ] [ --d ]
```
参数
- status: 状态
- start: 启动
- stop: 关闭
- restart: 重启
- --d : 后台执行
## 长连接服务
在h5聊天,后台管理员消息通知等功能使用到
```sh
php think workerman [ status ] [ server ] [ --d ]
```
windows环境下需要分三步执行
```sh
# 内部通讯服务
php think workerman start channel
# h5端聊天服务
php think workerman start chat
# 后台管理员通知
php think workerman start admin
```
参数
- status: 状态
- start: 启动
- stop: 关闭
- restart: 重启
- server: 服务 (windows)
- channel: 内部通讯
- chat: h5
- admin: 后台
- --d : 后台执行
## 文档
[使用手册](https://help.crmeb.net)
[TP6开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content)
## 参与开发
请参阅 [CRMEB](https://github.com/crmeb/CRMEB)。
## 版权信息
本项目包含的第三方源码和二进制文件之版权信息另行标注。
版权所有Copyright © 2017-2019 by CRMEB (http://www.crmeb.com)
All rights reserved。
CRMEB® 商标和著作权所有者为西安众邦网络科技有限公司。

View File

@ -0,0 +1,52 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller;
use crmeb\basic\BaseController;
/**
* 基类 所有控制器继承的类
* Class AuthController
* @package app\adminapi\controller
*/
class AuthController extends BaseController
{
/**
* 当前登陆管理员信息
* @var
*/
protected $adminInfo;
/**
* 当前登陆管理员ID
* @var
*/
protected $adminId;
/**
* 当前管理员权限
* @var array
*/
protected $auth = [];
/**
* 初始化
*/
protected function initialize()
{
$this->adminId = $this->request->adminId();
$this->adminInfo = $this->request->adminInfo();
$this->auth = $this->request->adminInfo['rule'] ?? [];
}
}

View File

@ -0,0 +1,440 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller;
use app\services\system\config\SystemConfigServices;
use app\services\system\SystemAuthServices;
use app\services\order\StoreOrderServices;
use app\services\product\product\StoreProductServices;
use app\services\product\product\StoreProductReplyServices;
use app\services\user\UserExtractServices;
use app\services\product\sku\StoreProductAttrValueServices;
use app\services\system\SystemMenusServices;
use app\services\user\UserServices;
use crmeb\services\HttpService;
/**
* 公共接口基类 主要存放公共接口
* Class Common
* @package app\adminapi\controller
*/
class Common extends AuthController
{
/**
* 获取logo
* @return mixed
*/
public function getLogo()
{
return app('json')->success([
'logo' => sys_config('site_logo'),
'logo_square' => sys_config('site_logo_square')
]);
}
/**
* @return mixed
*/
public function check_auth()
{
try {
[$res, $installtime, $encryptStr] = $this->authorizationDecryptCrmeb();
if ($installtime) {
if (!isset($res['id']) || !$res['id']) {
return app('json')->fail('您暂未取得授权,请及时前往CRMEB官方进行授权', ['auth' => false]);
} else if (isset($res['id']) && $res['id'] == -1) {
$time = $installtime + (30 * 3600 * 24);
if ($time < time()) {
return app('json')->success('您的授权已过期请及时前往CRMEB官方进行授权', ['auth' => false]);
} else {
$nowTime = ($time - time()) / (3600 * 24);
return app('json')->success('您得授权证书还有' . (int)$nowTime . '天过期,请及时前往CRMEB官方进行授权认证!', ['auth' => true]);
}
} else {
return app('json')->success('succes', ['auth' => true]);
}
} else {
return app('json')->fail('授权文件读取错误');
}
} catch (\RuntimeException $e) {
return app('json')->fail($e->getMessage());
}
}
/**
* @return mixed
*/
public function auth()
{
[$res, $installtime, $encryptStr] = $this->authorizationDecryptCrmeb();
$version = get_crmeb_version();
$res = HttpService::request('http://authorize.crmeb.net/api/auth_cert_query', 'post', [
'domain_name' => $this->request->host(),
'label' => 23,
'version' => $version
]);
$res = $res ? json_decode($res, true) : [];
$status = $res['data']['status'] ?? -9;
$time = $installtime + (30 * 3600 * 24);
if ($time < time()) {
$day = 0;
} else {
$day = (int)bcdiv((string)($time - time()), (string)(3600 * 24), 0);
}
$defaultRecordCode = '00000000';
switch ((int)$status) {
case 1:
//审核成功
$authCode = $res['data']['auth_code'] ?? $defaultRecordCode;
$autoContent = $res['data']['auto_content'] ?? '';
try {
/** @var SystemConfigServices $services */
$services = app()->make(SystemConfigServices::class);
if ($services->count(['menu_name' => 'cert_crmeb'])) {
$services->update(['menu_name' => 'cert_crmeb'], ['value' => json_encode($autoContent . ',' . $authCode)]);
} else {
$services->save([
'menu_name' => 'cert_crmeb',
'type' => 'text',
'input_type' => 'input',
'config_tab_id' => 1,
'value' => json_encode($autoContent . ',' . $authCode),
'status' => 2,
'info' => '授权密钥'
]);
}
} catch (\Throwable $e) {
return app('json')->fail('授权成功,写入数据库失败,请检查数据库链接配置');
}
return app('json')->success(['status' => 1, 'authCode' => $authCode, 'day' => 0]);
break;
case 2:
//审核失败
return app('json')->success(['status' => 2, 'day' => $day]);
break;
case -1:
//没有提交
return app('json')->success(['status' => -1, 'day' => $day]);
break;
case 0:
//待审核
return app('json')->success(['status' => 0, 'day' => $day]);
break;
default:
return app('json')->success(['status' => -9, 'day' => $day]);
break;
}
}
/**
* 申请授权
* @return mixed
*/
public function auth_apply(SystemAuthServices $services)
{
$version = get_crmeb_version();
$data = $this->request->postMore([
['company_name', ''],
['domain_name', ''],
['order_id', ''],
['phone', ''],
['label', 1],
['captcha', ''],
]);
if (!$data['company_name']) {
return app('json')->fail('请填写公司名称');
}
if (!$data['domain_name']) {
return app('json')->fail('请填写授权域名');
}
if (!$data['phone']) {
return app('json')->fail('请填写手机号码');
}
if (!$data['order_id']) {
return app('json')->fail('请填写订单id');
}
if (!$data['captcha']) {
return app('json')->fail('请填写验证码');
}
$datas = explode('.', $data['domain_name']);
$n = count($datas);
$preg = '/[\w].+\.(com|net|org|gov|edu)\.cn$/';
if(($n > 2) && preg_match($preg,$data['domain_name'])){
//双后缀取后3位
$domain_name = $datas[$n-3].'.'.$datas[$n-2].'.'.$datas[$n-1];
}else{
//非双后缀取后两位
$domain_name = $datas[$n-2].'.'.$datas[$n-1];
}
$data['domain_name'] = $domain_name;
$services->authApply($data);
return app('json')->success("申请授权成功!");
}
/**
* 首页头部统计数据
* @return mixed
*/
public function homeStatics()
{
/** @var StoreOrderServices $orderServices */
$orderServices = app()->make(StoreOrderServices::class);
$info = $orderServices->homeStatics();
return app('json')->success(compact('info'));
}
//增长率
public function growth($nowValue, $lastValue)
{
if ($lastValue == 0 && $nowValue == 0) return 0;
if ($lastValue == 0) return round($nowValue, 2);
if ($nowValue == 0) return -round($lastValue, 2);
return bcmul(bcdiv((bcsub($nowValue, $lastValue, 2)), $lastValue, 2), 100, 2);
}
/**
* 订单图表
*/
public function orderChart()
{
$cycle = $this->request->param('cycle') ?: 'thirtyday';//默认30天
/** @var StoreOrderServices $orderServices */
$orderServices = app()->make(StoreOrderServices::class);
$chartdata = $orderServices->orderCharts($cycle);
return app('json')->success($chartdata);
}
/**
* 用户图表
*/
public function userChart()
{
/** @var UserServices $uServices */
$uServices = app()->make(UserServices::class);
$chartdata = $uServices->userChart();
return app('json')->success($chartdata);
}
/**
* 交易额排行
* @return mixed
*/
public function purchaseRanking()
{
/** @var StoreProductAttrValueServices $valueServices */
$valueServices = app()->make(StoreProductAttrValueServices::class);
$list = $valueServices->purchaseRanking();
return app('json')->success(compact('list'));
}
/**
* 待办事统计
* @return mixed
*/
public function jnotice()
{
/** @var StoreOrderServices $orderServices */
$orderServices = app()->make(StoreOrderServices::class);
$data['ordernum'] = $orderServices->storeOrderCount();
$store_stock = sys_config('store_stock');
if ($store_stock < 0) $store_stock = 2;
/** @var StoreProductServices $storeServices */
$storeServices = app()->make(StoreProductServices::class);
$data['inventory'] = $storeServices->count(['type' => 5, 'store_stock' => $store_stock]);//警戒库存
/** @var StoreProductReplyServices $replyServices */
$replyServices = app()->make(StoreProductReplyServices::class);
$data['commentnum'] = $replyServices->replyCount();
/** @var UserExtractServices $extractServices */
$extractServices = app()->make(UserExtractServices::class);
$data['reflectnum'] = $extractServices->userExtractCount();//提现
$data['msgcount'] = intval($data['ordernum']) + intval($data['inventory']) + intval($data['commentnum']) + intval($data['reflectnum']);
$data['newOrderId'] = $orderServices->newOrderId(1);
if (count($data['newOrderId'])) $orderServices->newOrderUpdate($data['newOrderId']);
$value = [];
if ($data['ordernum'] != 0) {
$value[] = [
'title' => "您有$data[ordernum]个待发货的订单",
'type' => 'bulb',
'url' => '/admin/order/list?status=1'
];
}
if ($data['inventory'] != 0) {
$value[] = [
'title' => "您有$data[inventory]个商品库存预警",
'type' => 'information',
'url' => '/admin/product/product_list?type=5',
];
}
if ($data['commentnum'] != 0) {
$value[] = [
'title' => "您有$data[commentnum]条评论待回复",
'type' => 'bulb',
'url' => '/admin/product/product_reply?is_reply=0'
];
}
if ($data['reflectnum'] != 0) {
$value[] = [
'title' => "您有$data[reflectnum]个提现申请待审核",
'type' => 'bulb',
'url' => '/admin/finance/user_extract/index?status=0',
];
}
return app('json')->success($this->noticeData($value));
}
/**
* 消息返回格式
* @param array $data
* @return array
*/
public function noticeData(array $data): array
{
// 消息图标
$iconColor = [
// 邮件 消息
'mail' => [
'icon' => 'md-mail',
'color' => '#3391e5'
],
// 普通 消息
'bulb' => [
'icon' => 'md-bulb',
'color' => '#87d068'
],
// 警告 消息
'information' => [
'icon' => 'md-information',
'color' => '#fe5c57'
],
// 关注 消息
'star' => [
'icon' => 'md-star',
'color' => '#ff9900'
],
// 申请 消息
'people' => [
'icon' => 'md-people',
'color' => '#f06292'
],
];
// 消息类型
$type = array_keys($iconColor);
// 默认数据格式
$default = [
'icon' => 'md-bulb',
'iconColor' => '#87d068',
'title' => '',
'url' => '',
'type' => 'bulb',
'read' => 0,
'time' => 0
];
$value = [];
foreach ($data as $item) {
$val = array_merge($default, $item);
if (isset($item['type']) && in_array($item['type'], $type)) {
$val['type'] = $item['type'];
$val['iconColor'] = $iconColor[$item['type']]['color'] ?? '';
$val['icon'] = $iconColor[$item['type']]['icon'] ?? '';
}
$value[] = $val;
}
return $value;
}
/**
* 格式化菜单
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function menusList()
{
/** @var SystemMenusServices $menusServices */
$menusServices = app()->make(SystemMenusServices::class);
$list = $menusServices->getSearchList();
$counts = $menusServices->getColumn([
['is_show', '=', 1],
['auth_type', '=', 1],
['is_del', '=', 0],
['is_show_path', '=', 0],
], 'pid');
$data = [];
foreach ($list as $key => $item) {
$pid = $item->getData('pid');
$data[$key] = json_decode($item, true);
$data[$key]['pid'] = $pid;
if (in_array($item->id, $counts)) {
$data[$key]['type'] = 1;
} else {
$data[$key]['type'] = 0;
}
}
return app('json')->success(sort_list_tier($data));
}
/**
* @param bool $bool
* @param callable|null $callable
* @return array|bool
*/
protected function authorizationDecryptCrmeb()
{
$path = app()->getRootPath() . 'public' . DS . 'install' . DS . 'install.lock';
if (!is_file($path)) {
$path = app()->getRootPath() . ".constant";
}
if (!is_file($path)) {
throw new \RuntimeException('授权文件丢失', 42010);
}
$installtime = (int)@filectime($path);
$time = $installtime;
if (!$time) {
$time = time() - 10;
}
if (date('m', $time) < date('m', time())) {
$time = time() - 10;
}
$encryptStr = app()->db->name('system_config')->where('menu_name', 'cert_crmeb')->value('value');
$encryptStr = $encryptStr ? json_decode($encryptStr, true) : null;
$res = ['id' => '-1', 'key' => 'crmeb'];
$host = request()->host(true);
$data = explode('.', $host);
$n = count($data);
$preg = '/[\w].+\.(com|net|org|gov|edu)\.cn$/';
if(($n > 2) && preg_match($preg,$host)){
//双后缀取后3位
$url = $data[$n-3].'.'.$data[$n-2].'.'.$data[$n-1];
}else{
//非双后缀取后两位
$url = $data[$n-2].'.'.$data[$n-1];
}
if (in_array(date('d'), [5, 10, 15, 20, 25, 30]) && rand(1000, 100000) < 4000 && $encryptStr && $time < time()) {
$res = HttpService::request('http://store.crmeb.net/api/web/auth/get_id', 'POST', [
'domain_name' => $url,
'label' => 1,
]);
if (!isset($res['id']) || !$res['id']) {
$res = json_decode($res, true);
if (!$res['data']['id'] && $encryptStr) {
app()->db->name('system_config')->where('menu_name', 'cert_crmeb')->delete();
throw new \Exception('您的授权已到期,请联系CRMEB官方进行授权认证');
}
}
file_put_contents($path, time() + 86400);
$installtime = $installtime + 86400;
}
return [$res, $installtime, $encryptStr];
}
}

View File

@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller;
use think\facade\App;
use crmeb\utils\Captcha;
use crmeb\basic\BaseController;
use app\services\system\admin\SystemAdminServices;
/**
* 后台登陆
* Class Login
* @package app\adminapi\controller
*/
class Login extends BaseController
{
/**
* Login constructor.
* @param App $app
* @param SystemAdminServices $services
*/
public function __construct(App $app, SystemAdminServices $services)
{
parent::__construct($app);
$this->services = $services;
}
protected function initialize()
{
// TODO: Implement initialize() method.
}
/**
* 验证码
* @return $this|\think\Response
*/
public function captcha()
{
return app()->make(Captcha::class)->create();
}
/**
* 登陆
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function login()
{
[$account, $password, $imgcode] = $this->request->postMore([
'account', 'pwd', ['imgcode', '']
], true);
if (!app()->make(Captcha::class)->check($imgcode)) {
return app('json')->fail('验证码错误,请重新输入');
}
validate(\app\adminapi\validate\setting\SystemAdminValidata::class)->scene('get')->check(['account' => $account, 'pwd' => $password]);
return app('json')->success($this->services->login($account, $password, 'admin'));
}
/**
* 获取后台登录页轮播图以及LOGO
* @return mixed
*/
public function info()
{
return app('json')->success($this->services->getLoginInfo());
}
}

View File

@ -0,0 +1,23 @@
<?php
/**
* @author: liaofei<136327134@qq.com>
* @day: 2020/9/12
*/
namespace app\adminapi\controller;
use app\services\coupon\StoreCouponUserServices;
use app\services\order\StoreOrderCreateServices;
use crmeb\services\AliPayService;
class Test
{
public function index(StoreOrderCreateServices $services)
{
/** @var StoreCouponUserServices $couponServices */
$couponServices = app()->make(StoreCouponUserServices::class);
$couponInfo = $couponServices->getOne([['id', '=', 2], ['uid', '=', 1], ['is_fail', '=', 0], ['status', '=', 1], ['start_time', '<', time()], ['end_time', '>', time()]], '*', ['issue']);
dd($couponInfo);
}
}

View File

@ -0,0 +1,230 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\agent;
use app\adminapi\controller\AuthController;
use app\services\agent\AgentManageServices;
use app\services\user\UserServices;
use think\facade\App;
/**
* 分销商管理控制器
* Class AgentManage
* @package app\adminapi\controller\v1\agent
*/
class AgentManage extends AuthController
{
/**
* AgentManage constructor.
* @param App $app
* @param AgentManageServices $services
*/
public function __construct(App $app, AgentManageServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 分销管理列表
* @return mixed
*/
public function index()
{
$where = $this->request->getMore([
['nickname', ''],
['data', ''],
]);
return app('json')->success($this->services->agentSystemPage($where));
}
/**
* 分销头部统计
* @return mixed
*/
public function get_badge()
{
$where = $this->request->getMore([
['data', ''],
['nickname', ''],
]);
return app('json')->success(['res' => $this->services->getSpreadBadge($where)]);
}
/**
* 推广人列表
* @return mixed
*/
public function get_stair_list()
{
$where = $this->request->getMore([
['uid', 0],
['data', ''],
['nickname', ''],
['type', '']
]);
return app('json')->success($this->services->getStairList($where));
}
/**
* 推广人列表头部统计
* @return mixed
*/
public function get_stair_badge()
{
$where = $this->request->getMore([
['uid', ''],
['data', ''],
['nickname', ''],
['type', ''],
]);
return app('json')->success(['res' => $this->services->getSairBadge($where)]);
}
/**
* 统计推广订单列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function get_stair_order_list()
{
$where = $this->request->getMore([
['uid', 0],
['data', ''],
['order_id', ''],
['type', ''],
]);
return app('json')->success($this->services->getStairOrderList((int)$where['uid'], $where));
}
/**
* 统计推广订单头部统计
* @return mixed
*/
public function get_stair_order_badge()
{
$where = $this->request->getMore([
['uid', ''],
['data', ''],
['order_id', ''],
['type', ''],
]);
return app('json')->success($this->services->getStairOrderBadge($where));
}
/**
* 查看公众号推广二维码
* @param int $uid
* @return json
* */
public function look_code($uid = '', $action = '')
{
if (!$uid || !$action) return app('json')->fail('缺少参数');
try {
if (method_exists($this, $action)) {
$res = $this->$action($uid);
if ($res)
return app('json')->success($res);
else
return app('json')->fail(isset($res['msg']) ? $res['msg'] : '获取失败,请稍后再试!');
} else
return app('json')->fail('暂无此方法');
} catch (\Exception $e) {
return app('json')->fail('获取推广二维码失败,请检查您的微信配置', ['line' => $e->getLine(), 'messag' => $e->getMessage()]);
}
}
/**
* 获取公众号二维码
* */
public function wechant_code($uid)
{
$qr_code = $this->services->wechatCode((int)$uid);
if (isset($qr_code['url']))
return ['code_src' => $qr_code['url']];
else
return app('json')->fail('获取失败,请稍后再试!');
}
/**
* TODO 查看小程序推广二维码
* @param string $uid
*/
public function look_xcx_code($uid = '')
{
if (!strlen(trim($uid))) {
return app('json')->fail('缺少参数');
}
return app('json')->success($this->services->lookXcxCode((int)$uid));
}
/**
* 查看H5推广二维码
* @param string $uid
* @return mixed|string
*/
public function look_h5_code($uid = '')
{
if (!strlen(trim($uid))) return app('json')->fail('缺少参数');
return app('json')->success($this->services->lookH5Code((int)$uid));
}
/**
* 解除单个用户的推广权限
* @param int $uid
* */
public function delete_spread($uid)
{
if (!$uid) app('json')->fail('缺少参数');
return app('json')->success($this->services->delSpread((int)$uid) ? '解除成功' : '解除失败');
}
/**
* 修改上级推广人
* @param UserServices $services
* @return mixed
*/
public function editSpread(UserServices $services)
{
[$uid, $spreadUid] = $this->request->postMore([
[['uid', 'd'], 0],
[['spread_uid', 'd'], 0],
], true);
if (!$uid || !$spreadUid) {
return app('json')->fail('缺少参数');
}
if ($uid == $spreadUid) {
return app('json')->fail('上级推广人不能为自己');
}
$userInfo = $services->get($uid);
if (!$userInfo) {
return app('json')->fail('用户不存在');
}
if (!$services->count(['uid' => $spreadUid])) {
return app('json')->fail('上级用户不存在');
}
if ($userInfo->spread_uid == $spreadUid) {
return app('json')->fail('当前推广人已经是所选人');
}
$spreadInfo = $services->get($spreadUid);
if($spreadInfo->spread_uid == $uid) {
return app('json')->fail('上级推广人不能为自己下级');
}
$userInfo->spread_uid = $spreadUid;
$userInfo->spread_time = time();
$userInfo->save();
return app('json')->success('修改成功');
}
}

View File

@ -209,13 +209,13 @@ class RoutineTemplate extends AuthController
foreach ($all['list'] as $template) {
if ($template['tempkey']) {
if (!isset($template['kid'])) {
app('json')->fail('数据库模版表(template_message)缺少字段kid');
return app('json')->fail('数据库模版表(template_message)缺少字段kid');
}
$works = [];
try {
$works = MiniProgramService::getSubscribeTemplateKeyWords($template['tempkey']);
} catch (\Throwable $e) {
$errData[] = $template['name'] . '获取关键词列表失败';
$errData[1] = '获取关键词列表失败请检查小程序APPID、秘钥配置或者服务器ssl证书以及opennssl、curl扩展';
}
$kid = [];
if ($works) {
@ -233,14 +233,13 @@ class RoutineTemplate extends AuthController
try {
$tempid = MiniProgramService::addSubscribeTemplate($template['tempkey'], $kid, $template['name']);
} catch (\Throwable $e) {
$errData[] = $template['name'] . '添加订阅消息模版失败';
$errData[2] = '添加订阅消息模版失败:请去微信小程序后台检查订阅消息添加条数是否上限';
}
if ($tempid != $template['tempid']) {
$this->services->update($template['id'], ['tempid' => $tempid, 'kid' => json_encode($kid), 'add_time' => $time], 'id');
}
}
}
}
}
$msg = $errData ? implode('\n', $errData) : '同步成功';

View File

@ -76,7 +76,7 @@ class StoreServiceSpeechcraft extends AuthController
['sort', 0],
]);
validate(StoreServiceSpeechcraftValidata::class)->check($data);
Validate(StoreServiceSpeechcraftValidata::class)->check($data);
$data['add_time'] = time();
$data['kefu_id'] = 0;
if ($this->services->count(['message' => $data['message']])) {
@ -131,8 +131,7 @@ class StoreServiceSpeechcraft extends AuthController
[['cate_id', 'd'], 0],
]);
validate(StoreServiceSpeechcraftValidata::class)->check($data);
Validate(StoreServiceSpeechcraftValidata::class)->check($data);
$message = $this->services->get(['message' => $data['message']]);
if ($message && $message['id'] != $id) {
return app('json')->fail('话术不能重复添加');

View File

@ -15,6 +15,7 @@ use crmeb\services\WechatService;
use think\facade\App;
use app\services\wechat\WechatNewsCategoryServices;
use app\services\article\ArticleServices;
use think\facade\Log;
/**
* 图文信息
@ -179,6 +180,7 @@ class WechatNewsCategory extends AuthController
try {
WechatService::staffService()->message($message)->to($v['openid'])->send();
} catch (\Exception $e) {
Log::error($v['nickname'] . '发送失败,原因' . $e->getMessage());
$errorLog[] = $v['nickname'] . '发送失败';
}
} else {

View File

@ -50,7 +50,7 @@ class WechatTemplate extends AuthController
['name', ''],
['status', '']
]);
$where['type'] = 1;
$where['type']=1;
$data = $this->services->getTemplateList($where);
$industry = Cache::tag($this->cacheTag)->remember('_wechat_industry', function () {
try {
@ -106,7 +106,7 @@ class WechatTemplate extends AuthController
['type', 1]
]);
if ($data['tempkey'] == '') return app('json')->fail('请输入模板编号');
if ($data['tempkey'] != '' && $this->services->getOne(['tempkey' => $data['tempkey']]))
if ($data['tempkey'] != '' && $this->services->getOne(['tempkey'=>$data['tempkey']]))
return app('json')->fail('请输入模板编号已存在,请重新输入');
if ($data['tempid'] == '') return app('json')->fail('请输入模板ID');
if ($data['name'] == '') return app('json')->fail('请输入模板名');
@ -164,7 +164,7 @@ class WechatTemplate extends AuthController
if (!$id) return app('json')->fail('数据不存在');
$product = $this->services->get($id);
if (!$product) return app('json')->fail('数据不存在!');
$this->services->update($id, $data, 'id');
$this->services->update($id,$data, 'id');
return app('json')->success('修改成功!');
}
@ -192,7 +192,7 @@ class WechatTemplate extends AuthController
public function set_status($id, $status)
{
if ($status == '' || $id == 0) return app('json')->fail('参数错误');
$this->services->update($id, ['status' => $status], 'id');
$this->services->update($id,['status' => $status],'id');
return app('json')->success($status == 0 ? '关闭成功' : '开启成功');
}
}

View File

@ -130,7 +130,7 @@ class WechatUser extends AuthController
return ['value' => $item['id'], 'label' => $item['name']];
});
$groupId = UserModel::where('openid', $openid)->value('groupid');
$f = [Form::select('group_id', '用户分组', (string)$groupId)->setOptions($list->toArray())];
$f = [Form::select('group_id', '用户分组', $groupId)->setOptions($list->toArray())];
return app('json')->success(create_form('编辑用户标签', $f, Url::buildUrl('/app/wechat/user_group/' . $openid), 'PUT'));
}
@ -268,7 +268,7 @@ class WechatUser extends AuthController
public function create_group()
{
$f = [Form::input('name', '分组名称')];
return create_form('添加分组', $f, Url::buildUrl('/app/wechat/group'), 'POST');
return app('json')->success(create_form('添加分组', $f, Url::buildUrl('/app/wechat/group'), 'POST'));
}
/**
@ -295,7 +295,7 @@ class WechatUser extends AuthController
public function edit_group($id)
{
$f = [Form::input('name', '分组名称')];
return create_form('编辑分组', $f, Url::buildUrl('/app/wechat/group/' . $id), 'PUT');
return app('json')->success(create_form('编辑分组', $f, Url::buildUrl('/app/wechat/group/' . $id), 'PUT'));
}
/**

View File

@ -59,7 +59,6 @@ class Article extends AuthController
['synopsis', 0],
['share_title', ''],
['share_synopsis', ''],
['visit', 0],
['sort', 0],
['url', ''],
['is_banner', 0],

View File

@ -77,6 +77,7 @@ class ArticleCategory extends AuthController
}
$data['add_time'] = time();
$this->service->save($data);
CacheService::delete('ARTICLE_CATEGORY');
return app('json')->success('添加分类成功!');
}

View File

@ -0,0 +1,356 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\diy;
use app\adminapi\controller\AuthController;
use app\services\activity\StoreBargainServices;
use app\services\activity\StoreCombinationServices;
use app\services\activity\StoreSeckillServices;
use app\services\diy\DiyServices;
use app\services\other\CacheServices;
use app\services\product\product\StoreCategoryServices;
use app\services\product\product\StoreProductServices;
use crmeb\exceptions\AdminException;
use crmeb\services\FileService;
use think\facade\App;
class Diy extends AuthController
{
protected $services;
public function __construct(App $app, DiyServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* DIY列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getList()
{
$where = $this->request->getMore([
['status', ''],
['type', ''],
['name', ''],
['version', ''],
]);
$data = $this->services->getDiyList($where);
return app('json')->success($data);
}
/**
* 保存资源
* @param int $id
* @return mixed
*/
public function saveData(int $id = 0)
{
$data = $this->request->postMore([
['value', ''],
]);
$value_config = ['seckill','bargain','combination','goodList'];
$value = is_string($data['value']) ? json_decode($data['value'], true) : $data['value'];
foreach ($value as $key=>&$val){
if(in_array($key,$value_config) && is_array($val)){
foreach ($val as $k=>&$v){
if(isset($v['selectConfig']['list']) && $v['selectConfig']['list']){
$v['selectConfig']['list'] = [];
}
if(isset($v['goodsList']['list']) && $v['goodsList']['list'] && $v['tabConfig']['tabVal'] == 1){
$limitMax = config('database.page.limitMax', 50);
if(count($v['goodsList']['list']) > $limitMax){
return $this->fail('您设置得商品个数超出系统限制,最大限制' . $limitMax . '个商品');
}
$v['ids'] = array_column($v['goodsList']['list'], 'id');
$v['goodsList']['list'] = [];
}
}
}
}
$data['value'] = json_encode($value);
$this->services->saveData($id, $data);
return app('json')->success('保存成功');
}
/**
* 删除模板
* @param $id
* @return mixed
*/
public function del($id)
{
$this->services->del($id);
return app('json')->success('删除成功');
}
/**
* 使用模板
* @param $id
* @return mixed
*/
public function setStatus($id)
{
$name = $this->services->value(['id' => $id], 'template_name');
if (!is_file(public_path('template') . $name . '.zip')) {
throw new AdminException('请上传模板压缩包');
}
FileService::delDir(runtime_path('wap'));
FileService::delDir(public_path('pages'));
FileService::delDir(public_path('static'));
@unlink(public_path() . 'index.html');
$this->services->setStatus($id);
FileService::zipOpen(public_path('template') . $name . '.zip', public_path());
return app('json')->success('设置成功');
}
/**
* 获取一条数据
* @param int $id
* @return mixed
*/
public function getInfo(int $id, StoreProductServices $services,StoreSeckillServices $seckillServices, StoreCombinationServices $combinationServices,StoreBargainServices $bargainServices)
{
if (!$id) throw new AdminException('参数错误');
$info = $this->services->get($id);
if ($info) {
$info = $info->toArray();
} else {
throw new AdminException('模板不存在');
}
if(!$info['value']) return app('json')->success(compact('info'));
$info['value'] = json_decode($info['value'], true);
$value_config = ['seckill','bargain','combination','goodList'];
foreach ($info['value']as $key=>&$val){
if(in_array($key,$value_config) && is_array($val)){
if($key == 'goodList'){
foreach ($val as $k=>&$v){
if(isset($v['ids']) && $v['ids'] && $v['tabConfig']['tabVal'] == 1){
$v['goodsList']['list'] = $services->getSearchList(['ids' => $v['ids']]);
}
}
}
if($key == "seckill"){
foreach ($val as $k=>&$v){
if(isset($v['ids']) && $v['ids'] && $v['tabConfig']['tabVal'] == 1){
$v['goodsList']['list'] = $seckillServices->getDiySeckillList(['ids' => $v['ids']])['list'];
}
}
}
if($key == "bargain"){
foreach ($val as $k=>&$v){
if(isset($v['ids']) && $v['ids'] && $v['tabConfig']['tabVal'] == 1){
$v['goodsList']['list'] = $bargainServices->getHomeList(['ids' => $v['ids']])['list'];
}
}
}
if($key == "combination"){
foreach ($val as $k=>&$v){
if(isset($v['ids']) && $v['ids'] && $v['tabConfig']['tabVal'] == 1){
$v['goodsList']['list'] = $combinationServices->getHomeList(['ids' => $v['ids']])['list'];
}
}
}
}
}
return app('json')->success(compact('info'));
}
/**
* 获取uni-app路径
* @return mixed
*/
public function getUrl()
{
$url = sys_data('uni_app_link');
if ($url) {
foreach ($url as &$link) {
$link['url'] = $link['link'];
$link['parameter'] = trim($link['param']);
}
} else {
/** @var CacheServices $cache */
$cache = app()->make(CacheServices::class);
$url = $cache->getDbCache('uni_app_url', null);
}
return app('json')->success(compact('url'));
}
/**
* 获取商品分类
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getCategory()
{
/** @var StoreCategoryServices $categoryService */
$categoryService = app()->make(StoreCategoryServices::class);
$list = $categoryService->getTierList(1, 1);
$data = [];
foreach ($list as $value) {
$data[] = [
'id' => $value['id'],
'title' => $value['html'] . $value['cate_name']
];
}
return app('json')->success($data);
}
/**
* 获取商品
* @return mixed
*/
public function getProduct()
{
$where = $this->request->getMore([
['id', 0],
['salesOrder', ''],
['priceOrder', ''],
]);
$id = $where['id'];
unset($where['id']);
/** @var StoreCategoryServices $storeCategoryServices */
$storeCategoryServices = app()->make(StoreCategoryServices::class);
if ($storeCategoryServices->value(['id' => $id], 'pid')) {
$where['sid'] = $id;
} else {
$where['cid'] = $id;
}
[$page, $limit] = $this->services->getPageValue();
/** @var StoreProductServices $productService */
$productService = app()->make(StoreProductServices::class);
$list = $productService->getSearchList($where, $page, $limit);
return app('json')->success($list);
}
/**
* 获取提货点自提开启状态
* @return mixed
*/
public function getStoreStatus()
{
$data['store_status'] = sys_config('store_self_mention', 0);
return app('json')->success($data);
}
/**
* 还原模板数据
* @param $id
* @return mixed
*/
public function Recovery($id)
{
if (!$id) throw new AdminException('参数错误');
$info = $this->services->get($id);
if ($info) {
$info->value = $info->default_value;
$info->update_time = time();
$info->save();
return app('json')->success('还原成功');
} else {
throw new AdminException('模板不存在');
}
}
/**
* 获取二级分类
* @return mixed
*/
public function getByCategory()
{
$where = $this->request->getMore([
['pid', -1],
['name', '']
]);
/** @var StoreCategoryServices $categoryServices */
$categoryServices = app()->make(StoreCategoryServices::class);
return app('json')->success($categoryServices->getALlByIndex($where));
}
/**
* 添加页面
* @return mixed
*/
public function create(){
return app('json')->success($this->services->createForm());
}
/**
* 保存页面
* @return mixed
*/
public function save(){
$data = $this->request->postMore([
['name', ''],
['template_name', ''],
]);
if (!$data['name']) throw new AdminException('请输入页面名称');
if (!$data['template_name']) throw new AdminException('请输入页面类型');
$data['version'] = '1.0';
$data['add_time'] = time();
$data['type'] = 1;
$this->services->save($data);
return app('json')->success('保存成功!');
}
/**
* 设置默认数据
* @param $id
* @return mixed
*/
public function setRecovery($id){
if (!$id) throw new AdminException('参数错误');
$info = $this->services->get($id);
if ($info) {
$info->default_value = $info->value;
$info->update_time = time();
$info->save();
return app('json')->success('设置成功');
} else {
throw new AdminException('模板不存在');
}
}
/**
* 获取商品列表
* @return mixed
*/
public function getProductList(){
$where = $this->request->getMore([
['cate_id', ''],
['store_name', ''],
['type', 0],
]);
$where['is_show'] = 1;
$where['is_del'] = 0;
/** @var StoreCategoryServices $storeCategoryServices */
$storeCategoryServices = app()->make(StoreCategoryServices::class);
if ($where['cate_id'] !== '') {
if ($storeCategoryServices->value(['id' => $where['cate_id']], 'pid')) {
$where['sid'] = $where['cate_id'];
} else {
$where['cid'] = $where['cate_id'];
}
}
unset($where['cate_id']);
$list = $this->services->ProductList($where);
return app('json')->success($list);
}
}

View File

@ -0,0 +1,285 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\export;
use app\adminapi\controller\AuthController;
use app\services\activity\StoreBargainServices;
use app\services\activity\StoreCombinationServices;
use app\services\activity\StorePinkServices;
use app\services\activity\StoreSeckillServices;
use app\services\agent\AgentManageServices;
use app\services\export\ExportServices;
use app\services\order\StoreOrderServices;
use app\services\product\product\StoreProductServices;
use app\services\system\store\SystemStoreServices;
use app\services\user\MemberCardServices;
use app\services\user\UserBillServices;
use app\services\user\UserRechargeServices;
use app\services\wechat\WechatUserServices;
use think\facade\App;
/**
* 导出excel类
* Class ExportExcel
* @package app\adminapi\controller\v1\export
*/
class ExportExcel extends AuthController
{
/**
* @var ExportServices
*/
protected $service;
/**
* ExportExcel constructor.
* @param App $app
* @param ExportServices $services
*/
public function __construct(App $app, ExportServices $services)
{
parent::__construct($app);
$this->service = $services;
}
/**
* 保存用户资金监控的excel表格
* @param UserBillServices $services
* @return mixed
*/
public function userFinance(UserBillServices $services)
{
$where = $this->request->getMore([
['start_time', ''],
['end_time', ''],
['nickname', ''],
['type', ''],
]);
$data = $services->getBillList($where, '*', false);
return app('json')->success($this->service->userFinance($data['data'] ?? []));
}
/**
* 用户佣金
* @param UserBillServices $services
* @return mixed
*/
public function userCommission(UserBillServices $services)
{
$where = $this->request->getMore([
['page', 1],
['limit', 20],
['nickname', ''],
['price_max', ''],
['price_min', ''],
['excel', '1'],
]);
$data = $services->getCommissionList($where, false);
return app('json')->success($this->service->userCommission($data['list'] ?? []));
}
/**
* 用户积分
* @param UserBillServices $services
* @return mixed
*/
public function userPoint(UserBillServices $services)
{
$where = $this->request->getMore([
['start_time', ''],
['end_time', ''],
['nickname', ''],
['excel', '1'],
]);
$data = $services->getPointList($where, '*', false);
return app('json')->success($this->service->userPoint($data['list'] ?? []));
}
/**
* 用户充值
* @param UserRechargeServices $services
* @return mixed
*/
public function userRecharge(UserRechargeServices $services)
{
$where = $this->request->getMore([
['data', ''],
['paid', ''],
['page', 1],
['limit', 20],
['nickname', ''],
['excel', '1'],
]);
$data = $services->getRechargeList($where, '*', false);
return app('json')->success($this->service->userRecharge($data['list'] ?? []));
}
/**
* 分销管理 用户推广
* @param AgentManageServices $services
* @return mixed
*/
public function userAgent(AgentManageServices $services)
{
$where = $this->request->getMore([
['nickname', ''],
['data', ''],
['excel', '1'],
]);
$data = $services->agentSystemPage($where, false);
return app('json')->success($this->service->userAgent($data['list']));
}
/**
* 微信用户导出
* @param WechatUserServices $services
* @return mixed
*/
public function wechatUser(WechatUserServices $services)
{
$where = $this->request->getMore([
['page', 1],
['limit', 20],
['nickname', ''],
['data', ''],
['tagid_list', ''],
['groupid', '-1'],
['sex', ''],
['export', '1'],
['subscribe', '']
]);
$tagidList = explode(',', $where['tagid_list']);
foreach ($tagidList as $k => $v) {
if (!$v) {
unset($tagidList[$k]);
}
}
$tagidList = array_unique($tagidList);
$where['tagid_list'] = implode(',', $tagidList);
$data = $services->exportData($where);
return app('json')->success($this->service->wechatUser($data));
}
/**
* 商铺砍价活动导出
* @param StoreBargainServices $services
* @return mixed
*/
public function storeBargain(StoreBargainServices $services)
{
$where = $this->request->getMore([
['status', ''],
['store_name', ''],
]);
$data = $services->getList($where);
return app('json')->success($this->service->storeBargain($data));
}
/**
* 商铺拼团导出
* @param StoreCombinationServices $services
* @return mixed
*/
public function storeCombination(StoreCombinationServices $services)
{
$where = $this->request->getMore([
['is_show', ''],
['store_name', ''],
]);
$data = $services->getList($where);
/** @var StorePinkServices $storePinkServices */
$storePinkServices = app()->make(StorePinkServices::class);
$countAll = $storePinkServices->getPinkCount([]);
$countTeam = $storePinkServices->getPinkCount(['k_id' => 0]);
foreach ($data as &$item) {
$item['count_people_all'] = $countAll[$item['id']] ?? 0;//参与人数
$item['count_people_pink'] = $countTeam[$item['id']] ?? 0;//成团数量
}
return app('json')->success($this->service->storeCombination($data));
}
/**
* 商铺秒杀导出
* @param StoreSeckillServices $services
* @return mixed
*/
public function storeSeckill(StoreSeckillServices $services)
{
$where = $this->request->getMore([
['status', ''],
['store_name', '']
]);
$data = $services->getList($where);
return app('json')->success($this->service->storeSeckill($data));
}
/**
* 商铺产品导出
* @param StoreProductServices $services
* @return mixed
*/
public function storeProduct(StoreProductServices $services)
{
$where = $this->request->getMore([
['store_name', ''],
['cate_id', ''],
['type', 1]
]);
$data = $services->searchList($where, true, false);
return app('json')->success($this->service->storeProduct($data['list'] ?? []));
}
/**
* 订单列表导出
* @param StoreOrderServices $services
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function storeOrder(StoreOrderServices $services)
{
$where = $this->request->getMore([
['status', ''],
['real_name', ''],
['data', '', '', 'time']
]);
$data = $services->getExportList($where);
return app('json')->success($this->service->storeOrder($data));
}
/**
* 获取提货点
* @return mixed
*/
public function storeMerchant(SystemStoreServices $services)
{
$where = $this->request->getMore([
[['keywords', 's'], ''],
[['type', 'd'], 0],
]);
$data = $services->getExportData($where);
return app('json')->success($this->service->storeMerchant($data));
}
/**会员卡导出
* @param int $id
* @param MemberCardServices $services
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function memberCard(int $id, MemberCardServices $services)
{
$data = $services->getExportData(['batch_card_id' => $id]);
return app('json')->success($this->service->memberCard($data));
}
}

View File

@ -0,0 +1,97 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\finance;
use app\services\user\UserBillServices;
use think\facade\App;
use app\adminapi\controller\AuthController;
class Finance extends AuthController
{
/**
* Finance constructor.
* @param App $app
* @param UserBillServices $services
*/
public function __construct(App $app, UserBillServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 筛选类型
*/
public function bill_type()
{
return app('json')->success($this->services->bill_type());
}
/**
* 资金记录
*/
public function list()
{
$where = $this->request->getMore([
['start_time', ''],
['end_time', ''],
['nickname', ''],
['limit', 20],
['page', 1],
['type', ''],
]);
return app('json')->success($this->services->getBillList($where));
}
/**
* 佣金记录
* @return mixed
*/
public function get_commission_list()
{
$where = $this->request->getMore([
['nickname', ''],
['price_max', ''],
['price_min', ''],
['sum_number', 'normal'],
['brokerage_price', 'normal']
]);
return app('json')->success($this->services->getCommissionList($where));
}
/**
* 佣金详情用户信息
* @param $id
* @return mixed
*/
public function user_info($id)
{
return app('json')->success($this->services->user_info((int)$id));
}
/**
* 佣金提现记录个人列表
*/
public function get_extract_list($id = '')
{
if ($id == '') return app('json')->fail('缺少参数');
$where = $this->request->getMore([
['start_time', ''],
['end_time', ''],
['nickname', '']
]);
$where['category'] = 'now_money';
$where['type'] = 'brokerage';
return app('json')->success($this->services->getBillOneList((int)$id, $where));
}
}

View File

@ -0,0 +1,135 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\finance;
use app\adminapi\controller\AuthController;
use app\services\user\UserExtractServices;
use think\facade\App;
use think\Request;
class UserExtract extends AuthController
{
/**
* UserExtract constructor.
* @param App $app
* @param UserExtractServices $services
*/
public function __construct(App $app, UserExtractServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
$where = $this->request->getMore([
['status', ''],
['extract_type', ''],
['nireid', '', '', 'like'],
['data', '', '', 'time'],
]);
if(isset($where['extract_type']) && $where['extract_type'] == 'wx'){
$where['extract_type'] = 'weixin';
}
return app('json')->success($this->services->index($where));
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return \think\Response
*/
public function edit($id)
{
if (!$id) return app('json')->fail('数据不存在');
return app('json')->success($this->services->edit((int)$id));
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update(Request $request, $id)
{
if (!$id) return app('json')->fail('缺少参数!');
$id = (int)$id;
$UserExtract = $this->services->getExtract($id);
if (!$UserExtract) app('json')->fail('数据不存在');
if ($UserExtract['extract_type'] == 'alipay') {
$data = $this->request->postMore([
'real_name',
'mark',
'extract_price',
'alipay_code',
]);
if (!$data['real_name']) return app('json')->fail('请输入姓名');
if ($data['extract_price'] <= -1) return app('json')->fail('请输入提现金额');
if (!$data['alipay_code']) return app('json')->fail('请输入支付宝账号');
} else if ($UserExtract['extract_type'] == 'weixin') {
$data = $this->request->postMore([
'real_name',
'mark',
'extract_price',
'wechat',
]);
if ($data['extract_price'] <= -1) return app('json')->fail('请输入提现金额');
if (!$data['wechat']) return app('json')->fail('请输入微信账号');
} else {
$data = $this->request->postMore([
'real_name',
'extract_price',
'mark',
'bank_code',
'bank_address',
]);
if (!$data['real_name']) return app('json')->fail('请输入姓名');
if ($data['extract_price'] <= -1) return app('json')->fail('请输入提现金额');
if (!$data['bank_code']) return app('json')->fail('请输入银行卡号');
if (!$data['bank_address']) return app('json')->fail('请输入开户行');
}
return app('json')->success($this->services->update($id, $data) ? '修改成功' : '修改失败');
}
/**
* 拒绝
* @param $id
* @return mixed
*/
public function refuse($id)
{
if (!$id) app('json')->fail('缺少参数');
$data = $this->request->postMore([
['message', '']
]);
return app('json')->success($this->services->refuse((int)$id, $data['message']) ? '操作成功' : '操作失败');
}
/**
* 通过
* @param $id
* @return mixed
*/
public function adopt($id)
{
if (!$id) app('json')->fail('缺少参数');
return app('json')->success($this->services->adopt((int)$id) ? '操作成功' : '操作失败');
}
}

View File

@ -0,0 +1,95 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\finance;
use app\adminapi\controller\AuthController;
use app\services\user\UserRechargeServices;
use think\facade\App;
class UserRecharge extends AuthController
{
/**
* UserRecharge constructor.
* @param App $app
* @param UserRechargeServices $services
*/
public function __construct(App $app, UserRechargeServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
$where = $this->request->getMore([
['data', ''],
['paid', ''],
['nickname', ''],
]);
return app('json')->success($this->services->getRechargeList($where));
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
if (!$id) return app('json')->fail('缺少参数');
return app('json')->success($this->services->delRecharge((int)$id) ? '删除成功' : '删除失败');
}
/**
* 获取用户充值数据
* @return array
*/
public function user_recharge()
{
$where = $this->request->getMore([
['data', ''],
['paid', ''],
['nickname', ''],
]);
return app('json')->success($this->services->user_recharge($where));
}
/**退款表单
* @param $id
* @return mixed|void
*/
public function refund_edit($id)
{
if (!$id) return app('json')->fail('数据不存在');
return app('json')->success($this->services->refund_edit((int)$id));
}
/**
* 退款操作
* @param $id
*/
public function refund_update($id)
{
$data = $this->request->postMore([
'refund_price',
]);
if (!$id) return app('json')->fail('数据不存在');
// if (!$data['refund_price']) return app('json')->fail('请输入退款金额');
return app('json')->success($this->services->refund_update((int)$id, $data['refund_price']) ? '退款成功' : '退款失败');
}
}

View File

@ -0,0 +1,179 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\marketing;
use app\adminapi\controller\AuthController;
use app\services\activity\StoreBargainServices;
use app\services\activity\StoreBargainUserHelpServices;
use app\services\activity\StoreBargainUserServices;
use think\facade\App;
/**
* 砍价管理
* Class StoreBargain
* @package app\adminapi\controller\v1\marketing
*/
class StoreBargain extends AuthController
{
public function __construct(App $app, StoreBargainServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
$where = $this->request->getMore([
['status', ''],
['store_name', ''],
]);
$where['is_del'] = 0;
$list = $this->services->getStoreBargainList($where);
return app('json')->success($list);
}
/**
* 保存新建的资源
*
* @param \think\Request $request
* @return \think\Response
*/
public function save($id)
{
$data = $this->request->postMore([
['title', ''],
['info', ''],
['unit_name', ''],
['section_time', []],
['image', ''],
['images', []],
['bargain_max_price', 0],
['bargain_min_price', 0],
['sort', 0],
['give_integral', 0],
['is_hot', 0],
['status', 0],
['product_id', 0],
['description', ''],
['attrs', []],
['items', []],
['temp_id', 0],
['rule', ''],
['num', 1],
['copy', 0],
['bargain_num', 1],
['people_num', 1],
]);
Validate(\app\adminapi\validate\marketing\StoreBargainValidate::class)->scene('save')->check($data);
if ($data['section_time']) {
[$start_time, $end_time] = $data['section_time'];
if (strtotime($end_time) < time()) {
return app('json')->fail('活动结束时间不能小于当前时间');
}
}
$bragain = [];
if ($id) {
$bragain = $this->services->get((int)$id);
if (!$bragain) {
return app('json')->fail('数据不存在');
}
}
//限制编辑
if ($data['copy'] == 0 && $bragain) {
if ($bragain['stop_time'] < time()) {
return app('json')->fail('活动已结束,请重新添加或复制');
}
}
if ($data['copy'] == 1) {
$id = 0;
unset($data['copy']);
}
$this->services->saveData($id, $data);
return app('json')->success('保存成功');
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
$info = $this->services->getInfo($id);
return app('json')->success(compact('info'));
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
$this->services->update($id, ['is_del' => 1]);
/** @var StoreBargainUserServices $bargainUserService */
$bargainUserService = app()->make(StoreBargainUserServices::class);
$bargainUserService->UserBargainStatusFail($id);
return app('json')->success('删除成功!');
}
/**
* 修改状态
* @param $id
* @param $status
* @return mixed
*/
public function set_status($id, $status)
{
/** @var StoreBargainUserServices $bargainUserService */
$bargainUserService = app()->make(StoreBargainUserServices::class);
$bargainUserService->UserBargainStatusFail($id);
$this->services->update($id, ['status' => $status]);
return app('json')->success($status == 0 ? '关闭成功' : '开启成功');
}
/**
* 砍价列表
* @return mixed
*/
public function bargainList()
{
$where = $this->request->getMore([
['status', ''],
['data', '', '', 'time'],
]);
/** @var StoreBargainUserServices $bargainUserService */
$bargainUserService = app()->make(StoreBargainUserServices::class);
$list = $bargainUserService->bargainUserList($where);
return app('json')->success($list);
}
/**
* 砍价信息
* @param $id
* @return mixed
*/
public function bargainListInfo($id)
{
/** @var StoreBargainUserHelpServices $bargainUserHelpService */
$bargainUserHelpService = app()->make(StoreBargainUserHelpServices::class);
$list = $bargainUserHelpService->getHelpList($id);
return app('json')->success(compact('list'));
}
}

View File

@ -0,0 +1,184 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\marketing;
use app\adminapi\controller\AuthController;
use app\services\activity\StoreCombinationServices;
use app\services\activity\StorePinkServices;
use think\facade\App;
/**
* 拼团管理
* Class StoreCombination
* @package app\admin\controller\store
*/
class StoreCombination extends AuthController
{
public function __construct(App $app, StoreCombinationServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 拼团列表
* @return mixed
*/
public function index()
{
$where = $this->request->getMore([
['is_show', ''],
['store_name', '']
]);
$where['is_del'] = 0;
$list = $this->services->systemPage($where);
return app('json')->success($list);
}
/**
* 拼团统计
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function statistics()
{
/** @var StorePinkServices $storePinkServices */
$storePinkServices = app()->make(StorePinkServices::class);
$info = $storePinkServices->getStatistics();
return app('json')->success($info);
}
/**
* 详情
* @param $id
* @return mixed
*/
public function read($id)
{
$info = $info = $this->services->getInfo((int)$id);
return app('json')->success(compact('info'));
}
/**
* 保存新建的资源
* @param int $id
*/
public function save($id = 0)
{
$data = $this->request->postMore([
[['product_id', 'd'], 0],
[['title', 's'], ''],
[['info', 's'], ''],
[['unit_name', 's'], ''],
['image', ''],
['images', []],
['section_time', []],
[['is_host', 'd'], 0],
[['is_show', 'd'], 0],
[['num', 'd'], 0],
[['temp_id', 'd'], 0],
[['effective_time', 'd'], 0],
[['people', 'd'], 0],
[['description', 's'], ''],
['attrs', []],
['items', []],
['num', 1],
['once_num', 1],
['sort', 0],
['copy', 0],
['virtual', 100],
]);
Validate(\app\adminapi\validate\marketing\StoreCombinationValidate::class)->scene('save')->check($data);
if ($data['section_time']) {
[$start_time, $end_time] = $data['section_time'];
if (strtotime($end_time) < time()) {
return app('json')->fail('活动结束时间不能小于当前时间');
}
}
$bragain = [];
if ($id) {
$bragain = $this->services->get((int)$id);
if (!$bragain) {
return app('json')->fail('数据不存在');
}
}
//限制编辑
if ($data['copy'] == 0 && $bragain) {
if ($bragain['stop_time'] < time()) {
return app('json')->fail('活动已结束,请重新添加或复制');
}
}
if($data['num'] < $data['once_num']){
return app('json')->fail('限制单次购买数量不能大于总购买数量');
}
if ($data['copy'] == 1) {
$id = 0;
unset($data['copy']);
}
$this->services->saveData($id, $data);
return app('json')->success('保存成功');
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
$this->services->update($id, ['is_del' => 1]);
return app('json')->success('删除成功!');
}
/**
* 修改状态
* @param $id
* @param $status
* @return mixed
*/
public function set_status($id, $status)
{
$this->services->update($id, ['is_show' => $status]);
return app('json')->success($status == 0 ? '关闭成功' : '开启成功');
}
/**拼团列表
* @return mixed
*/
public function combine_list()
{
$where = $this->request->getMore([
['status', ''],
['data', '', '', 'time'],
]);
/** @var StorePinkServices $storePinkServices */
$storePinkServices = app()->make(StorePinkServices::class);
$list = $storePinkServices->systemPage($where);
return app('json')->success($list);
}
/**拼团人列表
* @return mixed
*/
public function order_pink($id)
{
/** @var StorePinkServices $storePinkServices */
$storePinkServices = app()->make(StorePinkServices::class);
$list = $storePinkServices->getPinkMember($id);
return app('json')->success(compact('list'));
}
}

View File

@ -0,0 +1,160 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\marketing;
use app\adminapi\controller\AuthController;
use app\services\activity\StoreSeckillServices;
use app\services\product\sku\StoreProductAttrValueServices;
use crmeb\services\CacheService;
use think\facade\App;
/**
* 限时秒杀 控制器
* Class StoreSeckill
* @package app\admin\controller\store
*/
class StoreSeckill extends AuthController
{
public function __construct(App $app, StoreSeckillServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
$where = $this->request->getMore([
[['status', 's'], ''],
[['store_name', 's'], '']
]);
return app('json')->success($this->services->systemPage($where));
}
/**
* 详情
* @param $id
* @return mixed
*/
public function read($id)
{
$info = $this->services->getInfo($id);
return app('json')->success(compact('info'));
}
/**
* 保存秒杀商品
* @param int $id
*/
public function save($id)
{
$data = $this->request->postMore([
[['product_id', 'd'], 0],
[['title', 's'], ''],
[['info', 's'], ''],
[['unit_name', 's'], ''],
['image', ''],
['images', []],
[['give_integral', 'd'], 0],
['section_time', []],
[['is_hot', 'd'], 0],
[['status', 'd'], 0],
[['num', 'd'], 0],
[['once_num', 'd'], 0],
[['time_id', 'd'], 0],
[['temp_id', 'd'], 0],
[['sort', 'd'], 0],
[['description', 's'], ''],
['attrs', []],
['items', []],
['copy', 0]
]);
validate(\app\adminapi\validate\marketing\StoreSeckillValidate::class)->scene('save')->check($data);
if ($data['section_time']) {
[$start_time, $end_time] = $data['section_time'];
if (strtotime($end_time) + 86400 < time()) {
return app('json')->fail('活动结束时间不能小于当前时间');
}
}
$seckill = [];
if ($id) {
$seckill = $this->services->get((int)$id);
if (!$seckill) {
return app('json')->fail('数据不存在');
}
}
//限制编辑
if ($data['copy'] == 0 && $seckill) {
if ($seckill['stop_time'] < time()) {
return app('json')->fail('活动已结束,请重新添加或复制');
}
}
if ($data['num'] < $data['once_num']) {
return app('json')->fail('限制单次购买数量不能大于总购买数量');
}
if ($data['copy'] == 1) {
$id = 0;
unset($data['copy']);
}
$this->services->saveData($id, $data);
return app('json')->success('保存成功');
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
if (!$id) return app('json')->fail('缺少参数');
$this->services->update($id, ['is_del' => 1]);
/** @var StoreProductAttrValueServices $storeProductAttrValueServices */
$storeProductAttrValueServices = app()->make(StoreProductAttrValueServices::class);
$unique = $storeProductAttrValueServices->value(['product_id' => $id, 'type' => 1], 'unique');
if ($unique) {
$name = 'seckill_' . $unique . '_1';
/** @var CacheService $cache */
$cache = app()->make(CacheService::class);
$cache->del($name);
}
return app('json')->success('删除成功!');
}
/**
* 修改状态
* @param $id
* @param $status
* @return mixed
*/
public function set_status($id, $status)
{
$this->services->update($id, ['status' => $status]);
return app('json')->success($status == 0 ? '关闭成功' : '开启成功');
}
/**
* 秒杀时间段列表
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
*/
public function time_list()
{
$list['data'] = sys_data('routine_seckill_time');
return app('json')->success(compact('list'));
}
}

View File

@ -0,0 +1,121 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\marketing\live;
use app\adminapi\controller\AuthController;
use app\services\live\LiveAnchorServices;
use think\facade\App;
/**
* 直播间主播
* Class LiveAnchor
* @package app\controller\admin\store
*/
class LiveAnchor extends AuthController
{
/**
* LiveAnchor constructor.
* @param App $app
* @param LiveAnchorServices $services
*/
public function __construct(App $app, LiveAnchorServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 列表
* @return mixed
*/
public function list()
{
$where = $this->request->postMore([
['kerword', ''],
]);
return app('json')->success($this->services->getList($where));
}
/**
* 添加修改表单
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function add()
{
list($id) = $this->request->getMore([
['id', 0],
], true);
return app('json')->success($this->services->add((int)$id));
}
/**
* 保存标签表单数据
* @param int $id
* @return mixed
*/
public function save()
{
$data = $this->request->postMore([
['id', 0],
['name', ''],
['wechat', ''],
['phone', ''],
['cover_img', '']
]);
if (!$data['name'] = trim($data['name'])) return app('json')->fail('名称不能为空!');
if (!$data['wechat'] = trim($data['wechat'])) return app('json')->fail('微信号不能为空!');
if (!$data['phone'] = trim($data['phone'])) return app('json')->fail('手机号不能为空!');
if (!check_phone($data['phone'])) return app('json')->fail('请输入正确手机号');
if (!$data['cover_img'] = trim($data['cover_img'])) return app('json')->fail('请选择主播图像');
$res = $this->services->save((int)$data['id'], $data);
if ($res === true) {
return app('json')->success('保存成功', ['auth' => false]);
}
return app('json')->success('请先去小程序认证主播', $res);
}
/**
* 删除
* @param $id
* @throws \Exception
*/
public function delete()
{
list($id) = $this->request->getMore([
['id', 0],
], true);
if (!$id) return app('json')->fail('数据不存在');
$this->services->delAnchor((int)$id);
return app('json')->success('刪除成功!');
}
/**
* 设置会员等级显示|隐藏
*
* @return json
*/
public function setShow($id = '', $is_show = '')
{
if ($is_show == '' || $id == '') return app('json')->fail('缺少参数');
return app('json')->success($this->services->setShow((int)$id, (int)$is_show));
}
/**
* 同步主播
* @return mixed
*/
public function syncAnchor()
{
$this->services->syncAnchor();
return app('json')->success('同步成功');
}
}

View File

@ -0,0 +1,118 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\marketing\live;
use app\adminapi\controller\AuthController;
use app\services\live\LiveGoodsServices;
use think\facade\App;
/**
* 直播间商品
* Class LiveGoods
* @package app\controller\admin\store
*/
class LiveGoods extends AuthController
{
/**
* LiveGoods constructor.
* @param App $app
* @param LiveGoodsServices $services
*/
public function __construct(App $app, LiveGoodsServices $services)
{
parent::__construct($app);
$this->services = $services;
}
public function list()
{
$where = $this->request->postMore([
['kerword', ''],
['status', ''],
['is_show', ''],
['live_id', 0]
]);
return app('json')->success($this->services->getList($where));
}
public function create()
{
[$product_ids] = $this->request->postMore([
['product_id', []]
], true);
if (!$product_ids) return app('json')->fail('请选择商品');
return app('json')->success($this->services->create($product_ids));
}
public function add()
{
[$goods_info] = $this->request->postMore([
['goods_info', []]
], true);
if (!$goods_info) return app('json')->fail('请选择商品');
foreach ($goods_info as $goods) {
if (!$goods['id']) return app('json')->fail('请选择商品');
if (!$goods['store_name']) return app('json')->fail('请输入名称');
if (!$goods['image']) return app('json')->fail('请选择背景图');
if (!$goods['price']) return app('json')->fail('请输入直播价格');
if ($goods['price'] <= 0) return app('json')->fail('直播价格必须大于0');
}
$this->services->add($goods_info);
return app('json')->success('添加成功');
}
public function detail($id)
{
if (!$id)
return app('json')->fail('数据不存在');
$goods = $this->services->get($id, ['*'], ['product']);
return app('json')->success('ok', $goods ? $goods->toArray() : []);
}
public function syncGoods()
{
$this->services->syncGoodStatus();
return app('json')->success('同步成功');
}
public function audit($id)
{
if (!$id)
return app('json')->fail('数据不存在');
$this->services->audit((int)$id);
return app('json')->success('提交审核成功');
}
public function resetAudit($id)
{
if (!$id)
return app('json')->fail('数据不存在');
$this->services->resetAudit((int)$id);
return app('json')->success('撤销成功');
}
public function setShow(int $id, $is_show)
{
if (!$id)
return app('json')->fail('数据不存在');
return app('json')->success($this->services->isShow($id, $is_show));
}
public function delete($id)
{
if (!$id)
return app('json')->fail('数据不存在');
$this->services->delete($id);
return app('json')->success('删除成功');
}
}

View File

@ -0,0 +1,129 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\marketing\live;
use app\adminapi\controller\AuthController;
use app\services\live\LiveRoomServices;
use think\facade\App;
/**
* 直播间
* Class LiveRoom
* @package app\adminapi\controller\v1\marketing\live
*/
class LiveRoom extends AuthController
{
/**
* LiveRoom constructor.
* @param App $app
* @param LiveRoomServices $services
*/
public function __construct(App $app, LiveRoomServices $services)
{
parent::__construct($app);
$this->services = $services;
}
public function list()
{
$where = $this->request->postMore([
['kerword', ''],
['status', '']
]);
return app('json')->success($this->services->getList($where));
}
public function detail($id)
{
if (!$id)
return app('json')->fail('数据不存在');
return app('json')->success('ok', $this->services->get((int)$id)->toArray());
}
public function add()
{
$data = $this->request->postMore([
['name', ''],
['cover_img', ''],
['share_img', ''],
['anchor_name', ''],
['anchor_wechat', ''],
['phone', ''],
['start_time', ['', '']],
['type', 1],
['screen_type', 1],
['close_like', 0],
['close_goods', 0],
['close_comment', 0],
['replay_status', 1],
['sort', 0]
]);
if (!$data['name']) return app('json')->fail('请输入名称');
if (!$data['cover_img']) return app('json')->fail('请选择背景图');
if (!$data['share_img']) return app('json')->fail('请选择分享图');
if (!$data['anchor_wechat']) return app('json')->fail('请选择主播');
if (!$data['start_time'] || count($data['start_time']) != 2) return app('json')->fail('请选择直播开始、结束时间');
if (!$data['phone'] || !check_phone($data['phone'])) return app('json')->fail('请输入正确手机号');
[$data['start_time'], $data['end_time']] = $data['start_time'];
$this->services->add($data);
return app('json')->success('添加成功');
}
public function addGoods()
{
[$room_id, $goods_ids] = $this->request->postMore([
['room_id', 0],
['goods_ids', []]
], true);
if (!$room_id) return app('json')->fail('请选择直播间');
if (!$goods_ids) return app('json')->fail('请选择商品');
$this->services->exportGoods((int)$room_id, $goods_ids);
return app('json')->success('添加商品成功');
}
public function apply($id)
{
[$status, $msg] = $this->request->postMore([
['status', ''],
['msg', '']
], true);
if (!$id)
return app('json')->fail('数据不存在');
$status = $status == 1 ? 1 : -1;
if ($status == -1 && !$msg)
return app('json')->fail('请输入理由');
$this->services->apply((int)$id, $status, $msg);
return app('json')->success('操作成功');
}
public function setShow($id, $is_show)
{
if (!$id)
return app('json')->fail('数据不存在');
return app('json')->success($this->services->isShow((int)$id, $is_show));
}
public function delete($id)
{
if (!$id)
return app('json')->fail('数据不存在');
$this->services->delete($id);
return app('json')->success('删除成功');
}
public function syncRoom()
{
$this->services->syncRoomStatus();
return app('json')->success('同步成功');
}
}

View File

@ -0,0 +1,163 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\merchant;
use think\facade\App;
use app\adminapi\controller\AuthController;
use app\services\system\store\SystemStoreServices;
/**
* 门店管理控制器
* Class SystemAttachment
* @package app\admin\controller\system
*
*/
class SystemStore extends AuthController
{
/**
* 构造方法
* SystemStore constructor.
* @param App $app
* @param SystemStoreServices $services
*/
public function __construct(App $app, SystemStoreServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 获取门店列表1
* @return mixed
*/
public function index()
{
$where = $this->request->getMore([
[['keywords', 's'], ''],
[['type', 'd'], 0]
]);
return app('json')->success($this->services->getStoreList($where));
}
/**
* 获取门店头部
* @return mixed
*/
public function get_header()
{
$count = $this->services->getStoreData();
return app('json')->success(compact('count'));
}
/**
* 门店设置
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function get_info()
{
[$id] = $this->request->getMore([
[['id', 'd'], 0],
], true);
$info = $this->services->getStoreDispose($id);
return app('json')->success(compact('info'));
}
/**
* 位置选择
* @return mixed
*/
public function select_address()
{
$key = sys_config('tengxun_map_key');
if (!$key) return app('json')->fail('请前往设置->系统设置->物流配置 配置腾讯地图KEY');
return app('json')->success(compact('key'));
}
/**
* 设置单个门店是否显示
* @param string $is_show
* @param string $id
* @return json
*/
public function set_show($is_show = '', $id = '')
{
($is_show == '' || $id == '') && app('json')->fail('缺少参数');
$res = $this->services->update((int)$id, ['is_show' => (int)$is_show]);
if ($res) {
return app('json')->success($is_show == 1 ? '设置显示成功' : '设置隐藏成功');
} else {
return app('json')->fail($is_show == 1 ? '设置显示失败' : '设置隐藏失败');
}
}
/**
* 保存修改门店信息
* param int $id
* */
public function save($id = 0)
{
$data = $this->request->postMore([
['name', ''],
['introduction', ''],
['image', ''],
['phone', ''],
['address', ''],
['detailed_address', ''],
['latlng', ''],
['day_time', []],
]);
validate(\app\adminapi\validate\merchant\SystemStoreValidate::class)->scene('save')->check($data);
$data['address'] = implode(',', $data['address']);
$data['latlng'] = explode(',', $data['latlng']);
if (!isset($data['latlng'][0]) || !isset($data['latlng'][1])) {
return app('json')->fail('请选择门店位置');
}
$data['latitude'] = $data['latlng'][0];
$data['longitude'] = $data['latlng'][1];
$data['day_time'] = implode(' - ', $data['day_time']);
unset($data['latlng']);
if ($data['image'] && strstr($data['image'], 'http') === false) {
$site_url = sys_config('site_url');
$data['image'] = $site_url . $data['image'];
}
$this->services->saveStore((int)$id, $data);
return app('json')->success('操作成功!');
}
/**
* 删除恢复门店
* @param $id
*/
public function delete($id)
{
if (!$id) return app('json')->fail('数据不存在');
$storeInfo = $this->services->get($id);
if (!$storeInfo) {
return app('json')->fail('数据不存在');
}
if ($storeInfo->is_del == 1) {
$storeInfo->is_del = 0;
if (!$storeInfo->save())
return app('json')->fail('恢复失败,请稍候再试!');
else
return app('json')->success('恢复门店成功!');
} else {
$storeInfo->is_del = 1;
if (!$storeInfo->save())
return app('json')->fail('删除失败,请稍候再试!');
else
return app('json')->success('删除门店成功!');
}
}
}

View File

@ -0,0 +1,174 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\merchant;
use app\services\system\store\SystemStoreServices;
use app\services\system\store\SystemStoreStaffServices;
use think\facade\App;
use app\adminapi\controller\AuthController;
/**
* 店员
* Class SystemStoreStaff
* @package app\adminapi\controller\v1\merchant
*/
class SystemStoreStaff extends AuthController
{
/**
* 构造方法
* SystemStoreStaff constructor.
* @param App $app
* @param SystemStoreStaffServices $services
*/
public function __construct(App $app, SystemStoreStaffServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 获取店员列表
* @return mixed
*/
public function index()
{
$where = $this->request->getMore([
[['store_id', 'd'], 0],
]);
return app('json')->success($this->services->getStoreStaffList($where));
}
/**
* 门店列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function store_list(SystemStoreServices $services)
{
return app('json')->success($services->getStore());
}
/**
* 店员新增表单
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function create()
{
return app('json')->success($this->services->createForm());
}
/**
* 店员修改表单
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function edit()
{
[$id] = $this->request->getMore([
[['id', 'd'], 0],
], true);
return app('json')->success($this->services->updateForm($id));
}
/**
* 保存店员信息
*/
public function save($id = 0)
{
$data = $this->request->postMore([
['image', ''],
['uid', 0],
['avatar', ''],
['store_id', ''],
['staff_name', ''],
['phone', ''],
['verify_status', 1],
['status', 1],
]);
if (!$id) {
if ($data['image'] == '') {
return app('json')->fail('请选择用户');
}
if ($this->services->count(['uid' => $data['uid']])) {
return app('json')->fail('添加的核销员用户已存在!');
}
$data['uid'] = $data['image']['uid'];
$data['avatar'] = $data['image']['image'];
} else {
$data['avatar'] = $data['image'];
}
if ($data['uid'] == 0) {
return app('json')->fail('请选择用户');
}
if ($data['store_id'] == '') {
return app('json')->fail('请选择所属提货点');
}
if ($data['staff_name'] == ''){
return app('json')->fail('请填写核销员名称');
}
if ($data['phone'] == ''){
return app('json')->fail('请填写核销员电话');
}
unset($data['image']);
if ($id) {
$res = $this->services->update($id, $data);
if ($res) {
return app('json')->success('编辑成功');
} else {
return app('json')->fail('编辑失败');
}
} else {
$data['add_time'] = time();
$res = $this->services->save($data);
if ($res) {
return app('json')->success('核销员添加成功');
} else {
return app('json')->fail('核销员添加失败,请稍后再试');
}
}
}
/**
* 设置单个店员是否开启
* @param string $is_show
* @param string $id
* @return mixed
*/
public function set_show($is_show = '', $id = '')
{
if ($is_show == '' || $id == '') {
app('json')->fail('缺少参数');
}
$res = $this->services->update($id, ['status' => (int)$is_show]);
if ($res) {
return app('json')->success($is_show == 1 ? '开启成功' : '关闭成功');
} else {
return app('json')->fail($is_show == 1 ? '开启失败' : '关闭失败');
}
}
/**
* 删除店员
* @param $id
*/
public function delete($id)
{
if (!$id) return app('json')->fail('数据不存在');
if (!$this->services->delete($id))
return app('json')->fail('删除失败,请稍候再试!');
else
return app('json')->success('删除成功!');
}
}

View File

@ -0,0 +1,88 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\merchant;
use app\adminapi\controller\AuthController;
use app\services\order\StoreOrderServices;
use app\services\user\UserServices;
use think\facade\App;
/**
* 核销订单
* Class SystemVerifyOrder
* @package app\adminapi\controller\v1\merchant
*/
class SystemVerifyOrder extends AuthController
{
/**
* 构造方法
* SystemVerifyOrder constructor.
* @param App $app
* @param StoreOrderServices $services
*/
public function __construct(App $app, StoreOrderServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 获取核销订单列表
* return json
*/
public function list()
{
$where = $this->request->getMore([
['data', '', '', 'time'],
['real_name', ''],
['store_id', ''],
['type', ''],
['field_key', ''],
]);
$data = $this->services->getOrderList($where + ['status' => 6], ['*'], ['store', 'staff']);
return app('json')->success(['count' => $data['count'], 'data' => $data['data'], 'badge' => $data['stat']]);
}
/**
* 未使用,获取核销订单头部
* @return mixed
*/
public function getVerifyBadge()
{
return app('json')->success([]);
}
/**
* 订单列表推荐人详细
* @param $uid
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function order_spread_user($uid)
{
/** @var UserServices $userServices */
$userServices = app()->make(UserServices::class);
$userInfo = $userServices->getUserInfo((int)$uid);
$spread = [];
if ($userInfo['spread_uid']) {
$spread = $userServices->getUserInfo((int)$userInfo['spread_uid']);
if ($spread) {
$spread = $spread->toArray();
$spread['brokerage_pric'] = $spread['brokerage_price'];
$spread['birthday'] = $spread['birthday'] ? date('Y-m-d', $spread['birthday']) : '';
$spread['last_time'] = $spread['last_time'] ? date('Y-m-d H:i:s', $spread['last_time']) : '';
}
}
return app('json')->success(['spread' => $spread]);
}
}

View File

@ -0,0 +1,136 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\notification\sms;
use app\services\message\sms\SmsAdminServices;
use app\services\message\sms\SmsRecordServices;
use app\services\serve\ServeServices;
use crmeb\services\CacheService;
use app\adminapi\controller\AuthController;
use think\facade\App;
/**
* 短信配置
* Class SmsConfig
* @package app\admin\controller\sms
*/
class SmsConfig extends AuthController
{
/**
* 构造方法
* SmsConfig constructor.
* @param App $app
* @param SmsAdminServices $services
*/
public function __construct(App $app, SmsAdminServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 保存短信配置
* @return mixed
*/
public function save_basics()
{
[$account, $token] = $this->request->postMore([
['sms_account', ''],
['sms_token', '']
], true);
validate(\app\adminapi\validate\notification\SmsConfigValidate::class)->check(['sms_account' => $account, 'sms_token' => $token]);
if ($this->services->login($account, $token)) {
return app('json')->success('登录成功');
} else {
return app('json')->fail('账号或密码错误');
}
}
/**
* 检测登录
* @return mixed
*/
public function is_login(ServeServices $services)
{
$sms_info = CacheService::redisHandler()->get('sms_account');
$data = ['status' => false, 'info' => ''];
if ($sms_info) {
try {
$result = $services->user()->getUser();
} catch (\Throwable $e) {
$result = [];
}
if (!$result) {
$this->logout();
} else {
$data['status'] = true;
$data['info'] = $sms_info;
}
return app('json')->success($data);
} else {
\crmeb\services\CacheService::clear();
$account = sys_config('sms_account');
$password = sys_config('sms_token');
//没有退出登录 清空这两个数据 自动登录
if ($account && $password) {
$res = $services->user()->login($account, $password);
if ($res) {
CacheService::redisHandler()->set('sms_account', $account);
$data['status'] = true;
$data['info'] = $account;
}
}
}
return app('json')->success($data);
}
/**
* 退出
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function logout()
{
$res = CacheService::redisHandler()->delete('sms_account');
if ($res) {
$this->services->updateSmsConfig('', '');
CacheService::clear();
return app('json')->success('退出成功');
} else {
return app('json')->fail('退出失败');
}
}
/**
* 短信发送记录
* @return mixed
*/
public function record(ServeServices $services)
{
[$page, $limit, $status] = $this->request->getMore([
[['page', 'd'], 0],
[['limit', 'd'], 10],
['type', '', '', 'status'],
], true);
return app('json')->success($services->user()->record($page, $limit, 1, $status));
}
/**
* @return mixed
*/
public function data()
{
return app('json')->success($this->services->getSmsData());
}
}

View File

@ -11,10 +11,14 @@
namespace app\adminapi\controller\v1\order;
use app\adminapi\controller\AuthController;
use app\services\kefu\LoginServices;
use app\services\message\service\StoreServiceLogServices;
use app\services\message\service\StoreServiceServices;
use app\services\order\DeliveryServiceServices;
use app\services\user\UserServices;
use app\services\user\UserWechatuserServices;
use crmeb\exceptions\AdminException;
use crmeb\services\CacheService;
use think\facade\App;
/**
@ -25,9 +29,9 @@ use think\facade\App;
class DeliveryService extends AuthController
{
/**
* DeliveryService constructor.
* StoreService constructor.
* @param App $app
* @param DeliveryServiceServices $services
* @param StoreServiceServices $services
*/
public function __construct(App $app, DeliveryServiceServices $services)
{

View File

@ -0,0 +1,93 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\order;
use app\adminapi\controller\AuthController;
use app\services\order\OtherOrderServices;
use app\services\other\QrcodeServices;
use crmeb\utils\Canvas;
use think\facade\App;
use think\facade\Log;
class OtherOrder extends AuthController
{
/**
* OtherOrder constructor.
* @param App $app
* @param OtherOrderServices $service
*/
public function __construct(App $app, OtherOrderServices $service)
{
parent::__construct($app);
$this->services = $service;
}
/**线下收银
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function scan_list()
{
$where = $this->request->getMore([
['order_id', ''],
['add_time', ''],
['name', ''],
['page', 1],
['limit', 20],
]);
$data = $this->services->getScanOrderList($where);
return app('json')->success($data);
}
/** 获取线下二维码
* @return mixed
*/
public function offline_scan()
{
[$type] = $this->request->getMore([
['type', 1]
], true);
//生成h5地址
$weixinPage = "/pages/annex/offline_pay/index";
$weixinFileName = "wechat_offline_scan.png";
/** @var QrcodeServices $QrcodeService */
$QrcodeService = app()->make(QrcodeServices::class);
$wechatQrcode = $QrcodeService->getWechatQrcodePath($weixinFileName, $weixinPage, false, false);
//生成小程序地址
$routineQrcode = $QrcodeService->getRoutineQrcodePath(4, 6, 3, [], false);
$qrcod = ['wechat' => $wechatQrcode, 'routine' => $routineQrcode];
if ($type) {
//生成画布
$canvas = Canvas::instance();
$path = 'uploads/offline/';
$imageType = 'jpg';
$siteUrl = sys_config('site_url');
$canvas->setImageUrl(public_path().'statics/qrcode/offlines.jpg')->setImageHeight(730)->setImageWidth(500)->pushImageValue();
foreach ($qrcod as $k => $v) {
if ($v) {
$name = 'offline_' . $k;
$canvas->setImageUrl($v)->setImageHeight(344)->setImageWidth(344)->setImageLeft(76)->setImageTop(120)->pushImageValue();
$image = $canvas->setFileName($name)->setImageType($imageType)->setPath($path)->setBackgroundWidth(500)->setBackgroundHeight(720)->starDrawChart();
$data[$k] = $image ? $siteUrl . '/' . $image : '';
}else{
$data[$k] = "";
}
}
} else {
$data = ['wechat' => $wechatQrcode, 'routine' => $routineQrcode];
}
return app('json')->success($data);
}
}

View File

@ -0,0 +1,607 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\order;
use app\adminapi\controller\AuthController;
use app\adminapi\validate\order\StoreOrderValidate;
use app\services\serve\ServeServices;
use app\services\order\{
StoreOrderDeliveryServices,
StoreOrderRefundServices,
StoreOrderStatusServices,
StoreOrderTakeServices,
StoreOrderWriteOffServices,
StoreOrderServices
};
use app\services\pay\OrderOfflineServices;
use app\services\shipping\ExpressServices;
use app\services\system\store\SystemStoreServices;
use app\services\user\UserServices;
use think\facade\App;
/**
* 订单管理
* Class StoreOrder
* @package app\adminapi\controller\v1\order
*/
class StoreOrder extends AuthController
{
/**
* StoreOrder constructor.
* @param App $app
* @param StoreOrderServices $service
* @method temp
*/
public function __construct(App $app, StoreOrderServices $service)
{
parent::__construct($app);
$this->services = $service;
}
/**
* 获取订单类型数量
* @return mixed
*/
public function chart()
{
$where = $this->request->getMore([
['data', '', '', 'time'],
[['type', 'd'], 0],
]);
$data = $this->services->orderCount($where);
return app('json')->success($data);
}
/**
* 获取订单列表
* @return mixed
*/
public function lst()
{
$where = $this->request->getMore([
['status', ''],
['real_name', ''],
['is_del', ''],
['data', '', '', 'time'],
['type', ''],
['pay_type', ''],
['order', ''],
['field_key', ''],
]);
$where['shipping_type'] = 1;
$where['is_system_del'] = 0;
return app('json')->success($this->services->getOrderList($where, ['*'], ['pink', 'invoice']));
}
/**
* 核销码核销
* @param $code 核销码
* @param int $confirm 确认核销 0=确认1=核销
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function write_order(StoreOrderWriteOffServices $services)
{
[$code, $confirm] = $this->request->getMore([
['code', ''],
['confirm', 0]
], true);
if (!$code) return app('json')->fail('Lack of write-off code');
$orderInfo = $services->writeOffOrder($code, (int)$confirm);
if ($confirm == 0) {
return app('json')->success('验证成功', $orderInfo);
}
return app('json')->success('Write off successfully');
}
/**
* 订单号核销
* @param StoreOrderWriteOffServices $services
* @param $order_id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function write_update(StoreOrderWriteOffServices $services, $order_id)
{
$orderInfo = $this->services->getOne(['order_id' => $order_id, 'is_del' => 0]);
if ($orderInfo->shipping_type != 2 && $orderInfo->delivery_type != 'send') {
return app('json')->fail('核销订单未查到!');
} else {
if (!$orderInfo->verify_code) {
return app('json')->fail('Lack of write-off code');
}
$orderInfo = $services->writeOffOrder($orderInfo->verify_code, 1);
if ($orderInfo) {
return app('json')->success('Write off successfully');
} else {
return app('json')->fail('核销失败!');
}
}
}
/**
* 修改支付金额等
* @param $id
* @return mixed|\think\response\Json|void
*/
public function edit($id)
{
if (!$id) return app('json')->fail('Data does not exist!');
return app('json')->success($this->services->updateForm($id));
}
/**
* 修改订单
* @param $id
* @return mixed
*/
public function update($id)
{
if (!$id) return app('json')->fail('Missing order ID');
$data = $this->request->postMore([
['order_id', ''],
['total_price', 0],
['total_postage', 0],
['pay_price', 0],
['pay_postage', 0],
['gain_integral', 0],
]);
validate(StoreOrderValidate::class)->check($data);
if ($data['total_price'] < 0) return app('json')->fail('Please enter the total price');
if ($data['pay_price'] < 0) return app('json')->fail('Please enter the actual payment amount');
$this->services->updateOrder((int)$id, $data);
return app('json')->success('Modified success');
}
/**
* 获取快递公司
* @return mixed
*/
public function express(ExpressServices $services)
{
return app('json')->success($services->express(['is_show' => 1]));
}
/**
* 批量删除用户已经删除的订单
* @return mixed
*/
public function del_orders()
{
[$ids] = $this->request->postMore([
['ids', []],
], true);
if (!count($ids)) return app('json')->fail('请选择需要删除的订单');
if ($this->services->getOrderIdsCount($ids))
return app('json')->fail('您选择的的订单存在用户未删除的订单');
if ($this->services->batchUpdate($ids, ['is_system_del' => 1]))
return app('json')->success('SUCCESS');
else
return app('json')->fail('ERROR');
}
/**
* 删除订单
* @param $id
* @return mixed
*/
public function del($id)
{
if (!$id || !($orderInfo = $this->services->get($id)))
return app('json')->fail('订单不存在');
if (!$orderInfo->is_del)
return app('json')->fail('订单用户未删除无法删除');
$orderInfo->is_system_del = 1;
if ($orderInfo->save())
return app('json')->success('SUCCESS');
else
return app('json')->fail('ERROR');
}
/**
* 订单发送货
* @param $id 订单id
* @return mixed
*/
public function update_delivery($id, StoreOrderDeliveryServices $services)
{
$data = $this->request->postMore([
['type', 1],
['delivery_name', ''],//快递公司名称
['delivery_id', ''],//快递单号
['delivery_code', ''],//快递公司编码
['express_record_type', 2],//发货记录类型
['express_temp_id', ""],//电子面单模板
['to_name', ''],//寄件人姓名
['to_tel', ''],//寄件人电话
['to_addr', ''],//寄件人地址
['sh_delivery_name', ''],//送货人姓名
['sh_delivery_id', ''],//送货人电话
['sh_delivery_uid', ''],//送货人ID
['fictitious_content', '']//虚拟发货内容
]);
$services->delivery((int)$id, $data);
return app('json')->success('SUCCESS');
}
/**
* 确认收货
* @param $id 订单id
* @return mixed
* @throws \Exception
*/
public function take_delivery(StoreOrderTakeServices $services, $id)
{
if (!$id) return app('json')->fail('缺少参数');
$order = $this->services->get($id);
if (!$order)
return app('json')->fail('Data does not exist!');
if ($order['status'] == 2)
return app('json')->fail('不能重复收货!');
if ($order['paid'] == 1 && $order['status'] == 1)
$data['status'] = 2;
else if ($order['pay_type'] == 'offline')
$data['status'] = 2;
else
return app('json')->fail('请先发货或者送货!');
if (!$this->services->update($id, $data)) {
return app('json')->fail('收货失败,请稍候再试!');
} else {
$services->storeProductOrderUserTakeDelivery($order);
return app('json')->success('收货成功');
}
}
/**
* 获取配置信息
* @return mixed
*/
public function getDeliveryInfo()
{
return app('json')->success([
'express_temp_id' => sys_config('config_export_temp_id'),
'id' => sys_config('config_export_id'),
'to_name' => sys_config('config_export_to_name'),
'to_tel' => sys_config('config_export_to_tel'),
'to_add' => sys_config('config_export_to_address'),
'export_open' => (int)sys_config('config_export_open') ? true : false
]);
}
/**
* 退款表单生成
* @param $id 订单id
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function refund(StoreOrderRefundServices $services, $id)
{
if (!$id) {
return app('json')->fail('Data does not exist!');
}
return app('json')->success($services->refundOrderForm((int)$id));
}
/**
* 订单退款
* @param $id 订单id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function update_refund(StoreOrderRefundServices $services, $id)
{
$data = $this->request->postMore([
['refund_price', 0],
['type', 1]
]);
if (!$id) {
return app('json')->fail('Data does not exist!');
}
$order = $this->services->get($id);
if (!$order) {
return app('json')->fail('Data does not exist!');
}
//0元退款
if ($order['pay_price'] == 0 && in_array($order['refund_status'], [0, 1])) {
$refund_price = 0;
} else {
if ($order['pay_price'] == $order['refund_price']) {
return app('json')->fail('已退完支付金额!不能再退款了');
}
if (!$data['refund_price']) {
return app('json')->fail('请输入退款金额');
}
$refund_price = $data['refund_price'];
$data['refund_price'] = bcadd($data['refund_price'], $order['refund_price'], 2);
$bj = bccomp((string)$order['pay_price'], (string)$data['refund_price'], 2);
if ($bj < 0) {
return app('json')->fail('退款金额大于支付金额,请修改退款金额');
}
}
if ($data['type'] == 1) {
$data['refund_status'] = 2;
} else if ($data['type'] == 2) {
$data['refund_status'] = 0;
}
$type = $data['type'];
unset($data['type']);
$refund_data['pay_price'] = $order['pay_price'];
$refund_data['refund_price'] = $refund_price;
if ($order['refund_price'] > 0) {
$refund_data['refund_id'] = $order['order_id'] . rand(100, 999);
}
//退款处理
$services->payOrderRefund($type, $order, $refund_data);
//修改订单退款状态
if ($this->services->update($id, $data)) {
$services->storeProductOrderRefundY($data, $order, $refund_price);
return app('json')->success('退款成功');
} else {
$services->storeProductOrderRefundYFasle((int)$id, $refund_price);
return app('json')->fail('退款失败');
}
}
/**
* 订单详情
* @param $id 订单id
* @return mixed
*/
public function order_info($id)
{
if (!$id || !($orderInfo = $this->services->get($id))) {
return app('json')->fail('订单不存在');
}
/** @var UserServices $services */
$services = app()->make(UserServices::class);
$userInfo = $services->get($orderInfo['uid']);
if (!$userInfo) return app('json')->fail('用户信息不存在');
$userInfo = $userInfo->hidden(['pwd', 'add_ip', 'last_ip', 'login_type']);
$userInfo['spread_name'] = '无';
if ($userInfo['spread_uid']) {
$spreadName = $services->value(['uid' => $userInfo['spread_uid']], 'nickname');
if ($spreadName) {
$userInfo['spread_name'] = $spreadName;
} else {
$userInfo['spread_uid'] = '';
}
} else {
$userInfo['spread_uid'] = '';
}
$orderInfo = $this->services->tidyOrder($orderInfo->toArray());
if ($orderInfo['store_id'] && $orderInfo['shipping_type'] == 2) {
/** @var $storeServices */
$storeServices = app()->make(SystemStoreServices::class);
$orderInfo['_store_name'] = $storeServices->value(['id' => $orderInfo['store_id']], 'name');
} else
$orderInfo['_store_name'] = '';
$userInfo = $userInfo->toArray();
return app('json')->success(compact('orderInfo', 'userInfo'));
}
/**
* 查询物流信息
* @param $id 订单id
* @return mixed
*/
public function get_express($id, ExpressServices $services)
{
if (!$id || !($orderInfo = $this->services->get($id)))
return app('json')->fail('订单不存在');
if ($orderInfo['delivery_type'] != 'express' || !$orderInfo['delivery_id'])
return app('json')->fail('该订单不存在快递单号');
$cacheName = $orderInfo['order_id'] . $orderInfo['delivery_id'];
$data['delivery_name'] = $orderInfo['delivery_name'];
$data['delivery_id'] = $orderInfo['delivery_id'];
$data['result'] = $services->query($cacheName, $orderInfo['delivery_id'], $orderInfo['delivery_code'] ?? null);
return app('json')->success($data);
}
/**
* 获取修改配送信息表单结构
* @param $id 订单id
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function distribution(StoreOrderDeliveryServices $services, $id)
{
if (!$id) {
return app('json')->fail('订单不存在');
}
return app('json')->success($services->distributionForm((int)$id));
}
/**
* 修改配送信息
* @param $id 订单id
* @return mixed
*/
public function update_distribution(StoreOrderDeliveryServices $services, $id)
{
$data = $this->request->postMore([['delivery_name', ''], ['delivery_id', '']]);
if (!$id) return app('json')->fail('Data does not exist!');
$services->updateDistribution($id, $data);
return app('json')->success('Modified success');
}
/**
* 不退款表单结构
* @param $id
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function no_refund(StoreOrderRefundServices $services, $id)
{
if (!$id) return app('json')->fail('Data does not exist!');
return app('json')->success($services->noRefundForm((int)$id));
}
/**
* 订单不退款
* @param StoreOrderRefundServices $services
* @param $id
* @return mixed
*/
public function update_un_refund(StoreOrderRefundServices $services, $id)
{
if (!$id || !($orderInfo = $this->services->get($id)))
return app('json')->fail('订单不存在');
[$refund_reason] = $this->request->postMore([['refund_reason', '']], true);
if (!$refund_reason) {
return app('json')->fail('请输入不退款原因');
}
$orderInfo->refund_reason = $refund_reason;
$orderInfo->refund_status = 0;
$orderInfo->save();
$services->storeProductOrderRefundNo((int)$id, $refund_reason);
$services->OrderRefundNoSendTemplate($orderInfo);
return app('json')->success('Modified success');
}
/**
* 线下支付
* @param $id 订单id
* @return mixed
*/
public function pay_offline(OrderOfflineServices $services, $id)
{
if (!$id) return app('json')->fail('缺少参数');
$res = $services->orderOffline((int)$id);
if ($res) {
return app('json')->success('Modified success');
} else {
return app('json')->fail('Modification failed');
}
}
/**
* 退积分表单获取
* @param $id
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function refund_integral(StoreOrderRefundServices $services, $id)
{
if (!$id)
return app('json')->fail('订单不存在');
return app('json')->success($services->refundIntegralForm((int)$id));
}
/**
* 退积分保存
* @param $id
* @return mixed
*/
public function update_refund_integral(StoreOrderRefundServices $services, $id)
{
[$back_integral] = $this->request->postMore([['back_integral', 0]], true);
if (!$id || !($orderInfo = $this->services->get($id))) {
return app('json')->fail('订单不存在');
}
if ($orderInfo->is_del) {
return app('json')->fail('订单已删除无法退积分');
}
if ($back_integral <= 0) {
return app('json')->fail('请输入积分');
}
if ($orderInfo['use_integral'] == $orderInfo['back_integral']) {
return app('json')->fail('已退完积分!不能再积分了');
}
$data['back_integral'] = bcadd((string)$back_integral, (string)$orderInfo['back_integral'], 2);
$bj = bccomp((string)$orderInfo['use_integral'], (string)$data['back_integral'], 2);
if ($bj < 0) {
return app('json')->fail('退积分大于支付积分,请修改退积分');
}
//积分退款处理
$orderInfo->back_integral = $data['back_integral'];
if ($services->refundIntegral($orderInfo, $back_integral)) {
return app('json')->success('退积分成功');
} else {
return app('json')->fail('退积分失败');
}
}
/**
* 修改备注
* @param $id
* @return mixed
*/
public function remark($id)
{
$data = $this->request->postMore([['remark', '']]);
if (!$data['remark'])
return app('json')->fail('请输入要备注的内容');
if (!$id)
return app('json')->fail('缺少参数');
if (!$order = $this->services->get($id)) {
return app('json')->fail('修改的订单不存在!');
}
$order->remark = $data['remark'];
if ($order->save()) {
return app('json')->success('备注成功');
} else
return app('json')->fail('备注失败');
}
/**
* 获取订单状态列表并分页
* @param $id
* @return mixed
*/
public function status(StoreOrderStatusServices $services, $id)
{
if (!$id) return app('json')->fail('缺少参数');
return app('json')->success($services->getStatusList(['oid' => $id])['list']);
}
/**
* 易联云打印机打印
* @param $id
* @return mixed
*/
public function order_print($id)
{
if (!$id) return app('json')->fail('缺少参数');
$order = $this->services->get($id);
if (!$order) {
return app('json')->fail('订单没有查到,无法打印!');
}
$res = $this->services->orderPrint($order, $order->cart_id);
if ($res) {
return app('json')->success('打印成功');
} else {
return app('json')->fail('打印失败');
}
}
}

View File

@ -0,0 +1,128 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\order;
use app\adminapi\controller\AuthController;
use app\services\order\StoreOrderInvoiceServices;
use app\services\order\StoreOrderServices;
use app\services\product\product\StoreProductServices;
use app\services\system\store\SystemStoreServices;
use app\services\user\UserServices;
use think\facade\App;
/**
* Class UserLevel
* @package app\adminapi\controller\v1\order
*/
class StoreOrderInvoice extends AuthController
{
/**
* StoreOrderInvoice constructor.
* @param App $app
* @param StoreOrderInvoiceServices $services
*/
public function __construct(App $app, StoreOrderInvoiceServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 获取订单类型数量
* @return mixed
*/
public function chart()
{
$where = $this->request->getMore([
['data', '', '', 'time'],
[['type', 'd'], 0],
]);
$data = $this->services->chart($where);
return app('json')->success($data);
}
public function list()
{
$where = $this->request->getMore([
['status', 0],
['real_name', ''],
['header_type', ''],
['type', ''],
['data', '', '', 'time'],
['field_key', ''],
]);
return app('json')->success($this->services->getList($where));
}
/**
* 设置发票状态
* @param string $id
* @return mixed
*/
public function set_invoice($id = '')
{
if ($id == '') return app('json')->fail('缺少参数');
$data = $this->request->postMore([
['is_invoice', 0],
['invoice_number', 0],
['remark', '']
]);
if ($data['is_invoice'] == 1 && !$data['invoice_number']) {
return app('json')->fail('请填写开票号');
}
if ($data['invoice_number'] && !preg_match('/^\d{8,10}$/', $data['invoice_number'])) {
return app('json')->fail('请填写正确的开票号');
}
$this->services->setInvoice((int)$id, $data);
return app('json')->success('设置成功');
}
/**
* 订单详情
* @param $id 订单id
* @return mixed
*/
public function orderInfo(StoreProductServices $productServices, StoreOrderServices $orderServices, $id)
{
if (!$id || !($orderInfo = $orderServices->get($id))) {
return app('json')->fail('订单不存在');
}
/** @var UserServices $services */
$services = app()->make(UserServices::class);
$userInfo = $services->get($orderInfo['uid']);
if (!$userInfo) {
return app('json')->fail('用户信息不存在');
}
$userInfo = $userInfo->hidden(['pwd', 'add_ip', 'last_ip', 'login_type']);
$userInfo['spread_name'] = '';
if ($userInfo['spread_uid'])
$userInfo['spread_name'] = $services->value(['uid' => $userInfo['spread_uid']], 'nickname');
$orderInfo = $orderServices->tidyOrder($orderInfo->toArray(), true);
$orderInfo['add_time'] = $orderInfo['_add_time'] ?? '';
$productId = array_column($orderInfo['cartInfo'], 'product_id');
$cateData = $productServices->productIdByProductCateName($productId);
foreach ($orderInfo['cartInfo'] as &$item) {
$item['class_name'] = $cateData[$item['product_id']] ?? '';
}
if ($orderInfo['store_id'] && $orderInfo['shipping_type'] == 2) {
/** @var $storeServices */
$storeServices = app()->make(SystemStoreServices::class);
$orderInfo['_store_name'] = $storeServices->value(['id' => $orderInfo['store_id']], 'name');
} else {
$orderInfo['_store_name'] = '';
}
$userInfo = $userInfo->toArray();
$invoice = $this->services->getOne(['order_id' => $id]);
return app('json')->success(compact('orderInfo', 'userInfo', 'invoice'));
}
}

View File

@ -12,6 +12,7 @@ namespace app\adminapi\controller\v1\product;
use app\adminapi\controller\AuthController;
use app\services\product\product\CopyTaobaoServices;
use app\services\serve\ServeServices;
use think\facade\App;
@ -21,12 +22,41 @@ use think\facade\App;
*/
class CopyTaobao extends AuthController
{
/**
* CopyTaobao constructor.
* @param App $app
* @param CopyTaobaoServices $services
*/
public function __construct(App $app, CopyTaobaoServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* @return mixed
*/
public function getConfig()
{
$data = [];
$copy = sys_config('system_product_copy_type', 1);
$data['copy_type'] = $copy;
$data['copy_num'] = 0;
if ($copy == 1) {//一号通
/** @var ServeServices $serverServices */
$serverServices = app()->make(ServeServices::class);
try {
$info = $serverServices->user()->getUser();
} catch (\Throwable $e) {
$info = [];
}
if ($info) {
$data['copy_num'] = $info['copy']['num'] ?? 0;
}
}
return app('json')->success($data);
}
/**
* 复制商品
* @return mixed

View File

@ -232,10 +232,12 @@ class StoreProduct extends AuthController
*/
public function delete($id)
{
//删除商品检测是否有参与活动
$this->service->checkActivity($id);
$res = $this->service->del($id);
/** @var StoreCartServices $cartService */
$cartService = app()->make(StoreCartServices::class);
$cartService->changeStatus($id, 1);
$cartService->changeStatus($id, 0);
return app('json')->success($res);
}
@ -251,6 +253,7 @@ class StoreProduct extends AuthController
['attrs', []],
['items', []]
]);
if ($id > 0 && $type == 1) $this->service->checkActivity($id);
$info = $this->service->getAttr($data, $id, $type);
return app('json')->success(compact('info'));
}
@ -263,19 +266,22 @@ class StoreProduct extends AuthController
public function search_list()
{
$where = $this->request->getMore([
['cate_id', 0],
['cate_id', ''],
['store_name', ''],
['type', 1],
['is_live', 0]
['is_live', 0],
['is_new', '']
]);
$where['is_show'] = 1;
$where['is_del'] = 0;
/** @var StoreCategoryServices $storeCategoryServices */
$storeCategoryServices = app()->make(StoreCategoryServices::class);
if ($storeCategoryServices->value(['id' => $where['cate_id']], 'pid')) {
$where['sid'] = $where['cate_id'];
} else {
$where['cid'] = $where['cate_id'];
if ($where['cate_id'] !== '') {
if ($storeCategoryServices->value(['id' => $where['cate_id']], 'pid')) {
$where['sid'] = $where['cate_id'];
} else {
$where['cid'] = $where['cate_id'];
}
}
unset($where['cate_id']);
$list = $this->service->searchList($where);
@ -311,4 +317,17 @@ class StoreProduct extends AuthController
$re = $upload->getTempKeys();
return $re ? app('json')->success($re) : app('json')->fail($upload->getError());
}
/**
* 检测商品是否开活动
* @param $id
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function check_activity($id)
{
$this->service->checkActivity($id);
return app('json')->success('删除成功');
}
}

View File

@ -0,0 +1,110 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\product;
use app\adminapi\controller\AuthController;
use app\services\product\product\StoreProductReplyServices;
use think\facade\App;
/**
* 评论管理 控制器
* Class StoreProductReply
* @package app\admin\controller\store
*/
class StoreProductReply extends AuthController
{
public function __construct(App $app, StoreProductReplyServices $service)
{
parent::__construct($app);
$this->services = $service;
}
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
$where = $this->request->getMore([
['is_reply', ''],
['store_name', ''],
['account', ''],
['data', ''],
['product_id', 0]
]);
$list = $this->services->sysPage($where);
return app('json')->success($list);
}
/**
* 删除评论
* @param $id
* @return mixed
*/
public function delete($id)
{
$this->services->del($id);
return app('json')->success('删除成功!');
}
/**
* 回复评论
* @param $id
* @return mixed
*/
public function set_reply($id)
{
[$content] = $this->request->postMore([
['content', '']
], true);
$this->services->setReply($id, $content);
return app('json')->success('回复成功!');
}
/**
* 创建虚拟评论表单
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function fictitious_reply()
{
list($product_id) = $this->request->postMore([
['product_id', 0],
], true);
return app('json')->success($this->services->createForm($product_id));
}
/**
* 保存虚拟评论
* @return mixed
*/
public function save_fictitious_reply()
{
$data = $this->request->postMore([
['image', ''],
['nickname', ''],
['avatar', ''],
['comment', ''],
['pics', []],
['product_score', 0],
['service_score', 0],
['product_id', 0],
['add_time', 0]
]);
if (!$data['product_id']) {
$data['product_id'] = $data['image']['product_id'] ?? '';
}
validate(\app\adminapi\validate\product\StoreProductReplyValidate::class)->scene('save')->check(['product_id' => $data['product_id'], 'nickname' => $data['nickname'], 'avatar' => $data['avatar'], 'comment' => $data['comment'], 'product_score' => $data['product_score'], 'service_score' => $data['service_score']]);
$this->services->saveReply($data);
return app('json')->success('添加成功!');
}
}

View File

@ -13,9 +13,15 @@ namespace app\adminapi\controller\v1\serve;
use app\adminapi\controller\AuthController;
use app\services\serve\ServeServices;
use app\services\shipping\ExpressServices;
use think\facade\App;
/**
* 一号通平台物流服务
* Class Export
* @package app\adminapi\controller\v1\serve
*/
class Export extends AuthController
{
@ -40,11 +46,11 @@ class Export extends AuthController
* @param string $com
* @return mixed
*/
public function getExportTemp()
public function getExportTemp(ServeServices $services)
{
[$com] = $this->request->getMore([
['com', ''],
], true);
return app('json')->success($this->services->express()->temp($com));
return app('json')->success($services->express()->temp($com));
}
}

View File

@ -0,0 +1,116 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\serve;
use app\adminapi\controller\AuthController;
use app\adminapi\validate\serve\ServeValidata;
use app\Request;
use app\services\message\sms\SmsAdminServices;
use crmeb\services\CacheService;
use app\services\serve\ServeServices;
use think\facade\App;
/**
* 服务登录
* Class Login
* @package app\adminapi\controller\v1\serve
*/
class Login extends AuthController
{
public function __construct(App $app, ServeServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 发送验证码
* @param string $phone
* @return mixed
*/
public function captcha(string $phone)
{
validate(ServeValidata::class)->scene('phone')->check(['phone' => $phone]);
return app('json')->success('发送成功', $this->services->user()->code($phone));
}
/**
* 验证验证码
* @param string $phone
* @param $code
* @return mixed
*/
public function checkCode()
{
[$phone, $verify_code] = $this->request->postMore([
['phone', ''],
['verify_code', ''],
], true);
validate(ServeValidata::class)->scene('phone')->check(['phone' => $phone]);
return app('json')->success('success', $this->services->user()->checkCode($phone, $verify_code));
}
/**
* 注册服务
* @param Request $request
* @param SmsAdminServices $services
* @return mixed
*/
public function register(Request $request, SmsAdminServices $services)
{
$data = $request->postMore([
['phone', ''],
['account', ''],
['password', ''],
['verify_code', ''],
]);
$data['account'] = $data['phone'];
validate(ServeValidata::class)->check($data);
$data['password'] = md5($data['password']);
$res = $this->services->user()->register($data);
if ($res) {
$services->updateSmsConfig($data['account'], md5($data['account'] . md5($data['password'])));
return app('json')->success('注册成功');
} else {
return app('json')->fail('注册失败');
}
}
/**
* 平台登录
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function login(SmsAdminServices $services)
{
[$account, $password] = $this->request->postMore([
['account', ''],
['password', '']
], true);
validate(ServeValidata::class)->scene('login')->check(['account' => $account, 'password' => $password]);
$password = md5($account . md5($password));
$res = $this->services->user()->login($account, $password);
if ($res) {
CacheService::clear();
CacheService::redisHandler()->set('sms_account', $account);
$services->updateSmsConfig($account, $password);
return app('json')->success('登录成功', $res);
} else {
return app('json')->fail('登录失败');
}
}
}

View File

@ -80,9 +80,23 @@ class Serve extends AuthController
['type', ''],
['pay_type', ''],
]);
$openInfo = $this->services->user()->getUser();
if (!$openInfo) app('json')->fail('获取支付码失败');
switch ($data['type']) {
case "sms" :
if (!$openInfo['sms']['open']) return app('json')->fail('请先开通短信服务');
break;
case "query" :
if (!$openInfo['query']['open']) return app('json')->fail('请先开通物流查询服务');
break;
case "dump" :
if (!$openInfo['dump']['open']) return app('json')->fail('请先开通电子面单打印服务');
break;
case "copy" :
if (!$openInfo['copy']['open']) return app('json')->fail('请先开通商品采集服务');
break;
}
validate(MealValidata::class)->check($data);
$res = $this->services->user()->payMeal($data);
if ($res) {
return app('json')->success($res);
@ -99,7 +113,6 @@ class Serve extends AuthController
{
$this->services->express()->open();
return app('json')->success('开通成功');
}
/**
@ -156,7 +169,6 @@ class Serve extends AuthController
]);
validate(ServeValidata::class)->check($data);
$data['password'] = md5($data['password']);
$this->services->user()->modify($data);
CacheService::redisHandler()->delete('sms_account');
@ -176,7 +188,6 @@ class Serve extends AuthController
]);
validate(ServeValidata::class)->scene('phone')->check($data);
$this->services->user()->modifyPhone($data);
CacheService::redisHandler()->delete('sms_account');
return app('json')->success('修改成功');

View File

@ -62,12 +62,8 @@ class Sms extends AuthController
['phone', ''],
['code', ''],
], true);
$smsInfo = CacheService::redisHandler()->get('sms_account');
if ($phone !== $smsInfo) {
return app('json')->fail('您的手机号不是当前登录手机号!');
}
validate(ServeValidata::class)->scene('phone')->check(['phone' => $phone]);
validate(ServeValidata::class)->scene('phone')->check(['phone' => $phone]);
if (!$sign) {
return app('json')->fail('请设置短信签名');
}

View File

@ -75,7 +75,6 @@ class SystemAdmin extends AuthController
]);
validate(\app\adminapi\validate\setting\SystemAdminValidata::class)->check($data);
$data['level'] = $this->adminInfo['level'] + 1;
$this->services->create($data);
return app('json')->success('添加成功');
@ -113,7 +112,6 @@ class SystemAdmin extends AuthController
]);
validate(\app\adminapi\validate\setting\SystemAdminValidata::class)->scene('update')->check($data);
if ($this->services->save((int)$id, $data)) {
return app('json')->success('修改成功');
} else {
@ -169,7 +167,7 @@ class SystemAdmin extends AuthController
['new_pwd', ''],
['conf_pwd', ''],
]);
if (!preg_match('/^(?![^a-zA-Z]+$)(?!\D+$).{6,}$/', $data['new_pwd'])) {
if(!preg_match('/^(?![^a-zA-Z]+$)(?!\D+$).{6,}$/',$data['new_pwd'])){
return app('json')->fail('设置的密码过于简单(不小于六位包含数字字母)');
}
if ($this->services->updateAdmin($this->adminId, $data))

View File

@ -24,9 +24,10 @@ use crmeb\services\{CacheService};
class SystemCity extends AuthController
{
/**
* 构造方法
* SystemCity constructor.
* @param App $app
* @param SystemCityServices $services
* @param SystemStoreServices $services
*/
public function __construct(App $app, SystemCityServices $services)
{

View File

@ -251,14 +251,6 @@ class SystemConfig extends AuthController
return app('json')->fail('分销海报不能多于5张');
}
}
if (isset($post['site_url'])) {
if (!check_link($post['site_url'])) {
return app('json')->fail('请输入正确的网站地址');
}
if (substr($post['site_url'], -1) == '/' || substr($post['site_url'], -1) == '\\') {
return app('json')->fail('网站地址不能以/或\\结尾');
}
}
foreach ($post as $k => $v) {
if ($k === 'user_extract_min_price' && !preg_match('/[0-9]$/', $v)) {
return app('json')->fail('提现最低金额只能为数字!');

View File

@ -113,13 +113,13 @@ class SystemClearData extends AuthController
public function userRelevantData()
{
$this->services->clearData([
'user_address', 'user_bill', 'user_enter',
'user_recharge', 'user_address', 'user_bill', 'user_enter', 'user_extract',
'user_notice', 'user_notice_see', 'wechat_message', 'store_visit',
'store_coupon_user', 'store_coupon_issue_user',
'store_product_reply', 'store_product_cate',
'user_group', 'user_visit', 'user_label', 'user_label_relation', 'user_label_relation',
'store_product_relation', 'sms_record', 'system_file',
'qrcode','user_invoice'
'store_coupon_user', 'store_coupon_issue_user', 'store_bargain_user', 'store_bargain_user_help',
'store_product_reply', 'store_product_cate', 'user_sign',
'user_level', 'user_group', 'user_visit', 'user_label', 'user_label_relation', 'user_label_relation',
'store_product_relation', 'sms_record', 'system_file', 'system_store', 'system_store_staff',
'member_card', 'member_card_batch', 'member_ship', 'qrcode', 'user_brokerage_frozen', 'user_invoice'
], true);
$this->services->delDirAndFile('./public/uploads/store/comment');
@ -133,10 +133,10 @@ class SystemClearData extends AuthController
public function storeData()
{
$this->services->clearData([
'store_coupon_issue', 'store_product_attr',
'store_coupon_issue', 'store_bargain', 'store_combination', 'store_product_attr',
'store_product_attr_result', 'store_product_cate', 'store_product_attr_value', 'store_product_description',
'store_product_rule', 'store_product', 'store_visit', 'store_product_log', 'category', 'delivery_service',
'store_product_coupon'
'store_product_rule', 'store_seckill', 'store_product', 'store_visit', 'store_product_log', 'category', 'delivery_service',
'live_anchor', 'live_goods', 'live_room', 'live_room_goods', 'store_product_coupon'
], true);
return app('json')->success('清除数据成功!');
}
@ -157,8 +157,8 @@ class SystemClearData extends AuthController
*/
public function orderData()
{
$this->services->clearData(['store_order', 'store_order_cart_info', 'store_order_status',
'store_cart', 'store_order_status'
$this->services->clearData(['store_order', 'store_order_cart_info', 'store_order_status', 'store_pink',
'store_cart', 'store_order_status', 'other_order', 'other_order_status', 'store_order_invoice'
], true);
return app('json')->success('清除数据成功!');
}
@ -170,16 +170,9 @@ class SystemClearData extends AuthController
public function kefuData()
{
$this->services->clearData([
'article','article_category','article_content','category','delivery_service','qrcode','routine_access_token','routine_form_id','routine_qrcode',
'sms_record','store_cart','store_category','store_coupon','store_coupon_issue','store_coupon_issue_user','store_coupon_product','store_coupon_user',
'store_order','store_order_cart_info','store_order_economize','store_order_invoice','store_order_status','store_product','store_product_attr',
'store_product_attr_result','store_product_attr_value','store_product_cate','store_product_coupon','store_product_description','store_product_log',
'store_product_relation','store_product_reply','store_product_rule','store_visit','system_attachment','system_attachment_category','system_file',
'system_log','system_notice','system_notice_admin','system_role','user','user_address','user_bill','user_enter','user_friends','user_group',
'user_invoice','user_label','user_label_relation','user_notice','user_notice_see','user_search','user_visit','wechat_key','wechat_media','wechat_message',
'wechat_news_category','wechat_qrcode','wechat_reply','wechat_user'
'store_service', 'store_service_log', 'store_service_record', 'store_service_feedback', 'store_service_speechcraft'
], true);
// $this->services->delDirAndFile('./public/uploads/store/service');
$this->services->delDirAndFile('./public/uploads/store/service');
return app('json')->success('清除数据成功!');
}

View File

@ -0,0 +1,438 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\user;
use app\adminapi\validate\user\UserValidata;
use app\services\user\UserServices;
use app\adminapi\controller\AuthController;
use think\exception\ValidateException;
use think\facade\App;
use think\Request;
class User extends AuthController
{
/**
* user constructor.
* @param App $app
* @param UserServices $services
*/
public function __construct(App $app, UserServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 显示资源列表头部
*
* @return \think\Response
*/
public function type_header()
{
$list = $this->services->typeHead();
return app('json')->success(compact('list'));
}
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
$where = $this->request->getMore([
['page', 1],
['limit', 20],
['nickname', ''],
['status', ''],
['pay_count', ''],
['is_promoter', ''],
['order', ''],
['data', ''],
['user_type', ''],
['country', ''],
['province', ''],
['city', ''],
['user_time_type', ''],
['user_time', ''],
['sex', ''],
[['level', 0], 0],
[['group_id', 'd'], 0],
[['label_id', 'd'], 0],
['now_money', 'normal'],
['field_key', ''],
['isMember', '']
]);
return app('json')->success($this->services->index($where));
}
/**
* 显示创建资源表单页.
*
* @return \think\Response
*/
public function create()
{
return app('json')->success($this->services->saveForm());
}
/**
* 保存新建的资源
*
* @param \think\Request $request
* @return \think\Response
*/
public function save()
{
$data = $this->request->postMore([
['is_promoter', 0],
['real_name', ''],
['card_id', ''],
['birthday', ''],
['mark', ''],
['status', 0],
['level', 0],
['phone', 0],
['addres', ''],
['label_id', []],
['group_id', 0],
['pwd', ''],
['true_pwd', ''],
['spread_open', 1]
]);
if ($data['phone']) {
if (!check_phone($data['phone'])) {
return app('json')->fail('手机号码格式不正确');
}
if ($this->services->count(['phone' => $data['phone']])) {
return app('json')->fail('手机号已经存在不能添加相同的手机号用户');
}
$data['nickname'] = substr_replace($data['phone'], '****', 3, 4);
}
if ($data['card_id']) {
if (!check_card($data['card_id'])) return app('json')->fail('请输入正确的身份证');
}
if ($data['pwd']) {
if (!$data['true_pwd']) {
return app('json')->fail('请输入确认密码');
}
if ($data['pwd'] != $data['true_pwd']) {
return app('json')->fail('两次输入的密码不一致');
}
$data['pwd'] = md5($data['pwd']);
} else {
unset($data['pwd']);
}
unset($data['true_pwd']);
$data['avatar'] = sys_config('h5_avatar');
$data['adminId'] = $this->adminId;
$data['user_type'] = 'h5';
$lables = $data['label_id'];
unset($data['label_id']);
foreach ($lables as $k => $v) {
if (!$v) {
unset($lables[$k]);
}
}
$data['birthday'] = empty($data['birthday']) ? 0 : strtotime($data['birthday']);
$data['add_time'] = time();
$this->services->transaction(function () use ($data, $lables) {
$res = true;
$userInfo = $this->services->save($data);
if ($lables) {
$res = $this->services->saveSetLabel([$userInfo->uid], $lables);
}
if ($data['level']) {
$res = $this->services->saveGiveLevel((int)$userInfo->uid, (int)$data['level']);
}
if (!$res) {
throw new ValidateException('保存添加用户失败');
}
});
return app('json')->success('添加成功');
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
if (is_string($id)) {
$id = (int)$id;
}
return app('json')->success($this->services->read($id));
}
/**
* 赠送会员等级
* @param int $uid
* @return mixed
* */
public function give_level($id)
{
if (!$id) return app('json')->fail('缺少参数');
return app('json')->success($this->services->giveLevel((int)$id));
}
/*
* 执行赠送会员等级
* @param int $uid
* @return mixed
* */
public function save_give_level($id)
{
if (!$id) return app('json')->fail('缺少参数');
list($level_id) = $this->request->postMore([
['level_id', 0],
], true);
return app('json')->success($this->services->saveGiveLevel((int)$id, (int)$level_id) ? '赠送成功' : '赠送失败');
}
/**
* 赠送付费会员时长
* @param int $uid
* @return mixed
* */
public function give_level_time($id)
{
if (!$id) return app('json')->fail('缺少参数');
return app('json')->success($this->services->giveLevelTime((int)$id));
}
/*
* 执行赠送付费会员时长
* @param int $uid
* @return mixed
* */
public function save_give_level_time($id)
{
if (!$id) return app('json')->fail('缺少参数');
list($days) = $this->request->postMore([
['days', 0],
], true);
return app('json')->success($this->services->saveGiveLevelTime((int)$id, (int)$days) ? '赠送成功' : '赠送失败');
}
/**
* 清除会员等级
* @param int $uid
* @return json
*/
public function del_level($id)
{
if (!$id) return app('json')->fail('缺少参数');
return app('json')->success($this->services->cleanUpLevel((int)$id) ? '清除成功' : '清除失败');
}
/**
* 设置会员分组
* @param $id
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function set_group()
{
list($uids) = $this->request->postMore([
['uids', []],
], true);
if (!$uids) return app('json')->fail('缺少参数');
return app('json')->success($this->services->setGroup($uids));
}
/**
* 保存会员分组
* @param $id
* @return mixed
*/
public function save_set_group()
{
list($group_id, $uids) = $this->request->postMore([
['group_id', 0],
['uids', ''],
], true);
if (!$uids) return app('json')->fail('缺少参数');
if (!$group_id) return app('json')->fail('请选择分组');
$uids = explode(',', $uids);
return app('json')->success($this->services->saveSetGroup($uids, (int)$group_id) ? '设置分组成功' : '设置分组失败或无改动');
}
/**
* 设置用户标签
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function set_label()
{
list($uids) = $this->request->postMore([
['uids', []],
], true);
$uid = implode(',', $uids);
if (!$uid) return app('json')->fail('缺少参数');
return app('json')->success($this->services->setLabel($uids));
}
/**
* 保存用户标签
* @return mixed
*/
public function save_set_label()
{
list($lables, $uids) = $this->request->postMore([
['label_id', []],
['uids', ''],
], true);
if (!$uids) return app('json')->fail('缺少参数');
if (!$lables) return app('json')->fail('请选择标签');
$uids = explode(',', $uids);
return app('json')->success($this->services->saveSetLabel($uids, $lables) ? '设置标签成功' : '设置标签失败');
}
/**
* 编辑其他
* @param $id
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function edit_other($id)
{
if (!$id) return app('json')->fail('数据不存在');
return app('json')->success($this->services->editOther((int)$id));
}
/**
* 执行编辑其他
* @param int $id
* @return mixed
*/
public function update_other($id)
{
$data = $this->request->postMore([
['money_status', 0],
['money', 0],
['integration_status', 0],
['integration', 0],
]);
if (!$id) return app('json')->fail('数据不存在');
$data['adminId'] = $this->adminId;
$data['money'] = (string)$data['money'];
$data['integration'] = (string)$data['integration'];
$data['is_other'] = true;
return app('json')->success($this->services->updateInfo($id, $data) ? '修改成功' : '修改失败');
}
/**
* 修改user表状态
*
* @return array
*/
public function set_status($status, $id)
{
// if ($status == '' || $id == 0) return app('json')->fail('参数错误');
// UserModel::where(['uid' => $id])->update(['status' => $status]);
return app('json')->success($status == 0 ? '禁用成功' : '解禁成功');
}
/**
* 编辑会员信息
* @param $id
* @return mixed|\think\response\Json|void
*/
public function edit($id)
{
if (!$id) return app('json')->fail('数据不存在');
return app('json')->success($this->services->edit($id));
}
public function update($id)
{
$data = $this->request->postMore([
['money_status', 0],
['is_promoter', 0],
['real_name', ''],
['card_id', ''],
['birthday', ''],
['mark', ''],
['money', 0],
['integration_status', 0],
['integration', 0],
['status', 0],
['level', 0],
['phone', 0],
['addres', ''],
['label_id', ''],
['group_id', 0],
['pwd', ''],
['true_pwd'],
['spread_open', 1]
]);
if ($data['phone']) {
if (!preg_match("/^1[3456789]\d{9}$/", $data['phone'])) return app('json')->fail('手机号码格式不正确');
}
if ($data['card_id']) {
if (!check_card($data['card_id'])) return app('json')->fail('请输入正确的身份证');
}
if ($data['pwd']) {
if (!$data['true_pwd']) {
return app('json')->fail('请输入确认密码');
}
if ($data['pwd'] != $data['true_pwd']) {
return app('json')->fail('两次输入的密码不一致');
}
$data['pwd'] = md5($data['pwd']);
} else {
unset($data['pwd']);
}
unset($data['true_pwd']);
if (!$id) return app('json')->fail('数据不存在');
$data['adminId'] = $this->adminId;
$data['money'] = (string)$data['money'];
$data['integration'] = (string)$data['integration'];
return app('json')->success($this->services->updateInfo($id, $data) ? '修改成功' : '修改失败');
}
/**
* 获取单个用户信息
* @param $id 用户id
* @return mixed
*/
public function oneUserInfo($id)
{
$data = $this->request->getMore([
['type', ''],
]);
$id = (int)$id;
if ($data['type'] == '') return app('json')->fail('缺少参数');
return app('json')->success($this->services->oneUserInfo($id, $data['type']));
}
/**
* 同步微信粉丝用户
* @return mixed
*/
public function syncWechatUsers()
{
$this->services->syncWechatUsers();
return app('json')->success('加入消息队列成功,正在异步执行中');
}
}

View File

@ -73,7 +73,6 @@ class UserLabelCate extends AuthController
]);
validate(UserLabeCateValidata::class)->check($data);
if ($this->services->count(['name' => $data['name']])) {
return app('json')->fail('分类已经存在,请勿重复添加');
}
@ -128,9 +127,7 @@ class UserLabelCate extends AuthController
['name', ''],
['sort', 0],
]);
validate(UserLabeCateValidata::class)->check($data);
if ($this->services->update($id, $data)) {
$this->services->deleteCateCache();
return app('json')->success('修改成功');

View File

@ -0,0 +1,133 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\user;
use app\adminapi\controller\AuthController;
use app\services\user\UserLevelServices;
use think\facade\App;
/**
* 会员设置
* Class UserLevel
* @package app\adminapi\controller\v1\user
*/
class UserLevel extends AuthController
{
/**
* user constructor.
* @param App $app
* @param UserLevelServices $services
*/
public function __construct(App $app, UserLevelServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/*
* 获取添加资源表单
* */
public function create()
{
$where = $this->request->getMore(
['id', 0]
);
return app('json')->success($this->services->edit((int)$where['id']));
}
/*
* 会员等级添加或者修改
* @param $id 修改的等级id
* @return json
* */
public function save()
{
$data = $this->request->postMore([
['id', 0],
['name', ''],
['is_forever', 0],
['money', 0],
['is_pay', 0],
['valid_date', 0],
['grade', 0],
['discount', 0],
['icon', ''],
['image', ''],
['is_show', ''],
['explain', ''],
['exp_num', 0]
]);
if ($data['valid_date'] == 0) $data['is_forever'] = 1;//有效时间为0的时候就是永久
if (!$data['name']) return app('json')->fail('请输入等级名称');
if (!$data['grade']) return app('json')->fail('请输入等级');
if (!$data['explain']) return app('json')->fail('请输入等级说明');
if (!$data['icon']) return app('json')->fail('请上传等级图标');
if (!$data['image']) return app('json')->fail('请上传等级背景图标');
if (!$data['exp_num']) return app('json')->fail('请输入升级经验值');
return app('json')->success($this->services->save((int)$data['id'], $data));
}
/*
* 获取系统设置的vip列表
* @param int page
* @param int limit
* */
public function get_system_vip_list()
{
$where = $this->request->getMore([
['page', 0],
['limit', 10],
['title', ''],
['is_show', ''],
]);
return app('json')->success($this->services->getSytemList($where));
}
/*
* 删除会员等级
* @param int $id
* */
public function delete($id)
{
return app('json')->success($this->services->delLevel((int)$id));
}
/**
* 设置会员等级显示|隐藏
*
* @return json
*/
public function set_show($is_show = '', $id = '')
{
if ($is_show == '' || $id == '') return app('json')->fail('缺少参数');
return app('json')->success($this->services->setShow((int)$id, (int)$is_show));
}
/**
* 等级列表快速编辑
* field:value name:钻石会员/grade:8/discount:92.00
* @return json
*/
public function set_value($id)
{
$data = $this->request->postMore([
['field', ''],
['value', '']
]);
if ($data['field'] == '' || $data['value'] == '') return app('json')->fail('缺少参数');
$this->services->setValue((int)$id, $data);
return app('json')->success('保存成功');
}
}

View File

@ -0,0 +1,48 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use think\facade\Route;
/**
* 分销管理 相关路由
*/
Route::group('agent', function () {
//推销员列表
Route::get('index', 'v1.agent.AgentManage/index');
//修改上级推广人
Route::put('spread', 'v1.agent.AgentManage/editSpread');
//头部统计
Route::get('statistics', 'v1.agent.AgentManage/get_badge');
//推广人列表
Route::get('stair', 'v1.agent.AgentManage/get_stair_list');
//推广人头部统计
Route::get('stair/statistics', 'v1.agent.AgentManage/get_stair_badge');
//统计推广订单列表
Route::get('stair/order', 'v1.agent.AgentManage/get_stair_order_list');
//统计推广订单列表头部
Route::get('stair/order/statistics', 'v1.agent.AgentManage/get_stair_order_badge');
//清除上级推广人
Route::put('stair/delete_spread/:uid', 'v1.agent.AgentManage/delete_spread');
//查看公众号推广二维码
Route::get('look_code', 'v1.agent.AgentManage/look_code');
//查看小程序推广二维码
Route::get('look_xcx_code', 'v1.agent.AgentManage/look_xcx_code');
//查看H5推广二维码
Route::get('look_h5_code', 'v1.agent.AgentManage/look_h5_code');
//积分配置编辑表单
Route::get('config/edit_basics', 'v1.setting.SystemConfig/edit_basics');
//积分配置保存数据
Route::post('config/save_basics', 'v1.setting.SystemConfig/save_basics');
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,
\app\adminapi\middleware\AdminCkeckRoleMiddleware::class,
\app\adminapi\middleware\AdminLogMiddleware::class
]);

Some files were not shown because too many files have changed in this diff Show More