likeshop单商户开源商城系统,企业版重磅开源,免费商用!

This commit is contained in:
lr 2021-08-23 17:28:32 +08:00
parent 67fbc9a335
commit 0f23d343cb
4865 changed files with 593938 additions and 25 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/.idea
/.vscode

200
README.md
View file

@ -1,37 +1,187 @@
# likeshop单商户开源商城系统_代码全开源_免费商用_功能丰富_口碑之选
# likeshop开源商城系统-单商户B2C
![gitee头图 0817.png](https://resource.likeshop.cn/gitee/toutu.png)
## likeshop「开源精神」
likeshop开源团队专注于围绕电商交易领域打造新时代的开源商城系统。我们关心并聚焦于解决以下问题
1. 系统安装部署要保持简单无需配置复杂的运行环境方便后续工作开展。为此我们准备了简洁大方的傻瓜式安装引导界面并且提供了宝塔一键安装教程无论是Linux还是Windows操作系统都很方便部署。
2. 商城运营起步要清晰明了后台操作界面容易上手快速进入卖货状态。例如微信公众号、小程序设置微信支付、支付宝支付设置阿里云、腾讯云短信设置七牛云、阿里云OSS、腾讯云OSS设置等功能操作都非常方便。同时我们还准备了专业的运营手册进行操作指导。
3. 系统代码真正做到容易懂很好改易维护。与其过度封装代码制造二开难度还不如简简单单回归到开源的初心让后续开发者看到易读易懂易改的优秀代码。我们力求二开文档能够做到详细说明目录结构数据字典API接口开发规范开发注意事项等各种开发细节。
4. 提供直接的产品沟通渠道有的时候绞尽脑汁不如官方开发人员指点一二。我们考虑再三毅然决定停止使用社区收集问题往返回帖的方式太慢了而且官方很难定位问题。做好技术服务是我们在众多优秀产品里面拥有立足之地的秘诀。因此我们统一使用微信群和QQ群进行直接畅快的沟通这个成本绝对不能省。
5. 让大家用的起用的好正版的likeshop开源商城系统极致的性价比能免费不收费能收费不收贵。大幅度降低项目实施和落地的成本把资金都集中用在运营推广的刀刃上不枉花一分钱。
6. 代码全开源小白易看懂二开容易改运营好上手就是likeshop的开源精神内核与初心。希望能够和大家携手并进一起做好这个开源商城产品。在如今这个内卷严重公域流量费用昂贵的时代likeshop必然会是一款合适的工具去帮助大家挖掘属于自己的金矿。
## 免费企业版和付费企业版的区别
likeshop开源不代表不收费健康合理大大方方的收费方式能够助力开源项目持续的更新迭代长久提供质量可靠的开源代码。现在重点说明likeshop单商户开源商城系统免费企业版和付费企业版的区别
1. 本仓库代码为单商户免费企业版版本号v.2.4.0.20210429,代码全开源,支持免费商用,不能去除版权。任何发布在本仓库的单商户企业版代码都属于已免费开源的企业版本。其它领先的未发布版本为付费企业版。
2. 免费企业版没有阉割任何功能分销、拼团、砍价、抽奖、支付宝支付、APP商城等等功能模块完全同步付费企业版。免费企业版本包含H5商城端小程序商城端、APP商城端、PC管理后台端不含PC商城端不能去除版权不支持在线升级和更新包升级。
3. 付费企业版本比免费企业版本领先几个版本([点击前往技术社区查看最新企业版本号](https://home.likeshop.cn/?zone=1) 包含H5商城端小程序商城端、APP商城端、PC商城端PC管理后台端可以去版本、支持在线升级和更新包升级付费后可永远获取最新企业版本加入付费会员群交换资源享受更好的技术支持
4. 付费企业版本会按照升级一个版本就免费开源一个之前版本的节奏发布为免费企业版本。
5. likeshop之所以开源齐全完整的企业版本进行免费商用核心的原因是我们的商城系统口碑好无论是使用的稳定性还是二开的便利性都获得了很多的赞誉和欣赏受宠若惊再次感谢各位朋友。但是之前的免费版本过于基础很多好功能因为收费原因没有办法及时释放出来不仅是用户无法体验我们也是跟着干着急。在一次项目会议上大家提到这个问题一致同意既然开源那肯定是希望更多的用户能够使用likeshop实现大家的价值显然比实现likeshop团队的价值是一个更宏伟的命题所以我们开源企业版了
6. 免费企业版非常确定且需要大家保留官方版权不能私下移除版权。这样无形之中才可以为我们多宣传宣传让更多用户能够使用likeshop否则既没有实现大家的价值又没有创造团队收入企业版拿来免费商用就没有太大的意义了。如果觉得likeshop确实挺好用也好二开也欢迎购买授权不仅可以去版权可以用到最新版本更稳定功能更新鲜还有PC商城端能在线升级又有付费会员群。付费会员群的人脉资源也相当不错随便带来一个单子就回本了轻轻松松助你走上自由之路。
7. likeshop单商户商城系统一路研发过来耗费的研发资金不敢说有几百万但对我们而言也是无法想象的一个数目我们不擅长去计算这些成本只知道从likeshop单商户开始准备、深入研发、面世推出、更新迭代已经过去了很久的时间每个月研发团队发放的薪资和社保都越来越多一直处于亏损之中。所以请不要认为私下去除官方版权似乎对官方没有任何影响开源项目要稳定的成长就需要健康的收入因此去除版本切记购买付费版本。我们会认认真真做研发也会认认真真去维权。
## likeshop「欢迎大家使用」
有朋自远方来不亦乐乎多一份使用多一份责任请建议结合自身情况合理使用likeshop落地商城项目。
### 需要具备的基本能力
没有具体的能力要求会电脑开关机即可。我们已经准备了详尽的开发文档宝塔一键部署教程常见问题集合甚至还有docker镜像包直接拿来用。小白上手也方便直接根据运营文档操作。
### 适合使用的用户
- [x] 电商公司通过likeshop部署自有私域流量商城快速实现社交电商裂变推广变现。公域流量虽大但私域流量经营的方案也同样重要likeshop会是得力的商城系统工具。
- [x] 软件公司不用再苦苦找寻靠谱稳定的商城系统解决方案了likeshop开源商城代码通俗易懂容易二次开发值得项目使用。
- [x] 开发者可以学习如何用ThinkPHP、Vue、Redis、MySQL、uni-app、Nuxt.js等前沿技术开发企业级电商项目甚至好吧这可能是主要目的可以无忧无虑接活儿增加收入。
- [x] 教学领域教学过程中好的教材可以发挥重要作用likeshop基于最新的MVC框架前后端分离思想uni-app跨终端解决方案可以作为生动的教学案例演讲。
- [x] 学生群体纸上得来终觉浅绝知此事要躬行。理论需要结合实践才能磨炼自己请下载likeshop学一学改一改找寻完成优秀毕业设计的灵感吧。
- [x] 代码收藏爱好者收藏天下一切有价值的代码点个star收藏起来。
## likeshop 「多沟通交流」
我们喜欢直接的沟通交流,请加群或者客服吧。
### 加入微信群 | QQ群
![qun.png](https://resource.likeshop.cn/gitee/qun.png)
### 联系微信客服(专业解答、获取功能清单)
![联系微信客服.png](https://resource.likeshop.cn/gitee/lxkf.gif)
小提示:当你预算购买付费企业版时,联系微信客服是有优惠的,请添加她们吧。
### 官方公众号 | 官方商城
![官方公众号 官方商城.png](https://resource.likeshop.cn/gitee/gfsc.png)
### 开发文档
http://doc.likeshop.cn/
运营文档、开发文档、API文档一应俱全。
### 技术社区
https://home.likeshop.cn/
查看官方动态、更新计划、下载单商户和多商户等产品付费企业版代码。
### 官方网站
https://www.likeshop.cn/
更多产品介绍欢迎访问likeshop官方网站。
## likeshop单商户商城系统「产品说明」
### 产品定位
likeshop单商户商城系统产品定位为B2C模式类似京东自营商城。
免费企业版和付费企业版功能基本相同,不再赘述之间的区别。
### 产品终端
![产品终端.png](https://resource.likeshop.cn/gitee/cpzd.png?v=2)
### 产品功能
likeshop单商户商城系统具备PC商城、H5商城、微信小程序商城、APP商城各商城终端数据打通使用PC管理后台进行统一的数据管理。
单商户商城系统包含分销裂变,限时秒杀,拼团活动,砍价活动,优惠券,大转盘抽奖,每日签到,小票打印,积分商城,会员价,微信零钱到账,系统通知/短信通知/APP推送/微信模板消息/小程序消息提醒等常用丰富的营销模块。
![功能清单缩略图.png](https://resource.likeshop.cn/gitee/cpjs.png?v=2)
联系客服获取完整PDF、Excel版本产品功能对照表。
### 产品手册
likeshop开源团队深知手册的重要性为此我们会一直投入充足的时间为大家提供更详尽的手册支持高效运营支持二次开发。
小提示likeshop开源团队后续将会为付费用户准备更专业的手册。
![帮助文档.png](https://resource.likeshop.cn/gitee/doc.png?v=2)
[点击阅读全部手册;](http://doc.likeshop.cn)
## likeshop单商户 「技术架构」
### 技术架构
likeshop服务端基于国内最流行php框架thinkphp5.1即将升级为6.0遵循thinkphp开发规范代码逻辑清晰方便二次开发。管理后台使用php渲染页面模式让开发更简单。
商城端使用业界标准方式前端分离由服务端提供标准数据接口并且基于uni-app前端框架一套代码可以发布微信小程序、手机h5网页、安卓app、苹果app等10个应用平台。
## 推荐环境
### 服务器推荐
#### 配置推荐
服务器镜像系统推荐CentOS7.2~7.9
配置推荐内存2G以上、带宽4M以上、其他配置项根据项目规模选择。
服务器型号根据需求选择所有ECS服务器型号都适合常规项目使用。
#### 阿里云服务器
|初级配置 |中级配置|企业级配置|
| :--- | :--- | :--- |
| CPU2核<br>内存4G<br>带宽1~10M <br>云盘40~100G <br>1年价格¥244<br>3年价格¥565 | CPU4核<br>内存8G<br>带宽1~10M <br>云盘40~100G <br>1年价格¥598<br>3年价格¥1495 | CPU8核<br>内存16G<br>带宽1~10M <br>云盘40~100G <br>1年价格¥1897 <br>3年价格¥4879
|[新人优惠](https://www.aliyun.com/1111/new?userCode=cvswwj8k)|[爆款特惠](https://www.aliyun.com/activity/daily/bestoffer?userCode=cvswwj8k) |[老用户优惠](https://www.aliyun.com/activity/daily/bestoffer?userCode=cvswwj8k)|
#### 腾讯云服务器
|初级配置 |中级配置|企业级配置|
|:--- | :--- | :--- |
|CPU2核<br>内存4G<br>带宽1~10M <br>云盘50GB <br>1年价格¥803<br>3年价格¥2067 | CPU4核<br>内存8G<br>带宽1~10M <br>云盘40~100G <br>1年价格¥1350<br>3年价格¥3471 | CPU8核<br>内存16G<br>带宽1~10M <br>云盘40~100G <br>1年价格¥2511 <br>3年价格¥6457
|[新客专属福利](https://curl.qcloud.com/pD62VbaW)|[爆款特惠](https://curl.qcloud.com/mkwiZjsW) |[企业特惠](https://curl.qcloud.com/8liI3Cyx)|
<br>具体配置,打开链接获取。
### 功能特性
代码逻辑注释清晰,非常方便二次开发。
支持PHP7执行效率翻倍遵循PSR-4开发规范。
支持composer内置优秀php开发sdk方便二次开发。
支持docker部署内置docker-compose容器编排一句命令自动配置项目运行环境。
支持管理后台配置定时任务,并记录定时任务运行日志。
支持七牛云、阿里云、腾讯云多种OSS对象存储提升项目访问速度降低服务器成本。
支持CDN配置加快各地方访问速度。
支持商城多种场景的足迹气泡,让商城跟用户有更强的互动性。
支持商城首页、商城分类页、用户个人中心页、底部导航装修。
支持广告位,可在商城多个地方编辑添加广告。
支持5种佣金提现方式更有微信零钱到账零钱可直接到用户微信钱包。
下载体验更多功能!
### 部署运行
#### 宝塔面板部署(正式发布推荐)
[点击这里查看详细部署教程沉浸式教你如何使用宝塔面板安装likeshop](http://doc.likemarket.net/likeshop_develop_v2_x/2107074)
#### phpStudy部署本地部署推荐
[点击这里查看详细部署教程沉浸式教你如何使用phpStudy安装likeshop](http://doc.likemarket.net/likeshop_develop_v2_x/2119296)
#### docker部署
[点击这里查看详细部署教程沉浸式教你如何使用docker安装likeshop](http://doc.likemarket.net/likeshop_develop_v2_x/2107075)
## likeshop单商户商城系统 「演示环境」
### PC商城
PC端访问链接[https://likeshop.likemarket.net/](https://likeshop.likemarket.net/)
### 移动端商城
![移动端演示.png](https://resource.likeshop.cn/gitee/yszx.png)
### PC管理后台
PC管理后台演示 [http://likeshop-demo.likemarket.net/admin ](http://likeshop-demo.likemarket.net/admin )
账号admin 密码123456
## likeshop单商户 「界面预览」
### 移动端商城界面
![step01.png](https://resource.likeshop.cn/gitee/m1.png?v=2)
![step02.png](https://resource.likeshop.cn/gitee/m2.png)
![step03.png](https://resource.likeshop.cn/gitee/m3.png)
![step04.png](https://resource.likeshop.cn/gitee/m4.png)
![step05.png](https://resource.likeshop.cn/gitee/m5.png)
![step06.png](https://resource.likeshop.cn/gitee/m6.png)
![step07png](https://resource.likeshop.cn/gitee/m7.png)
![step08png](https://resource.likeshop.cn/gitee/m8.png)
![step09.png](https://resource.likeshop.cn/gitee/m9.png)
![step10.png](https://resource.likeshop.cn/gitee/m10.png)
![step11.png](https://resource.likeshop.cn/gitee/m11.png)
### PC端商城界面
![pc_step01.png](https://resource.likeshop.cn/gitee/pc1.png)
![pc_step03.png](https://resource.likeshop.cn/gitee/pc2.png)
![pc_step04.png](https://resource.likeshop.cn/gitee/pc3.png)
### PC端管理后台
![ht_step01.png](https://resource.likeshop.cn/gitee/admin1.png)
![ht_step02.png](https://resource.likeshop.cn/gitee/admin2.png)
![ht_step03.png](https://resource.likeshop.cn/gitee/admin3.png)
![ht_step04.png](https://resource.likeshop.cn/gitee/admin4.png)
![ht_step05.png](https://resource.likeshop.cn/gitee/admin5.png)
![ht_step07.png](https://resource.likeshop.cn/gitee/admin6.png)
## likeshop单商户 「特别说明」
1. 付费企业版领先免费企业版几个版本,免费企业版没有阉割功能,需要大家保留官方版权,为我们多宣传宣传。
2. likeshop单商户商城系统一路研发过来耗费的研发资金不敢说有几百万但对我们而言也是无法想象的一个数目我们不擅长去计算这些成本只知道从likeshop单商户开始准备、深入研发、面世推出、更新迭代已经过去了很久的时间每个月研发团队发放的薪资和社保都越来越多一直处于亏损之中。所以请不要认为私下去除官方版权似乎对官方没有任何影响开源项目要稳定的成长就需要健康的收入因此去除版本切记购买付费版本。我们会认认真真做研发也会认认真真去维权。
## likeshop单商户 「版权证书」
![版权.png](https://resource.likeshop.cn/gitee/csbq.png)
likeshop系列产品版权归likeshop团队所有且原创研发。本文档最终解释权归likeshop团队所有。
#### 介绍
🔥🔥🔥 likeshop单商户开源商城系统公众号商城、H5商城、小程序商城、安卓APP商城、苹果APP商城代码全开源免费商用。适用场景B2C商城新零售商城社交电商商城分销系统商城分销电商商城小程序商城商城源码商城系统单商户多商户电商系统直播uniappuni-appB2B2CB2BO2OERPWechat交易系统内容系统雷达crm
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

2
docker/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/data
/log

View file

@ -0,0 +1,31 @@
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
#
# 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; version 2 of the License.
#
# 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, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# The MySQL Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
log-error = /var/log/mysql/error.log
# By default we only accept connections from localhost
#bind-address = 127.0.0.1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
max_connections=1000

View file

@ -0,0 +1,35 @@
server {
listen 80;
server_name www.likeshopv2.localhost;
access_log /logs/www.likeshopv2.localhost_access_nginx.log;
error_log /logs/www.likeshopv2.localhost_error_nginx.log;
client_max_body_size 5M;
location / {
root /server/public;
index index.html index.htm index.php;
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?s=$1 last;
break;
}
}
location ~ /.*\.php/ {
rewrite ^(.*?/?)(.*\.php)(.*)$ /$2?s=$3 last;
break;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
location ~ \.php$ {
fastcgi_pass likeshop-php7.2.4:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /server/public$fastcgi_script_name;
include fastcgi_params;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
}

View file

@ -0,0 +1,42 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
location / {
return 404;
}
}
include /etc/nginx/conf.d/company/*.conf;
include /etc/nginx/conf.d/my/*.conf;
include /etc/nginx/conf.d/product/*.conf;
include /etc/nginx/conf.d/project/*.conf;
}

View file

@ -0,0 +1 @@
upload_max_filesize = 5M

98
docker/docker-compose.yml Normal file
View file

@ -0,0 +1,98 @@
# +----------------------------------------------------------------------
# | LikeShop100%开源免费商用电商系统
# +----------------------------------------------------------------------
# | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
# | 开源版本可自由商用可去除界面版权logo
# | 商业版本务必购买商业授权,以免引起法律纠纷
# | 禁止对系统程序代码以任何目的,任何形式的再发布
# | Gitee下载https://gitee.com/likemarket/likeshopv2
# | 访问官网https://www.likemarket.net
# | 访问社区https://home.likemarket.net
# | 访问手册http://doc.likemarket.net
# | 微信公众号:好象科技
# | 好象科技开发团队 版权所有 拥有最终解释权
# +----------------------------------------------------------------------
# | author: likeshop.cn.team
# +----------------------------------------------------------------------
version: '3'
networks:
likeshop:
driver: bridge
services:
nginx:
container_name: likeshop-nginx
image: nginx:1.17.0
restart: always
depends_on:
- "php7.2.4"
volumes:
- ../server:/server
- ./config/nginx/conf.d:/etc/nginx/conf.d
- ./log/nginx/logs:/logs
networks:
- likeshop
ports:
- "80:80"
- "443:443"
php7.2.4:
container_name: likeshop-php7.2.4
image: indexlin/likeshop-php7.2.4:1.0
restart: always
working_dir: /server
volumes:
- ../server:/server
- ./config/php/php.ini:/usr/local/etc/php/php.ini
networks:
- likeshop
ports:
- "9004:9000"
#user: "1000:1000"
mysql:
container_name: likeshop-mysql
image: mysql:5.7.29 #X86架构
#image: amd64/mysql:5.7.29 #arm架构
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
volumes:
- ./data/mysql5.7.29/lib:/var/lib/mysql
- ./config/mysql/mysqld.cnf:/etc/mysql/my.cnf
networks:
- likeshop
ports:
- "3306:3306"
redis:
container_name: likeshop-redis
image: redis:5.0.5
restart: always
volumes:
- ./data/redis:/data
networks:
- likeshop
ports:
- "6379:6379"
node:
container_name: likeshop-node
image: node:10.15.3
restart: always
volumes:
- ../web:/web
networks:
- likeshop
tty: true
working_dir: /web
ports:
- "8080:8080"

16
server/.example.env Normal file
View file

@ -0,0 +1,16 @@
[app]
app_debug = true;
app_trace = false;
[database]
hostname = like-mysql
database = test_likeshop
username = root
password = roixxx2008fffot
hostport = 3306
[project]
env_name =
file_domain = www.likeshopv2.localhost

6
server/.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
/config/install.lock
/public/uploads/*
!/public/uploads/index.html
/runtime/*
!/runtime/index.html
/.env

42
server/.travis.yml Normal file
View file

@ -0,0 +1,42 @@
sudo: false
language: php
branches:
only:
- stable
cache:
directories:
- $HOME/.composer/cache
before_install:
- composer self-update
install:
- composer install --no-dev --no-interaction --ignore-platform-reqs
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
- composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
- composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
- composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
script:
- php think unit
deploy:
provider: releases
api_key:
secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
file:
- ThinkPHP_Core.zip
- ThinkPHP_Full.zip
skip_cleanup: true
on:
tags: true

927
server/CHANGELOG.md Normal file
View file

@ -0,0 +1,927 @@
## V5.1.39 LTS2019-11-18
本次更新为常规更新,主要包括:
* 修正`memcached`驱动
* 改进`HasManyThrough`关联查询
* 改进`Request`类`isJson`方法
* 改进关联查询
* 改进`redis`驱动
* 增加 Model类`getWhere`方法对复合主键的支持
* 改进`newQuery`方法
* 改进闭包查询的参数绑定
* 修正`Validate`
* 修复某些情况下URL会多一个冒号
* 调整composer.json
* 修复使用`Cache::clear()`时,报错缓存文件不存在问题
* 使用File类的unlink方法进行文件删除
* 改进`paraseData`方法
* 修正image验证方法
* 改进Url生成
* 改进空操作对数字的支持
* 改进一处PHP7.4兼容性问题
## V5.1.38 LTS2019-8-8
本次更新为常规更新,主要包括:
* `Request`类增加`isJson`方法
* 改进浮点型查询
* 修正关联查询关联外键为空的查询错误
* 远程一对多支持关联统计和预载入查询
* 远程一对多关联支持`has`/`hasWhere`查询
* 优化`parseIn`解析
* 改进`parseLike`查询
* 改进Url生成
* 改进模型的`toArray`方法
* 修正`notIn`查询
* 改进`JSON`字段查询
* 改进Controller类`display`/`fetch`方法返回`ViewResponse`对象
* 改进`param`方法
* 改进`mysql`驱动`getExplain`方法
* 改进时间查询
* 改进模型关联的`has`/`hasWhere`方法对软删除的支持
* 修正社区反馈的BUG
## V5.1.37 LTS2019-5-26
本次更新为常规更新,主要更新如下:
* 改进关联数据更新
* 修正关联动态获取器
* 改进`redis`驱动
* 修复验证规则里面出现二维数组时的错误
* 改进跨域请求支持
* 完善模型`hidden`方法对关联属性的支持
* 改进`where`查询方法传入`Query`对象的支持`bind`数据
* 改进数据集对象的`load`方法
* 修正缓存类`clear`方法对`tag`的支持
## V5.1.36 LTS2019-4-28
本次更新为常规更新,主要更新如下:
* 修正`chunk`方法一处异常抛出的错误
* 修正模型输出的`visible`
* 改进环境变量加载
* 改进命令行日志的`level`配置支持
* 修复设置有缓存前缀时,无法清空缓存标签的问题
* HasMony对象`saveAll`方法兼容`Collection`格式参数格式
* 修正`whereOr`查询使用字符串的问题
* 改进`dateFormat`设置对写入数据的影响
* 修正查询缓存
* 记住指定的跳转地址
* 改进软删除
* 改进聚合查询SQL去除limit 1
* 改进缓存驱动
## V5.1.35 LTS2019-3-2
本次主要为常规更新,修正了一些反馈的问题。
* 修正验证类自定义验证方法执行两次的问题
* 模型增加`isEmpty`方法用于判断是否空模型
* 改进获取器对`append`的支持
* 修正一对多关联的`withCount`自关联问题
* facade类注释调整
* 改进关联属性的`visible`和`hidden`判断
* 修正路由分组的`MISS`路由
* 改进pgsql.sql
## V5.1.34 LTS2019-1-30
本次更新为常规更新,修正了一些反馈的问题。
* 改进Request类的`has`方法,支持`patch`
* 改进`unique`验证的多条件支持
* 修复自定义上传验证,检测文件大小
* 改进`in`查询支持表达式
* 改进路由的`getBind`方法
* 改进验证类的错误信息获取
* 改进`response`助手函数默认值
* 修正mysql的`regexp`查询
* 改进模型类型强制转换写入对`Expression`对象的支持
## V5.1.33 LTS2019-1-16
* 修复路由中存在多个相同替换的正则BUG
* 修正whereLike查询
* join方法支持参数绑定
* 改进union方法
* 修正多对多关联的attach方法
* 改进验证类的正则规则自定义
* 改进Request类method方法
* 改进File日志类型的CLI日志写入
* 改进文件日志time_format配置对JSON格式的支持
## V5.1.32 LTS2018-12-24
本次主要为常规更新,修正了一些反馈的问题。
* 改进多对多关联的`attach`方法
* 改进聚合查询的`field`处理
* 改进关联的`save`方法
* 修正模型`exists`方法返回值
* 改进时间字段写入和输出
* 改进控制器中间件的调用
* 改进路由变量替换的性能
* 改进缓存标签的处理机制
## V5.1.31 LTS (2018-12-9)
本次版本包含一个安全更新,建议升级。
* 改进`field`方法
* 改进`count`方法返回类型
* `download`函数增加在浏览器中显示文件功能
* 修正多对多模型的中间表数据写入
* 改进`sqlsrv`驱动支持多个Schemas模式查询
* 统一助手函数与\think\response\Download函数文件过期时间
* 完善关联模型的`save`方法 增加`make`方法仅创建对象不保存
* 修改条件表达式对静态变量的支持
* 修正控制器名获取
* 改进view方法的`field`解析
## V5.1.30 LTS2018-11-30
该版本为常规更新,修正了一些社区反馈的问题。
主要更新如下:
* 改进查询类的`execute`方法
* 判断路由规则定义添加对请求类型的判断
* 修复`orderRaw`异常
* 修正 `optimize:autoload`指令
* 改进软删除的`destroy`方法造成重复执行事件的问题
* 改进验证类对扩展验证规则 始终验证 不管是否`require`
* 修复自定义验证`remove`所有规则的异常
* 改进时间字段的自动写入支持微秒数据
* 改进`Connection`类的`getrealsql`方法
* 修正`https`地址的URL生成
* 修复 `array_walk_recursive` 在低于PHP7.1消耗内部指针问题
* 改进手动参数绑定使用
* 改进聚合查询方法的`field`参数支持`Expression`
## V5.1.29 LTS2018-11-11
该版本主要改进了参数绑定的解析问题和提升性能,并修正了一些反馈的问题。
* 改进手动参数绑定
* 修正MISS路由的分组参数无效问题
* 行为支持对象的方法
* 修正全局查询范围
* 改进`belongsto`关联的`has`方法
* 改进`hasMany`关联
* 改进模型观察者多次注册的问题
* 改进`query`类的默认查询参数处理
* 修正`parseBetween`解析方法
* 改进路由地址生成的本地域名支持
* 改进参数绑定的实际URL解析性能
* 改进`Env`类的`getEnv`和`get`方法
* 改进模板缓存的生成优化
* 修复验证类的多语言支持
* 修复自定义场景验证`remove`规则异常
* File类添加是否自动补全扩展名的选项
* 改进`strpos`对子串是否存在的判断
* 修复`choice`无法用值选择第一个选项问题
* 验证器支持多维数组取值验证
* 改进解析`extend`和`block`标签的正则
## V5.1.28 LTS2018-10-29
该版本主要修正了上一个版本存在的一些问题,并改进了关联查询
* 改进聚合查询方法的字段支持DISTINCT
* 改进定义路由后url函数的端口生成
* 改进控制器中间件对`swoole`等的支持
* 改进Log类`save`方法
* 改进验证类的闭包验证参数
* 多对多关联支持指定中间表数据的名称
* 关联聚合查询支持闭包方式指定聚合字段
* 改进Lang类`get`方法
* 多对多关联增加判断关联数据是否存在的方法
* 改进关联查询使用`fetchsql`的情况
* 改进修改器的是否已经执行判断
* 增加`afterWith`和`beforeWith`验证规则 用于比较日期字段
## V5.1.27 LTS2018-10-22
该版本主要修正了路由绑定的参数改进了修改器的执行多次问题并正式宣布为LTS版本
* 修正路由绑定的参数丢失问题
* 修正路由别名的参数获取
* 改进修改器会执行多次的问题
## V5.1.262018-10-12
该版本主要修正了上一个版本的一些问题,并改进了全局查询范围的支持,同时包含了一个安全更新。
* 修正单一模块下注解路由无效的问题
* 改进数据库的聚合查询的字段处理
* 模型类增加`globalScope`属性定义 用于指定全局的查询范围
* 模型的`useGlobalScope`方法支持传入数组 用于指定当前查询需要使用的全局查询范围
* 改进数据集的`order`方法对数字类型的支持
* 修正上一个版本`order`方法解析的一处BUG
* 排序字段不合法或者错误的时候抛出异常
* 改进`Request`类的`file`方法对上传文件的错误判断
## V5.1.252018-9-21
该版本主要改进了查询参数绑定的性能和对浮点型的支持,以及一些细节的完善。
* 修正一处命令行问题
* 改进`Socketlog`日志驱动,支持自定义默认展开日志类别
* 修正`MorphMany`一处bug
* 跳转到上次记住的url并支持默认值
* 改进模型的异常提示
* 改进参数绑定对浮点型的支持
* 改进`order`方法解析
* 改进`json`字段数据的自动编码
* 改进日志`log_write`可能造成的日志写入死循环
* Log类增加`log_level`行为标签位置,用于对某个类型的日志进行处理
* Route类增加`clear`方法清空路由规则
* 分布式数据库配置支持使用数组
* 单日志文件也支持`max_files`参数
* 改进查询参数绑定的性能
* 改进别名路由的URL后缀参数检测
* 控制器前置方法和控制器中间件的`only`和`except`定义不区分大小写
## V5.1.242018-9-5
该版本主要增加了命令行的表格输出功能,并增加了查看路由定义的指令,以及修正了社区的一些反馈问题。
* 修正`Request`类的`file`方法
* 修正路由的`cache`方法
* 修正路由缓存的一处问题
* 改进上传文件获取的异常处理
* 改进`fetchCollection`方法支持传入数据集类名
* 修正多级控制器的注解路由生成
* 改进`Middleware`类`clear`方法
* 增加`route:list`指令用于[查看定义的路由](752690) 并支持排序
* 命令行增加`Table`输出类
* `Command`类增加`table`方法用于输出表格
* 改进搜索器查询方法支持别名定义
* 命令行配置增加`auto_path`参数用于定义自动载入的命令类路径
* 增加`make:command`指令用于[快速生成指令](354146)
* 改进`make:controller`指令对操作方法后缀的支持
* 改进命令行的定义文件支持索引数组 用于指令对象的惰性加载
* 改进`value`和`column`方法对后续查询结果的影响
* 改进`RuleName`类的`setRule`方法
## V5.1.232018-8-23
该版本主要改进了数据集对象的处理,增加了`findOrEmpty`方法并且修正了一些社区反馈的BUG。
* 数据集类增加`diff`/`intersect`方法用于获取差集和交集(默认根据主键值比较)
* 数据集类增加`order`方法支持指定字段排序
* 数据集类增加`map`方法使用回调函数处理数据并返回新的数据集对象
* Db增加`allowEmpty`方法允许`find`方法在没有数据的时候返回空数组或者空模型对象而不是null
* Db增加`findOrEmpty`方法
* Db增加`fetchCollection`方法用于指定查询返回数据集对象
* 改进`order`方法的数组方式解析,增强安全性
* 改进`withSearch`方法,支持第三个参数传入字段前缀标识,用于多表查询字段搜索
* 修正`optimize:route`指令开启类库后缀后的注解路由生成
* 修正redis缓存及session驱动
* 支持指定`Yaconf`的独立配置文件
* 增加`yaconf`助手函数用于配置文件
## V5.1.222018-8-9
该版本主要增加了模型搜索器和`withJoin`方法,完善了模型输出和对`Yaconf`的支持修正了一些社区反馈的BUG。
* 改进一对一关联的`table`识别问题
* 改进内置`Facade`类
* 增加`withJoin`方法支持`join`方式的[一对一关联](一对一关联.md)查询
* 改进`join`预载入查询的空数据问题
* 改进`Config`类的`load`方法支持快速加载配置文件
* 改进`execute`方法和事务的断线重连
* 改进`memcache`驱动的`has`方法
* 模型类支持定义[搜索器](搜索器.md)方法
* 完善`Config`类对`Yaconf`的支持
* 改进模型的`hidden/visible/append/withAttr`方法,支持在[查询前后调用](数组访问.md),以及支持数据集对象
* 数据集对象增加`where`方法根据字段或者关联数据[过滤数据](模型数据集.md)
* 改进AJAX请求的`204`判断
## V5.1.212018-8-2
该版本主要增加了下载响应对象和数组查询对象的支持,并修正了一些社区反馈的问题。
* 改进核心对象的无用信息调试输出
* 改进模型的`isRelationAttr`方法判断
* 模型类的`get`和`all`方法并入Db类
* 增加[下载响应对象](文件下载.md)和`download`助手函数
* 修正别名路由配置定义读取
* 改进`resultToModel`方法
* 修正开启类库后缀后的注解路由生成
* `Response`类增加`noCache`快捷方法
* 改进路由对象在`Swoole`/`Workerman`下面参数多次合并问题
* 修正路由`ajax`/`pjax`参数后路由变量无法正确获取的问题
* 增加清除中间件的方法
* 改进依赖注入的参数规范自动识别(便于对接前端小写+下划线规范)
* 改进`hasWhere`的数组条件的字段判断
* 增加[数组查询对象](高级查询.md)`Where`支持(喜欢数组查询的福音)
* 改进多对多关联的闭包支持
## V5.1.202018-7-25
该版本主要增加了Db和模型的动态获取器的支持并修正了一些已知问题。
* Db类添加[获取器支持](703981)
* 支持模型及关联模型字段[动态定义获取器](354046)
* 动态获取器支持`JSON`字段
* 改进路由的`before`行为执行(匹配后执行)
* `Config`类支持`Yaconf`
* 改进Url生成的端口问题
* Request类增加`setUrl`和`setBaseUrl`方法
* 改进页面trace的信息显示
* 修正`MorphOne`关联
* 命令行添加[查看版本指令](703994)
## V5.1.19 2018-7-13
该版本是一个小幅改进版本,针对`Swoole`和`Workerman`的`Cookie`支持做了一些改进,并修正了一些已知的问题。
* 改进query类`delete`方法对软删除条件判断
* 修正分表查询的软删除问题
* 模型查询的时候同时传入`table`和`name`属性
* 容器类增加`IteratorAggregate`和`Countable`接口支持
* 路由分组支持对下面的资源路由统一设置`only/except/vars`参数
* 改进Cookie类更好支持扩展
* 改进Request类`post`方法
* 改进模型自关联的自动识别
* 改进Request类对`php://input`数据的处理
## V5.1.18 2018-6-30
该版本主要完善了对`Swoole`和`Workerman`的`HttpServer`运行支持,改进`Request`类,并修正了一些已知的问题。
* 改进关联`append`方法的处理
* 路由初始化和检测方法分离
* 修正`destroy`方法强制删除
* `app_init`钩子位置移入`run`方法
* `think-swoole`扩展更新到2.0版本
* `think-worker`扩展更新到2.0版本
* 改进Url生成的域名自动识别
* `Request`类增加`setPathinfo`方法和`setHost`方法
* `Request`类增加`withGet`/`withPost`/`withHeader`/`withServer`/`withCookie`/`withEnv`方法进行赋值操作
* Route类改进`host`属性的获取
* 解决注解路由配置不生效的问题
* 取消Test日志驱动改为使用`close`设置关闭全局日志写入
* 修正路由的`response`参数
* 修正204响应输出的判断
## V5.1.17 2018-6-18
该版本主要增加了控制器中间件的支持,改进了路由功能,并且修正了社区反馈的一些问题。
* 修正软删除的`delete`方法
* 修正Query类`Count`方法
* 改进多对多`detach`方法
* 改进Request类`Session`方法
* 增加控制器中间件支持
* 模型类增加`jsonAssoc`属性用于定义json数据是否返回数组
* 修正Request类`method`方法的请求伪装
* 改进静态路由的匹配
* 分组首页路由自动完整匹配
* 改进sqlsrv的`column`方法
* 日志类的`apart_level`配置支持true自动生成对应类型的日志文件
* 改进`204`输出判断
* 修正cli下页面输出的BUG
* 验证类使用更高效的`ctype`验证机制
* 改进Request类`cookie`方法
* 修正软删除的`withTrashed`方法
* 改进多态一对多的预载入查询
* 改进Query类`column`方法的缓存读取
* Query类增加`whereBetweenTimeField`方法
* 改进分组下多个相同路由规则的合并匹配问题
* 路由类增加`getRule`/`getRuleList`方法获取定义的路由
## V5.1.16 2018-6-7
该版本主要修正了社区反馈的一些问题并对Request类做了进一步规范和优化。
* 改进Session类的`boot`方法
* App类的初始化方法可以单独执行
* 改进Request类的`param`方法
* 改进资源路由的变量替换
* Request类增加`__isset`方法
* 改进`useGlobalScope`方法对软删除的影响
* 修正命令行调用
* 改进Cookie类`init`方法
* 改进多对多关联删除的返回值
* 一对多关联写入支持`replace`
* 路由增加`filter`检测方法,用于通过请求参数检测路由是否匹配
* 取消Request类`session/env/server`方法的`filter`参数
* 改进关联的指定属性输出
* 模型删除操作删除后不清空对象数据仅作标记
* 调整模型的`save`方法返回值为布尔值
* 修正Request类`isAjax`方法
* 修正中间件的模块配置读取
* 取消Request类的请求变量的设置功能
* 取消请求变量获取的默认修饰符
* Request类增加`setAction/setModule/setController`方法
* 关联模型的`delete`方法调用Query类
* 改进URL生成的域名识别
* 改进URL检测对已定义路由的域名判断
* 模型类增加`isExists`和`isForce`方法
* 软删除的`destroy`和`restore`方法返回值调整为布尔值
## V5.1.15 2018-6-1
该版本主要改进了路由缓存的性能和缓存方式设置增加了JSON格式文件日志的支持并修正了社区反馈的一些问题。
* 容器类增加`exists`方法 仅判断是否存在对象实例
* 取消配置类的`autoload`方法
* 改进路由缓存大小提高性能
* 改进Dispatch类`init`方法
* 增加`make:validate`指令生成验证器类
* Config类`get`方法支持默认值参数
* 修正字段缓存指令
* 改进App类对`null`数据的返回
* 改进模型类的`__isset`方法判断
* 修正`Query`类的`withAggregate`方法
* 改进`RuleItem`类的`setRuleName`方法
* 修正依赖注入和参数的冲突问题
* 修正Db类对第三方驱动的支持
* 修正模型类查询对象问题
* 修正File缓存驱动的`has`方法
* 修正资源路由嵌套
* 改进Request类对`$_SERVER`变量的读取
* 改进请求缓存处理
* 路由缓存支持指定单独的缓存方式和参数
* 修正资源路由的中间件多次执行问题
* 修正`optimize:config`指令
* 文件日志支持`JSON`格式日志保存
* 修正Db类`connect`方法
* 改进Log类`write`方法不会自动写入之前日志
* 模型的关联操作默认启用事务
* 改进软删除的事件响应
## V5.1.14 2018-5-18
该版本主要对底层容器进行了一些优化改进,并增加了路由缓存功能,可以进一步提升路由性能。
* 依赖注入的对象参数传入改进
* 改进核心类的容器实例化
* 改进日期字段的读取
* 改进验证类的`getScene`方法
* 模型的`create`方法和`save`方法支持`replace`操作
* 改进`Db`类的调用机制
* App类调整为容器类
* 改进容器默认绑定
* `Loader`类增加工厂类的实例化方法
* 增加路由变量默认规则配置参数
* 增加路由缓存设计
* 错误处理机制改进
* 增加清空路由缓存指令
## V5.1.13 2018-5-11
该版本主要增加了MySQL的XA事务支持模型事件支持观察者以及对Facade类的改进。
* 改进自动缓存
* 改进Url生成
* 修正数据缓存
* 修正`value`方法的缓存
* `join`方法和`view`方法的条件支持使用`Expression`对象
* 改进驱动的`parseKey`方法
* 改进Request类`host`方法和`domain`方法对端口的处理
* 模型增加`withEvent`方法用于控制当前操作是否需要执行模型事件
* 模型`setInc/setDec`方法支持更新事件
* 模型添加`before_restore/after_restore`事件
* 增加模型事件观察者
* 路由增加`mobile`方法设置是否允许手机访问
* 数据库XA事务支持
* 改进索引数组查询对`IN`查询的支持
* 修正`invokeMethod`方法
* 修正空数据写入返回值的BUG
* redis驱动支持`predis`
* 改进`parseData`方法
* 改进模块加载
* App类初始化方法调整
* 改进数组查询对表达式`Expression`对象支持
* 改进闭包的依赖注入调用
* 改进多对多关联的中间表模型更新
* 增加容器中对象的自定义实例化
## V5.1.12 2018-4-25
该版本主要改进了主从查询的及时性,并支持动态设置请求数据。
* 支持动态设置请求数据
* 改进`comment`方法解析
* 修正App类`__unset`方法
* 改进url生成的域名绑定
* 改进主从查询的及时性
* 修正`value`的数据缓存功能
* 改进分页类的集合对象方法调用
* 改进Db类的代码提示
* SQL日志增加主从标记
## V5.1.11 2018-4-19
该版本为安全和修正版本改进了JSON查询的参数绑定问题和容器类对象实例获取并包含一处可能的安全隐患建议更新。
* 支持指定JSON数据查询的字段类型
* 修正`selectInsert`方法
* `whereColumn`方法支持数组方式
* 改进容器类`make`方法
* 容器类`delete`方法支持数组
* 改进`composer`自动加载
* 改进模板引擎
* 修正`like`查询的一处安全隐患
## V5.1.10 2018-4-16
该版本为修正版本修正上一个版本的一些BUG并增强了`think clear`指令。
* 改进`orderField`方法
* 改进`exists`查询
* 修改cli模式入口文件位置计算
* 修正`null`查询
* 改进`parseTime`方法
* 修正关联预载入查询
* 改进`mysql`驱动
* 改进`think clear`指令 支持 `-c -l -r `选项
* 改进路由规则对`/`结尾的支持
## V5.1.9 2018-4-12
该版本主要是一些改进和修正,并包含一个安全更新,是一个推荐更新版本。
* 默认模板渲染规则支持配置保持操作方法名
* 改进`Request`类的`ip`方法
* 支持模型软删除字段的默认值定义
* 改进路由变量规则对中文的支持
* 使用闭包查询的时候使用`cache(true)` 抛出异常提示
* 改进`Loader`类`loadComposerAutoloadFiles`方法
* 改进查询方法安全性
* 修正路由地址中控制器名驼峰问题
* 调整上一个版本的`module_init`和`app_begin`的钩子顺序问题
* 改进CLI命令行执行的问题
* 修正社区反馈的其它问题
## V5.1.8 2018-4-5
该版本主要改进了中间件的域名和模块支持,并同时修正了几个已知问题。
* 增加`template.auto_rule` 参数设置默认模板渲染的操作名自动转换规则
* 默认模板渲染规则改由视图驱动实现
* 修正路由标识定义
* 修正控制器路由方法
* 改进Request类`ip`方法支持自定义代理IP参数
* 路由注册中间件支持数组方式别名
* 改进命令行执行下的`composer`自动加载
* 添加域名中间件注册支持
* 全局中间件支持模块定义文件
* Log日志配置支持`close`参数可以全局关闭日志写入
* 中间件方法中捕获`HttpResponseException`异常
* 改进中间件的闭包参数传入
* 改进分组路由的延迟解析
* 改进URL生成对域名绑定的支持
* 改进文件缓存和文件日志驱动的并发支持
## V5.1.7 2018-3-28
该版本主要修正了路由的一些问题,并改进了查询的安全性。
* 支持`middleware`配置文件预先定义中间件别名方便路由调用
* 修正资源路由
* 改进`field`方法 自动识别`fieldRaw`
* 增加`Expression`类
* Query类增加`raw`方法
* Query类的`field`/ `order` 和` where`方法都支持使用`raw`表达式查询
* 改进`inc/dec`查询 支持批量更新
* 改进路由分组
* 改进Response类`create`方法
* 改进composer自动加载
* 修正域名路由的`append`方法
* 修正操作方法的初始化方法获取不到问题
## V5.1.6 2018-3-26
该版本主要改进了路由规则的匹配算法,大幅提升了路由性能。并正式引入了中间件的支持,可以在路由中定义或者全局定义。另外包含了一个安全更新,是一个建议更新版本。
* 改进URL生成对路由`ext`方法的支持
* 改进查询缓存对不同数据库相同表名的支持
* 改进composer自动加载的性能
* 改进空路由变量对默认参数的影响
* mysql的`json`字段查询支持多级
* Query类增加`option`方法
* 优化路由匹配
* 修复验证规则数字键名丢失问题
* 改进路由Url生成
* 改进一对一关联预载入查询
* Request类增加`rootDomain`方法
* 支持API资源控制器生成 `make:controller --api`
* 优化Template类的标签解析
* 容器类增加删除和清除对象实例的方法
* 修正MorphMany关联的`eagerlyMorphToMany`方法一处错误
* Container类的异常捕获改进
* Domain对象支持`bind`方法
* 修正分页参数
* 默认模板的输出规则不受URL影响
* 注解路由支持多级控制器
* Query类增加`getNumRows`方法获取前次操作影响的记录数
* 改进查询条件的性能
* 改进模型类`readTransform`方法对序列化类型的处理
* Log类增加`close`方法可以临时关闭当前请求的日志写入
* 文件日志方式增加自动清理功能(设置`max_files`参数)
* 修正Query类的`getPk`方法
* 修正模板缓存的布局开关问题
* 修正Query类`select`方法的缓存
* 改进input助手函数
* 改进断线重连的信息判断
* 改进正则验证方法
* 调整语言包的加载顺序 放到`app_init`之前
* controller类`fetch`方法改为`final`
* 路由地址中的变量支持使用`<var>`方式
* 改进XMLResponse 支持传入编码过的xml内容
* 修正Query类`view`方法的数组表名支持
* 改进路由的模型闭包绑定
* 改进分组变量规则的继承
* 改进`cli-server`模式下的`composer`自动加载
* 路由变量规则异常捕获
* 引入中间件支持
* 路由定义增加`middleware`方法
* 增加生成中间件指令`make:middleware`
* 增加全局中间件定义支持
* 改进`optimize:config`指令对全局中间件的支持
* 改进config类`has`方法
* 改进时间查询的参数绑定
* 改进`inc/dec/exp`查询的安全性
## V5.1.5 2018-1-31
该版本主要增强了数据库的JSON查询并支持JSON字段的聚合查询改进了一些性能问题修正了路由的一些BUG主要更新如下
* 改进数据集查询对`JSON`数据的支持
* 改进聚合查询对`JSON`字段的支持
* 模型类增加`getOrFail`方法
* 改进数据库驱动的`parseKey`方法
* 改进Query类`join`方法的自关联查询
* 改进数据查询不存在不生成查询缓存
* 增加`run`命令行指令启动内置服务器
* `Request`类`pathinfo`方法改进对`cli-server`支持
* `Session`类增加`use_lock`配置参数设置是否启用锁机制
* 优化`File`缓存自动生成空目录的问题
* 域名及分组路由支持`append`方法传递隐式参数
* 改进日志的并发写入问题
* 改进`Query`类的`where`方法支持传入`Query`对象
* 支持设置单个日志文件的文件名
* 修正路由规则的域名条件约束
* `Request`类增加`subDomain`方法用于获取当前子域名
* `Response`类增加`allowCache`方法控制是否允许请求缓存
* `Request`类增加`sendData`方法便于扩展
* 改进`Env`类不依赖`putenv`方法
* 改进控制台`trace`显示错误
* 改进`MorphTo`关联
* 改进完整路由匹配后带斜线访问出错的情况
* 改进路由的多级分组问题
* 路由url地址生成支持多级分组
* 改进路由Url生成的`url_convert`参数的影响
* 改进`miss`和`auto`路由内部解析
* 取消预载入关联查询缓存功能
## V5.1.4 2018-1-19
该版本主要增强了数据库和模型操作,主要更新如下:
* 支持设置 `deleteTime`属性为`false` 关闭软删除
* 模型增加`getError`方法
* 改进Query类的`getTableFields`/`getFieldsType`方法 支持表名自动获取
* 模型类`toCollection`方法增加参数指定数据集类
* 改进`union`查询
* 关联预载入`with`方法增加缓存参数
* 改进模型类的`get`和`all`方法的缓存 支持关联缓存
* 支持`order by field`操作
* 改进`insertAll`分批写入
* 改进`json`字段数据支持
* 增加JSON数据的模型对象化操作
* 改进路由`ext`参数检测
* 修正`rule`方法的`method`参数使用 `get|post` 方式注册路由的问题
## V5.1.3 2018-1-12
该版本主要改进了路由及调整函数加载顺序,主要更新如下:
* 增加`env`助手函数;
* 增加`route`助手函数;
* 增加视图路由方法;
* 增加路由重定向方法;
* 路由默认区分最后的目录斜杆(支持设置不区分);
* 调整公共文件和配置文件的加载顺序(可以在配置文件中直接使用助手函数);
* 视图类增加`filter`方法设置输出过滤;
* `view`助手函数增加`filter`参数;
* 改进缓存生成指令;
* Session类的`get`方法支持获取多级;
* Request类`only`方法支持指定默认值;
* 改进路由分组;
* 修正使用闭包查询的时候自动数据缓存出错的情况;
* 废除`view_filter`钩子位置;
* 修正分组下面的资源路由;
* 改进session驱动;
## V5.1.2 2018-1-8
该版本改进了配置类及数据库类,主要更新如下:
* 修正嵌套路由分组;
* 修正自定义模板标签界定符后表达式语法出错的情况;
* 修正自关联的多次调用问题;
* 修正数组查询的`null`条件查询;
* 修正Query类的`order`及`field`的一处可能的BUG
* 配置参数设置支持三级;
* 配置对象支持`ArrayAccess`
* App类增加`path`方法用于设置应用目录;
* 关联定义增加`selfRelation`方法用于设置是否为自关联;
## V5.1.1 2018-1-3
修正一些反馈的BUG包括
* 修正Cookie类存取数组的问题
* 修正Controller的`fetch`方法
* 改进跨域请求
* 修正`insertAll`方法
* 修正`chunk`方法
## V5.1.0 2018-1-1
主要更新如下:
* 增加注解路由支持
* 路由支持跨域请求设置
* 增加`app_dispatch`钩子位置
* 修正多对多关联的`detach`方法
* 修正软删除的`destroy`方法
* Cookie类`httponly`参数默认为false
* 日志File驱动增加`single`参数配置记录同一个文件(不按日期生成)
* 路由的`ext`和`denyExt`方法支持不传任何参数
* 改进模型的`save`方法对`oracle`的支持
* Query类的`insertall`方法支持配合`data`和`limit`方法
* 增加`whereOr`动态查询支持
* 日志的ip地址记录改进
* 模型`saveAll`方法支持`isUpdate`方法
* 改进`Pivot`模型的实例化操作
* 改进Model类的`data`方法
* 改进多对多中间表模型类
* 模型增加`force`方法强制更新所有数据
* Hook类支持设置入口方法名称
* 改进验证类
* 改进`hasWhere`查询的数据重复问题
* 模型的`saveall`方法返回数据集对象
* 改进File缓存的`clear`方法
* 缓存添加统一的序列化机制
* 改进泛三级域名的绑定
* 改进泛域名的传值和取值
* Request类增加`panDomain`方法
* 改进废弃字段判断
* App类增加`create`方法用于实例化应用类库
* 容器类增加`has`方法
* 改进多数据库切换连接
* 改进断线重连的异常捕获
* 改进模型类`buildQuery`方法
* Query类增加`unionAll`方法
* 关联统计功能增强支持Sum/Max/Min/Avg
* 修正延迟写入
* chunk方法支持复合主键
* 改进JSON类型的写入
* 改进Mysql的insertAll方法
* Model类`save`方法改进复合主键包含自增的情况
* 改进Query类`inc`和`dec`方法的关键字处理
* File缓存inc和dec方法保持原来的有效期
* 改进redis缓存的有效期判断
* 增加checkRule方法用于单独数据的多个验证规则
* 修正setDec方法的延迟写入
* max和min方法增加force参数
* 二级配置参数区分大小写
* 改进join方法自关联的问题
* 修正关联模型自定义表名的情况
* Query类增加getFieldsType和getTableFields方法
* 取消视图替换功能及view_replace_str配置参数
* 改进域名绑定模块后的额外路由规则问题
* 改进mysql的insertAll方法
* 改进insertAll方法写入json字段数据的支持
* 改进redis长连接多编号库的情况
## RC3版本2017-11-6
主要更新如下:
* 改进redis驱动的`get`方法
* 修正Query类的`alias`方法
* `File`类错误信息支持多语言
* 修正路由的额外参数解析
* 改进`whereTime`方法
* 改进Model类`getAttr`方法
* 改进App类的`controller`和`validate`方法支持多层
* 改进`HasManyThrough`类
* 修正软删除的`restore`方法
* 改进`MorpthTo`关联
* 改进数据库驱动类的`parseKey`方法
* 增加`whereField`动态查询方法
* 模型增加废弃字段功能
* 改进路由的`after`行为检查和`before`行为机制
* 改进路由分组的检查
* 修正mysql的`json`字段查询
* 取消Connection类的`quote`方法
* 改进命令行的支持
* 验证信息支持多语言
* 修正路由模型绑定
* 改进参数绑定类型对枚举类型的支持
* 修正模板的`{$Think.version} `输出
* 改进模板`date`函数解析
* 改进`insertAll`方法支持分批执行
* Request类`host`方法支持反向代理
* 改进`JumpResponse`支持区分成功和错误模板
* 改进开启类库后缀后的关联外键自动识别问题
* 修正一对一关联的JOIN方式预载入查询问题
* Query类增加`hidden`方法
## RC2版本2017-10-17
主要更新如下:
* 修正视图查询
* 修正资源路由
* 修正`HasMany`关联 修正`where`方法的闭包查询
* 一对一关联绑定属性到父模型后 关联属性不再保留
* 修正应用的命令行配置文件读取
* 改进`Connection`类的`getCacheKey`方法
* 改进文件上传的非法图像异常
* 改进验证类的`unique`规则
* Config类`get`方法支持获取一级配置
* 修正count方法对`fetchSql`的支持
* 修正mysql驱动对`socket`支持
* 改进Connection类的`getRealSql`方法
* 修正`view`助手函数
* Query类增加`leftJoin` `rightJoin``fullJoin`方法
* 改进app_namespace的获取
* 改进`append`方法对一对一`bind`属性的支持
* 改进关联的`saveall`方法的返回值
* 路由标识设置异常修复
* 改进Route类`rule`方法
* 改进模型的`table`属性设置
* 改进composer autofile的加载顺序
* 改进`exception_handle`配置对闭包的支持
* 改进app助手函数增加参数
* 改进composer的加载路径判断
* 修正路由组合变量的URL生成
* 修正路由URL生成
* 改进`whereTime`查询并支持扩展规则
* File类的`move`方法第二个参数支持`false`
* 改进Config类
* 改进缓存类`remember`方法
* 惯例配置文件调整 Url类当普通模式参数的时候不做`urlencode`处理
* 取消`ROOT_PATH`和`APP_PATH`常量定义 如需更改应用目录 自己重新定义入口文件
* 增加`app_debug`的`Env`获取
* 修正泛域名绑定
* 改进查询表达式的解析机制
* mysql增加`regexp`查询表达式 支持正则查询
* 改进查询表达式的异常判断
* 改进model类的`destroy`方法
* 改进Builder类 取消`parseValue`方法
* 修正like查询的参数绑定问题
* console和start文件移出核心纳入应用库
* 改进Db类主键删除方法
* 改进泛域名绑定模块
* 取消`BIND_MODULE`常量 改为在入口文件使用`bind`方法设置
* 改进数组查询
* 改进模板渲染的异常处理
* 改进控制器基类的架构方法参数
* 改进Controller类的`success`和`error`方法
* 改进对浏览器`JSON-Handle`插件的支持
* 优化跳转模板的移动端显示
* 修正模型查询的`chunk`方法对时间字段的支持
* 改进trace驱动
* Collection类增加`push`方法
* 改进Redis Session驱动
* 增加JumpResponse驱动
## RC12017-9-8
主要新特性为:
* 引入容器和Facade支持
* 依赖注入完善和支持更多场景
* 重构的(对象化)路由
* 配置和路由目录独立
* 取消系统常量
* 助手函数增强
* 类库别名机制
* 模型和数据库增强
* 验证类增强
* 模板引擎改进
* 支持PSR-3日志规范
* RC1版本取消了5.0多个字段批量数组查询的方式

32
server/LICENSE.txt Normal file
View file

@ -0,0 +1,32 @@
ThinkPHP遵循Apache2开源协议发布并提供免费使用。
版权所有Copyright © 2006-2018 by ThinkPHP (http://thinkphp.cn)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
Apache Licence是著名的非盈利开源组织Apache采用的协议。
该协议和BSD类似鼓励代码共享和尊重原作者的著作权
允许代码修改,再作为开源或商业软件发布。需要满足
的条件:
1 需要给代码的用户一份Apache Licence
2 如果你修改了代码,需要在被修改的文件中说明;
3 在延伸的代码中(修改和有源代码衍生的代码中)需要
带有原来代码中的协议,商标,专利声明和其他原来作者规
定需要包含的说明;
4 如果再发布的产品中包含一个Notice文件则在Notice文
件中需要带有本协议内容。你可以在Notice中增加自己的
许可但不可以表现为对Apache Licence构成更改。
具体的协议参考http://www.apache.org/licenses/LICENSE-2.0
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

180
server/README.md Normal file
View file

@ -0,0 +1,180 @@
![](https://box.kancloud.cn/5a0aaa69a5ff42657b5c4715f3d49221)
ThinkPHP 5.1LTS版本 —— 12载初心你值得信赖的PHP框架
===============
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/top-think/framework/badges/quality-score.png?b=5.1)](https://scrutinizer-ci.com/g/top-think/framework/?branch=5.1)
[![Build Status](https://travis-ci.org/top-think/framework.svg?branch=master)](https://travis-ci.org/top-think/framework)
[![Total Downloads](https://poser.pugx.org/topthink/framework/downloads)](https://packagist.org/packages/topthink/framework)
[![Latest Stable Version](https://poser.pugx.org/topthink/framework/v/stable)](https://packagist.org/packages/topthink/framework)
[![PHP Version](https://img.shields.io/badge/php-%3E%3D5.6-8892BF.svg)](http://www.php.net/)
[![License](https://poser.pugx.org/topthink/framework/license)](https://packagist.org/packages/topthink/framework)
ThinkPHP5.1对底层架构做了进一步的改进,减少依赖,其主要特性包括:
+ 采用容器统一管理对象
+ 支持Facade
+ 注解路由支持
+ 路由跨域请求支持
+ 配置和路由目录独立
+ 取消系统常量
+ 助手函数增强
+ 类库别名机制
+ 增加条件查询
+ 改进查询机制
+ 配置采用二级
+ 依赖注入完善
+ 支持`PSR-3`日志规范
+ 中间件支持V5.1.6+
+ Swoole/Workerman支持V5.1.18+
> ThinkPHP5的运行环境要求PHP5.6以上。
## 安装
使用composer安装
~~~
composer create-project topthink/think tp
~~~
启动服务
~~~
cd tp
php think run
~~~
然后就可以在浏览器中访问
~~~
http://localhost:8000
~~~
更新框架
~~~
composer update topthink/framework
~~~
## 在线手册
+ [完全开发手册](https://www.kancloud.cn/manual/thinkphp5_1/content)
+ [升级指导](https://www.kancloud.cn/manual/thinkphp5_1/354155)
## 目录结构
初始的目录结构如下:
~~~
www WEB部署目录或者子目录
├─application 应用目录
│ ├─common 公共模块目录(可以更改)
│ ├─module_name 模块目录
│ │ ├─common.php 模块函数文件
│ │ ├─controller 控制器目录
│ │ ├─model 模型目录
│ │ ├─view 视图目录
│ │ └─ ... 更多类库目录
│ │
│ ├─command.php 命令行定义文件
│ ├─common.php 公共函数文件
│ └─tags.php 应用行为扩展定义文件
├─config 应用配置目录
│ ├─module_name 模块配置目录
│ │ ├─database.php 数据库配置
│ │ ├─cache 缓存配置
│ │ └─ ...
│ │
│ ├─app.php 应用配置
│ ├─cache.php 缓存配置
│ ├─cookie.php Cookie配置
│ ├─database.php 数据库配置
│ ├─log.php 日志配置
│ ├─session.php Session配置
│ ├─template.php 模板引擎配置
│ └─trace.php Trace配置
├─route 路由定义目录
│ ├─route.php 路由定义
│ └─... 更多
├─public WEB目录对外访问目录
│ ├─index.php 入口文件
│ ├─router.php 快速测试文件
│ └─.htaccess 用于apache的重写
├─thinkphp 框架系统目录
│ ├─lang 语言文件目录
│ ├─library 框架类库目录
│ │ ├─think Think类库包目录
│ │ └─traits 系统Trait目录
│ │
│ ├─tpl 系统模板目录
│ ├─base.php 基础定义文件
│ ├─console.php 控制台入口文件
│ ├─convention.php 框架惯例配置文件
│ ├─helper.php 助手函数文件
│ ├─phpunit.xml phpunit配置文件
│ └─start.php 框架入口文件
├─extend 扩展类库目录
├─runtime 应用的运行时目录(可写,可定制)
├─vendor 第三方类库目录Composer依赖库
├─build.php 自动生成定义文件(参考)
├─composer.json composer 定义文件
├─LICENSE.txt 授权说明文件
├─README.md README 文件
├─think 命令行入口文件
~~~
> 可以使用php自带webserver快速测试
> 切换到根目录后启动命令php think run
## 命名规范
`ThinkPHP5`遵循PSR-2命名规范和PSR-4自动加载规范并且注意如下规范
### 目录和文件
* 目录不强制规范,驼峰和小写+下划线模式均支持;
* 类库、函数文件统一以`.php`为后缀;
* 类的文件名均以命名空间定义,并且命名空间的路径和类库文件所在路径一致;
* 类名和类文件名保持一致,统一采用驼峰法命名(首字母大写);
### 函数和类、属性命名
* 类的命名采用驼峰法,并且首字母大写,例如 `User`、`UserType`,默认不需要添加后缀,例如`UserController`应该直接命名为`User`
* 函数的命名使用小写字母和下划线(小写字母开头)的方式,例如 `get_client_ip`
* 方法的命名使用驼峰法,并且首字母小写,例如 `getUserName`
* 属性的命名使用驼峰法,并且首字母小写,例如 `tableName`、`instance`
* 以双下划线“__”打头的函数或方法作为魔法方法例如 `__call``__autoload`
### 常量和配置
* 常量以大写字母和下划线命名,例如 `APP_PATH``THINK_PATH`
* 配置参数以小写字母和下划线命名,例如 `url_route_on` 和`url_convert`
### 数据表和字段
* 数据表和字段采用小写加下划线方式命名,并注意字段名不要以下划线开头,例如 `think_user` 表和 `user_name`字段,不建议使用驼峰和中文作为数据表字段命名。
## 参与开发
请参阅 [ThinkPHP5 核心框架包](https://github.com/top-think/framework)。
## 版权信息
ThinkPHP遵循Apache2开源协议发布并提供免费使用。
本项目包含的第三方源码和二进制文件之版权信息另行标注。
版权所有Copyright © 2006-2018 by ThinkPHP (http://thinkphp.cn)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
更多细节参阅 [LICENSE.txt](LICENSE.txt)

View file

@ -0,0 +1 @@
deny from all

View file

@ -0,0 +1,39 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\behavior;
use app\admin\cache\RoleMenuCache;
use app\admin\cache\RoleNoneAuthCacheUris;
class ClearMenuAuthCache
{
/**
* 清除菜单权限缓存
*/
public function run()
{
(new RoleMenuCache())->delAll();
(new RoleNoneAuthCacheUris())->delAll();
}
}

View file

@ -0,0 +1,52 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\behavior;
use think\Db;
use think\Request;
class SystemLog
{
/**
* 记录后台操作日志
* @param Request $request
*/
public function run(Request $request)
{
$admin_info = session('admin_info');
if (!session('admin_info')) {
return;
}
$data = [
'admin_id' => $admin_info['id'],
'account' => $admin_info['account'],
'name' => $admin_info['name'],
'create_time' => time(),
'uri' => url(),
'type' => $request->isPost() ? 'POST' : 'GET',
'param' => json_encode($request->param(),JSON_UNESCAPED_UNICODE),
'ip' => $request->ip(),
];
Db::name('system_log')->insert($data);
}
}

View file

@ -0,0 +1,43 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\cache;
use app\admin\server\MenuServer;
use app\common\cache\CacheBase;
/**
* 登录控制
* Class LoginCtrlCache
* @package app\admin\cache
*/
class LoginStateCache extends CacheBase
{
public function setTag()
{
return 'login_state';
}
public function setData()
{
return time();
}
}

View file

@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\cache;
use app\admin\server\MenuServer;
use app\common\cache\CacheBase;
class RoleMenuCache extends CacheBase
{
public function setTag()
{
return 'role_menu';
}
public function setData()
{
return MenuServer::getMenuHtml($this->extend['role_id']);
}
}

View file

@ -0,0 +1,39 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\cache;
use app\admin\server\AuthServer;
use app\common\cache\CacheBase;
class RoleNoneAuthCacheIds extends CacheBase
{
public function setTag()
{
return 'role_none_auth_ids';
}
public function setData()
{
return AuthServer::getRoleNoneAuthIds($this->extend['role_id']);
}
}

View file

@ -0,0 +1,39 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\cache;
use app\admin\server\AuthServer;
use app\common\cache\CacheBase;
class RoleNoneAuthCacheUris extends CacheBase
{
public function setTag()
{
return 'role_none_auth_uris';
}
public function setData()
{
return AuthServer::getRoleNoneAuthUris($this->extend['role_id']);
}
}

View file

@ -0,0 +1,29 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
use think\facade\Env;
return [
//默认错误跳转对应的模板文件
'dispatch_error_tmpl' => '../application/admin/view/dispatch/error.html',
//默认成功跳转对应的模板文件
'dispatch_success_tmpl' => '../application/admin/view/dispatch/success.html',
];

View file

@ -0,0 +1,32 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
use think\facade\Env;
return [
//免登录页面
'free_login' => ['account_login'],
//样式显示
'env_name' => Env::get('project.env_name', '本地环境-'),
'admin_name' => Env::get('project.admin_name', 'LikeShop管理后台'),
'theme_color' => 'layui-bg-blue',
'theme_button' => 'layui-btn-normal',
];

View file

@ -0,0 +1,37 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | 模板设置
// +----------------------------------------------------------------------
return [
//'layout_on' => true,
//'layout_name' => 'layout',
];

View file

@ -0,0 +1,65 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\LoginLogic;
use app\admin\validate\Login;
use think\facade\Url;
class Account extends AdminBase
{
public $like_not_need_login = ['login'];
/**
* 登录
* @return mixed
*/
public function login()
{
if ($this->request->isAjax()) {
$post = input('post.');
$result = $this->validate($post, 'app\admin\validate\Login');
if ($result === true) {
LoginLogic::login($post);
$this->_success('登录成功');
}
$this->_error($result);
}
$this->assign('account', cookie('account'));
//首页配置
$this->assign('config', LoginLogic::config());
return $this->fetch();
}
/**
* 退出登录
*/
public function logout()
{
LoginLogic::logout(session('admin_info.id'));
$url = Url::build('account/login');
$this->redirect($url);
}
}

View file

@ -0,0 +1,68 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\AccountLogLogic;
use think\helper\Time;
class AccountLog extends AdminBase{
/**
* note 资金记录
* create_time 2020/11/20 17:36
*/
public function capitalList(){
if($this->request->isAjax()){
$get = $this->request->get();
$list = AccountLogLogic::lists($get);
$this->_success('',$list);
}
$this->assign('order_source',AccountLogLogic::orderSourceList(1));
$this->assign('time',AccountLogLogic::getTime());
return $this->fetch();
}
/**
* note 积分记录
* create_time 2020/11/20 17:36
*/
public function integralList(){
if($this->request->isAjax()){
$get = $this->request->get();
$list = AccountLogLogic::lists($get);
$this->_success('',$list);
}
$this->assign('order_source',AccountLogLogic::orderSourceList(2));
$this->assign('time',AccountLogLogic::getTime());
return $this->fetch();
}
/**
* note 成长值记录
* create_time 2020/11/20 17:36
*/
public function growthList(){
if($this->request->isAjax()){
$get = $this->request->get();
$list = AccountLogLogic::lists($get);
$this->_success('',$list);
}
$this->assign('order_source',AccountLogLogic::orderSourceList(3));
$this->assign('time',AccountLogLogic::getTime());
return $this->fetch();
}
}

View file

@ -0,0 +1,153 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\ActivityAreaLogic;
class Activity extends AdminBase{
public function lists(){
$this->assign('activity_list',ActivityAreaLogic::getActivityList());
return $this->fetch();
}
/**
* note 活动专区列表
* create_time 2020/11/25 10:36
*/
public function areaLists(){
if($this->request->isAjax()){
$list = ActivityAreaLogic::areaLists();
$this->_success('',$list);
}
}
/**
* note 活动商品列表
* create_time 2020/11/25 10:36
*/
public function goodsLists(){
if($this->request->isAjax()){
$get = $this->request->get();
$list = ActivityAreaLogic::goodsLists($get);
$this->_success('',$list);
}
}
/**
* note 添加活动专区
* create_time 2020/11/25 10:37
*/
public function addActivity(){
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\ActivityArea.add');
if($result === true){
ActivityAreaLogic::addActivity($post);
$this->_success('新增成功',[]);
}
$this->_error($result);
}
return $this->fetch();
}
/**
* note 编辑活动专区
* create_time 2020/11/25 10:37
*/
public function editActivity($id){
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post,'app\admin\validate\ActivityArea');
if($result === true){
ActivityAreaLogic::editActivity($post);
$this->_success('新增成功',[]);
}
$this->_error($result);
}
$this->assign('info',ActivityAreaLogic::getActivity($id));
return $this->fetch();
}
/**
* note 删除活动专区
* create_time 2020/11/25 10:37
*/
public function delActivity(){
$id = $this->request->post('id');
ActivityAreaLogic::delActivity($id);
$this->_success('删除成功',[]);
}
/**
* note 添加活动商品
* create_time 2020/11/25 10:37
*/
public function addGoods(){
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['goods_list'] = form_to_linear($post);
$result = $this->validate($post,'app\admin\validate\ActivityGoods.add');
if($result === true){
ActivityAreaLogic::addGoods($post);
$this->_success('新增成功',[]);
}
$this->_error($result);
}
$this->assign('activity_list',ActivityAreaLogic::getActivityList());
return $this->fetch();
}
/**
* note 编辑活动商品
* create_time 2020/11/25 10:37
*/
public function editGoods(){
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post,'app\admin\validate\ActivityGoods');
if($result === true){
ActivityAreaLogic::editGoods($post);
$this->_success('新增成功',[]);
}
$this->_error($result);
}
$goods_id = $this->request->get('goods_id');
$activity_id = $this->request->get('activity_id');
$this->assign('activity_list',ActivityAreaLogic::getActivityList());
$this->assign('info',ActivityAreaLogic::getActivityGoods($goods_id,$activity_id));
return $this->fetch();
}
/**
* note 删除活动商品
* create_time 2020/11/25 10:38
*/
public function delGoods(){
$goods_id = $this->request->post('goods_id');
$activity_id = $this->request->post('activity_id');
$result = ActivityAreaLogic::delGoods($goods_id,$activity_id);
if($result == true){
$this->_success('删除成功','');
}
return $this->_error('删除失败','');
}
}

View file

@ -0,0 +1,160 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\AdLogic;
class Ad extends AdminBase
{
/**
* 广告管理列表
* @return mixed
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('获取成功', AdLogic::lists($get));
}
$type = \app\common\model\Ad::getAdTypeDesc(true);
$this->assign('type', $type);
return $this->fetch();
}
/**
* 添加
* @return mixed
*/
public function add($client = '')
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\Ad.add');
if ($result === true) {
$result = AdLogic::add($post);
if ($result) {
$this->_success('添加成功!');
} else {
$this->_error('添加失败');
}
}
$this->_error($result);
}
$this->assign('category_list',AdLogic::getGoodsCategory());
$this->assign('link_page', \app\common\model\Ad::getLinkPage($client));
$this->assign('position_list', AdLogic::infoPosition($client));
return $this->fetch();
}
/**
* 编辑
* @param string $id
* @return mixed
*/
public function edit($id = '')
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\Ad');
if ($result === true) {
$result = AdLogic::edit($post);
if ($result) {
$this->_success('编辑成功!');
} else {
$this->_error('编辑失败');
}
}
$this->_error($result);
}
$info = AdLogic::info($id);
$this->assign('position_list', AdLogic::infoPosition($info['client']));
$this->assign('category_list',AdLogic::getGoodsCategory());
$this->assign('link_page', \app\common\model\Ad::getLinkPage($info['client']));
$this->assign('info', $info);
return $this->fetch();
}
/**
* 删除
* @param $delData
*/
public function del($id, $client)
{
if ($this->request->isAjax()) {
$result = AdLogic::del($id, $client);
if ($result) {
$this->_success('删除成功');
}
$this->_error('删除失败');
}
}
/**
* 修改状态
*/
public function switchStatus()
{
$post = $this->request->post();
$result = AdLogic::switchStatus($post);
if ($result) {
$this->_success('修改成功');
}
$this->_error('修改失败');
}
/**
* 获取相应广告位置尺寸
*/
public function imgSize()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$result = AdLogic::imgSize($get);
if ($result) {
$this->_success('', $result);
}
$this->_error($result);
}
}
/**
* 获取对应终端的广告位置列表
*/
public function getPosition()
{
if ($this->request->isAjax()) {
$client = $this->request->get('client');
$result = AdLogic::infoPosition($client);
if ($result) {
$this->_success('', $result);
}
$this->_error($result);
}
}
}

View file

@ -0,0 +1,136 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\AdPositionLogic;
use app\common\model\Ad;
class AdPosition extends AdminBase
{
/**
* 广告管理列表
* @return mixed
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$result = AdPositionLogic::lists($get);
$this->_success('获取成功', $result);
}
$type = \app\common\model\Ad::getAdTypeDesc(true);
$this->assign('type', $type);
return $this->fetch();
}
/**
* 添加
* @return mixed
*/
public function add($client = '')
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\AdPosition.add');
if ($result === true) {
$result = AdPositionLogic::addAdPosition($post);
if ($result) {
$this->_success('添加成功!');
} else {
$this->_error('添加失败');
}
}
$this->_error($result);
}
return $this->fetch();
}
/**
* 编辑
* @param string $id
* @return mixed
*/
public function edit($id = '')
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\AdPosition.edit');
if ($result === true) {
$result = AdPositionLogic::editAdPosition($post);
if ($result) {
$this->_success('编辑成功!');
} else {
$this->_error('编辑失败');
}
}
$this->_error($result);
}
$this->assign('info', AdPositionLogic::info($id));
return $this->fetch();
}
/**
* 删除
* @param $delData
*/
public function del()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$delData = $this->request->post('delData');
$attr = $this->request->post('attr');
$client = $this->request->post('client');
$result = $this->validate($post, 'app\admin\validate\AdPosition.del');
if ($result === true) {
// dd($result);
$result = AdPositionLogic::del($delData, $client, $attr);
if ($result) {
$this->_success('删除成功');
}
$this->_error('删除失败');
}
$this->_error($result);
}
}
/**
* 修改状态
*/
public function switchStatus()
{
$post = $this->request->post();
$result = AdPositionLogic::switchStatus($post);
if ($result) {
$this->_success('修改成功');
}
$this->_error('修改失败');
}
}

View file

@ -0,0 +1,115 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\AdminLogic;
class Admin extends AdminBase
{
/**
* 管理员列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('', AdminLogic::lists($get));
}
$this->assign('role_lists', AdminLogic::roleLists());
return $this->fetch();
}
/**
* 添加管理员
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['disable'] = isset($post['disable']) && $post['disable'] == 'on' ? 0 : 1;
$result = $this->validate($post, 'app\admin\validate\Admin.add');
if ($result === true) {
AdminLogic::addAdmin($post);
$this->_success('修改成功');
}
$this->_error($result);
}
$this->assign('role_lists', AdminLogic::roleLists());
return $this->fetch();
}
/**
* 编辑管理员
* @param string $admin_id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function edit($admin_id = '')
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['disable'] = isset($post['disable']) && $post['disable'] == 'on' ? 0 : 1;
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\Admin.edit');
if ($result === true) {
AdminLogic::editAdmin($post);
$this->_success('修改成功');
}
$this->_error($result);
}
$this->assign('info', AdminLogic::info($admin_id));
$this->assign('role_lists', AdminLogic::roleLists());
return $this->fetch();
}
/**
* 删除管理员
* @param $admin_id
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function del($admin_id)
{
if ($this->request->isAjax()) {
$result = AdminLogic::delAdmin($admin_id);
if ($result) {
$this->_success('删除成功');
}
$this->_error('删除失败');
}
}
}

View file

@ -0,0 +1,182 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\server\AuthServer;
use app\BaseController;
use app\common\server\UrlServer;
use think\Controller;
use think\exception\HttpResponseException;
use think\facade\Config;
use think\facade\Debug;
use think\facade\Url;
use think\Response;
class AdminBase extends Controller
{
public $like_not_need_login = [];
protected $js_data = [];
public $admin_info = [];
public $admin_id;
public $view_theme_color = '';
public $page_no = 1;
public $page_size = 15;
public function __construct()
{
parent::__construct();
$this->setValue();
self::setViewValue();
}
public function setValue()
{
$this->admin_info = session('admin_info');
$this->admin_id = session('admin_info.id');
//分页参数
$page_no = (int)$this->request->get('page_no');
$this->page_no = $page_no && is_numeric($page_no) ? $page_no : $this->page_no;
$page_size = (int)$this->request->get('page_size');
$this->page_size = $page_size && is_numeric($page_size) ? $page_size : $this->page_size;
$this->page_size = min($this->page_size, 100);
}
/**
* 设置视图全局变量
*/
private function setViewValue()
{
$app = Config::get('project.');
$this->assign('view_env_name', $app['env_name']);
$this->assign('view_admin_name', $app['admin_name']);
$this->assign('view_theme_color', $app['theme_color']);
$this->assign('view_theme_button', $app['theme_button']);
$this->assign('version', $app['version']);
$this->assign('front_version', $app['front_version']);
$this->assign('storageUrl', UrlServer::getFileUrl('/'));
$this->assignJs('image_upload_url', Url::build('file/image'));
}
/**
* User: 意象信息科技 lr
* Desc: 请求成功
* @param string $msg
* @param array $data
* @param int $code
* @param int $show
* @param array $header
*/
protected function _success($msg = '', $data = [], $code = 1, $show = 0, $wait = 3, $url = '', array $header = [])
{
$type = $this->getResponseType();
$time = Debug::getUseTime();
$result = [
'code' => $code,
'msg' => $msg,
'data' => $data,
'show' => $show,
'time' => $time,
'wait' => $wait,
'url' => $url,
];
$type = $this->getResponseType();
// 把跳转模板的渲染下沉,这样在 response_send 行为里通过getData()获得的数据是一致性的格式
if ('html' == strtolower($type)) {
$type = 'jump';
}
$response = Response::create($result, $type)->header($header)->options(['jump_template' => $this->app['config']->get('dispatch_success_tmpl')]);
throw new HttpResponseException($response);
}
/**
* User: 意象信息科技 lr
* Desc: 请求失败
* @param string $msg
* @param array $data
* @param int $code
* @param int $show
* @param array $header
*/
protected function _error($msg = '', $data = [], $code = 0, $show = 1, $wait = 3, $url = '', array $header = [])
{
$type = $this->getResponseType();
$time = Debug::getUseTime();
$result = [
'code' => $code,
'msg' => $msg,
'data' => $data,
'show' => $show,
'time' => $time,
'wait' => $wait,
'url' => $url,
];
if ('html' == strtolower($type)) {
$type = 'jump';
}
$response = Response::create($result, $type)->header($header)->options(['jump_template' => $this->app['config']->get('dispatch_error_tmpl')]);
throw new HttpResponseException($response);
}
/**
* User: 意象信息科技 lr
* Desc: 通过返回
* @param $data
*/
protected function successOrError($data)
{
if ($data['code'] == 1) {
$this->_success($data['msg'], $data['data'], $data['code'], $data['show']);
}
$this->_error($data['msg'], $data['data'], $data['code'], $data['show']);
}
protected function assignJs($name, $value)
{
$this->js_data[$name] = $value;
$js_code = "<script>";
foreach ($this->js_data as $name => $value) {
if (is_array($value)) {
$value = json_encode($value);
} elseif (!is_integer($value)) {
$value = '"' . $value . '"';
}
$js_code .= $name . '=' . $value . ';';
}
$js_code .= "</script>";
$this->assign('js_code', $js_code);
}
}

View file

@ -0,0 +1,143 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\AfterSaleLogic;
use app\common\model\AfterSale as CommonAfterSale;
class AfterSale extends AdminBase
{
/**
* User: 意象信息科技 mjf
* Desc: 列表
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('', AfterSaleLogic::lists($get));
}
$this->assign('status', CommonAfterSale::getStatusDesc(true));
return $this->fetch();
}
/**
* User: 意象信息科技 mjf
* Desc: 详情
*/
public function detail()
{
$id = $this->request->get('id');
$detail = AfterSaleLogic::getDetail($id);
$this->assign('detail', $detail);
return $this->fetch();
}
/**
* User: 意象信息科技 mjf
* Desc: 同意
*/
public function agree()
{
if ($this->request->isAjax()) {
$post = $this->request->post('');
$check = $this->validate($post, 'app\admin\validate\AfterSale.agree');
if (true !== $check) {
$this->_error($check);
}
AfterSaleLogic::agree($post['id'],$this->admin_id);
$this->_success('操作成功');
}
}
/**
* User: 意象信息科技 mjf
* Desc: 拒绝
*/
public function refuse()
{
if ($this->request->isAjax()) {
$post = $this->request->post('');
$check = $this->validate($post, 'app\admin\validate\AfterSale.refuse');
if (true !== $check) {
$this->_error($check);
}
AfterSaleLogic::refuse($post,$this->admin_id);
$this->_success('操作成功');
}
}
/**
* User: 意象信息科技 mjf
* Desc: 收货
*/
public function take()
{
if ($this->request->isAjax()) {
$post = $this->request->post('');
$check = $this->validate($post, 'app\admin\validate\AfterSale.take');
if (true !== $check) {
$this->_error($check);
}
AfterSaleLogic::takeGoods($post,$this->admin_id);
$this->_success('操作成功');
}
}
/**
* User: 意象信息科技 mjf
* Desc: 拒绝收货
*/
public function refuseGoods()
{
if ($this->request->isAjax()) {
$post = $this->request->post('');
$check = $this->validate($post, 'app\admin\validate\AfterSale.refuse_goods');
if (true !== $check) {
$this->_error($check);
}
AfterSaleLogic::refuseGoods($post,$this->admin_id);
$this->_success('操作成功');
}
}
/**
* User: 意象信息科技 mjf
* Desc: 确认退款
*/
public function confirm()
{
if ($this->request->isAjax()) {
$post = $this->request->post('');
$check = $this->validate($post, 'app\admin\validate\AfterSale.confirm');
if (true !== $check) {
$this->_error($check);
}
$res = AfterSaleLogic::confirm($post,$this->admin_id);
if ($res === true){
$this->_success('操作成功');
}
$this->_error($res);
}
}
}

View file

@ -0,0 +1,118 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\{
ArticleLogic,
ArticleCategoryLogic
};
class Article extends AdminBase
{
/**
* 文章列表
* @return mixed
*/
public function lists()
{
$category = ArticleCategoryLogic::getArticleCategory();
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('', ArticleLogic::lists($get, $category));
}
$this->assign('category_list', $category);
return $this->fetch();
}
/**
* 添加文章
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\Article.add');
if ($result === true) {
ArticleLogic::addArticle($post);
$this->_success('添加成功!');
}
$this->_error($result);
}
$acticle_category = ArticleCategoryLogic::getArticleCategory();
$this->assign('category_list', $acticle_category);
return $this->fetch();
}
/**
* 编辑文章
*/
public function edit($id)
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\Article.edit');
if ($result === true) {
ArticleLogic::editArticle($post);
$this->_success('编辑成功!');
}
$this->_error($result);
}
$article = ArticleLogic::getArticle($id);
$category_list = ArticleCategoryLogic::getArticleCategory();
$this->assign('article', $article);
$this->assign('category_list', $category_list);
return $this->fetch();
}
/**
* 删除文章
*/
public function del($id)
{
if ($this->request->isAjax()) {
$result = $this->validate(['id' => $id], 'app\admin\validate\Article.del');
if ($result === true) {
ArticleLogic::delArticle($id);
$this->_success('删除成功');
}
$this->_error($result);
}
}
/**
* 修改状态
*/
public function switchStatus()
{
$post = $this->request->post();
ArticleLogic::switchStatus($post);
$this->_success('修改成功');
}
}

View file

@ -0,0 +1,100 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\{
ArticleCategoryLogic
};
class ArticleCategory extends AdminBase {
/**
* 文章分类列表
* @return mixed
*/
public function lists(){
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('', ArticleCategoryLogic::lists($get));
}
return $this->fetch();
}
/**
* 添加文章分类
* @return mixed
*/
public function add(){
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\ArticleCategory');
if($result === true){
ArticleCategoryLogic::addArticleCategory($post);
$this->_success('添加成功!');
}
$this->_error($result);
}
return $this->fetch();
}
/**
* 编辑文章分类
* @return mixed
*/
public function edit($id){
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\ArticleCategory.edit');
if($result === true){
ArticleCategoryLogic::editArticleCategory($post);
$this->_success('编辑成功!');
}
$this->_error($result);
}
$category= ArticleCategoryLogic::getArticleCategory($id);
$this->assign('category',array_values($category)[0]);
return $this->fetch();
}
/**
* 删除文章分类
* @return mixed
*/
public function del($id)
{
if ($this->request->isAjax()) {
$result = $this->validate(['id' => $id], 'app\admin\validate\ArticleCategory.del');
if ($result === true) {
ArticleCategoryLogic::delArticleCategory($id);
$this->_success('删除成功');
}
$this->_error($result);
}
}
/**
* 修改状态
*/
public function switchStatus(){
$post = $this->request->post();
ArticleCategoryLogic::switchStatus($post);
$this->_success('修改成功');
}
}

View file

@ -0,0 +1,135 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\AuthLogic;
use think\facade\Hook;
use think\facade\Url;
class Auth extends AdminBase
{
/**
* 菜单列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function lists()
{
$lists = json_encode(AuthLogic::lists());
$this->assign('lists', $lists);
return $this->fetch();
}
/**
* 添加菜单
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['disable'] = isset($post['disable']) && $post['disable'] == 'on' ? 0 : 1;
$result = $this->validate($post, 'app\admin\validate\Auth');
if ($result === true) {
$result = AuthLogic::addMenu($post);
if (!is_string($result)) {
$this->_success('添加成功');
} else {
$this->_error($result);
}
}
$this->_error($result);
}
$this->assign('menu_lists', AuthLogic::chooseMenu());
return $this->fetch();
}
/**
* 编辑菜单
* @param $id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function edit($id)
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['disable'] = isset($post['disable']) && $post['disable'] == 'on' ? 0 : 1;
$result = $this->validate($post, 'app\admin\validate\Auth');
if ($result === true) {
$result = AuthLogic::updateMenu($post);
if (!is_string($result)) {
$this->_success('修改成功');
} else {
$this->_error($result);
}
}
$this->_error($result);
}
$this->assign('info', AuthLogic::info($id));
$this->assign('menu_lists', AuthLogic::chooseMenu($id));
return $this->fetch();
}
/**
* 设置状态
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function status()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
AuthLogic::setStatus($post);
Hook::listen('menu_auth');
$this->_success('修改成功');
}
}
/**
* 删除菜单
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function del()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
if (empty($post['ids'])) {
$this->_error('删除失败');
}
AuthLogic::delMenu($post['ids']);
Hook::listen('menu_auth');
$this->_success('删除成功');
}
}
}

View file

@ -0,0 +1,201 @@
<?php
// +----------------------------------------------------------------------
// | LikeShop有特色的全开源社交分销电商系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 商业用途务必购买系统授权,以免引起不必要的法律纠纷
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | 微信公众号:好象科技
// | 访问官网http://www.likemarket.net
// | 访问社区http://bbs.likemarket.net
// | 访问手册http://doc.likemarket.net
// | 好象科技开发团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\BargainLogic;
use app\common\model\BargainLaunch;
use app\common\server\ConfigServer;
class Bargain extends AdminBase
{
/**
* Notes: 砍价活动 商品列表
* @author 张无忌(2021/1/30 15:06)
* @return mixed
*/
public function activity()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = BargainLogic::activity($get);
$this->_success('获取成功', $lists);
}
return $this->fetch();
}
/**
* Notes: 新增活动 商品
* @author 张无忌(2021/1/30 15:21)
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$check = $this->validate($post, 'app\admin\validate\Bargain.add');
if ($check !== true) {
$this->_error($check);
}
if (BargainLogic::add($post)) {
$this->_success('新增成功');
} else {
$error = BargainLogic::getError() ?? '新增失败';
$this->_error($error);
}
}
return $this->fetch();
}
/**
* Notes: 编辑活动 商品
* @author 张无忌(2021/1/30 15:21)
*/
public function edit()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$check = $this->validate($post, 'app\admin\validate\Bargain');
if ($check !== true) {
$this->_error($check);
}
if (BargainLogic::edit($post)) {
$this->_success('编辑成功');
} else {
$error = BargainLogic::getError() ?? '编辑失败';
$this->_error($error);
}
}
$id = $this->request->get('id');
$detail = BargainLogic::getDetail($id);
$this->assign('detail', $detail);
return $this->fetch();
}
/**
* Notes: 删除
* @author 张无忌(2021/1/12 15:52)
* @return mixed
*/
public function del()
{
if ($this->request->isAjax()) {
$id = $this->request->post('id');
if (BargainLogic::softDelete($id)) {
$this->_success('删除成功');
} else {
$error = BargainLogic::getError() ?? '删除失败';
$this->_error($error);
}
}
}
/**
* Notes: 切换状态
* @author 张无忌(2021/1/13 18:01)
*/
public function switchStatus()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
if (BargainLogic::switchStatus($post)) {
$this->_success('更新成功');
} else {
$error = BargainLogic::getError() ?? '更新失败';
$this->_error($error);
}
}
}
/**
* Notes: 发起砍价列表
* @author 张无忌(2021/1/30 16:51)
*/
public function launch()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = BargainLogic::getLaunch($get);
$this->_success('Ok', $lists);
}
$bargain_id = $this->request->get('bargain_id', 0);
$this->assign('bargain_id', $bargain_id);
return $this->fetch();
}
/**
* Notes: 砍价详细
* @author 张无忌(2021/1/30 17:13)
* @return mixed
*/
public function detail()
{
$id = $this->request->get('id');
$detail = BargainLogic::getLaunchDetail($id);
$this->assign('detail', $detail);
return $this->fetch();
}
/**
* Notes: 砍价订单记录
* @author 张无忌(2021/2/24 15:59)
*/
public function knifeOrderRecord() {
$launch_id = $this->request->get('launch_id');
$get = $this->request->get();
$lists = BargainLogic::getKnifeOrderRecord($launch_id, $get);
$this->_success('获取成功', $lists);
}
/**
* Notes: 砍价助力记录
* @author 张无忌(2021/2/24 15:58)
*/
public function knifeRecord()
{
$launch_id = $this->request->get('launch_id');
$get = $this->request->get();
$lists = BargainLogic::getKnifeRecord($launch_id, $get);
$this->_success('获取成功', $lists);
}
/**
* Notes: 砍价设置
* @author 张无忌(2021/2/24 18:16)
* @return mixed
*/
public function set()
{
if ($this->request->isAjax()) {
$payment_limit_time = $this->request->post('payment_limit_time', 0);
try {
ConfigServer::set('bargain', 'payment_limit_time', $payment_limit_time);
} catch (\Exception $e) {
$this->_error('设置失败');
}
$this->_success('设置成功');
}
$payment_limit_time = ConfigServer::get('bargain', 'payment_limit_time', 0);
$this->assign('payment_limit_time', $payment_limit_time);
return $this->fetch();
}
}

View file

@ -0,0 +1,243 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\common\server\ConfigServer;
use app\common\server\UrlServer;
class Basic extends AdminBase
{
/**
* 网站配置
* @return mixed
*/
public function website()
{
$config = [
'file_url' => UrlServer::getFileUrl('/'),
'name' => ConfigServer::get('website', 'name'),
'login_logo' => ConfigServer::get('website', 'login_logo'),
'keyword' => ConfigServer::get('website', 'keyword'),
'slogan_status' => ConfigServer::get('website', 'slogan_status'),
'slogan' => ConfigServer::get('website', 'slogan'),
'backstage_logo' => ConfigServer::get('website', 'backstage_logo'),
'admin_image' => ConfigServer::get('website', 'admin_image'),
'admin_title' => ConfigServer::get('website', 'admin_title'),
'partner_image' => ConfigServer::get('website', 'partner_image'),
'partner_title' => ConfigServer::get('website', 'partner_title'),
'shop_logo' => ConfigServer::get('website', 'shop_logo'),
'shop_login_logo' =>ConfigServer::get('website', 'shop_login_logo'),
'pc_logo' => ConfigServer::get('website', 'pc_logo'),
'user_image' => ConfigServer::get('website', 'user_image'),
'goods_image' =>ConfigServer::get('website', 'goods_image'),
'web_favicon' =>ConfigServer::get('website', 'web_favicon'),
];
$this->assign('config', $config);
return $this->fetch('');
}
/**
* 设置网站
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function setWebsite()
{
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\Basic');
if ($result === true) {
ConfigServer::set('website', 'name', $post['name']);
ConfigServer::set('website', 'login_logo', $post['login_logo']);
ConfigServer::set('website', 'web_favicon', $post['web_favicon']);
ConfigServer::set('website', 'backstage_logo', $post['backstage_logo']);
ConfigServer::set('website', 'admin_image', $post['admin_image']);
ConfigServer::set('website', 'admin_title', $post['admin_title']);
ConfigServer::set('website', 'shop_logo', $post['shop_logo']);
ConfigServer::set('website', 'shop_login_logo', $post['shop_login_logo']);
ConfigServer::set('website', 'pc_logo', $post['pc_logo']);
ConfigServer::set('website', 'user_image', $post['user_image']);
ConfigServer::set('website', 'goods_image', $post['goods_image']);
$this->_success('修改成功');
}
$this->_error($result);
}
/**
* 版权备案
* @return mixed
*/
public function copyright()
{
$config = [
'company_name' => ConfigServer::get('copyright', 'company_name'),
'number' => ConfigServer::get('copyright', 'number'),
'link' => ConfigServer::get('copyright', 'link'),
];
$this->assign('config', $config);
return $this->fetch();
}
/**
* 设置版权备案
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function setCopyright()
{
$post = $this->request->post();
ConfigServer::set('copyright', 'company_name', $post['company_name']);
// ConfigServer::set('copyright', 'logo',$post['logo']);
ConfigServer::set('copyright', 'number', $post['number']);
ConfigServer::set('copyright', 'link', $post['link']);
return $this->_success('修改成功');
}
/**
* 上传设置
*/
public function upload()
{
$config = [
'way' => ConfigServer::get('upload', 'way'),
'size' => ConfigServer::get('upload', 'size'),
'type' => ConfigServer::get('upload', 'type'),
'mime_type' => ConfigServer::get('upload', 'mime_type'),
'status' => ConfigServer::get('watermark', 'status'),
'mark_type' => ConfigServer::get('watermark', 'mark_type'),
'mark' => ConfigServer::get('watermark', 'mark'),
'location' => ConfigServer::get('watermark', 'location'),
'transparency' => ConfigServer::get('watermark', 'transparency'),
'slope' => ConfigServer::get('watermark', 'slope'),
'offset_x' => ConfigServer::get('watermark', 'offset_x'),
'offset_y' => ConfigServer::get('watermark', 'offset_y'),
];
$this->assign('config', $config);
return $this->fetch();
}
public function setUpload()
{
$post = $this->request->post();
if ($post) {
ConfigServer::set('upload', 'way', $post['way']);
ConfigServer::set('upload', 'size', $post['size']);
ConfigServer::set('upload', 'type', $post['type']);
ConfigServer::set('upload', 'mime_type', $post['mime_type']);
ConfigServer::set('watermark', 'status', $post['status']);
ConfigServer::set('watermark', 'mark_type', $post['mark_type']);
ConfigServer::set('watermark', 'mark', $post['mark']);
ConfigServer::set('watermark', 'location', $post['location']);
ConfigServer::set('watermark', 'transparency', $post['transparency']);
ConfigServer::set('watermark', 'slope', $post['slope']);
ConfigServer::set('watermark', 'offset_x', $post['offset_x']);
ConfigServer::set('watermark', 'offset_y', $post['offset_y']);
return $this->_success('修改成功');
}
}
/**
* APP设置
* @return mixed
*/
public function app()
{
$config = [
'line_ios' => ConfigServer::get('app', 'line_ios', ''),
'line_android' => ConfigServer::get('app', 'line_android', ''),
'download_doc' => ConfigServer::get('app', 'download_doc', ''),
'agreement' => ConfigServer::get('app', 'agreement', 0),
'wechat_login' => ConfigServer::get('app', 'wechat_login', 0),
];
$this->assign('config',$config);
return $this->fetch();
}
public function setApp()
{
$post = $this->request->post();
$post['agreement'] = isset($post['agreement']) && $post['agreement'] == 'on' ? 1 : 0;
$post['wechat_login'] = isset($post['wechat_login']) && $post['wechat_login'] == 'on' ? 1 : 0;
ConfigServer::set('app', 'line_ios',$post['line_ios']);
ConfigServer::set('app', 'line_android',$post['line_android']);
ConfigServer::set('app', 'download_doc',$post['download_doc']);
ConfigServer::set('app', 'agreement',$post['agreement']);
ConfigServer::set('app', 'wechat_login',$post['wechat_login']);
$this->_success('修改成功');
}
/**
* 分享设置
*/
public function share()
{
$config = [
'file_url' => UrlServer::getFileUrl('/'),
'h5' => ConfigServer::get('share', 'h5', [
'h5_share_title' => '',
'h5_share_intro' => '',
'h5_share_image' => ''
]),
'mnp' => ConfigServer::get('share', 'mnp', [
'mnp_share_title' => ''
])
];
$this->assign('config', $config);
return $this->fetch();
}
public function setShare()
{
$post = $this->request->post();
$h5 = json_encode([
'h5_share_title' => $post['h5_share_title'],
'h5_share_intro' => $post['h5_share_intro'],
'h5_share_image' => $post['h5_share_image'],
], JSON_UNESCAPED_UNICODE);
$mnp = json_encode([
'mnp_share_title' => $post['mnp_share_title'],
], JSON_UNESCAPED_UNICODE);
ConfigServer::set('share', 'h5', $h5);
ConfigServer::set('share', 'mnp', $mnp);
$this->_success('修改成功');
}
}

View file

@ -0,0 +1,35 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\GoodsCategoryLogic;
use app\admin\logic\CommonLogic;
class Common extends AdminBase{
public function selectGoods(){
if ($this->request->isAjax()){
$get = $this->request->get();
$goods_list = CommonLogic::getGoodsList($get,true);
$this->_success('',$goods_list);
}
$category_list = GoodsCategoryLogic::categoryTreeeTree();
$this->assign('category_list', $category_list);
return $this->fetch();
}
}

View file

@ -0,0 +1,150 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\CouponLogic;
class Coupon extends AdminBase{
/**
* note 优惠券列表
* create_time 2020/10/22 10:14
*/
public function lists(){
if($this->request->isAjax()){
$get = $this->request->get();
$lists = CouponLogic::lists($get);
$this->_success('',$lists);
}
return $this->fetch();
}
/**
* note 添加优惠券
* create_time 2020/10/22 10:14
*/
public function add(){
if($this->request->isAjax()){
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\Coupon');
if($result === true){
$result = CouponLogic::add($post);
if($result == true){
$this->_success('新增成功','');
}
$result = '新增失败';
}
return $this->_error($result,'');
}
return $this->fetch();
}
/**
* note 编辑优惠券
* create_time 2020/10/22 10:15
*/
public function edit($id){
if($this->request->isAjax()){
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\Coupon');
if($result === true){
$result = CouponLogic::edit($post);
if($result == true){
$this->_success('编辑成功','');
}
$result = '编辑失败';
}
return $this->_error($result,'');
}
$detail = CouponLogic::getCoupon($id,true);
$this->assign('detail',json_encode($detail,JSON_UNESCAPED_UNICODE));
return $this->fetch();
}
/**
* note 删除优惠券
* create_time 2020/10/22 10:15
*/
public function del($id){
if($this->request->isAjax()){
$result = CouponLogic::del($id);
if($result == true){
$this->_success('删除成功','');
}
return $this->_error('删除失败','');
}
}
/**
* note 优惠券发放记录
* create_time 2020/10/22 10:18
*/
public function log($id){
if($this->request->isAjax()){
$get = $this->request->get();
$lists = CouponLogic::log($get);
$this->_success('',$lists);
}
$this->assign('id',$id);
return $this->fetch();
}
/**
* note 优惠券详情
* create_time 2020/10/22 10:18
*/
public function detail($id){
$detail = CouponLogic::getCoupon($id,true);
$this->assign('detail',json_encode($detail,JSON_UNESCAPED_UNICODE));
return $this->fetch();
}
/**
* note 关闭优惠券
* create_time 2020/10/22 10:19
*/
public function close($id){
if($this->request->isAjax()){
$result = CouponLogic::close($id);
if($result == true){
$this->_success('优惠券关闭成功','');
}
return $this->_error('优惠券关闭失败,请重新关闭','');
}
}
public function sendCouponList(){
if($this->request->isAjax()){
$list = CouponLogic::sendCouponList();
$this->_success('',$list);
}
return $this->fetch();
}
public function sendCoupon(){
if($this->request->isAjax()){
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\SendCoupon');
if($result === true){
CouponLogic::sendCoupon($post);
return $this->_success('发放成功',[]);
}
return $this->_error($result,'');
}
}
}

View file

@ -0,0 +1,119 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\CrontabLogic;
class Crontab extends AdminBase
{
/**
* 定时任务列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function lists()
{
if ($this->request->isAjax()) {
$this->_success('', CrontabLogic::lists());
}
return $this->fetch();
}
/**
* 添加定时任务
* @return mixed
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['status'] = isset($post['status']) && $post['status'] == 'on' ? 1 : 2;
$result = $this->validate($post, 'app\admin\validate\Crontab.add');
if ($result === true) {
CrontabLogic::add($post);
$this->_success('添加成功');
}
$this->_error($result);
}
return $this->fetch();
}
/**
* 编辑定时任务
* @return mixed
*/
public function edit()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['status'] = isset($post['status']) && $post['status'] == 'on' ? 1 : 2;
$result = $this->validate($post, 'app\admin\validate\Crontab');
if ($result === true) {
CrontabLogic::edit($post);
$this->_success('修改成功');
}
$this->_error($result);
}
$id = $this->request->get('id');
$this->assign('info',CrontabLogic::info($id));
return $this->fetch();
}
public function del()
{
if ($this->request->isAjax()) {
$id = $this->request->post('id');
if (CrontabLogic::del($id) !== true) {
$this->_success('删除成功');
}
}
$this->_error('删除失败');
}
/**
* 定时任务操作
*/
public function operation()
{
$post = $this->request->post();
$result = CrontabLogic::operation($post['operation'], $post['id']);
if ($result !== true) {
$this->_error('操作失败:' . $result);
}
$this->_success('操作成功');
}
/**
* 获取接下来执行时间
*/
public function expression()
{
$get = $this->request->get();
$this->_success('', CrontabLogic::expression($get));
}
}

View file

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
class Dispatch extends AdminBase
{
public function dispatch_error($msg)
{
return $this->_error($msg);
}
}

View file

@ -0,0 +1,69 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\common\server\ConfigServer;
/**
* 分销设置
* Class Distribution
* @package app\admin\controller
*/
class Distribution extends AdminBase
{
/**
* 分销会员列表/审核会员列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function setting()
{
$config = [
'is_open' => ConfigServer::get('distribution', 'is_open', 1),
'member_apply' => ConfigServer::get('distribution', 'member_apply', 1),
];
$this->assign('config', $config);
return $this->fetch('');
}
/**
* 设置分销配置
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function setDistribution()
{
$post = $this->request->post();
if ($post) {
ConfigServer::set('distribution', 'is_open', $post['is_open']);
ConfigServer::set('distribution', 'member_apply', $post['member_apply']);
$this->_success('修改成功');
}
}
}

View file

@ -0,0 +1,185 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\DistributionMemberLogic;
use app\common\model\DistributionMember as DistributionMemberModel;
class DistributionMember extends AdminBase
{
/**
* 分销会员列表/审核会员列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$type = $get['type'] ?? 'member';
if ($type == 'member') {
$this->_success('获取成功', DistributionMemberLogic::memberLists($get));
}
$this->_success('获取成功', DistributionMemberLogic::auditLists($get));
}
$this->assign('status', DistributionMemberModel::getApplyStatus(true));
return $this->fetch('index');
}
/**
* 审核分销会员
*/
public function audit()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$check = $this->validate($post, 'app\admin\validate\DistributionMember.audit');
if (true !== $check) {
$this->_error($check);
}
if ($post['type'] == 'pass') {
$res = DistributionMemberLogic::auditPass($post);
} else {
$res = DistributionMemberLogic::auditRefuse($post);
}
if ($res !== true) {
$this->_error('操作失败');
}
$this->_success('操作成功');
}
}
//冻结/解冻分销资格
public function freeze()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$check = $this->validate($post, 'app\admin\validate\DistributionMember.freeze');
if (true !== $check) {
$this->_error($check);
}
DistributionMemberLogic::freeze($post);
$this->_success('操作成功');
}
$this->_error('操作失败');
}
/**
* 分销会员详情(分销资料)
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function info()
{
$get = $this->request->get();
$info = DistributionMemberLogic::getMemberInfo($get);
$this->assign('detail', $info);
return $this->fetch();
}
/**
* 推广会员
* @return mixed
*/
public function fans()
{
$user_id = $this->request->get('id');
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('获取成功', DistributionMemberLogic::getFansLists($get));
}
$this->assign('user_id', $user_id);
return $this->fetch();
}
/**
* 分销收入明细
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function earningsDetail()
{
$user_id = $this->request->get('id');
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('获取成功', DistributionMemberLogic::getEarningsDetail($get));
}
$this->assign('user_id', $user_id);
return $this->fetch();
}
//修改上级
public function updateLeader()
{
$user_id = $this->request->get('id');
if ($this->request->isAjax()) {
$post = $this->request->post();
$check = $this->validate($post, 'app\admin\validate\DistributionMember.updateLeader');
if (true !== $check) {
$this->_error($check);
}
$res = DistributionMemberLogic::updateRelation($post);
if ($res === true){
$this->_success('操作成功');
}
$this->_error($res);
}
$this->assign('first_leader',DistributionMemberLogic::getLeaderInfo($user_id));
$this->assign('user_id', $user_id);
return $this->fetch();
}
/**
* Notes: 添加分销会员
* @author 张无忌(2021/1/11 16:32)
*/
public function addMember()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$check = $this->validate($post, 'app\admin\validate\DistributionMember.addMember');
if (true !== $check) {
$this->_error($check);
}
$result = DistributionMemberLogic::addMember($post);
if ($result === true) {
$this->_success('添加成功');
} else {
$this->_error($result);
}
}
return $this->fetch('distribution_member/add_member');
}
}

View file

@ -0,0 +1,122 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\common\server\ConfigServer;
use app\admin\logic\ExpressLogic;
use think\db;
class Express extends AdminBase
{
/**
* lists
* @return mixed
* @throws \think\exception\DbException
* @throws db\exception\DataNotFoundException
* @throws db\exception\ModelNotFoundException
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('', ExpressLogic::lists($get));
}
}
/**
* 添加
* @return mixed
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\Express.add');
if ($result === true) {
$result = ExpressLogic::addExpress($post);
if ($result) {
$this->_success('添加成功');
}
}
$this->_error($result);
}
return $this->fetch();
}
/**
* 编辑
* @param $id
* @return mixed
*/
public function edit($id)
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\Express.edit');
if ($result === true) {
$result = ExpressLogic::editExpress($post);
if ($result) {
$this->_success('修改成功');
}
}
$this->_error($result);
}
$this->assign('info', ExpressLogic::info($id));
return $this->fetch();
}
/**
* 删除
* @param $delData
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function del($delData)
{
if ($this->request->isAjax()) {
$result = ExpressLogic::delExpress($delData);
if ($result) {
$this->_success('删除成功');
}
$this->_error('删除失败');
}
}
//查询配置
public function setExpress()
{
$post = $this->request->post();
if($post){
ConfigServer::set('express', 'way', $post['way']);
ConfigServer::set('kd100', 'appkey', $post['kd100_appkey']);
ConfigServer::set('kd100', 'appsecret', $post['kd100_customer']);
ConfigServer::set('kdniao', 'appkey', $post['kdniao_appkey']);
ConfigServer::set('kdniao', 'appsecret', $post['kdniao_ebussinessid']);
}
$this->_success('操作成功');
}
}

View file

@ -0,0 +1,101 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\common\logic\FileCateLogic;
use app\common\server\FileServer;
class File extends AdminBase
{
/**
* 图片列表
* @param string $type
*/
public function lists($type = '')
{
$cate_id = $this->request->get('cate', 0);
$this->_success('', FileServer::lists($this->page_no, $this->page_size, $cate_id, $type));
}
/**
* User: 意象信息科技 mjf
* Desc: 删除图片
*/
public function del()
{
$ids = $this->request->post('ids');
FileServer::del($ids);
$this->_success('操作成功');
}
/**
* Notes: 上传图片
* @author 张无忌(2021/2/19 16:39)
* @return mixed
*/
public function image()
{
if ($this->request->isPost()) {
$cate_id = $this->request->post('cate',0);
$result = FileServer::image($cate_id);
$this->successOrError($result);
}
$auth_tree = FileCateLogic::cateTree();
$this->assign('list', json_encode($auth_tree));
return $this->fetch();
}
/**
* 视频上传
*/
public function video(){
if ($this->request->isPost()) {
$result = FileServer::video('uploads/video');
$this->successOrError($result);
}
}
/**
* 其他文件上传
*/
public function other()
{
if ($this->request->isPost()) {
$local = $this->request->get('local',0);
$sub_dir = $this->request->get('sub_dir','');
$local = $local == 0 ? false : true;
$save_path = 'uploads/other';
if ($local && $local !== '') {
$save_path = 'uploads/other/'.$sub_dir;
}
$result = FileServer::other($save_path, $local);
$this->successOrError($result);
}
$this->_success();
}
}

View file

@ -0,0 +1,86 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\common\logic\FileCateLogic;
/**
* 图片分类
* Class FileCate
* @package app\admin\controller
*/
class FileCate extends AdminBase
{
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\FileCate.add');
if ($result !== true) {
$this->_error($result);
}
$result = FileCateLogic::add($post);
if ($result !== true) {
$this->_error($result);
}
$this->_success('添加成功');
}
$tree = FileCateLogic::categoryToSelect();
$this->assign('cate_tree', $tree);
return $this->fetch();
}
public function edit($id = '')
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\FileCate.edit');
if ($result !== true) {
$this->_error($result);
}
$result = FileCateLogic::edit($post);
if ($result !== true) {
$this->_error($result);
}
$this->_success('编辑成功');
}
$tree = FileCateLogic::categoryToSelect();
$this->assign('cate_tree', $tree);
$this->assign('detail', FileCateLogic::info($id));
return $this->fetch();
}
public function del()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\FileCate.del');
if ($result !== true) {
$this->_error($result);
}
FileCateLogic::del($post['id']);
$this->_success('删除成功');
}
}
}

View file

@ -0,0 +1,34 @@
<?php
namespace app\admin\controller;
use app\admin\logic\FinanceLogic;
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
class Finance extends AdminBase
{
public function lists()
{
$data = FinanceLogic::lists();
$this->assign('data', $data);
return $this->fetch();
}
}

View file

@ -0,0 +1,70 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team-张无忌
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\FootprintLogic;
use app\common\server\ConfigServer;
/**
* 访问足迹(气泡足迹)
* Class Footprint
* @package app\admin\controller
*/
class Footprint extends AdminBase
{
public function index()
{
$set['footprint_duration'] = ConfigServer::get('footprint','footprint_duration',60);
$set['footprint_status'] = ConfigServer::get('footprint','footprint_status',1);
$this->assign('set', $set);
$this->assign('footprint', FootprintLogic::lists());
return $this->fetch();
}
public function edit()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = FootprintLogic::edit($post);
if ($result) {
$this->_success('编辑成功');
}
$this->_error('编辑失败');
}
$id = $this->request->get('id', 0, 'intval');
$this->assign('info', FootprintLogic::info($id));
return $this->fetch();
}
public function set()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = FootprintLogic::set($post);
if ($result) {
$this->_success('更新成功');
}
$this->_error('更新失败');
}
}
}

View file

@ -0,0 +1,144 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\ExpressLogic;
use app\common\server\ConfigServer;
use app\admin\logic\FreightLogic;
use app\admin\model\Freight as FreightModel;
class Freight extends AdminBase
{
/**
* User: 意象信息科技 mjf
* Desc: 设置快递方式
*/
public function set()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['type'] = isset($post['type']) && $post['type'] == 'on' ? 1 : 0;
ConfigServer::set('express', 'is_express', $post['type']);
$this->_success('操作成功');
}
$type = ConfigServer::get('express', 'is_express');
$this->assign('type', $type);
return $this->fetch();
}
/**
* User: 意象信息科技 mjf
* Desc: 运费模板列表
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('获取成功', FreightLogic::lists($get));//运费模板页
}
$this->assign('charge_way_lists', FreightModel::getChargeWay(true));
$this->assign('config', ExpressLogic::getExpress());
return $this->fetch('index');
}
/**
* User: 意象信息科技 mjf
* Desc: 添加运费模板
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\Freight.add');
if ($result === true) {
FreightLogic::add($post);
$this->_success('添加成功!');
}
$this->_error($result);
}
return $this->fetch();
}
/**
* User: 意象信息科技 mjf
* Desc: 删除运费模板
*/
public function del()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\Freight.del');
if ($result === true) {
FreightLogic::del($post);
$this->_success('删除成功!');
}
$this->_error($result);
}
return $this->fetch();
}
/**
* User: 意象信息科技 mjf
* Desc: 运费模板详情
*/
public function detail()
{
$id = $this->request->get('id');
$detail = FreightLogic::detail($id);
$this->assign('detail', $detail);
return $this->fetch();
}
/**
* User: 意象信息科技 mjf
* Desc: 运费模板编辑
*/
public function edit()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\Freight.edit');
if ($result !== true) {
$this->_error($result);
}
FreightLogic::edit($post);
$this->_success('编辑成功!');
}
$id = $this->request->get('id');
$detail = FreightLogic::detail($id);
$this->assign('detail', $detail);
return $this->fetch();
}
public function area()
{
return $this->fetch();
}
//编辑页的地区选择
public function areaEdit()
{
return $this->fetch();
}
}

View file

@ -0,0 +1,279 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\{GoodsBrandLogic, GoodsCategoryLogic, GoodsLogic, SupplierLogic,FreightLogic,CommonLogic};
class Goods extends AdminBase
{
// TODO 商品发布
// TODO 编辑
// TODO 复制
/**
* 商品列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('', GoodsLogic::lists($get));
}
$this->assign('statistics',GoodsLogic::statistics());
$this->assign('category_list', GoodsCategoryLogic::categoryTreeeTree());
$this->assign('supplier_list',SupplierLogic::getSupplierList());
return $this->fetch();
}
/**
* Notes: 获取Tab统计数据
* @author 张无忌(2021/1/19 18:49)
*/
public function totalCount()
{
if ($this->request->isAjax()) {
$this->_success('获取成功', GoodsLogic::statistics());
}
}
/**
* 添加商品
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function add()
{
if ($this->request->isAjax() && $this->request->isPost()) {
$post = $this->request->post();
$post['del'] = 0;
//主表验证
$result = $this->validate($post, 'app\admin\validate\Goods.add');
if ($result !== true) {
$this->_error($result);
}
//单规格验证
if ($post['spec_type'] == 1) {
$result = $this->validate($post, 'app\admin\validate\GoodsOneSpec');
if ($result !== true) {
$this->_error($result);
}
}
//多规格验证
$spec_lists = [];
if ($post['spec_type'] == 2) {
$spec_lists = $post;
unset($spec_lists['goods_image']);
unset($spec_lists['spec_name']);
unset($spec_lists['spec_values']);
unset($spec_lists['spec_id']);
unset($spec_lists['spec_value_ids']);
$spec_lists = form_to_linear($spec_lists);
//规格验证
if (empty($spec_lists)) {
$this->_error('至少添加一个规格');
}
$result = $this->validate($post, 'app\admin\validate\GoodsMoreSpec');
if ($result !== true) {
$this->_error($result);
}
//规格商品列表验证
foreach ($spec_lists as $v) {
$result = $this->validate($v, 'app\admin\validate\GoodsMoreSpecLists');
if ($result !== true) {
$this->_error($result);
}
}
}
//添加商品
$result = GoodsLogic::add($post, $spec_lists);
if ($result !== true) {
$this->_error('添加失败:' . $result);
}
$this->_success('添加成功');
}
$this->assign('category_lists', json_encode(GoodsCategoryLogic::getAllTree(), JSON_UNESCAPED_UNICODE));
$this->assign('brand_lists',json_encode(GoodsBrandLogic::getGoodsBrandList(),JSON_UNESCAPED_UNICODE));
$this->assign('supplier_lists',json_encode(SupplierLogic::getSupplierList(),JSON_UNESCAPED_UNICODE));
$this->assign('freight_lists',json_encode(FreightLogic::getFreightList(),JSON_UNESCAPED_UNICODE));
return $this->fetch();
}
/**
* Notes:编辑商品
* @param $goods_id int 商品id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function edit($goods_id)
{
if ($this->request->isAjax() && $this->request->isPost()) {
$post = $this->request->post();
$post['del'] = 0;
$post['id'] = $post['goods_id'];
//主表验证
$result = $this->validate($post, 'app\admin\validate\Goods');
if ($result !== true) {
$this->_error($result);
}
//单规格验证
if ($post['spec_type'] == 1) {
$result = $this->validate($post, 'app\admin\validate\GoodsOneSpec');
if ($result !== true) {
$this->_error($result);
}
}
//多规格验证
$spec_lists = [];
if ($post['spec_type'] == 2) {
$spec_lists = $post;
unset($spec_lists['goods_image']);
unset($spec_lists['spec_name']);
unset($spec_lists['spec_values']);
unset($spec_lists['spec_id']);
unset($spec_lists['spec_value_ids']);
$spec_lists = form_to_linear($spec_lists);
//规格验证
if (empty($spec_lists)) {
$this->_error('至少添加一个规格');
}
$result = $this->validate($post, 'app\admin\validate\GoodsMoreSpec');
if ($result !== true) {
$this->_error($result);
}
//规格商品列表验证
foreach ($spec_lists as $v) {
$result = $this->validate($v, 'app\admin\validate\GoodsMoreSpecLists');
if ($result !== true) {
$this->_error($result);
}
}
}
//添加商品
$result = GoodsLogic::edit($post, $spec_lists);
if ($result !== true) {
$this->_error('添加失败:' . $result);
}
$this->_success('修改成功');
}
$this->assign('category_lists', json_encode(GoodsCategoryLogic::getAllTree(), JSON_UNESCAPED_UNICODE));
$this->assign('info', json_encode(GoodsLogic::info($goods_id),JSON_UNESCAPED_UNICODE));
$this->assign('brand_lists',json_encode(GoodsBrandLogic::getGoodsBrandList(),JSON_UNESCAPED_UNICODE));
$this->assign('supplier_lists',json_encode(SupplierLogic::getSupplierList(),JSON_UNESCAPED_UNICODE));
$this->assign('freight_lists',json_encode(FreightLogic::getFreightList(),JSON_UNESCAPED_UNICODE));
return $this->fetch('goods/add');
}
/**
* Notes:删除商品
* @param $id int 商品id
*/
public function del($id)
{
if ($this->request->isAjax()) {
//todo 商品删除验证
$result = GoodsLogic::del($id); //逻辑层处理删除信息
if ($result) {
$this->_success('删除成功');
}
$this->_error('删除失败');
}
}
/**
* Notes:修改商品字段(上下架、新品推荐、好物优选、猜你喜欢)
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function changeFields(){
$table = $this->request->controller();
$pk_name = 'id';
$pk_value = $this->request->post('id');
$field = $this->request->post('field');
$field_value = $this->request->post('value');
$result = CommonLogic::changeTableValue($table,$pk_name,$pk_value,$field,$field_value);
if($result){
$this->_success('修改成功');
}
$this->_error('修改失败');
}
/**
* Notes: 下架商品
* @author 张无忌(2021/1/11 14:33)
*/
public function lowerStatus()
{
if ($this->request->isAjax()) {
$ids = $this->request->post('ids', []);
$result = GoodsLogic::upperOrLower($ids, 0);
if ($result) {
$this->_success('下架成功');
}
$this->_error('下架失败');
}
}
/**
* Notes: 上架商品
* @author 张无忌(2021/1/11 14:33)
*/
public function upperStatus()
{
if ($this->request->isAjax()) {
$ids = $this->request->post('ids', []);
$result = GoodsLogic::upperOrLower($ids, 1);
if ($result) {
$this->_success('上架成功');
}
$this->_error('上架失败');
}
}
}

View file

@ -0,0 +1,111 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\GoodsBrandLogic;
use app\common\model\Capital_;
class GoodsBrand extends AdminBase {
/**
* note 品牌列表
*/
public function lists()
{
if ($this->request->isAjax())
{
$get = $this->request->get();
$list = GoodsBrandLogic::lists($get);
$this->_success('',$list);
}
return $this->fetch();
}
/**
* note 添加品牌
*/
public function add()
{
if ($this->request->isAjax()){
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post,'app\admin\validate\GoodsBrand.add');
if ($result === true){
GoodsBrandLogic::add($post);
$this->_success('添加成功!');
}
$this->_error($result);
}
$capital = Capital_::getData();
$this->assign('capital',$capital);
return $this->fetch();
}
/**
* note 编辑品牌
*/
public function edit($id)
{
if ($this->request->isAjax()){
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post,'app\admin\validate\GoodsBrand.edit');
if ($result === true){
GoodsBrandLogic::edit($post,$id);
$this->_success('修改成功');
}
$this->_error($result);
}
$info = GoodsBrandLogic::getGoodsBrand($id);
$capital = Capital_::getData();
$this->assign('info',$info);
$this->assign('capital',$capital);
return $this->fetch();
}
/**
* note 删除品牌
*/
public function del($delData)
{
if ($this->request->isAjax()) {
$result = GoodsBrandLogic::del($delData);
if ($result) {
$this->_success('删除成功');
}
$this->_error('删除失败');
}
}
/**
* note 修改品牌的显示状态
*/
public function switchStatus(){
$post = $this->request->post();
$result =GoodsBrandLogic::switchStatus($post);
if ($result) {
$this->_success('修改成功');
}
$this->_success('修改失败');
}
}

View file

@ -0,0 +1,119 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\{
GoodsCategoryLogic
};
use app\common\logic\CommonLogic;
class GoodsCategory extends AdminBase
{
/**
* 商品分类列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function lists(){
$category_tree = GoodsCategoryLogic::categoryThirdTree();
$this->assign('category_tree', json_encode($category_tree));
return $this->fetch();
}
/**
* 添加商品分类
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function add(){
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\GoodsCategory.add');
if ($result === true) {
GoodsCategoryLogic::add($post);
$this->_success('添加成功!');
}
$this->_error($result);
}
$category_list = GoodsCategoryLogic::categoryTwoTree();
$this->assign('category_list', $category_list);
return $this->fetch();
}
/**
* 编辑商品分类
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function edit($id){
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\GoodsCategory.edit');
if ($result === true) {
GoodsCategoryLogic::edit($post);
$this->_success('修改成功');
}
$this->_error($result);
}
$category_info = GoodsCategoryLogic::getCategory($id);
$category_list = GoodsCategoryLogic::categoryTwoTree();
$this->assign('info',$category_info);
$this->assign('category_list', $category_list);
return $this->fetch();
}
/**
* 删除商品分类
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function del(){
$id = $this->request->post('ids');
$result = $this->validate(['id'=>[$id]], 'app\admin\validate\GoodsCategory.del');
if ($result === true) {
GoodsCategoryLogic::del($id);
$this->_success('删除成功!');
}
$this->_error($result);
}
/**
* note 修改品牌的显示状态
*/
public function switchStatus(){
$post = $this->request->post();
$result =GoodsCategoryLogic::switchStatus($post);
if ($result) {
$this->_success('修改成功');
}
$this->_success('修改失败');
}
}

View file

@ -0,0 +1,77 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\GoodsCommentLogic;
class GoodsComment extends AdminBase{
/**
* 列表
*/
public function lists(){
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('', GoodsCommentLogic::lists($get));
}
return $this->fetch();
}
/**
* 删除
*/
public function del($delData)
{
if ($this->request->isAjax()) {
$result = GoodsCommentLogic::del($delData); //逻辑层处理删除信息
if ($result) {
$this->_success('删除成功');
}
$this->_error('删除失败');
}
}
/**
* 修改状态
*/
public function switchStatus(){
$get = $this->request->get();
GoodsCommentLogic::switchStatus($get);
$this->_success('修改成功');
}
//回复
public function reply($id){
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\GoodsComment');
if($result === true){
GoodsCommentLogic::reply($post);
$this->_success('回复成功!');
}
$this->_error($result);
}
$this->assign('res',GoodsCommentLogic::info($id));
return $this->fetch();
}
}

View file

@ -0,0 +1,112 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\{
HelpLogic,
HelpCategoryLogic
};
class Help extends AdminBase
{
/**
* 帮助列表
* @return mixed
*/
public function lists()
{
$category = HelpCategoryLogic::getHelpCategory();
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('', HelpLogic::lists($get, $category));
}
$this->assign('category_list', $category);
return $this->fetch();
}
/**
* 添加帮助
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\Help.add');
if ($result === true) {
HelpLogic::addHelp($post);
$this->_success('添加成功!');
}
$this->_error($result);
}
$acticle_category = HelpCategoryLogic::getHelpCategory();
$this->assign('category_list', $acticle_category);
return $this->fetch();
}
/**
* 编辑帮助
*/
public function edit($id)
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\Help.edit');
if ($result === true) {
HelpLogic::editHelp($post);
$this->_success('编辑成功!');
}
$this->_error($result);
}
$help = HelpLogic::getHelp($id);
$category_list = HelpCategoryLogic::getHelpCategory();
$this->assign('help', $help);
$this->assign('category_list', $category_list);
return $this->fetch();
}
/**
* 删除帮助
*/
public function del($id)
{
if ($this->request->isAjax()) {
$result = $this->validate(['id' => $id], 'app\admin\validate\Help.del');
if ($result === true) {
HelpLogic::delHelp($id);
$this->_success('删除成功');
}
$this->_error($result);
}
}
/**
* 修改状态
*/
public function switchStatus()
{
$post = $this->request->post();
HelpLogic::switchStatus($post);
$this->_success('修改成功');
}
}

View file

@ -0,0 +1,105 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\{HelpCategoryLogic};
class HelpCategory extends AdminBase
{
/**
* 帮助分类列表
* @return mixed
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('', HelpCategoryLogic::lists($get));
}
return $this->fetch();
}
/**
* 添加帮助分类
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\HelpCategory');
if ($result === true) {
HelpCategoryLogic::addHelpCategory($post);
$this->_success('添加成功!');
}
$this->_error($result);
}
return $this->fetch();
}
/**
* 编辑帮助分类
*/
public function edit($id)
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\HelpCategory.edit');
if ($result === true) {
HelpCategoryLogic::editHelpCategory($post);
$this->_success('编辑成功!');
}
$this->_error($result);
}
$category = HelpCategoryLogic::getHelpCategory($id);
$this->assign('category', array_values($category)[0]);
return $this->fetch();
}
/**
* 删除帮助分类
*/
public function del($id)
{
if ($this->request->isAjax()) {
$result = $this->validate(['id' => $id], 'app\admin\validate\HelpCategory.del');
if ($result === true) {
HelpCategoryLogic::delHelpCategory($id);
$this->_success('删除成功');
}
$this->_error($result);
}
}
/**
* 修改状态
*/
public function switchStatus()
{
$post = $this->request->post();
HelpCategoryLogic::switchStatus($post);
$this->_success('修改成功');
}
}

View file

@ -0,0 +1,29 @@
<?php
namespace app\admin\controller;
use app\admin\logic\HotSearchLogic;
use app\common\server\ConfigServer;
class HotSearch extends AdminBase
{
public function index() {
$info = HotSearchLogic::info();
$this->assign('info',$info);
return $this->fetch();
}
public function set(){
$post = $this->request->post();
$result = HotSearchLogic::set($post);
if($result == true){
$this->_success('操作成功');
}
$this->_error('操作失败');
}
}

View file

@ -0,0 +1,82 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\cache\RoleMenuCache;
use app\admin\logic\StatLogic;
use app\admin\server\MenuServer;
use app\common\server\ConfigServer;
use think\Db;
use think\facade\Config;
class Index extends AdminBase
{
/**
* 后台前端全局界面
* @return mixed
*/
public function index()
{
// 菜单渲染
$menu = MenuServer::getMenuTree($this->admin_info['role_id']);
$this->assign('menu', $menu);
//开启右上角前端示例
$app_trace = Config::get('app.app_trace');
$this->assign('view_app_trace', $app_trace);
//管理员名称
$this->assign('admin_name', $this->admin_info['name']);
//角色名称
$role_name = Db::name('role')
->where(['id' => $this->admin_info['role_id']])
->value('name');
$role_name = empty($role_name) ? '系统管理员' : $role_name;
$this->assign('role_name', $role_name);
// 网站配置
$config = [
'name' => ConfigServer::get('website', 'name'),
'backstage_logo' => ConfigServer::get('website', 'backstage_logo'),
'web_favicon' => ConfigServer::get('website', 'web_favicon'),
];
$this->assign('config', $config);
return $this->fetch();
}
/**
* 工作台
* @return mixed
*/
public function stat()
{
if($this->request->isAjax()){
$this->_success('', StatLogic::graphData());
}
$this->assign('res', StatLogic::stat());
$this->assign('company_name',ConfigServer::get('copyright', 'company_name'));
return $this->fetch();
}
}

View file

@ -0,0 +1,69 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\LogLogic;
use think\helper\Time;
class Log extends AdminBase
{
/**
* 系统日志
* @return mixed
*/
public function lists()
{
if ($this->request->isAjax()) {
$limit = $this->request->get('limit', 20);
$page_no = $this->request->get('page', 1);
$get = $this->request->get();
$this->_success('', LogLogic::lists($page_no, $limit, $get));
}
$today = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::today());
$this->assign('today', $today);
$yesterday = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::yesterday());
$this->assign('yesterday', $yesterday);
$days_ago7 = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::dayToNow(7));
$this->assign('days_ago7', $days_ago7);
$days_ago30 = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::dayToNow(30, true));
$this->assign('days_ago30', $days_ago30);
return $this->fetch();
}
}

View file

@ -0,0 +1,155 @@
<?php
namespace app\admin\controller;
use app\admin\logic\LuckDrawLogic;
use app\common\server\ConfigServer;
class LuckDraw extends AdminBase
{
/**
* Notes: 查看页面
* @author 张无忌(2021/1/25 11:08)
* @return mixed
*/
public function index()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = LuckDrawLogic::lists($get);
$this->_success('获取成功', $lists);
}
// 获取抽奖设置信息
$this->assign('setConfig', [
'limit' => ConfigServer::get('luckdraw', 'limit', 0),
'rule' => ConfigServer::get('luckdraw', 'rule', ''),
'status' => ConfigServer::get('luckdraw', 'status', 0)
]);
return $this->fetch();
}
/**
* Notes: 添加奖品
* @author 张无忌(2021/1/25 11:08)
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$validate = $this->validate($post, 'app\admin\validate\LuckDraw.add');
if ($validate !== true) {
$this->_error($validate);
}
if (LuckDrawLogic::add($post)) {
$this->_success('新增成功');
}
$error = LuckDrawLogic::getError() ?: '新增失败';
$this->_error($error);
}
return $this->fetch();
}
/**
* Notes: 编辑奖品
* @author 张无忌(2021/1/25 11:08)
*/
public function edit()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$validate = $this->validate($post, 'app\admin\validate\LuckDraw');
if ($validate !== true) {
$this->_error($validate);
}
if (LuckDrawLogic::edit($post)) {
$this->_success('编辑成功');
}
$error = LuckDrawLogic::getError() ?: '编辑失败';
$this->error($error);
}
$id = $this->request->get('id');
$this->assign('detail', LuckDrawLogic::detail($id));
return $this->fetch();
}
/**
* Notes: 删除
* @author 张无忌(2021/1/26 11:19)
*/
public function del()
{
if ($this->request->isAjax()) {
$id = $this->request->post('id', 0, 'intval');
if (LuckDrawLogic::del($id)) {
$this->_success('删除成功');
}
$error = LuckDrawLogic::getError() ?: '删除失败';
$this->_error($error);
}
}
public function switchStatus()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
if (LuckDrawLogic::switchStatus($post)) {
$this->_success('更新成功');
} else {
$error = LuckDrawLogic::getError() ?? '更新失败';
$this->_error($error);
}
}
}
/**
* Notes: 更新排序
* @author 张无忌(2021/1/28 10:21)
*/
public function sort()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
if (LuckDrawLogic::updateSort($post)) {
$this->_success('更新成功');
} else {
$error = LuckDrawLogic::getError() ?? '更新失败';
$this->_error($error);
}
}
}
/**
* Notes: 设置抽奖规则
* @author 张无忌(2021/1/25 11:08)
*/
public function set()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = LuckDrawLogic::set($post);
if (!$result) {
$error = LuckDrawLogic::getError() ?: '设置失败';
$this->_error($error);
}
$this->_success('更新成功');
}
}
/**
* Notes: 抽奖记录
* @author 张无忌(2021/1/25 11:08)
*/
public function record()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = LuckDrawLogic::record($get);
$this->_success('OK', $lists);
}
}
}

View file

@ -0,0 +1,95 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\MarketingConfigLogic;
class MarketingConfig extends AdminBase{
/**
* note 邀请奖励
* create_time 2020/12/2 16:18
*/
public function invitedAwardConfig(){
if($this->request->isAjax()){
$post = $this->request->post();
MarketingConfigLogic::setConfig($post);
return $this->_success('设置成功',[]);
}
$this->assign('config',MarketingConfigLogic::getConfig(['invited_award_integral']));
return $this->fetch();
}
/**
* note 下单奖励
* create_time 2020/12/2 16:19
*/
public function orderAwardConfig(){
if($this->request->isAjax()){
$post = $this->request->post();
MarketingConfigLogic::setConfig($post);
return $this->_success('设置成功',[]);
}
$this->assign('config',MarketingConfigLogic::getConfig(['order_award_integral']));
return $this->fetch();
}
/**
* note 会员注册
* create_time 2020/12/2 16:22
*/
public function registerAwardConfig(){
if($this->request->isAjax()){
$post = $this->request->post();
MarketingConfigLogic::setConfig($post);
return $this->_success('设置成功',[]);
}
$config = [
'register_award_integral_status',
'register_award_integral',
'register_award_coupon_status',
'register_award_coupon',
];
$this->assign('config',MarketingConfigLogic::getConfig($config));
$this->assign('coupon_list',MarketingConfigLogic::getCouponList());
return $this->fetch();
}
/**
* Notes: 积分抵扣
* @author 段誉(2021/3/30 17:43)
* @return mixed
*/
public function integralDeduction()
{
if($this->request->isAjax()){
$post = $this->request->post();
MarketingConfigLogic::setConfig($post);
$this->_success('设置成功',[]);
}
$config = [
'integral_deduction_status',//积分抵扣状态
'integral_deduction_money',//积分抵扣比例
'integral_deduction_limit',//积分使用需超过多少才可使用
];
$this->assign('config',MarketingConfigLogic::getConfig($config));
return $this->fetch();
}
}

View file

@ -0,0 +1,318 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\CommonLogic;
use app\admin\logic\MenuDecorateLogic;
use app\common\model\Menu_;
use app\common\server\ConfigServer;
use app\common\server\UrlServer;
class MenuDecorate extends AdminBase{
/**
* note 首页导航装修页面
*/
public function indexList(){
if($this->request->isAjax()) {
$get = $this->request->get();
return $this->_success('', MenuDecorateLogic::indexList($get));
}
$index_setting_logo = ConfigServer::get('decoration', 'index_setting_logo',1);
$index_setting_hots = ConfigServer::get('decoration', 'index_setting_hots',1);
$index_setting_news = ConfigServer::get('decoration', 'index_setting_news', 1);
$index_setting_top_bg_image = ConfigServer::get('decoration', 'index_setting_top_bg_image', '');
if(!empty($index_setting_top_bg_image)) {
$index_setting_top_bg_image = UrlServer::getFileUrl($index_setting_top_bg_image);
}
$this->assign('index_setting_logo', $index_setting_logo);
$this->assign('index_setting_hots', $index_setting_hots);
$this->assign('index_setting_news', $index_setting_news);
$this->assign('index_setting_top_bg_image', $index_setting_top_bg_image);
return $this->fetch();
}
/**
* note 个人中心装修页面
*/
// public function centerList(){
// $this->assign('type',2);
// return $this->fetch('lists');
// }
/**
* note 个人中心装修页面
*/
public function centerList(){
if($this->request->isAjax()) {
$get = $this->request->get();
return $this->_success('', MenuDecorateLogic::centerList($get));
}
$center_setting_top_bg_image = ConfigServer::get('decoration', 'center_setting_top_bg_image', '');
if(!empty($center_setting_top_bg_image)) {
$center_setting_top_bg_image = UrlServer::getFileUrl($center_setting_top_bg_image);
}
$this->assign('center_setting_top_bg_image', $center_setting_top_bg_image);
return $this->fetch();
}
/**
* note 获取数据列表
* create_time 2020/12/1 11:14
*/
public function lists(){
$get = $this->request->get('');
if($this->request->isAjax()){
$this->_success('', MenuDecorateLogic::lists($get));
}
}
/**
* note 添加菜单
* create_time 2020/12/1 11:00
*/
public function add(){
if($this->request->isAjax()){
$post_data = $this->request->post();
$post_data['del'] = 0;
$result = $this->validate($post_data, 'app\admin\validate\MenuDecorate.add');
if($result === true){
MenuDecorateLogic::add($post_data); //逻辑层处理添加数据
$this->_success('修改成功');
}
$this->_error($result);
}
$type = $this->request->param('type',1);
$menu_list = Menu_::getMenuContent($type,true);
$this->assign('menu_list',$menu_list);
return $this->fetch();
}
/**
* note 编辑菜单
* create_time 2020/12/1 11:00
*/
public function edit(){
if($this->request->isAjax()){
$post_data = $this->request->post();
$post_data['del'] = 0;
$result = $this->validate($post_data, 'app\admin\validate\MenuDecorate.edit');
if($result === true){
MenuDecorateLogic::edit($post_data); //逻辑层处理添加数据
$this->_success('修改成功');
}
$this->_error($result);
}
$id = $this->request->get('id');
$decorate = MenuDecorateLogic::getMenuDecorate($id);
$menu_list = Menu_::getMenuContent($decorate['decorate_type'],true);
$this->assign('menu_list',$menu_list);
$this->assign('decorate',$decorate);
return $this->fetch();
}
/**
* note 删除菜单
* create_time 2020/12/1 11:00
*/
public function del($id){
if ($this->request->isAjax()) {
$result = $this->validate(['id' => $id], 'app\admin\validate\MenuDecorate.del');
if ($result === true) {
MenuDecorateLogic::del($id);
$this->_success('删除成功');
}
$this->_error($result);
}
}
/*
* 批量删除菜单
*/
public function batchDel(){
if ($this->request->isAjax()) {
$ids = $this->request->post('id');
$result = $this->validate(['id' => $ids], 'app\admin\validate\MenuDecorate.del');
if ($result === true) {
MenuDecorateLogic::batchDelMenuDecorate($ids);
$this->_success('删除成功');
}
$this->_error($result);
}
}
/*
* 复制菜单
*/
public function copy(){
$id = $this->request->get('id');
$decorate = MenuDecorateLogic::getMenuDecorate($id);
$menu_list = Menu_::getIndexMenu(true);
if($decorate['decorate_type'] == 2){
$menu_list = Menu_::getCentreMenu(true);
}
$this->assign('menu_list',$menu_list);
$this->assign('decorate',$decorate);
return $this->fetch();
}
/*
* 修改字段
*/
public function changeFields(){
$table = $this->request->controller();
$pk_name = 'id';
$pk_value = $this->request->post('id');
$field = $this->request->post('field');
$field_value = $this->request->post('value');
$result = CommonLogic::changeTableValue($table, $pk_name, $pk_value, $field, $field_value);
if ($result) {
$this->_success('修改成功');
}
$this->_error('修改失败');
}
/**
* 商品分类布局页
*/
public function categoryLayout() {
if($this->request->isPost()) {
$post = $this->request->post();
// 这里设置值要与显示时取值不同,这里相当于所有的
ConfigServer::set('decoration', 'layout_no', $post['layout_no']);
$this->_success('设置成功');
}
$category_layouts = ConfigServer::get('decoration', 'category_layout');
$category_layouts_tips = ConfigServer::get('decoration', 'category_layout_tips');
$layout_no = ConfigServer::get('decoration', 'layout_no', '');
$this->assign('category_layouts', $category_layouts);
$this->assign('category_layouts_tips', $category_layouts_tips);
$this->assign('layout_no', $layout_no);
return $this->fetch();
}
/**
* 首页 - 其它设置
*/
public function setIndexSetting()
{
$post = $this->request->post();
ConfigServer::set('decoration', 'index_setting_logo', $post['logo']);
ConfigServer::set('decoration', 'index_setting_hots', $post['hots']);
ConfigServer::set('decoration', 'index_setting_news', $post['news']);
ConfigServer::set('decoration', 'index_setting_top_bg_image', $post['top_bg_image']);
$this->_success('设置成功');
}
/**
* 我的 - 其它设置
*/
public function setCenterSetting()
{
$post = $this->request->post();
ConfigServer::set('decoration', 'center_setting_top_bg_image', $post['top_bg_image']);
$this->_success('设置成功');
}
/**
* 底部导航
*/
public function bottomNavigation()
{
if($this->request->isAjax()) {
$get = $this->request->get();
$result = MenuDecorateLogic::bottomNavigation($get);
return $this->_success('', $result);
}
$unSelectedTextColor = ConfigServer::get('decoration', 'navigation_setting_ust_color', '#000000');
$selectedTextColor = ConfigServer::get('decoration', 'navigation_setting_st_color', '#000000');
// $top_bg_image = ConfigServer::get('decoration', 'navigation_setting_top_bg_image', '');
// if(!empty($top_bg_image)) {
// $top_bg_image = UrlServer::getFileUrl($top_bg_image);
// }
$this->assign('unSelectedTextColor', $unSelectedTextColor);
$this->assign('selectedTextColor', $selectedTextColor);
// $this->assign('top_bg_image', $top_bg_image);
return $this->fetch();
}
/**
* 添加底部导航
*/
public function addNavigation()
{
if($this->request->isAjax()) {
$post = $this->request->post();
$result = MenuDecorateLogic::addNavigation($post);
if($result['flag']) {
$this->_success($result['msg']);
}else{
$this->_error($result['msg']);
}
}
return $this->fetch();
}
/**
* 编辑底部导航
*/
public function editNavigation()
{
if($this->request->isAjax()) {
$post = $this->request->post();
$result = MenuDecorateLogic::editNavigation($post);
if($result['flag']) {
$this->_success($result['msg']);
}else{
$this->_error($result['msg']);
}
}
$id = $this->request->get('id');
$navigation = MenuDecorateLogic::getNavigation($id);
$this->assign('navigation', $navigation);
return $this->fetch();
}
/**
* 删除底部导航
*/
public function delNavigation()
{
if($this->request->isPost()) {
$id = $this->request->post('id', '', 'intval');
$result = MenuDecorateLogic::delNavigation($id);
if($result) {
return $this->_success('删除成功');
}else{
return $this->_error('删除失败');
}
}
}
/**
* 底部导航 - 其他设置
*/
public function setNavigationSetting()
{
$post = $this->request->post();
ConfigServer::set('decoration', 'navigation_setting_ust_color', $post['unSelectedTextColor']);
ConfigServer::set('decoration', 'navigation_setting_st_color', $post['selectedTextColor']);
// ConfigServer::set('decoration', 'navigation_setting_top_bg_image', $post['top_bg_image']);
$this->_success('设置成功');
}
}

View file

@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\MessageLogic;
class Message extends AdminBase{
public function config(){
$config = MessageLogic::config();
$this->assign('config',$config);
return $this->fetch();
}
public function set(){
$id = $this->request->get('id',1);
if($this->request->isAjax()){
$post = $this->request->post();
MessageLogic::setConfig($post);
$this->_success('设置成功');
}
$info = MessageLogic::getMessage($id);
$this->assign('info',$info);
return $this->fetch();
}
}

View file

@ -0,0 +1,45 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\MnpLogic;
use think\Request;
class Mnp extends AdminBase
{
/**
* 设置小程序
* @return mixed
*/
public function setMnp()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
MnpLogic::SetMnp($post);
$this->_success('设置成功');
}
$mnp = MnpLogic::getMnp();
$this->assign('mnp', $mnp);
return $this->fetch();
}
}

View file

@ -0,0 +1,78 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\MnpMessageLogic;
class MnpMessage extends AdminBase
{
/**
* Notes: 模板消息管理
*/
public function lists()
{
if($this->request->isAjax()){
$get = $this->request->get();
$list = MnpMessageLogic::lists($get);
$this->_success('', $list);
}
return $this->fetch();
}
/**
* Notes: 编辑模板消息
* @param $id
* @return mixed
*/
public function edit($id)
{
$info = MnpMessageLogic::getTemplateMessage($id);
$this->assign('info',$info);
return $this->fetch();
}
/**
* Notes: 修改消息模板使用状态
*/
public function switchStatus()
{
$get = $this->request->get();
$result = MnpMessageLogic::switchStatus($get);
if ($result) {
$this->_success('修改成功');
}
$this->_success('修改失败');
}
/**
* Notes: 同步消息模板
*/
public function synchro()
{
$post = $this->request->post();
$result = MnpMessageLogic::synchro($post);
if ($result === true) {
$this->_success('同步成功');
}
$this->_error('同步失败,请检查配置信息');
}
}

View file

@ -0,0 +1,52 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\MyLogic;
use yx\admin\builderClass;
class My extends AdminBase
{
/**
* 修改个人密码
* @return mixed
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function password()
{
if ($this->request->post()) {
$post = input('post.');
$post['admin_id'] = $this->admin_id;
$result = $this->validate($post, 'app\admin\validate\Password');
if ($result === true) {
MyLogic::updatePassword($post['password'], $this->admin_id);
$this->_success('修改密码成功');
}
$this->_error($result);
}
return $this->fetch();
}
}

View file

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\NoticeSettingLogic;
use app\common\model\NoticeSetting as NoticeSettingModel;
use think\Db;
class NoticeSetting extends AdminBase
{
/**
* Notes: 消息设置列表
* @author 段誉(2021/4/27 17:17)
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$type = $get['type'] ?? NoticeSettingModel::NOTICE_USER;
$this->_success('获取成功', NoticeSettingLogic::lists($type));
}
return $this->fetch();
}
/**
* Notes: 设置系统通知模板
* @author 段誉(2021/4/27 17:18)
* @return mixed
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function set()
{
$id = $this->request->get('id');
$type = $this->request->get('type');
if ($this->request->isAjax()) {
$post = $this->request->post();
NoticeSettingLogic::set($post);
$this->_success('操作成功');
}
$this->assign('info', NoticeSettingLogic::info($id, $type));
$this->assign('type', $type);
return $this->fetch('set_'.$type);
}
/**
* 通知记录
*/
public function record()
{
if($this->request->isAjax()) {
$get = $this->request->get();
$data = NoticeSettingLogic::record($get);
$this->_success('', $data);
}
$param = $this->request->get();
$this->assign('param', $param);
return $this->fetch();
}
/**
* 删除记录,直接删除(非软删除)
*/
public function delRecord()
{
$id = $this->request->post('id', '', 'intval');
if(empty($id)) {
return $this->_error('参数缺失,删除失败');
}
$res = Db::name('notice')->delete($id);
if($res) {
return $this->_success('删除成功');
}else{
return $this->_error('删除失败');
}
}
}

View file

@ -0,0 +1,67 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\OaLogic;
use app\admin\logic\WeChatLogic;
use app\common\server\ConfigServer;
class Oa extends AdminBase {
/**
* note 设置公众号
* create_time 2020/12/11 11:28
*/
public function setOa(){
if($this->request->isAjax()){
$post = $this->request->post();
OaLogic::setOa($post);
$this->_success('设置成功');
}
$oa = OaLogic::getOa();
$this->assign('oa',$oa);
return $this->fetch();
}
/**
* note 微信菜单
* create_time 2020/12/11 11:28
*/
public function oaMenu(){
$wechat_menu = ConfigServer::get('menu', 'wechat_menu',[]);
$this->assign('menu',$wechat_menu);
return $this->fetch();
}
/**
* note 发布菜单
* create_time 2020/12/11 11:28
*/
public function pulishMenu(){
$menu = $this->request->post('button');
if(empty($menu)){
$this->_error('请设置菜单');
}
$result = OaLogic::pulishMenu($menu);
if($result['code'] == 1){
$this->_success($result['msg']);
}
$this->_error($result['msg']);
}
}

View file

@ -0,0 +1,79 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\OaMessageLogic;
class OaMessage extends AdminBase
{
/**
* Notes: 模板消息管理
*/
public function lists()
{
if($this->request->isAjax()){
$get = $this->request->get();
$list = OaMessageLogic::lists($get);
$this->_success('', $list);
}
return $this->fetch();
}
/**
* Notes: 编辑模板消息
* @param $id
* @return mixed
*/
public function edit($id)
{
$info = OaMessageLogic::getTemplateMessage($id);
$this->assign('info',$info);
return $this->fetch();
}
/**
* Notes: 修改消息模板使用状态
*/
public function switchStatus()
{
$get = $this->request->get();
$result = OaMessageLogic::switchStatus($get);
if ($result) {
$this->_success('修改成功');
}
$this->_success('修改失败');
}
/**
* Notes: 同步消息模板到公众号
*/
public function synchro()
{
$post = $this->request->post();
$result = OaMessageLogic::synchro($post);
if ($result === true) {
$this->_success('同步成功');
}
$this->_error('同步失败,请检查配置信息');
}
}

View file

@ -0,0 +1,16 @@
<?php
namespace app\admin\controller;
use app\admin\logic\OpLogic;
class Op extends Admin{
public function config(){
if($this->request->isAjax()){
$post = $this->request->post();
OpLogic::setConfig($post);
$this->_success('设置成功',[]);
}
$this->assign('config',OpLogic::getConfig(['app_id','secret']));
return $this->fetch();
}
}

View file

@ -0,0 +1,195 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\common\model\OrderLog;
use app\admin\logic\OrderLogic;
use app\common\model\Client_;
use app\common\model\Order as CommonOrder;
use app\common\model\Pay;
use think\Db;
class Order extends AdminBase
{
/**
* User: 意象信息科技 mjf
* Desc: 订单列表
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('', OrderLogic::lists($get));
}
$this->assign('order_status', CommonOrder::getOrderStatus(true));
$this->assign('order_type', CommonOrder::getOrderType(true));
$this->assign('pay_way', Pay::getPayWay(true));
$this->assign('delivery_type', CommonOrder::getDeliveryType(true));
$this->assign('order_source', Client_::getClient(true));
return $this->fetch();
}
/**
* User: 意象信息科技 mjf
* Desc: 订单详情
*/
public function detail()
{
$id = $this->request->get('id');
$detail = OrderLogic::getDetail($id);
$this->assign('detail', $detail);
$this->assign('logs', OrderLog::getOrderLog($id));
return $this->fetch();
}
/**
* User: 意象信息科技 mjf
* Desc: 取消订单
*/
public function cancel()
{
if ($this->request->isAjax()) {
$post = $this->request->post('');
$check = $this->validate($post, 'app\admin\validate\Order.cancel');
if (true !== $check) {
$this->_error($check);
}
$res = OrderLogic::cancel($post['order_id'], $this->admin_id);
if ($res === true) {
$this->_success('取消成功');
}
$this->_error($res);
}
}
/**
* User: 意象信息科技 mjf
* Desc: 删除订单
*/
public function del()
{
if ($this->request->isAjax()) {
$post = $this->request->post('');
$check = $this->validate($post, 'app\admin\validate\Order.del');
if (true !== $check) {
$this->_error($check);
}
OrderLogic::del($post['order_id'], $this->admin_id);
$this->_success('删除成功');
}
}
/**
* User: 意象信息科技 mjf
* Desc: 发货
*/
public function delivery()
{
$id = $this->request->get('id');
$detail = OrderLogic::getDetail($id);
$this->assign('detail', $detail);
$this->assign('express', OrderLogic::express());
return $this->fetch();
}
/**
* User: 意象信息科技 mjf
* Desc: 发货操作
*/
public function deliveryHandle()
{
if ($this->request->isAjax()) {
$post = $this->request->post('');
$check = $this->validate($post, 'app\admin\validate\Order.delivery');
if (true !== $check) {
$this->_error($check);
}
OrderLogic::deliveryHandle($post, $this->admin_id);
$this->_success('发货成功');
}
}
/**
* User: 意象信息科技 mjf
* Desc: 确认收货
*/
public function confirm()
{
if ($this->request->isAjax()) {
$post = $this->request->post('');
$check = $this->validate($post, 'app\admin\validate\Order.confirm');
if (true !== $check) {
$this->_error($check);
}
OrderLogic::confirm($post['order_id'], $this->admin_id);
$this->_success('确认成功');
}
}
/**
* User: 意象信息科技 mjf
* Desc: 物流信息
*/
public function express()
{
$id = $this->request->get('id');
$detail = OrderLogic::getDetail($id);
$detail['shipping'] = OrderLogic::shippingInfo($detail['id']);
$this->assign('detail', $detail);
return $this->fetch();
}
public function remarks()
{
// 获取的
if ($this->request->isAjax() && $this->request->isGet()){
$get = $this->request->get();
$detail = OrderLogic::remarks($get, 'get');
$this->_success('获取成功', $detail);
}
// 提交的
if ($this->request->isAjax() && $this->request->isPost()) {
$post = $this->request->post();
$result = OrderLogic::remarks($post, 'post');
if ($result) {
$this->_success('保存成功');
}
$this->error('保存失败');
}
}
/**
* Notes:打印接口
*/
public function orderPrint(){
$id = $this->request->post('id');
$result = $this->validate(['id'=>$id],'app\admin\validate\OrderPrint');
if(true === $result){
$result = OrderLogic::orderPrint($id);
if(true === $result){
$this->success('打印机成功,如未出小票,请检查打印机是否在线');
}
}
$this->_error($result);
}
}

View file

@ -0,0 +1,112 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\PayConfigLogic;
use app\common\server\ConfigServer;
use think\db;
class PayConfig extends AdminBase
{
/**
* Notes: 支付列表
* @author 段誉(2021/3/10 11:46)
* @return mixed
*/
public function lists()
{
if ($this->request->isAjax()) {
$this->_success('', PayConfigLogic::lists());
}
return $this->fetch();
}
/**
* Notes: 余额支付
* @author 段誉(2021/3/8 10:57)
* @return mixed
*/
public function editBalance()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
if (empty($post['icon'])) {
$this->_error('请选择支付图标');
}
PayConfigLogic::editBalance($post);
$this->_success('修改成功');
}
$this->assign('info', PayConfigLogic::info('balance'));
return $this->fetch();
}
/**
* Notes: 编辑微信
* @author 段誉(2021/3/8 11:16)
* @return mixed
*/
public function editWechat()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
if (empty($post['icon'])) {
$this->_error('请选择支付图标');
}
if ($post['apiclient_cert'] == '' || $post['apiclient_key'] == '') {
$this->_error('apiclient_cert或apiclient_key不能为空');
}
PayConfigLogic::editWechat($post);
$this->_success('修改成功');
}
$domain_name = ConfigServer::get('website', 'domain_name', '');
$domain_name = $domain_name ? $domain_name : request()->domain();
$this->assign('domain', $domain_name);
$this->assign('info', PayConfigLogic::info('wechat'));
return $this->fetch();
}
/**
* Notes: 支付宝
* @author 段誉(2021/3/10 11:47)
* @return mixed
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function editAlipay()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
if (empty($post['icon'])) {
$this->_error('请选择支付图标');
}
PayConfigLogic::editAlipay($post);
$this->_success('修改成功');
}
$this->assign('info', PayConfigLogic::info('alipay'));
return $this->fetch();
}
}

View file

@ -0,0 +1,140 @@
<?php
// +----------------------------------------------------------------------
// | LikeShop有特色的全开源社交分销电商系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 商业用途务必购买系统授权,以免引起不必要的法律纠纷
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | 微信公众号:好象科技
// | 访问官网http://www.likemarket.net
// | 访问社区http://bbs.likemarket.net
// | 访问手册http://doc.likemarket.net
// | 好象科技开发团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\PrinterLogic;
class Printer extends AdminBase{
/**
* Notes:打印机列表
* @return mixed
*/
public function lists(){
if($this->request->isAjax()){
$get = $this->request->get();
$list = PrinterLogic::lists($get);
$this->_success('',$list);
}
return $this->fetch();
}
/**
* Notes:添加打印机
* @return mixed
*/
public function add(){
if($this->request->isAjax()){
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post,'app\admin\validate\Printer.add');
if(true === $result){
$result = PrinterLogic::add($post);
if(true === $result){
$this->_success('添加成功');
}
}
$this->_error($result);
}
$this->assign('type_list',PrinterLogic::getTypeList());
return $this->fetch();
}
/**
* Notes:编辑打印机
* @param $id 打印机id
* @return mixed
*/
public function edit($id){
if($this->request->isAjax()){
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post,'app\admin\validate\Printer');
if(true === $result){
$result = PrinterLogic::edit($post);
if(true === $result){
$this->_success('添加成功');
}
}
$this->_error($result);
}
$this->assign('type_list',PrinterLogic::getTypeList());
$this->assign('detail',PrinterLogic::getPrinter($id));
return $this->fetch();
}
/**
* Notes:设置打印机配置
* @return mixed
*/
public function setConfig(){
$id = $this->request->get('id');
if($this->request->isAjax()){
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\SetConfig');
if(true === $result){
PrinterLogic::setConfig($post);
$this->_success('设置成功');
}
$this->_error($result);
}
$this->assign('detail',PrinterLogic::getConfig($id));
return $this->fetch('config');
}
/**
* Notes:设置打印机配置
*/
public function setTemplate(){
$post = $this->request->post();
$result = PrinterLogic::setTemplate($post);
if(true == $result){
$this->_success('模板设置成功');
}
$this->_error('模板设置失败');
}
/**
* Notes:测试打印
*/
public function testPrint(){
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\Printer.config');
if(true === $result){
$result = PrinterLogic::testPrint($post);
if(true === $result){
$this->_success('打印成功');
}
}
$this->_error($result);
}
public function del(){
$id = $this->request->post('id');
$result = $this->validate(['id'=>$id],'app\admin\validate\Printer.del');
if(true === $result){
$result = PrinterLogic::del($id);
if($result === true){
$this->_success('删除成功');
}
$this->error($result);
}
$this->_error($result);
}
}

View file

@ -0,0 +1,123 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\CommonLogic;
use app\admin\logic\RechargeLogic;
class Recharge extends AdminBase {
/**
* note 充值模板列表
* create_time 2020/10/23 16:21
*/
public function lists(){
$get = $this->request->get();
if($this->request->isAjax()){
if($get['type'] == 1){
$list = RechargeLogic::templatelists($get['type']);
}else{
$list = RechargeLogic::getRechargeConfig();
}
$this->_success('',$list);
}
return $this->fetch();
}
/**
* note 设置充值
* create_time 2020/10/24 11:34
*/
public function setRecharge(){
$post = $this->request->post();
if($this->request->isAjax()){
RechargeLogic::setRecharge($post);
$this->_success('设置成功');
}
}
/**
* note 添加充值模板
* create_time 2020/10/23 17:52
*/
public function add(){
if ($this->request->isAjax()){
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\RechargeTemplate');
if ($result === true){
RechargeLogic::add($post);
$this->_success('添加成功!');
}
$this->_error($result);
}
return $this->fetch();
}
/**
* note 编辑充值模板
* create_time 2020/10/23 17:51
*/
public function edit($id){
if ($this->request->isAjax()){
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post,'app\admin\validate\RechargeTemplate');
if ($result === true){
RechargeLogic::edit($post);
$this->_success('修改成功');
}
$this->_error($result);
}
$info = RechargeLogic::getRechargeTemplate($id);
$this->assign('info',$info);
return $this->fetch();
}
/**
* note 删除充值模板
*/
public function del($id)
{
if ($this->request->isAjax()) {
$result = RechargeLogic::del($id);
if ($result) {
$this->_success('删除成功');
}
$this->_error('删除失败');
}
}
public function changeFields(){
$table = 'recharge_template';
$pk_name = 'id';
$pk_value = $this->request->get('id');
$field = $this->request->get('field');
$field_value = $this->request->get('value');
$result = CommonLogic::changeTableValue($table,$pk_name,$pk_value,$field,$field_value);
if($result){
$this->_success('修改成功');
}
$this->_error('修改失败');
}
}

View file

@ -0,0 +1,60 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\RechargeLogLogic;
use think\helper\Time;
class RechargeLog extends AdminBase{
/**
* note 充值记录
* create_time 2020/11/18 10:05
*/
public function lists(){
if($this->request->isAjax()){
$get = $this->request->get();
$list = RechargeLogLogic::lists($get);
$this->_success('', $list);
}
$today = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::today());
$this->assign('today', $today);
$yesterday = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::yesterday());
$this->assign('yesterday', $yesterday);
$days_ago7 = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::dayToNow(7));
$this->assign('days_ago7', $days_ago7);
$days_ago30 = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::dayToNow(30, true));
$this->assign('days_ago30', $days_ago30);
return $this->fetch();
}
}

View file

@ -0,0 +1,107 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\AdminLogic;
use app\admin\logic\RoleLogic;
use think\facade\Hook;
class Role extends AdminBase
{
public function lists()
{
if ($this->request->isAjax()) {
$this->_success('', RoleLogic::lists());
}
return $this->fetch();
}
/**
* 添加角色
* @return mixed
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\Role.add');
if ($result !== true) {
$this->_error($result);
}
$result = RoleLogic::addRole($post);
if ($result !== true) {
$this->_error($result);
}
$this->_success('添加成功');
}
$auth_tree = RoleLogic::authTree();
$this->assign('auth_tree', json_encode($auth_tree));
return $this->fetch();
}
/**
* 编辑角色
* @param string $role_id
* @return mixed
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function edit($role_id = '')
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\Role.edit');
if ($result !== true) {
$this->_error($result);
}
$result = RoleLogic::editRole($post);
if ($result !== true) {
$this->_error($result);
}
Hook::listen('menu_auth');
$this->_success('修改成功');
}
$auth_tree = RoleLogic::authTree($role_id);
$this->assign('info', RoleLogic::roleInfo($role_id));
$this->assign('auth_tree', json_encode($auth_tree));
return $this->fetch();
}
/**
* 删除角色
* @param $role_id
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function del($role_id)
{
if ($this->request->isAjax()) {
$result = $this->validate(['id' => $role_id], 'app\admin\validate\Role.del');
if ($result === true) {
RoleLogic::delRole($role_id);
Hook::listen('menu_auth');
$this->_success('删除成功');
}
$this->_error($result);
}
}
}

View file

@ -0,0 +1,176 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\SeckillLogic;
class Seckill extends AdminBase{
public function lists(){
$seckill_time = SeckillLogic::getTimeAll();
$this->assign('seckill',$seckill_time);
return $this->fetch();
}
/**
* note 秒杀商品
* create_time 2020/11/13 16:01
*/
public function goodsLists(){
if($this->request->isAjax()){
$get = $this->request->get();
$list = SeckillLogic::goodsList($get);
$this->_success('',$list);
}
}
/**
* note 秒杀时间
* create_time 2020/11/13 16:01
*/
public function timeLists(){
if($this->request->isAjax()){
$get= $this->request->get();
$list = SeckillLogic::timeList($get);
$this->_success('',$list);
}
}
/**
* note 添加秒杀时间段
* create_time 2020/11/13 16:01
*/
public function addTime(){
if($this->request->isAjax()){
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\SeckillTime');
if($result === true){
SeckillLogic::addTime($post);
$this->_success('新增成功','');
}
$this->_error($result,'');
}
return $this->fetch();
}
/**
* note 编辑秒杀时间段
* create_time 2020/11/13 16:02
*/
public function editTime($id){
if($this->request->isAjax()){
$post = $this->request->post();
$result = $this->validate($post, 'app\admin\validate\SeckillTime');
if($result === true){
SeckillLogic::editTime($post);
$this->_success('编辑成功','');
}
$this->_error($result,'');
}
$this->assign('detail',SeckillLogic::getTime($id));
return $this->fetch();
}
/**
* note 删除秒杀时间段
* create_time 2020/11/13 16:02
*/
public function delTime(){
if($this->request->isAjax()){
$id = $this->request->post('id');
$result = SeckillLogic::delTime($id);
if($result == true){
$this->_success('删除成功','');
}
return $this->_error('删除失败','');
}
}
/**
* note 添加秒杀商品
* create_time 2020/11/13 16:02
*/
public function addGoods(){
if($this->request->isAjax()){
$post = $this->request->post();
$post['item'] = form_to_linear($post);
$result = $this->validate($post,'app\admin\validate\SeckillGoods.add');
if($result === true){
$result = SeckillLogic::addGoods($post);
if($result){
$this->_success('新增成功','');
}
$result = '新增失败';
}
$this->_error($result);
}
$seckill_time = SeckillLogic::getTimeAll();
$this->assign('seckill',$seckill_time);
return $this->fetch();
}
/**
* note 编辑秒杀商品
* create_time 2020/11/13 16:02
*/
public function editGoods(){
if($this->request->isAjax()){
$post = $this->request->post();
$post['item'] = form_to_linear($post);
$result = $this->validate($post,'app\admin\validate\SeckillGoods.edit');
if($result === true){
$result = SeckillLogic::editGoods($post);
if($result){
$this->_success('编辑成功','');
}
$result = '编辑失败';
}
$this->_error($result);
}
$id = $this->request->get('id');
$seckill_id = $this->request->get('seckill_id');
$detail = SeckillLogic::getSeckillGoods($id,$seckill_id);
$seckill_time = SeckillLogic::getTimeAll();
$this->assign('seckill',$seckill_time);
$this->assign('detail',$detail);
return $this->fetch();
}
/**
* note 删除秒杀商品
* create_time 2020/11/13 16:05
*/
public function delGoods(){
if($this->request->isAjax()){
$id = $this->request->post('id');
$seckill_id = $this->request->post('seckill_id');
$result = SeckillLogic::delGoods($id,$seckill_id);
if($result == true){
$this->_success('删除成功','');
}
return $this->_error('删除失败','');
}
}
}

View file

@ -0,0 +1,33 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\ServiceConfigLogic;
class ServiceConfig extends AdminBase{
public function config(){
if($this->request->isAjax()){
$post = $this->request->post();
ServiceConfigLogic::setConfig($post);
return $this->_success('设置成功',[]);
}
$this->assign('config',ServiceConfigLogic::getConfig());
return $this->fetch();
}
}

View file

@ -0,0 +1,154 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\common\server\ConfigServer;
class ShopSetting extends AdminBase
{
/**
* 交易设置
*/
public function trading()
{
$config = [
'order_contact' => ConfigServer::get('order_message', 'order_contact' ),//订单管理联系人
'order_contact_mobile' => ConfigServer::get('order_message', 'order_contact_mobile'),//订单管理联系人手机
'order_cancel' => ConfigServer::get('trading', 'order_cancel', 30),//未付款订单多久时间后自动关闭
'customer_cancel_limit' => ConfigServer::get('trading', 'customer_cancel_limit', 0),//已支付订单多长时间内允许客户主动取消订单
'order_finish' => ConfigServer::get('trading', 'order_finish', 7),//已发货订单多久时间后自动收货完成订单
'refund_days' => ConfigServer::get('after_sale', 'refund_days', 7),//已完成订单多久时间内允许售后退款
'deduct_type' => ConfigServer::get('trading', 'deduct_type', 1),//订单库存扣减方式
'growth_ratio' => ConfigServer::get('trading', 'growth_ratio', 0),//成长值比例
'contact' => ConfigServer::get('shop', 'contact' ),//联系人
'mobile' => ConfigServer::get('shop', 'mobile'),//联系手机号
'province_id' => ConfigServer::get('shop', 'province_id'),//省份id
'city_id' => ConfigServer::get('shop', 'city_id'),//市id
'district_id' => ConfigServer::get('shop', 'district_id'),//区id
'address' => ConfigServer::get('shop', 'address'),//详细地址
];
$this->assign('config', $config);
return $this->fetch();
}
public function setTrading()
{
$post = $this->request->post();
if ($post) {
ConfigServer::set('trading', 'order_cancel', $post['order_cancel']);
ConfigServer::set('trading', 'customer_cancel_limit', $post['customer_cancel_limit']);
ConfigServer::set('trading', 'order_finish', $post['order_finish']);
ConfigServer::set('after_sale', 'refund_days', $post['refund_days']);
ConfigServer::set('trading', 'deduct_type', $post['deduct_type']);//订单库存扣减方式
ConfigServer::set('trading', 'growth_ratio', $post['growth_ratio']);//成长值比例
ConfigServer::set('shop', 'contact', $post['contact']);//店铺联系人
ConfigServer::set('shop', 'mobile', $post['mobile']);//店铺联系手机号
ConfigServer::set('shop', 'province_id', $post['province_id']);//店铺省份id
ConfigServer::set('shop', 'city_id', $post['city_id']);//店铺市id
ConfigServer::set('shop', 'district_id', $post['district_id']);//店铺地区id
ConfigServer::set('shop', 'address', $post['address']);//店铺详细地址
ConfigServer::set('order_message', 'order_contact', $post['order_contact']);//订单管理联系人
ConfigServer::set('order_message', 'order_contact_mobile', $post['order_contact_mobile']);//订单管理联系人手机
$this->_success('修改成功');
}
}
/**
* 售后退款
*/
public function policy()
{
$config = [
'service' => ConfigServer::get('policy', 'service'),
'privacy' => ConfigServer::get('policy', 'privacy'),
'after_sale' => ConfigServer::get('policy', 'after_sale'),
];
$this->assign('config', $config);
return $this->fetch();
}
public function setPolicy()
{
$post = $this->request->post();
if ($post) {
ConfigServer::set('policy', 'service', $post['service']);
ConfigServer::set('policy', 'privacy', $post['privacy']);
ConfigServer::set('policy', 'after_sale', $post['after_sale']);
$this->_success('修改成功');
}
}
/**
* 会员提现设置
*/
public function withdraw()
{
$config = [
'min_withdraw' => ConfigServer::get('withdraw', 'min_withdraw'),
'max_withdraw' => ConfigServer::get('withdraw', 'max_withdraw'),
'poundage' => ConfigServer::get('withdraw', 'poundage'),
'type' => ConfigServer::get('withdraw', 'type') ? ConfigServer::get('withdraw', 'type') : []
];
$this->assign('config', $config);
return $this->fetch();
}
public function setWithdraw()
{
$post = $this->request->post();
if(empty($post['type'])) {
return $this->_error('至少选择一种提现方式');
}
if ($post) {
ConfigServer::set('withdraw', 'min_withdraw', $post['min_withdraw']);//最低提现
ConfigServer::set('withdraw', 'max_withdraw', $post['max_withdraw']);//最高提现
ConfigServer::set('withdraw', 'poundage', $post['poundage']);//提现手续费
ConfigServer::set('withdraw', 'type', $post['type']);//提现方式
$this->_success('操作成功');
}
}
/**
* Notes: 注册设置
* @author 段誉(2021/2/25 15:14)
* @return mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function setRegister()
{
if ($this->request->isAjax()){
$post = $this->request->post();
ConfigServer::set('register_setting', 'open', $post['open']);
$this->_success('操作成功');
}
$config = ConfigServer::get('register_setting', 'open', 0);
$this->assign('config', $config);
return $this->fetch('register');
}
}

View file

@ -0,0 +1,152 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\SignDailyLogic;
/**
* 天天签到
* Class SignDaily
* @package app\admin\controller
*/
class SignDaily extends AdminBase
{
/**
* 连续签到奖励列表
* @return mixed
*/
public function lists()
{
if ($this->request->isAjax()){
$get = $this->request->get();
$list = SignDailyLogic::lists($get);
$this->_success('',$list);
}
$config = SignDailyLogic::getSignRule();
$this->assign('config',$config);
return $this->fetch();
}
/**
* 签到记录列表
*/
public function record()
{
if ($this->request->isAjax()){
$get = $this->request->get();
$this->_success('',SignDailyLogic::record($get));
}
return $this->fetch();
}
/**
* 添加连续签到奖励
* @return mixed
*/
public function add()
{
if ($this->request->isAjax()){
$post = $this->request->post();
$result =$this->validate($post,'app\admin\validate\SignDaily.add');
if ($result === true){
$post['integral_status'] = isset($post['integral_status']) && $post['integral_status'] =='on'?1:0;
$post['growth_status'] = isset($post['growth_status']) && $post['growth_status'] =='on'?1:0;
SignDailyLogic::add($post);
$this ->success('添加成功');
}
$this->_error($result);
}
return $this->fetch();
}
/**
* 编辑连续签到奖励
* @return mixed
*/
public function edit($id)
{
if ($this->request->isAjax()){
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\SignDaily.edit');
if ($result === true){
$post['integral_status'] = isset($post['integral_status']) && $post['integral_status'] == 'on'?1:0;
$post['growth_status'] = isset($post['growth_status']) && $post['growth_status'] == 'on'?1:0;
SignDailyLogic::edit($post,$id);
$this->_success('修改成功');
}
$this->_error($result);
}
$info = SignDailyLogic::getSignDaily($id);
$this->assign('info',$info);
return $this->fetch();
}
/**
* 删除连续签到奖励
* @return mixed
*/
public function del($id)
{
if ($this->request->isAjax()){
SignDailyLogic::del($id);
$this->_success('删除成功');
}
return $this->fetch();
}
/**
* 签到规则说明设置
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function signRule()
{
if ($this->request->isAjax()){
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\SignDaily.sign');
if ($result === true){
$post['integral_status'] = isset($post['integral_status']) && $post['integral_status'] =='on'?1:0;
$post['growth_status'] = isset($post['growth_status']) && $post['growth_status'] =='on'?1:0;
SignDailyLogic::setSignRule($post);
$this ->success('保存成功');
}
$this->_error($result);
}
}
}

View file

@ -0,0 +1,32 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
class Sites extends AdminBase
{
public function index()
{
return '网站设置';
}
}

View file

@ -0,0 +1,61 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\SmsLogic;
use app\common\model\SmsLog;
class Sms extends AdminBase{
public function lists(){
if($this->request->isAjax()){
$list = SmsLogic::configLists();
return $this->_success('',$list);
}
$status_list = SmsLog::getSendStatusDesc(true);
$this->assign('status_list',$status_list);
return $this->fetch();
}
public function logLists(){
if($this->request->isAjax()){
$get = $this->request->get();
$list = SmsLogic::logLists($get);
return $this->_success('',$list);
}
}
public function config(){
$id = $this->request->get('id');
if($this->request->isAjax()){
$post = $this->request->post();
SmsLogic::setConfig($post);
return $this->_success('设置成功');
}
$info = SmsLogic::getConfig($id);
$this->assign('info',$info);
return $this->fetch();
}
public function detail(){
$id = $this->request->get('id');
$info = SmsLogic::detail($id);
$this->assign('info',$info);
return $this->fetch();
}
}

View file

@ -0,0 +1,60 @@
<?php
namespace app\admin\controller;
use app\admin\logic\StatisticsLogic;
class Statistics extends AdminBase
{
/**
* 会员统计
*/
public function member()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$this->_success('', StatisticsLogic::member($post));
}
$this->assign('res', StatisticsLogic::member(['days' => 'today']));
return $this->fetch();
}
/**
* 商品统计
*/
public function goods()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$this->_success('', StatisticsLogic::goods($post));
}
$this->assign('res', StatisticsLogic::goods(['days' => 'today']));
return $this->fetch();
}
/**
* 访问
*/
public function visit()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$this->_success('', StatisticsLogic::visit($post));
}
$this->assign('res', StatisticsLogic::visit(['days' => 'today']));
return $this->fetch();
}
/**
* 交易
*/
public function deal()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$this->_success('', StatisticsLogic::deal($post));
}
$this->assign('res', StatisticsLogic::deal(['days' => 'today']));
return $this->fetch();
}
}

View file

@ -0,0 +1,168 @@
<?php
// +----------------------------------------------------------------------
// | LikeShop有特色的全开源社交分销电商系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 商业用途务必购买系统授权,以免引起不必要的法律纠纷
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | 微信公众号:好象科技
// | 访问官网http://www.likemarket.net
// | 访问社区http://bbs.likemarket.net
// | 访问手册http://doc.likemarket.net
// | 好象科技开发团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\common\server\ConfigServer;
class StorageConfig extends AdminBase
{
/**
* Notes: 存储引擎列表
* @author 张无忌(2021/2/22 11:43)
* @return mixed
*/
public function lists()
{
if ($this->request->isAjax()) {
$default = ConfigServer::get('storage', 'default', '');
$data = [
[
'name' => '本地存储',
'path' => '存储在本地服务器',
'engine' => 'local',
'status' => $default == 'local' ? 1 : 0
],
[
'name' => '七牛云存储',
'path' => '存储在七牛云,请前往七牛云开通存储服务',
'engine' => 'qiniu',
'status' => $default == 'qiniu' ? 1 : 0
],
[
'name' => '阿里云OSS',
'path' => '存储在阿里云,请前往阿里云开通存储服务',
'engine' => 'aliyun',
'status' => $default == 'aliyun' ? 1 : 0
],
[
'name' => '腾讯云OSS',
'path' => '存储在腾讯云,请前往腾讯云开通存储服务',
'engine' => 'qcloud',
'status' => $default == 'qcloud' ? 1 : 0
]
];
$this->_success('获取成功', $data);
}
return $this->fetch();
}
/**
* Notes: 编辑存储引擎
* @author 张无忌(2021/2/22 11:43)
* @return mixed
*/
public function edit()
{
if ($this->request->isAjax()) {
$engine= $this->request->post('engine');
$post = $this->request->post();
if ($engine === 'qiniu') {
try {
ConfigServer::set('storage_engine', 'qiniu', [
'bucket' => $post['qiniu_bucket'],
'access_key' => $post['qiniu_ak'],
'secret_key' => $post['qiniu_sk'],
'domain' => $post['qiniu_domain']
]);
} catch (\Exception $e) {
$this->_error('设置失败:'.$e->getMessage());
}
$this->_success('设置成功');
} elseif ($engine === 'aliyun') {
try {
ConfigServer::set('storage_engine', 'aliyun', [
'bucket' => $post['aliyun_bucket'],
'access_key_id' => $post['aliyun_ak'],
'access_key_secret' => $post['aliyun_sk'],
'domain' => $post['aliyun_domain']
]);
} catch (\Exception $e) {
$this->_error('设置失败:'.$e->getMessage());
}
$this->_success('设置成功');
} elseif ($engine === 'qcloud') {
try {
ConfigServer::set('storage_engine', 'qcloud', [
'bucket' => $post['qcloud_bucket'],
'region' => $post['qcloud_region'],
'secret_id' => $post['qcloud_ak'],
'secret_key' => $post['qcloud_sk'],
'domain' => $post['qcloud_domain']
]);
} catch (\Exception $e) {
$this->_error('设置失败:'.$e->getMessage());
}
$this->_success('设置成功');
}
$this->_error('您设置的存储引擎不存在!');
}
$engine = $this->request->get('engine');
$storage = [
'qiniu' => ConfigServer::get('storage_engine', 'qiniu', [
'bucket' => '',
'access_key' => '',
'secret_key' => '',
'domain' => 'http://'
]),
'aliyun' => ConfigServer::get('storage_engine', 'aliyun', [
'bucket' => '',
'access_key_id' => '',
'access_key_secret' => '',
'domain' => 'http://'
]),
'qcloud' => ConfigServer::get('storage_engine', 'qcloud', [
'bucket' => '',
'region' => '',
'secret_id' => '',
'secret_key' => '',
'domain' => 'http://'
])
];
$this->assign('engine', $engine);
$this->assign('storage', $storage);
return $this->fetch();
}
/**
* Notes: 切换存储引擎
* @author 张无忌(2021/2/22 11:43)
*/
public function changeEngine()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
try {
ConfigServer::set('storage', 'default', $post['engine']);
} catch (\Exception $e) {
$this->_error('切换失败: ' . $e->getMessage());
}
$this->_success('切换成功');
}
}
}

View file

@ -0,0 +1,83 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\SupplierLogic;
class Supplier extends AdminBase{
/**
*列表
*/
public function lists(){
if ($this->request->isAjax()) {
$get = $this->request->get(); //获取get请求
$this->_success('', SupplierLogic::lists($get)); //逻辑层处理渲染数据
}
return $this->fetch(); //渲染
}
/**
*添加
*/
public function add(){
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\Supplier'); //验证信息
if($result=== true){
SupplierLogic::add($post); //逻辑层处理添加数据
$this->_success('添加成功');
}
$this->_error($result);
}
return $this->fetch(); //渲染
}
/**
*编辑
*/
public function edit($id = ''){
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\Supplier'); //验证信息
if($result=== true){
SupplierLogic::edit($post); //逻辑层处理添加数据
$this->_success('修改成功');
}
$this->_error($result);
}
$this->assign('info', SupplierLogic::info($id)); //逻辑层处理数据,返回已有信息
return $this->fetch(); //渲染
}
/**
*删除
*/
public function del($id)
{
if ($this->request->isAjax()) {
$result = SupplierLogic::del($id); //逻辑层处理删除信息
if ($result) {
$this->_success('删除成功');
}
$this->_error('删除失败');
}
}
}

View file

@ -0,0 +1,151 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\TeamActivityLogic;
use app\common\model\Team;
use think\helper\Time;
/**
* 拼团商品管理 - 控制器
* Class TeamActivity
* @package app\admin\controller
*/
class TeamActivity extends AdminBase
{
/**
* Notes: 列表
* @author 张无忌(2021/1/12 15:51)
* @return mixed
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = TeamActivityLogic::lists($get);
$this->_success('获取成功', $lists);
}
return $this->fetch('team_activity/lists');
}
/**
* Notes: 添加
* @author 张无忌(2021/1/12 15:52)
* @return mixed
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$check = $this->validate($post, 'app\admin\validate\TeamActivity.add');
if ($check !== true) {
$this->_error($check);
}
if (TeamActivityLogic::add($post)) {
$this->_success('新增成功');
} else {
$error = TeamActivityLogic::getError() ?? '新增失败';
$this->_error($error);
}
}
return $this->fetch('team_activity/add');
}
/**
* Notes: 编辑
* @author 张无忌(2021/1/12 15:52)
* @return mixed
*/
public function edit()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$check = $this->validate($post, 'app\admin\validate\TeamActivity');
if ($check !== true) {
$this->_error($check);
}
if (TeamActivityLogic::edit($post)) {
$this->_success('更新成功');
} else {
$error = TeamActivityLogic::getError() ?? '更新失败';
$this->_error($error);
}
}
$id = $this->request->get('id');
$this->assign('detail', TeamActivityLogic::getDetail($id));
return $this->fetch('team_activity/edit');
}
/**
* Notes: 删除
* @author 张无忌(2021/1/12 15:52)
* @return mixed
*/
public function del()
{
if ($this->request->isAjax()) {
$id = $this->request->post('id');
if (TeamActivityLogic::softDelete($id)) {
$this->_success('删除成功');
} else {
$error = TeamActivityLogic::getError() ?? '删除失败';
$this->_error($error);
}
}
}
/**
* Notes: 切换状态
* @author 张无忌(2021/1/13 18:01)
*/
public function switchStatus()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
if (TeamActivityLogic::switchStatus($post)) {
$this->_success('更新成功');
} else {
$error = TeamActivityLogic::getError() ?? '更新失败';
$this->_error($error);
}
}
}
/**
* Notes: 参团订单
* @author 张无忌(2021/1/13 18:21)
*/
public function teamOrder()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = TeamActivityLogic::teamOrder($get);
$this->_success('获取成功', $lists);
}
$team_id = $this->request->get('id', 0, 'intval');
$this->assign('team_id', $team_id);
$this->assign('team_status', Team::getStatusDesc(true));
return $this->fetch('team_activity/team_order');
}
}

View file

@ -0,0 +1,88 @@
<?php
namespace app\admin\controller;
use app\admin\logic\TeamFoundLogic;
use app\common\model\Team;
use think\helper\Time;
class TeamFound extends AdminBase
{
/**
* Notes: 列表
* @author 张无忌(2021/1/15 17:24)
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = TeamFoundLogic::lists($get);
$this->_success('获取成功', $lists);
}
$days_ago7 = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::dayToNow(7));
$days_ago30 = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::dayToNow(30, true));
$this->assign('days_ago7', $days_ago7);
$this->assign('days_ago30', $days_ago30);
$this->assign('team_status', Team::getStatusDesc(true));
return $this->fetch('team_found/lists');
}
/**
* Notes: 拼团详细
* @author 张无忌(2021/1/15 17:24)
*/
public function detail()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = TeamFoundLogic::teamOrderListById($get);
$this->_success('获取成功', $lists);
}
$found_id = $this->request->get('found_id', 0, 'intval');
$this->assign('found_id', $found_id);
$this->assign('detail', TeamFoundLogic::getDetail($found_id));
return $this->fetch('team_found/detail');
}
/**
* Notes: 退款列表
* @author 张无忌(2021/1/19 9:55)
* @return mixed
*/
public function refundDetail()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = TeamFoundLogic::getRefundDetail($get);
$this->_success('获取成功', $lists);
}
$found_id = $this->request->get('found_id', 0, 'intval');
$this->assign('found_id', $found_id);
return $this->fetch('team_found/refund');
}
/**
* Notes: 实现-原路退款
* @author 张无忌(2021/1/18 17:43)
*/
public function handlerRefund()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
if (TeamFoundLogic::handleRefund($post, $this->admin_id)) {
$this->_success('退款成功');
}
$error = TeamFoundLogic::getError() ?: '退款失败';
$this->_error($error);
}
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace app\admin\controller;
use app\common\server\ConfigServer;
/**
* 拼团设置
* Class TeamSet
* @package app\admin\controller
*/
class TeamSet extends AdminBase
{
public function index()
{
$automatic = ConfigServer::get('team', 'automatic', 0);
$this->assign('automatic', $automatic);
return $this->fetch('team_set/index');
}
public function set()
{
if ($this->request->isAjax()) {
$automatic = $this->request->post('automatic', 0, 'intval');
ConfigServer::set('team', 'automatic', $automatic);
$this->_success('设置成功');
}
}
}

View file

@ -0,0 +1,158 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\UserLogic;
use app\common\server\ConfigServer;
class User extends AdminBase
{
/**
* 会员列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function lists(){
if ($this->request->isAjax()) {
$get = $this->request->get();
$this->_success('', UserLogic::lists($get));
}
$this->assign('level_list',UserLogic::getLevelList());
$this->assign('group_list',UserLogic::getGroupList());
return $this->fetch();
}
/*
* 设置分组
*/
public function setGroup(){
if($this->request->isAjax()){
$post = $this->request->post();
UserLogic::setGroup($post);
$this->_success('设置成功','');
}
$this->assign('group_list',UserLogic::getGroupList());
return $this->fetch();
}
/**
* 账户调整
* @param $id
* @return mixed
*/
public function adjustAccount($id){
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\AdjustAccount');
if($result === true){
$result = UserLogic::adjustAccount($post); //逻辑层处理信息
if($result){
$this->_success('操作成功',$result);
}
$result = '操作失败';
}
$this->_error($result);
}
$this->assign('info',UserLogic::getUser($id));
return $this->fetch();
}
/*
* 等级调整
*/
public function adjustLevel($id){
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\AdjustUserLevel');
if($result === true){
$result = UserLogic::adjustLevel($post); //逻辑层处理信息
if($result){
$this->_success('操作成功',$result);
}
$result = '操作失败';
}
$this->_error($result);
}
$this->assign('info',UserLogic::getUser($id));
$this->assign('user_level',UserLogic::getLevelList());
return $this->fetch();
}
/*
* 会员编辑
*/
public function edit($id){
if($this->request->isAjax()){
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\User');
if($result === true){
UserLogic::edit($post);
$this->_success('保存成功');
}
return $this->_error($result);
}
$detail = UserLogic::getUser($id,true);
$this->assign('info',$detail);
return $this->fetch();
}
/*
* 会员详情
*/
public function info($id){
$detail = UserLogic::getUser($id,false,true);
$this->assign('detail',$detail);
return $this->fetch();
}
public function getList(){
$post = $this->request->get('');
$list = UserLogic::getList($post);
$this->_success('',$list);
}
public function sendCouponList(){
if($this->request->isAjax()){
$list = UserLogic::sendCouponList();
$this->_success('',$list);
}
return $this->fetch();
}
/**
* 转账记录
*/
public function transferRecord()
{
if($this->request->isAjax()) {
$get = $this->request->get();
$get['page'] = $get['page'] ?? $this->page_no;
$get['limit'] = $get['limit'] ?? $this->page_size;
$data = UserLogic::transferRecord($get);
$this->_success('', $data);
}
return $this->fetch();
}
}

View file

@ -0,0 +1,103 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\UserGroupLogic;
class UserGroup extends AdminBase
{
/**
* 用户分组列表
* @return mixed
*/
public function lists(){
if ($this->request->isAjax()) {
$get = $this->request->get(); //获取get请求
$this->_success('', UserGroupLogic::lists($get)); //逻辑层处理渲染数据
}
return $this->fetch(); //渲染
}
/**
* 添加
* @return mixed
*/
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\UserGroup.add');
if ($result === true) {
UserGroupLogic::addUserGroup($post);
$this->_success('添加成功');
}
$this->_error($result);
}
return $this->fetch();
}
/**
* 编辑
* @param string $id
* @return mixed
*/
public function edit($id)
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post, 'app\admin\validate\UserGroup.edit');
if ($result === true) {
UserGroupLogic::editUserGroup($post);
$this->_success('修改成功');
}
$this->_error($result);
}
$this->assign('info', UserGroupLogic::info($id));
return $this->fetch();
}
/**
* 删除
* @param $id
*/
public function del($id)
{
if ($this->request->isAjax()) {
$result = $this->validate(['id'=>$id], 'app\admin\validate\UserGroup.del');
if($result === true) {
UserGroupLogic::delUserGroup($id);
$this->_success('删除成功');
}
$this->_error($result);
}
}
}

View file

@ -0,0 +1,100 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\UserLevelLogic;
use app\admin\logic\UserLogic;
class UserLevel extends AdminBase{
/**
* note 会员列表
* create_time 2020/12/15 11:45
*/
public function lists(){
$get = $this->request->get();
if($this->request->isAjax()){
$lists = UserLevelLogic::lists($get);
$this->_success('',$lists);
}
return $this->fetch();
}
/**
* note 添加会员
* create_time 2020/12/15 11:45
*/
public function add(){
if($this->request->isAjax()){
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post,'app\admin\validate\UserLevel.add');
if($result === true){
$result = UserLevelLogic::add($post);
if($result){
$this->_success('添加成功','');
}
$result = '添加失败';
}
$this->_error($result);
}
$this->assign('privilege_list',UserLevelLogic::getPrivilegeList());
return $this->fetch();
}
/**
* note 会员编辑
* create_time 2020/12/15 11:45
*/
public function edit($id){
if($this->request->isAjax()){
$post = $this->request->post();
$post['del'] = 0;
$result = $this->validate($post,'app\admin\validate\UserLevel');
if($result === true){
$result = UserLevelLogic::edit($post);
if($result){
$this->_success('添加成功','');
}
$result = '添加失败';
}
$this->_error($result);
}
$detail = UserLevelLogic::getUserLevel($id);
$this->assign('privilege_list',UserLevelLogic::getPrivilegeList());
$this->assign('detail',$detail);
return $this->fetch();
}
/**
* note 会员删除
* create_time 2020/12/15 11:44
*/
public function del($id){
if($this->request->isAjax()){
$result = $this->validate(['id'=>$id],'app\admin\validate\UserLevel.del');
if($result === true){
UserLevelLogic::del($id);
$this->_success('删除成功','');
}
$this->_error('删除失败','');
}
}
}

View file

@ -0,0 +1,88 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\UserPrivilegeLogic;
class UserPrivilege extends AdminBase{
/**
* note 权益列表
* create_time 2020/12/2 11:04
*/
public function lists(){
if($this->request->isAjax()){
$get = $this->request->get();
$list = UserPrivilegeLogic::lists($get);
$this->_success('',$list);
}
return $this->fetch();
}
/**
* note 添加权益
* create_time 2020/12/2 11:04
*/
public function add(){
if($this->request->isAjax()){
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\UserPrivilege.add');
if($result === true){
UserPrivilegeLogic::add($post);
$this->_success('添加成功',[]);
}
$this->_error($result,[]);
}
return $this->fetch();
}
/**
* note 编辑权益
* create_time 2020/12/2 11:40
*/
public function edit($id){
if($this->request->isAjax()){
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\UserPrivilege.edit');
if($result === true){
UserPrivilegeLogic::edit($post);
$this->_success('添加成功',[]);
}
$this->_error($result,[]);
}
$this->assign('detail',UserPrivilegeLogic::getPrivilege($id));
return $this->fetch();
}
/**
* note 删除权益
* create_time 2020/12/2 11:40
*/
public function del($id){
if($this->request->isAjax()){
$result = $this->validate(['id'=>$id],'app\admin\validate\UserPrivilege.del');
if($result === true){
UserPrivilegeLogic::del($id);
$this->_success('删除成功','');
}
$this->_error($result,'');
}
}
}

View file

@ -0,0 +1,96 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\CommonLogic;
use app\admin\logic\WechatReplyLogic;
use app\common\model\WeChat;
class WechatReply extends AdminBase{
public function lists(){
if($this->request->isAjax()){
$get = $this->request->get();
$list = WechatReplyLogic::lists($get);
$this->_success('',$list);
}
$type_list= Wechat::getCustomReply();
$this->assign('type_list',$type_list);
return $this->fetch();
}
public function add(){
if($this->request->isAjax()){
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\WeChatReply.'.$post['reply_type']);
if ($result === true){
WechatReplyLogic::add($post);
$this->_success('添加超过',[]);
}
$this->_error($result);
}
$type = $this->request->get('type');
$template = 'add_'.$type;
return $this->fetch($template);
}
public function edit($id){
if($this->request->isAjax()){
$post = $this->request->post();
$result = $this->validate($post,'app\admin\validate\WeChatReply.'.$post['reply_type']);
if ($result === true){
WechatReplyLogic::edit($post);
$this->_success('添加超过',[]);
}
$this->_error($result);
}
$detail = WechatReplyLogic::getReply($id);
$this->assign('detail',$detail);
$template = 'edit_'.$detail['reply_type'];
return $this->fetch($template);
}
public function del($id){
$result = $this->validate(['id'=>$id],'app\admin\validate\WeChatReply.del');
if ($result === true) {
WechatReplyLogic::del($id);
$this->_success('删除成功');
}
$this->_error($result);
}
/*
* 修改字段
*/
public function changeFields(){
$pk_value = $this->request->post('id');
$field = $this->request->post('field');
$field_value = $this->request->post('value');
$reply_type = $this->request->post('reply_type');
$result = WechatReplyLogic::changeFields($pk_value, $field, $field_value,$reply_type);
if ($result) {
$this->_success('修改成功');
}
$this->_error('修改失败');
}
}

View file

@ -0,0 +1,179 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\WithdrawLogic;
use app\common\model\Withdraw as WithdrawModel;
use think\helper\Time;
use app\admin\logic\WechatCorporatePaymentLogic;
class Withdraw extends AdminBase
{
/**
* 提现列表
* @return mixed
*/
public function lists()
{
if($this->request->isAjax()) {
$get = $this->request->get();
return $this->_success('获取列表成功', WithdrawLogic::lists($get));
}
$this->assign('type', WithdrawModel::getTypeDesc(true));
$this->assign('status', WithdrawModel::getStatusDesc(true));
$today = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::today());
$this->assign('today', $today);
$yesterday = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::yesterday());
$this->assign('yesterday', $yesterday);
$days_ago7 = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::dayToNow(7));
$this->assign('days_ago7', $days_ago7);
$days_ago30 = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::dayToNow(30, true));
$this->assign('days_ago30', $days_ago30);
return $this->fetch();
}
/**
* Desc: 审核通过
*/
public function confirm()
{
if ($this->request->isAjax()){
$post = $this->request->post();
$result = WithdrawLogic::confirm($post);
if($result['code']) {
return $this->_success($result['msg']);
}else{
return $this->_error($result['msg']);
}
}
}
/**
* Desc: 审核拒绝
*/
public function refuse()
{
if ($this->request->isAjax()){
$post = $this->request->post();
WithdrawLogic::refuse($post);
$this->_success('已拒绝提现');
}
}
/**
* 提现详情
*/
public function detail()
{
$id = $this->request->get('id', '', 'intval');
$detail = WithdrawLogic::detail($id);
$this->assign('detail', $detail);
return $this->fetch();
}
/**
* 显示提现审核界面
*/
public function review()
{
$id = $this->request->get('id', '', 'intval');
$this->assign('id', $id);
return $this->fetch();
}
/**
* 显示提现转账界面
*/
public function transfer()
{
$id = $this->request->get('id', '', 'intval');
$this->assign('id', $id);
return $this->fetch();
}
/**
* 转账失败
*/
public function transferFail()
{
$post = $this->request->post();
$result = WithdrawLogic::transferFail($post);
if($result['code']) {
return $this->_success($result['msg']);
}else{
return $this->_error($result['msg']);
}
}
/**
* 转账成功
*/
public function transferSuccess()
{
$post = $this->request->post();
$result = WithdrawLogic::transferSuccess($post);
if($result['code']) {
return $this->_success($result['msg']);
}else{
return $this->_error($result['msg']);
}
}
/**
* 提现结果查询
*/
public function search()
{
$id = $this->request->post('id', '', 'intval');
$result = WithdrawLogic::search($id);
if($result['code']) {
return $this->_success($result['msg']);
}else{
return $this->_error($result['msg']);
}
}
/**
* 提现失败
*/
public function withdrawFailed() {
$id = $this->request->post('id', '', 'intval');
$result = WithdrawLogic::withdrawFailed($id);
$this->_success('提现失败已回退佣金');
}
}

View file

@ -0,0 +1,58 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\http\middleware;
use app\admin\cache\RoleNoneAuthCacheUris;
class Auth
{
/**
* 权限控制
* @param $request
* @param \Closure $next
* @return mixed|\think\response\Redirect
*/
public function handle($request, \Closure $next)
{
//未登录的无需权限控制
if (empty(session('admin_info'))) {
return $next($request);
}
//如果id为1视为系统超级管理无需权限控制
if (session('admin_info.id') == 1) {
return $next($request);
}
//权限控制判断
$controller_action = $request->controller() . '/' . $request->action();////当前访问
$controller_action = strtolower($controller_action);
$auth_cache = new RoleNoneAuthCacheUris(session('admin_info.role_id'), ['role_id' => session('admin_info.role_id')]);
$none_auth = $auth_cache->set(3600);
if (empty($none_auth) || !in_array($controller_action, $none_auth)) {
//通过权限控制
return $next($request);
}
return redirect('dispatch/dispatch_error',['msg' => '权限不足,无法访问']);
}
}

View file

@ -0,0 +1,81 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\http\middleware;
use app\admin\logic\LoginLogic;
use app\admin\server\LoginServer;
class Login
{
/**
* 登录验证
* @param $request
* @param \Closure $next
* @return mixed|\think\response\Redirect
*/
public function handle($request, \Closure $next)
{
//系统拦截强制下线
if (session('admin_info') && (LoginServer::isLogin(session('admin_info.id'))) == false) {
LoginLogic::logout(session('admin_info.id'));
}
//已登录的访问登录页
if (session('admin_info') && !$this->isNotNeedLogin($request)) {
return $next($request);
}
//已登录的访问非登录页
if (session('admin_info') && $this->isNotNeedLogin($request)) {
return redirect('index/index');
}
//未登录的访问非登录页
if (!session('admin_info') && $this->isNotNeedLogin($request)) {
return $next($request);
}
//未登录访问登录页
return redirect('account/login');
}
/**
* 是否免登录验证
* @param $request
* @return bool
*/
private function isNotNeedLogin($request)
{
$data = app()->controller($request->controller())->like_not_need_login;
if (empty($data)) {
return false;
}
$action = strtolower($request->action());
$data = array_map('strtolower', $data);
if (!in_array($action, $data)) {
return false;
}
return true;
}
}

View file

@ -0,0 +1,172 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\logic;
use app\common\model\AccountLog;
use think\Db;
use think\helper\Time;
class AccountLogLogic{
public static function lists($get){
$source_type = '';
$where = [];
switch ($get['type']){//记录类型
case 1://余额变动
$source_type = AccountLog::money_change;
break;
case 2://积分变动
$source_type = AccountLog::integral_change;
break;
case 3://成长值变动
$source_type = AccountLog::growth_change;
}
if(isset($get['order_source']) && $get['order_source']){
$source_type = $get['order_source'];
}
$where[] = ['source_type','in',$source_type];
if(isset($get['change_type']) && $get['change_type']){
$where[] = ['source_type','=',$get['change_type']];
}
if(isset($get['keyword']) && $get['keyword']){
$where[] = [$get['keyword_type'],'like','%'.$get['keyword'].'%'];
}
if (isset($get['start_time']) && $get['start_time'] && isset($get['end_time']) && $get['end_time']) {
$where[] = ['a.create_time', 'between', [strtotime($get['start_time']), strtotime($get['end_time'])]];
}else{
$where[] = ['a.create_time', 'between', Time::today()];
}
if(isset($get['create_end']) && $get['create_end']!=''){
$where[] = ['ro.create_time','<=',strtotime($get['create_end'])];
}
$count = Db::name('account_log')->alias('a')
->join('user u','a.user_id = u.id')
->where($where)
->count();
$list = Db::name('account_log')->alias('a')
->join('user u','a.user_id = u.id')
->where($where)
->page($get['page'],$get['limit'])
->order('a.id desc')
->field('a.*,nickname,sn,mobile')
->select();
foreach ($list as &$item){
$item['source_type_desc'] = AccountLog::getAcccountDesc($item['source_type']);
$item['create_time'] = date('Y-m-d H:i:s',$item['create_time']);
}
return ['count'=>$count,'lists'=>$list];
}
/**
* note 每个资金记录页面的的变动类型
* create_time 2020/11/23 9:55
*/
public static function orderSourceList($type){
$list = [];
switch ($type){
case 1:
$list = [
[
'source' => AccountLog::balance_pay_order,
'name' => '订单支付',
],
[
'source' => AccountLog::admin_add_money.','.AccountLog::recharge_money,
'name' => '钱包充值',
],
[
'source' => AccountLog::withdraw_to_balance,
'name' => '佣金提现',
],
];
break;
case 2:
$list = [
[
'source' => AccountLog::register_add_integral,
'name' => '关注赠送积分',
],
[
'source' => AccountLog::invite_add_integral,
'name' => '邀请赠送积分',
],
[
'source' => AccountLog::sign_in_integral,
'name' => '签到赠送积分',
],
[
'source' => AccountLog::recharge_give_integral,
'name' => '充值赠送积分',
],
[
'source' => AccountLog::order_add_integral,
'name' => '消费赠送积分',
],
[
'source' => AccountLog::order_deduction_integral,
'name' => '订单抵扣积分',
],
];
break;
case 3:
$list = [
[
'source' => AccountLog::sign_give_growth,
'name' => '签到赠送成长值',
],
[
'source' => AccountLog::recharge_give_growth,
'name' => '充值赠送成长值',
],
];
break;
}
return $list;
}
public static function getTime(){
$today = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::today());
$yesterday = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::yesterday());
$days_ago7 = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::dayToNow(7));
$days_ago30 = array_map(function ($time) {
return date('Y-m-d H:i:s', $time);
}, Time::dayToNow(30, true));
$time = [
'today' => $today,
'yesterday' => $yesterday,
'days_ago7' => $days_ago7,
'days_ago30' => $days_ago30,
];
return $time;
}
}

View file

@ -0,0 +1,223 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\logic;
use app\common\server\UrlServer;
use think\Db;
class ActivityAreaLogic{
/**
* note 活动专区列表
* create_time 2020/11/24 11:23
*/
public static function areaLists(){
$count = Db::name('activity_area')
->where(['del'=>0])
->count();
$lists = Db::name('activity_area')
->where(['del'=>0])
->select();
foreach ($lists as &$item){
$item['status_desc'] = '下架';
$item['status'] && $item['status_desc'] = '上架';
$item['image'] = UrlServer::getFileUrl($item['image']);
}
return ['count'=>$count,'lists'=>$lists];
}
/**
* note 活动专区商品
* create_time 2020/11/24 11:24
*/
public static function goodsLists($get){
$where[] = ['AG.del','=',0];
$where[] = ['AA.del','=',0];
if(isset($get['name']) && $get['name']){
$where[] = ['G.name','like','%'.$get['name'].'%'];
}
if(isset($get['activity_id']) && $get['activity_id']){
$where[] = ['AA.id','=',$get['activity_id']];
}
$count = Db::name('activity_goods')->alias('AG')
->join('activity_area AA','AG.activity_id = AA.id')
->join('goods G','AG.Goods_id = G.id')
->where($where)
->group('AG.goods_id')
->count();
$lists = Db::name('activity_goods')->alias('AG')
->join('activity_area AA','AG.activity_id = AA.id')
->join('goods G','AG.Goods_id = G.id')
->where($where)
->field('AG.id,AG.goods_id,AG.activity_id,AA.name,AA.status,G.id,G.name,G.image')
->group('AG.goods_id')
->order('AG.id desc')
->select();
$activity_lisst = Db::name('activity_area')
->where(['del'=>0])
->column('name,status','id');
foreach ($lists as &$item){
$item['activity_name'] = '';
$item['status_desc'] = '下架';
if(isset($activity_lisst[$item['activity_id']])){
$item['activity_name'] = $activity_lisst[$item['activity_id']]['name'];
$activity_lisst[$item['activity_id']]['status'] && $item['status_desc'] = '上架';
}
}
return ['count'=>$count,'lists'=>$lists];
}
/**
* note 获取全部的活动专区
* create_time 2020/11/24 12:01
*/
public static function getActivityList(){
return Db::name('activity_area')
->where(['del'=>0])
->column('name','id');
}
/**
* note 添加活动专区
* create_time 2020/11/24 12:01
*/
public static function addActivity($post){
$data = [
'name' => $post['name'],
'title' => $post['title'],
'image' => $post['image'],
'status' => $post['status'],
'del' => 0,
'create_time' => time(),
];
return Db::name('activity_area')->insert($data);
}
/**
* note 编辑活动专区
* create_time 2020/11/24 12:02
*/
public static function editActivity($post){
$data = [
'name' => $post['name'],
'title' => $post['title'],
'image' => $post['image'],
'status' => $post['status'],
'update_time' => time(),
];
return Db::name('activity_area')->where(['id'=>$post['id']])->update($data);
}
/**
* note 删除活动专区
* create_time 2020/11/24 12:02
*/
public static function delActivity($id){
Db::name('activity_area')->where(['id'=>$id])->update(['update_time'=>time(),'del'=>1]);
Db::name('activity_goods')->where(['activity_id'=>$id])->update(['update_time'=>time(),'del'=>1]);
return true;
}
/**
* note 获取活动商品详情
* create_time 2020/11/25 10:40
*/
public static function getActivity($id){
$activity = Db::name('activity_area')->where(['id'=>$id])->find();
$activity['image'] = UrlServer::getFileUrl($activity['image']);
return $activity;
}
/**
* note 添加活动商品
* create_time 2020/11/25 10:40
*/
public static function addGoods($post){
$new = time();
$add_data = [];
foreach ($post['goods_list'] as $goods){
$add_data[] = [
'activity_id' => $post['activity_id'],
'goods_id' => $goods['goods_id'],
'item_id' => $goods['item_id'],
'del' => 0,
'create_time' => $new,
];
}
return Db::name('activity_goods')->insertAll($add_data);
}
/**
* note 编辑活动商品
* create_time 2020/11/25 10:40
*/
public static function editGoods($post){
$new = time();
$update_data = [
'activity_id' => $post['activity_id'],
'update_time' => $new,
];
return Db::name('activity_goods')
->where(['id'=>$post['id'],'activity_id'=>$post['activity_id']])
->update($update_data);
}
/**
* note 删除活动商品
* create_time 2020/11/25 10:40
*/
public static function delGoods($goods_id,$activity_id){
$update_data = [
'update_time' => time(),
'del' => 1,
];
return Db::name('activity_goods')->where(['del'=>0,'goods_id'=>$goods_id,'activity_id'=>$activity_id])->update($update_data);
}
/**
* note 获取活动商品详情
* create_time 2020/11/25 10:41
*/
public static function getActivityGoods($goods_id,$activity_id){
$activity_list = Db::name('activity_goods')->alias('AG')
->join('goods_item GI','AG.item_id = GI.id')
->where(['activity_id'=>$activity_id,'AG.goods_id'=>$goods_id])
->field('AG.*,GI.price,GI.spec_value_str,GI.image,GI.price')
->select();
$goods_id = $activity_list[0]['goods_id'];
$goods = Db::name('goods')->where(['del'=>0,'id'=>$goods_id])->field('image,name')->find();
foreach ($activity_list as &$item){
$item['name'] = $goods['name'];
if(empty($item['image'])){
$item['image'] = $goods['image'];
}
}
return $activity_list;
}
}

View file

@ -0,0 +1,296 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\logic;
use app\common\model\Ad;
use app\admin\model\AdPosition;
use app\common\server\UrlServer;
use think\Db;
use think\Exception;
class AdLogic
{
/**
* 广告管理列表
* @param $get
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function lists($get)
{
$ad = new Ad();
$where = [];
$where[] = ['del', '=', 0];
if ($get['client'] != '') {
$where[] = ['client', '=', $get['client']];
}
if (isset($get['keyword']) && $get['keyword']) {
$where[] = ['name', 'like', '%' . $get['keyword'] . '%'];
}
if (isset($get['pid']) && $get['pid'] != '') {
$where[] = ['pid', '=', $get['pid']];
}
$ad_count = $ad
->where($where)
->count();
$ad_list = $ad->where($where)
->page($get['page'], $get['limit'])
->order('id desc')
->select();
$position = AdPosition::where('del', 0)->column('id,name', 'id');
foreach ($ad_list as $item) {
$item['image'] = UrlServer::getFileUrl($item['image']);
$url = '';
$item['client_name'] = Ad::getAdTypeDesc($item['client']);
if (isset($position[$item['pid']])) {
$item['position_name'] = $position[$item['pid']];
}
switch ($item['link_type']) {
case 1:
$page = Ad::getLinkPage($item['client'], $item['link']);
$url = '商城页面:' . $page['name'];
break;
case 2:
$goods = Db::name('goods g')
->where(['g.id' => $item['link']])
->field('g.name,min_price,max_price')
->find();
if ($goods) {
$price = '¥' . $goods['max_price'];
if ($goods['max_price'] !== $goods['min_price']) {
$price = '¥' . $goods['min_price'] . '~' . $goods['max_price'];
}
$url = '商品页面:' . $goods['name'] . '价格:' . $price;
}
break;
case 3:
$url = '自定义链接:' . $item['link'];
}
$item['link'] = $url;
}
return ['count' => $ad_count, 'list' => $ad_list];
}
/**
* 添加
* @param $post
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function add($post)
{
$ad = new Ad();
$post['type'] = isset($post['type']) ? $post['type'] : 1;
$post['status'] = isset($post['status']) ? $post['status'] : 0;
$post['link_type'] = isset($post['link_type']) ? $post['link_type'] : '';
$link = '';
switch ($post['link_type']) {
case '1':
$link = $post['page'];
break;
case '2':
$link = $post['goods_id'];
break;
case '3':
$link = $post['url'];
break;
}
$time = time();
$data = [
'name' => $post['name'],
'client' => $post['client'],
'pid' => $post['pid'],
'image' => $post['image'],
'link_type' => $post['link_type'],
'link' => $link,
'status' => $post['status'],
'category_id' => $post['category_id'] ?? 0,
'create_time' => $time,
];
return $ad->allowField(true)->save($data);
}
/**
* 编辑
* @param $post
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function edit($post)
{
$ad = new Ad();
$post['type'] = isset($post['type']) ? $post['type'] : 1;
$post['status'] = isset($post['status']) ? $post['status'] : 0;
$post['link_type'] = isset($post['link_type']) ? $post['link_type'] : '';
$time = time();
$link = '';
switch ($post['link_type']) {
case '1':
$link = $post['page'];
break;
case '2':
$link = $post['goods_id'];
break;
case '3':
$link = $post['url'];
break;
}
$data = [
'name' => $post['name'],
'client' => $post['client'],
'pid' => $post['pid'],
'image' => $post['image'],
'link_type' => $post['link_type'],
'link' => $link,
'category_id' => $post['category_id'] ?? 0,
'status' => $post['status'],
'update_time' => $time,
];
return $ad->allowField(true)->save($data, ['id' => $post['id']]);
}
/**
* 删除
* @param $delData
* @return int|string
* @throws Exception
* @throws \think\exception\PDOException
*/
public static function del($id, $client)
{
$data = [
'del' => 1,
'update_time' => time(),
];
return Db::name('ad')->where(['client' => $client, 'del' => 0, 'id' => $id])->update($data);
}
/**
* 广告表信息
* @param $id
* @return mixed
*/
public static function info($id)
{
$ad = new Ad();
$info = $ad::get(['id' => $id]);
$info['goods'] = '';
if ($info['link_type'] == 2) {
$goods = Db::name('goods g')
->where(['g.id' => $info['link']])
->field('g.id, g.name, g.image, min_price, max_price')
->find();
$price = '¥' . $goods['max_price'];
if ($goods['max_price'] !== $goods['min_price']) {
$price = '¥' . $goods['min_price'] . '~' . $goods['max_price'];
}
$goods['price'] = $price;
$info['goods'] = $goods;
}
$info['abs_image'] = UrlServer::getFileUrl($info['image']);
return $info;
}
/**
* 获取广告位置列表
* @return array
*/
public static function infoPosition($client)
{
$position_list = Db::name('ad_position')
->where(['client' => $client, 'status' => 1, 'del' => 0])
->group('name')
->column('id,name', 'id');
asort($position_list);
return $position_list;
}
/**
* 更改状态
* @param $get
* @return int|string
* @throws Exception
* @throws \think\exception\PDOException
*/
public static function switchStatus($get)
{
$data = [
'status' => $get['status'],
'update_time' => time(),
];
return Db::name('ad')->where(['client' => $get['client'], 'del' => 0, 'id' => $get['id']])->update($data);
}
/**
* 获取相应广告位置尺寸
* @param $get
* @return array|\PDOStatement|string|\think\Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function imgSize($get)
{
$img_size = Db::name('ad_position')
->where(['id' => $get['id'], 'del' => 0])
->field('width,height')
->find();
return $img_size;
}
/**
* Notes:筛选首页推荐分类
* @return array|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @author: 2021/3/6 12:01
*/
public static function getGoodsCategory(){
return Db::name('goods_category')->where(['level'=>1,'is_recommend'=>1])->field('id,name')->select();
}
}

View file

@ -0,0 +1,215 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\logic;
use app\admin\model\AdPosition;
use app\common\model\Ad;
use think\Db;
use think\Exception;
class AdPositionLogic
{
/**
* 广告管理列表
* @param $get
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function lists($get)
{
$ad_position = new AdPosition();
$where = [];
$where[] = ['del', '=', 0];
if ($get['client'] != '') {
if ($get['client'] == 3) {
$where[] = ['client', ['=', 3], ['=', 4], 'or'];
} else {
$where[] = ['client', '=', $get['client']];
}
}
if (isset($get['keyword']) && $get['keyword']) {
$where[] = ['name', 'like', '%' . $get['keyword'] . '%'];
}
if (isset($get['attr']) && $get['attr'] != '') {
$where[] = ['attr', '=', $get['attr']];
}
$ad_position_count = $ad_position
->where($where)
->count();
$ad_position_list = $ad_position
->where($where)
->page($get['page'], $get['limit'])
->select();
foreach ($ad_position_list as $item) {
$item['client_name'] = Ad::getAdTypeDesc($item['client']);
}
return ['count' => $ad_position_count, 'list' => $ad_position_list];
}
/**
* 添加
* @param $post
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function addAdPosition($post)
{
$ad_position = new AdPosition();
$post['status'] = isset($post['status']) ? $post['status'] : 0;
$time = time();
$data = [
'name' => $post['name'],
'width' => $post['width'],
'height' => $post['height'],
'status' => $post['status'],
'client' => $post['client'],
'attr' => 0,
'create_time' => $time,
];
return $ad_position->allowField(true)->save($data);
}
/**
* 编辑
* @param $post
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function editAdPosition($post)
{
$ad_position = new AdPosition();
$post['status'] = isset($post['status']) ? $post['status'] : 0;
$time = time();
$data = [
'name' => $post['name'],
'width' => $post['width'],
'height' => $post['height'],
'status' => $post['status'],
'attr' => 0,
'update_time' => $time,
];
return $ad_position->allowField(true)->save($data, ['id' => $post['id']]);
}
/**
* 删除
* @param $delData
* @return int|string
* @throws Exception
* @throws \think\exception\PDOException
*/
public static function del($delData, $client, $attr)
{
if (is_array($attr)) {
foreach ($attr as $key => $val) {
if ($val == 1) {
unset($delData[$key]);
}
}
} elseif ($attr == 1) {
return false;
}
if (is_array($delData)) {
$pid = Db::name('ad')
->where(['client' => $client, 'pid' => $delData, 'del' => 0])
->select();
if (!empty($pid)) {
return false;
}
} else {
$pid = Db::name('ad')
->where(['client' => $client, 'pid' => $delData, 'del' => 0])
->find();
if (!empty($pid)) {
return false;
}
}
$data = [
'del' => 1,
'update_time' => time(),
];
$result = Db::name('ad_position')->where(['client' => $client, 'id' => $delData, 'del' => 0])->update($data);
return $result;
}
/**
* 广告表信息
* @param $id
* @return mixed
*/
public static function info($id)
{
$ad_position = new AdPosition();
$info = $ad_position::get(['id' => $id]);
return $info;
}
/**
* 更改状态
* @param $get
* @return int|string
* @throws Exception
* @throws \think\exception\PDOException
*/
public static function switchStatus($get)
{
$data = [
'status' => $get['status'],
'update_time' => time(),
];
return Db::name('ad_position')
->where(['client' => $get['client'], 'id' => $get['id'], 'del' => 0])
->update($data);
}
}

View file

@ -0,0 +1,169 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\logic;
use app\admin\server\LoginServer;
use think\Db;
class AdminLogic
{
/**
* 管理员列表
* @param $get
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function lists($get)
{
$role_id_name = Db::name('role')
->column('name', 'id');
$where[] = ['del', '=', 0];
if (isset($get['role_id']) && $get['role_id']) {
$where[] = ['role_id', '=', $get['role_id']];
}
if (isset($get['name']) && $get['name']) {
$where[] = ['name', 'like', "%{$get['name']}%"];
}
if (isset($get['account']) && $get['account']) {
$where[] = ['account', 'like', "%{$get['account']}%"];
}
$admin_count = Db::name('admin')
->where($where)
->count();
$admin_lists = Db::name('admin')
->where($where)
->field(['id', 'root', 'name', 'account', 'role_id', 'create_time', 'login_time', 'login_ip', 'disable'])
->select();
foreach ($admin_lists as $k => $v) {
if ($v['root'] == 1) {
$admin_lists[$k]['role'] = '超级管理员';
} else {
$admin_lists[$k]['role'] = $role_id_name[$v['role_id']];
}
$admin_lists[$k]['create_time_str'] = date('Y-m-d H:i:s', $v['create_time']);
$admin_lists[$k]['login_time'] = empty($v['login_time']) ? '' : date('Y-m-d H:i:s', $v['login_time']);
$admin_lists[$k]['login_state'] = LoginServer::isLogin($v['id']) ? 1 : 0;
}
return ['count' => $admin_count, 'lists' => $admin_lists];
}
/**
* 管理员信息
* @param $admin_id
* @return array|\PDOStatement|string|\think\Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function info($admin_id)
{
return Db::name('admin')->where(['id' => $admin_id])->find();
}
/**
* 角色信息
* @return array|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public static function roleLists()
{
return Db::name('role')
->where(['del' => 0])
->field(['id', 'name'])
->select();
}
/**
* 添加管理员
* @param $post
* @return mixed
*/
public static function addAdmin($post)
{
$time = time();
$salt = substr(md5($time . $post['name']), 0, 4);//随机4位密码盐
$password = create_password($post['password'], $salt);//生成密码
$data = [
'name' => $post['name'],
'root' => 0,
'account' => $post['account'],
'password' => $password,
'salt' => $salt,
'role_id' => $post['role_id'],
'create_time' => $time,
'disable' => $post['disable']
];
return Db::name('admin')->insert($data);
}
/**
* 编辑管理员
* @param $post
* @return mixed
*/
public static function editAdmin($post)
{
$time = time();
$data = [
'name' => $post['name'],
'account' => $post['account'],
'role_id' => $post['role_id'],
'update_time' => $time,
'disable' => $post['disable']
];
if ($post['password']) {
$salt = Db::name('admin')->where(['id' => $post['id']])->value('salt');
$data['password'] = create_password($post['password'], $salt);//生成密码
}
$role_id = Db::name('admin')->where(['id' => $post['id']])->value('role_id');
if ($post['disable'] == 1 || $role_id != $post['role_id']) {
//禁用管理员并强制下线
LoginServer::setState($post['id'], false);
}
return Db::name('admin')->where(['id' => $post['id']])->update($data);
}
/**
* 删除管理员
* @param $admin_id
* @return int|string
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public static function delAdmin($admin_id)
{
$time = time();
return Db::name('admin')
->where(['id' => $admin_id, 'del' => 0])
->update(['account' => $time . '_' . $admin_id, 'del' => 1]);
}
}

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