init
This commit is contained in:
commit
84853b1ca9
16
.example.env
Normal file
16
.example.env
Normal file
@ -0,0 +1,16 @@
|
||||
[app]
|
||||
app_debug = true;
|
||||
app_trace = false;
|
||||
|
||||
[database]
|
||||
hostname = like-mysql
|
||||
database = test_likeshop
|
||||
username = root
|
||||
password = root
|
||||
hostport = 3306
|
||||
|
||||
|
||||
|
||||
[project]
|
||||
env_name =
|
||||
file_domain = www.likeshopb2c.localhost
|
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/config/install.lock
|
||||
/public/uploads/*
|
||||
!/public/uploads/index.html
|
||||
/runtime/*
|
||||
!/runtime/index.html
|
||||
/.env
|
||||
/public/upgrade/*
|
||||
!/public/upgrade/version.json
|
42
.travis.yml
Normal file
42
.travis.yml
Normal 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
CHANGELOG.md
Normal file
927
CHANGELOG.md
Normal file
@ -0,0 +1,927 @@
|
||||
## V5.1.39 LTS(2019-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 LTS(2019-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 LTS(2019-5-26)
|
||||
|
||||
本次更新为常规更新,主要更新如下:
|
||||
|
||||
* 改进关联数据更新
|
||||
* 修正关联动态获取器
|
||||
* 改进`redis`驱动
|
||||
* 修复验证规则里面出现二维数组时的错误
|
||||
* 改进跨域请求支持
|
||||
* 完善模型`hidden`方法对关联属性的支持
|
||||
* 改进`where`查询方法传入`Query`对象的支持`bind`数据
|
||||
* 改进数据集对象的`load`方法
|
||||
* 修正缓存类`clear`方法对`tag`的支持
|
||||
|
||||
## V5.1.36 LTS(2019-4-28)
|
||||
|
||||
本次更新为常规更新,主要更新如下:
|
||||
|
||||
* 修正`chunk`方法一处异常抛出的错误
|
||||
* 修正模型输出的`visible`
|
||||
* 改进环境变量加载
|
||||
* 改进命令行日志的`level`配置支持
|
||||
* 修复设置有缓存前缀时,无法清空缓存标签的问题
|
||||
* HasMony对象`saveAll`方法兼容`Collection`格式参数格式
|
||||
* 修正`whereOr`查询使用字符串的问题
|
||||
* 改进`dateFormat`设置对写入数据的影响
|
||||
* 修正查询缓存
|
||||
* 记住指定的跳转地址
|
||||
* 改进软删除
|
||||
* 改进聚合查询SQL去除limit 1
|
||||
* 改进缓存驱动
|
||||
|
||||
## V5.1.35 LTS(2019-3-2)
|
||||
|
||||
本次主要为常规更新,修正了一些反馈的问题。
|
||||
|
||||
* 修正验证类自定义验证方法执行两次的问题
|
||||
* 模型增加`isEmpty`方法用于判断是否空模型
|
||||
* 改进获取器对`append`的支持
|
||||
* 修正一对多关联的`withCount`自关联问题
|
||||
* facade类注释调整
|
||||
* 改进关联属性的`visible`和`hidden`判断
|
||||
* 修正路由分组的`MISS`路由
|
||||
* 改进pgsql.sql
|
||||
|
||||
## V5.1.34 LTS(2019-1-30)
|
||||
|
||||
本次更新为常规更新,修正了一些反馈的问题。
|
||||
|
||||
* 改进Request类的`has`方法,支持`patch`
|
||||
* 改进`unique`验证的多条件支持
|
||||
* 修复自定义上传验证,检测文件大小
|
||||
* 改进`in`查询支持表达式
|
||||
* 改进路由的`getBind`方法
|
||||
* 改进验证类的错误信息获取
|
||||
* 改进`response`助手函数默认值
|
||||
* 修正mysql的`regexp`查询
|
||||
* 改进模型类型强制转换写入对`Expression`对象的支持
|
||||
|
||||
## V5.1.33 LTS(2019-1-16)
|
||||
|
||||
* 修复路由中存在多个相同替换的正则BUG
|
||||
* 修正whereLike查询
|
||||
* join方法支持参数绑定
|
||||
* 改进union方法
|
||||
* 修正多对多关联的attach方法
|
||||
* 改进验证类的正则规则自定义
|
||||
* 改进Request类method方法
|
||||
* 改进File日志类型的CLI日志写入
|
||||
* 改进文件日志time_format配置对JSON格式的支持
|
||||
|
||||
## V5.1.32 LTS(2018-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 LTS(2018-11-30)
|
||||
|
||||
该版本为常规更新,修正了一些社区反馈的问题。
|
||||
|
||||
主要更新如下:
|
||||
|
||||
* 改进查询类的`execute`方法
|
||||
* 判断路由规则定义添加对请求类型的判断
|
||||
* 修复`orderRaw`异常
|
||||
* 修正 `optimize:autoload`指令
|
||||
* 改进软删除的`destroy`方法造成重复执行事件的问题
|
||||
* 改进验证类对扩展验证规则 始终验证 不管是否`require`
|
||||
* 修复自定义验证`remove`所有规则的异常
|
||||
* 改进时间字段的自动写入支持微秒数据
|
||||
* 改进`Connection`类的`getrealsql`方法
|
||||
* 修正`https`地址的URL生成
|
||||
* 修复 `array_walk_recursive` 在低于PHP7.1消耗内部指针问题
|
||||
* 改进手动参数绑定使用
|
||||
* 改进聚合查询方法的`field`参数支持`Expression`
|
||||
|
||||
## V5.1.29 LTS(2018-11-11)
|
||||
|
||||
该版本主要改进了参数绑定的解析问题和提升性能,并修正了一些反馈的问题。
|
||||
|
||||
* 改进手动参数绑定
|
||||
* 修正MISS路由的分组参数无效问题
|
||||
* 行为支持对象的方法
|
||||
* 修正全局查询范围
|
||||
* 改进`belongsto`关联的`has`方法
|
||||
* 改进`hasMany`关联
|
||||
* 改进模型观察者多次注册的问题
|
||||
* 改进`query`类的默认查询参数处理
|
||||
* 修正`parseBetween`解析方法
|
||||
* 改进路由地址生成的本地域名支持
|
||||
* 改进参数绑定的实际URL解析性能
|
||||
* 改进`Env`类的`getEnv`和`get`方法
|
||||
* 改进模板缓存的生成优化
|
||||
* 修复验证类的多语言支持
|
||||
* 修复自定义场景验证`remove`规则异常
|
||||
* File类添加是否自动补全扩展名的选项
|
||||
* 改进`strpos`对子串是否存在的判断
|
||||
* 修复`choice`无法用值选择第一个选项问题
|
||||
* 验证器支持多维数组取值验证
|
||||
* 改进解析`extend`和`block`标签的正则
|
||||
|
||||
## V5.1.28 LTS(2018-10-29)
|
||||
|
||||
该版本主要修正了上一个版本存在的一些问题,并改进了关联查询
|
||||
|
||||
* 改进聚合查询方法的字段支持DISTINCT
|
||||
* 改进定义路由后url函数的端口生成
|
||||
* 改进控制器中间件对`swoole`等的支持
|
||||
* 改进Log类`save`方法
|
||||
* 改进验证类的闭包验证参数
|
||||
* 多对多关联支持指定中间表数据的名称
|
||||
* 关联聚合查询支持闭包方式指定聚合字段
|
||||
* 改进Lang类`get`方法
|
||||
* 多对多关联增加判断关联数据是否存在的方法
|
||||
* 改进关联查询使用`fetchsql`的情况
|
||||
* 改进修改器的是否已经执行判断
|
||||
* 增加`afterWith`和`beforeWith`验证规则 用于比较日期字段
|
||||
|
||||
## V5.1.27 LTS(2018-10-22)
|
||||
|
||||
该版本主要修正了路由绑定的参数,改进了修改器的执行多次问题,并正式宣布为LTS版本!
|
||||
|
||||
|
||||
* 修正路由绑定的参数丢失问题
|
||||
* 修正路由别名的参数获取
|
||||
* 改进修改器会执行多次的问题
|
||||
|
||||
## V5.1.26(2018-10-12)
|
||||
|
||||
该版本主要修正了上一个版本的一些问题,并改进了全局查询范围的支持,同时包含了一个安全更新。
|
||||
|
||||
|
||||
* 修正单一模块下注解路由无效的问题
|
||||
* 改进数据库的聚合查询的字段处理
|
||||
* 模型类增加`globalScope`属性定义 用于指定全局的查询范围
|
||||
* 模型的`useGlobalScope`方法支持传入数组 用于指定当前查询需要使用的全局查询范围
|
||||
* 改进数据集的`order`方法对数字类型的支持
|
||||
* 修正上一个版本`order`方法解析的一处BUG
|
||||
* 排序字段不合法或者错误的时候抛出异常
|
||||
* 改进`Request`类的`file`方法对上传文件的错误判断
|
||||
|
||||
## V5.1.25(2018-9-21)
|
||||
|
||||
该版本主要改进了查询参数绑定的性能和对浮点型的支持,以及一些细节的完善。
|
||||
|
||||
* 修正一处命令行问题
|
||||
* 改进`Socketlog`日志驱动,支持自定义默认展开日志类别
|
||||
* 修正`MorphMany`一处bug
|
||||
* 跳转到上次记住的url,并支持默认值
|
||||
* 改进模型的异常提示
|
||||
* 改进参数绑定对浮点型的支持
|
||||
* 改进`order`方法解析
|
||||
* 改进`json`字段数据的自动编码
|
||||
* 改进日志`log_write`可能造成的日志写入死循环
|
||||
* Log类增加`log_level`行为标签位置,用于对某个类型的日志进行处理
|
||||
* Route类增加`clear`方法清空路由规则
|
||||
* 分布式数据库配置支持使用数组
|
||||
* 单日志文件也支持`max_files`参数
|
||||
* 改进查询参数绑定的性能
|
||||
* 改进别名路由的URL后缀参数检测
|
||||
* 控制器前置方法和控制器中间件的`only`和`except`定义不区分大小写
|
||||
|
||||
## V5.1.24(2018-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.23(2018-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.22(2018-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.21(2018-8-2)
|
||||
|
||||
该版本主要增加了下载响应对象和数组查询对象的支持,并修正了一些社区反馈的问题。
|
||||
|
||||
* 改进核心对象的无用信息调试输出
|
||||
* 改进模型的`isRelationAttr`方法判断
|
||||
* 模型类的`get`和`all`方法并入Db类
|
||||
* 增加[下载响应对象](文件下载.md)和`download`助手函数
|
||||
* 修正别名路由配置定义读取
|
||||
* 改进`resultToModel`方法
|
||||
* 修正开启类库后缀后的注解路由生成
|
||||
* `Response`类增加`noCache`快捷方法
|
||||
* 改进路由对象在`Swoole`/`Workerman`下面参数多次合并问题
|
||||
* 修正路由`ajax`/`pjax`参数后路由变量无法正确获取的问题
|
||||
* 增加清除中间件的方法
|
||||
* 改进依赖注入的参数规范自动识别(便于对接前端小写+下划线规范)
|
||||
* 改进`hasWhere`的数组条件的字段判断
|
||||
* 增加[数组查询对象](高级查询.md)`Where`支持(喜欢数组查询的福音)
|
||||
* 改进多对多关联的闭包支持
|
||||
|
||||
## V5.1.20(2018-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驱动
|
||||
|
||||
|
||||
## RC1(2017-9-8)
|
||||
|
||||
主要新特性为:
|
||||
|
||||
* 引入容器和Facade支持
|
||||
* 依赖注入完善和支持更多场景
|
||||
* 重构的(对象化)路由
|
||||
* 配置和路由目录独立
|
||||
* 取消系统常量
|
||||
* 助手函数增强
|
||||
* 类库别名机制
|
||||
* 模型和数据库增强
|
||||
* 验证类增强
|
||||
* 模板引擎改进
|
||||
* 支持PSR-3日志规范
|
||||
* RC1版本取消了5.0多个字段批量数组查询的方式
|
32
LICENSE.txt
Normal file
32
LICENSE.txt
Normal 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
README.md
Normal file
180
README.md
Normal file
@ -0,0 +1,180 @@
|
||||

|
||||
|
||||
ThinkPHP 5.1(LTS版本) —— 12载初心,你值得信赖的PHP框架
|
||||
===============
|
||||
|
||||
[](https://scrutinizer-ci.com/g/top-think/framework/?branch=5.1)
|
||||
[](https://travis-ci.org/top-think/framework)
|
||||
[](https://packagist.org/packages/topthink/framework)
|
||||
[](https://packagist.org/packages/topthink/framework)
|
||||
[](http://www.php.net/)
|
||||
[](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)
|
1
application/.htaccess
Normal file
1
application/.htaccess
Normal file
@ -0,0 +1 @@
|
||||
deny from all
|
38
application/admin/behavior/ClearMenuAuthCache.php
Normal file
38
application/admin/behavior/ClearMenuAuthCache.php
Normal 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\behavior;
|
||||
|
||||
|
||||
use app\admin\cache\RoleMenuCache;
|
||||
use app\admin\cache\RoleNoneAuthCacheUris;
|
||||
|
||||
class ClearMenuAuthCache
|
||||
{
|
||||
|
||||
/**
|
||||
* 清除菜单权限缓存
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
(new RoleMenuCache())->delAll();
|
||||
(new RoleNoneAuthCacheUris())->delAll();
|
||||
}
|
||||
}
|
51
application/admin/behavior/SystemLog.php
Normal file
51
application/admin/behavior/SystemLog.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
42
application/admin/cache/LoginStateCache.php
vendored
Normal file
42
application/admin/cache/LoginStateCache.php
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
37
application/admin/cache/RoleMenuCache.php
vendored
Normal file
37
application/admin/cache/RoleMenuCache.php
vendored
Normal 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
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
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']);
|
||||
}
|
||||
}
|
38
application/admin/cache/RoleNoneAuthCacheIds.php
vendored
Normal file
38
application/admin/cache/RoleNoneAuthCacheIds.php
vendored
Normal 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\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']);
|
||||
}
|
||||
}
|
38
application/admin/cache/RoleNoneAuthCacheUris.php
vendored
Normal file
38
application/admin/cache/RoleNoneAuthCacheUris.php
vendored
Normal 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\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']);
|
||||
}
|
||||
}
|
28
application/admin/config/app.php
Normal file
28
application/admin/config/app.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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',
|
||||
];
|
31
application/admin/config/project.php
Normal file
31
application/admin/config/project.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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',
|
||||
];
|
36
application/admin/config/template.php
Normal file
36
application/admin/config/template.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?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',
|
||||
];
|
64
application/admin/controller/Account.php
Normal file
64
application/admin/controller/Account.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
104
application/admin/controller/AccountLog.php
Normal file
104
application/admin/controller/AccountLog.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 佣金记录
|
||||
* @author 段誉(2021/5/15 11:36)
|
||||
* @return mixed
|
||||
*/
|
||||
public function withdrawList()
|
||||
{
|
||||
if($this->request->isAjax()){
|
||||
$get = $this->request->get();
|
||||
$list = [];
|
||||
switch ($get['type']) {
|
||||
case 'distribution':
|
||||
$list = AccountLogLogic::getDistributionLog($get);
|
||||
break;
|
||||
}
|
||||
$this->_success('',$list);
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 佣金统计
|
||||
* @author 段誉(2021/5/15 11:36)
|
||||
*/
|
||||
public function withdrawTotalCount()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$get = $this->request->get();
|
||||
$result = AccountLogLogic::withdrawTotalCount($get);
|
||||
$this->_success('OK', $result);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
152
application/admin/controller/Activity.php
Normal file
152
application/admin/controller/Activity.php
Normal 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\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('删除失败','');
|
||||
}
|
||||
|
||||
}
|
159
application/admin/controller/Ad.php
Normal file
159
application/admin/controller/Ad.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
135
application/admin/controller/AdPosition.php
Normal file
135
application/admin/controller/AdPosition.php
Normal 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\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('修改失败');
|
||||
}
|
||||
|
||||
}
|
114
application/admin/controller/Admin.php
Normal file
114
application/admin/controller/Admin.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?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('删除失败');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
181
application/admin/controller/AdminBase.php
Normal file
181
application/admin/controller/AdminBase.php
Normal file
@ -0,0 +1,181 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
|
||||
}
|
142
application/admin/controller/AfterSale.php
Normal file
142
application/admin/controller/AfterSale.php
Normal file
@ -0,0 +1,142 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
}
|
117
application/admin/controller/Article.php
Normal file
117
application/admin/controller/Article.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?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('修改成功');
|
||||
}
|
||||
|
||||
|
||||
}
|
99
application/admin/controller/ArticleCategory.php
Normal file
99
application/admin/controller/ArticleCategory.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?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('修改成功');
|
||||
}
|
||||
|
||||
}
|
134
application/admin/controller/Auth.php
Normal file
134
application/admin/controller/Auth.php
Normal file
@ -0,0 +1,134 @@
|
||||
<?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('删除成功');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
204
application/admin/controller/Bargain.php
Normal file
204
application/admin/controller/Bargain.php
Normal file
@ -0,0 +1,204 @@
|
||||
<?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\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();
|
||||
}
|
||||
}
|
242
application/admin/controller/Basic.php
Normal file
242
application/admin/controller/Basic.php
Normal file
@ -0,0 +1,242 @@
|
||||
<?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('修改成功');
|
||||
}
|
||||
}
|
39
application/admin/controller/Cache.php
Normal file
39
application/admin/controller/Cache.php
Normal 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\controller;
|
||||
|
||||
/**
|
||||
* 系统缓存
|
||||
* Class Cache
|
||||
* @package app\admin\controller
|
||||
*/
|
||||
class Cache extends AdminBase
|
||||
{
|
||||
|
||||
public function cache()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
\think\facade\Cache::clear();
|
||||
$this->_success('清除成功');
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
34
application/admin/controller/Common.php
Normal file
34
application/admin/controller/Common.php
Normal 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;
|
||||
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();
|
||||
}
|
||||
}
|
149
application/admin/controller/Coupon.php
Normal file
149
application/admin/controller/Coupon.php
Normal file
@ -0,0 +1,149 @@
|
||||
<?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,'');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
118
application/admin/controller/Crontab.php
Normal file
118
application/admin/controller/Crontab.php
Normal 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\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));
|
||||
}
|
||||
|
||||
}
|
33
application/admin/controller/Dispatch.php
Normal file
33
application/admin/controller/Dispatch.php
Normal 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;
|
||||
|
||||
|
||||
|
||||
|
||||
class Dispatch extends AdminBase
|
||||
{
|
||||
public function dispatch_error($msg)
|
||||
{
|
||||
return $this->_error($msg);
|
||||
}
|
||||
|
||||
}
|
74
application/admin/controller/Distribution.php
Normal file
74
application/admin/controller/Distribution.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?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 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),
|
||||
'show_commission' => ConfigServer::get('distribution', 'show_commission', 0),
|
||||
'share_poster' => ConfigServer::get('distribution', 'share_poster'),//分享海报
|
||||
];
|
||||
$config['share_poster'] = UrlServer::getFileUrl($config['share_poster']);
|
||||
$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']);
|
||||
ConfigServer::set('distribution', 'show_commission', $post['show_commission']);
|
||||
ConfigServer::set('distribution', 'share_poster', UrlServer::setFileUrl($post['share_poster']));
|
||||
$this->_success('修改成功');
|
||||
}
|
||||
}
|
||||
}
|
184
application/admin/controller/DistributionMember.php
Normal file
184
application/admin/controller/DistributionMember.php
Normal file
@ -0,0 +1,184 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
122
application/admin/controller/Express.php
Normal file
122
application/admin/controller/Express.php
Normal 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']);
|
||||
ConfigServer::set('kdniao', 'type', $post['kdniao_type']);
|
||||
}
|
||||
$this->_success('操作成功');
|
||||
}
|
||||
}
|
101
application/admin/controller/File.php
Normal file
101
application/admin/controller/File.php
Normal 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();
|
||||
}
|
||||
|
||||
|
||||
}
|
85
application/admin/controller/FileCate.php
Normal file
85
application/admin/controller/FileCate.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?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('删除成功');
|
||||
}
|
||||
}
|
||||
}
|
138
application/admin/controller/FileNew.php
Normal file
138
application/admin/controller/FileNew.php
Normal file
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\controller\AdminBase;
|
||||
use app\admin\logic\FileNewLogic;
|
||||
use app\common\model\FileCate;
|
||||
use app\admin\validate\FileCateNew as FileCateNewValidate;
|
||||
use app\common\server\FileServer;
|
||||
|
||||
class FileNew extends AdminBase
|
||||
{
|
||||
public function lists()
|
||||
{
|
||||
$get = $this->request->get();
|
||||
$get['type'] = $get['type'] ?? 'image';
|
||||
$get['partner_id'] = $get['partner_id'] ?? 0;
|
||||
$get['page_no'] = $get['page_no'] ?? 1;
|
||||
$get['page_size'] = $get['page_size'] ?? 20;
|
||||
$get['cate_id'] = $get['cate_id'] ?? 0;
|
||||
switch($get['type']) {
|
||||
case 'video':
|
||||
$title = '上传视频';
|
||||
break;
|
||||
case 'image':
|
||||
$title = '上传图片';
|
||||
break;
|
||||
case 'other':
|
||||
$title = '上传';
|
||||
break;
|
||||
}
|
||||
$menu = FileCate::getTreeMenu($get);
|
||||
$data = FileNewLogic::lists($get);
|
||||
$this->assign('type', $get['type']);
|
||||
$this->assign('title', $title);
|
||||
$this->assign('menu', json_encode($menu));
|
||||
$this->assign('data', $data);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function pagelists()
|
||||
{
|
||||
$get = $this->request->get();
|
||||
$get['type'] = $get['type'] ?? 'image';
|
||||
$get['partner_id'] = $get['partner_id'] ?? 0;
|
||||
$get['page_no'] = $get['page_no'] ?? 1;
|
||||
$get['page_size'] = $get['page_size'] ?? 20;
|
||||
$get['cate_id'] = $get['cate_id'] ?? 0;
|
||||
$data = FileNewLogic::pagelists($get);
|
||||
return $this->_success('', $data);
|
||||
}
|
||||
|
||||
public function addCate()
|
||||
{
|
||||
if($this->request->isPost()) {
|
||||
$post = $this->request->post();
|
||||
$validate = new FileCateNewValidate;
|
||||
if(!$validate->check($post)) {
|
||||
return $this->_error($validate->getError());
|
||||
}
|
||||
$result = FileNewLogic::addCate($post);
|
||||
if($result['flag']) {
|
||||
return $this->_success($result['msg']);
|
||||
}
|
||||
return $this->_error($result['msg']);
|
||||
}
|
||||
$get = $this->request->get();
|
||||
$get['type'] = $get['type'] ?? 'image';
|
||||
$get['partner_id'] = $get['partner_id'] ?? 0;
|
||||
$menu = FileCate::getMenu($get);
|
||||
$this->assign('menu', $menu);
|
||||
$this->assign('type', $get['type']);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function editCate()
|
||||
{
|
||||
if($this->request->isPost()) {
|
||||
$post = $this->request->post();
|
||||
$validate = new FileCateNewValidate;
|
||||
if(!$validate->check($post)) {
|
||||
return $this->_error($validate->getError());
|
||||
}
|
||||
$result = FileNewLogic::editCate($post);
|
||||
if($result['flag']) {
|
||||
return $this->_success($result['msg']);
|
||||
}
|
||||
return $this->_error($result['msg']);
|
||||
}
|
||||
|
||||
$get = $this->request->get();
|
||||
$get['type'] = $get['type'] ?? 'image';
|
||||
$get['partner_id'] = $get['partner_id'] ?? 0;
|
||||
$cate = FileCate::getCateById($get['id']);
|
||||
$menu = FileCate::getMenu($get);
|
||||
$this->assign('menu', $menu);
|
||||
$this->assign('type', $get['type']);
|
||||
$this->assign('cate', $cate);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function delCate()
|
||||
{
|
||||
$post = $this->request->post();
|
||||
$result = FileNewLogic::delCate($post);
|
||||
if($result['flag']) {
|
||||
return $this->_success($result['msg']);
|
||||
}
|
||||
return $this->_error($result['msg']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新视频上传
|
||||
*/
|
||||
public function videoNew(){
|
||||
if ($this->request->isPost()) {
|
||||
$post = $this->request->post();
|
||||
$result = FileServer::videoNew($post['cate_id']);
|
||||
$this->successOrError($result);
|
||||
}
|
||||
}
|
||||
|
||||
public function showVideo()
|
||||
{
|
||||
$uri = $this->request->get('uri');
|
||||
$this->assign('uri', $uri);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function delFile()
|
||||
{
|
||||
$post = $this->request->post();
|
||||
$result = FileNewLogic::delFile($post);
|
||||
if($result) {
|
||||
return $this->_success('删除成功');
|
||||
}
|
||||
return $this->_error('删除失败');
|
||||
}
|
||||
}
|
33
application/admin/controller/Finance.php
Normal file
33
application/admin/controller/Finance.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
69
application/admin/controller/Footprint.php
Normal file
69
application/admin/controller/Footprint.php
Normal 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\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',0);
|
||||
$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('更新失败');
|
||||
}
|
||||
}
|
||||
}
|
143
application/admin/controller/Freight.php
Normal file
143
application/admin/controller/Freight.php
Normal 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\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();
|
||||
}
|
||||
}
|
314
application/admin/controller/Goods.php
Normal file
314
application/admin/controller/Goods.php
Normal file
@ -0,0 +1,314 @@
|
||||
<?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};
|
||||
use think\Db;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表导出
|
||||
*/
|
||||
public function exportFile()
|
||||
{
|
||||
$get = $this->request->get();
|
||||
$this->_success('', GoodsLogic::exportFile($get));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
// 规格值验证长度验证
|
||||
foreach($spec_lists['spec_value_str'] as $key => $item) {
|
||||
$itemArr = explode(',', $item);
|
||||
foreach($itemArr as $subItem) {
|
||||
if(mb_strlen($subItem) > 64) {
|
||||
return $this->_error('第'. ($key+1) .'个SKU规格值超过了64个字符');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($post['status'] == 0) {
|
||||
$status = Db::name('goods')
|
||||
->where(['id' => $post['goods_id']])
|
||||
->value('status');
|
||||
if ($status == 1) {
|
||||
$res = Db::name('team_activity')
|
||||
->where(['status' => 1, 'goods_id'=> $post['goods_id']])
|
||||
->find();
|
||||
if ($res) {
|
||||
$this->_error('该商品正在参与拼团,请先关闭后才允许下架');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//添加商品
|
||||
$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 === true){
|
||||
$this->_success('修改成功');
|
||||
}
|
||||
$this->_error($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 === true) {
|
||||
$this->_success('下架成功');
|
||||
}
|
||||
$this->_error($result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 === true) {
|
||||
$this->_success('上架成功');
|
||||
}
|
||||
$this->_error('上架失败');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
110
application/admin/controller/GoodsBrand.php
Normal file
110
application/admin/controller/GoodsBrand.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?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('修改失败');
|
||||
}
|
||||
|
||||
}
|
118
application/admin/controller/GoodsCategory.php
Normal file
118
application/admin/controller/GoodsCategory.php
Normal 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\{
|
||||
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('修改失败');
|
||||
}
|
||||
}
|
76
application/admin/controller/GoodsComment.php
Normal file
76
application/admin/controller/GoodsComment.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?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();
|
||||
}
|
||||
|
||||
|
||||
}
|
111
application/admin/controller/Help.php
Normal file
111
application/admin/controller/Help.php
Normal 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\{
|
||||
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('修改成功');
|
||||
}
|
||||
|
||||
|
||||
}
|
104
application/admin/controller/HelpCategory.php
Normal file
104
application/admin/controller/HelpCategory.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?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('修改成功');
|
||||
}
|
||||
|
||||
}
|
29
application/admin/controller/HotSearch.php
Normal file
29
application/admin/controller/HotSearch.php
Normal 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('操作失败');
|
||||
}
|
||||
}
|
81
application/admin/controller/Index.php
Normal file
81
application/admin/controller/Index.php
Normal 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\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();
|
||||
}
|
||||
}
|
68
application/admin/controller/Log.php
Normal file
68
application/admin/controller/Log.php
Normal 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\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();
|
||||
}
|
||||
|
||||
}
|
155
application/admin/controller/LuckDraw.php
Normal file
155
application/admin/controller/LuckDraw.php
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
94
application/admin/controller/MarketingConfig.php
Normal file
94
application/admin/controller/MarketingConfig.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
317
application/admin/controller/MenuDecorate.php
Normal file
317
application/admin/controller/MenuDecorate.php
Normal file
@ -0,0 +1,317 @@
|
||||
<?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('设置成功');
|
||||
}
|
||||
}
|
43
application/admin/controller/Message.php
Normal file
43
application/admin/controller/Message.php
Normal 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\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();
|
||||
}
|
||||
}
|
44
application/admin/controller/Mnp.php
Normal file
44
application/admin/controller/Mnp.php
Normal 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\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();
|
||||
}
|
||||
}
|
77
application/admin/controller/MnpMessage.php
Normal file
77
application/admin/controller/MnpMessage.php
Normal 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\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('同步失败,请检查配置信息');
|
||||
}
|
||||
}
|
51
application/admin/controller/My.php
Normal file
51
application/admin/controller/My.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?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();
|
||||
}
|
||||
|
||||
}
|
107
application/admin/controller/NoticeSetting.php
Normal file
107
application/admin/controller/NoticeSetting.php
Normal 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\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('删除失败');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
66
application/admin/controller/Oa.php
Normal file
66
application/admin/controller/Oa.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?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']);
|
||||
|
||||
}
|
||||
|
||||
}
|
78
application/admin/controller/OaMessage.php
Normal file
78
application/admin/controller/OaMessage.php
Normal 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\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('同步失败,请检查配置信息');
|
||||
}
|
||||
}
|
16
application/admin/controller/Op.php
Normal file
16
application/admin/controller/Op.php
Normal 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();
|
||||
}
|
||||
|
||||
}
|
200
application/admin/controller/Order.php
Normal file
200
application/admin/controller/Order.php
Normal file
@ -0,0 +1,200 @@
|
||||
<?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();
|
||||
}
|
||||
|
||||
public function exportFile()
|
||||
{
|
||||
$get = $this->request->get();
|
||||
$this->_success('', OrderLogic::exportFile($get));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
113
application/admin/controller/PayConfig.php
Normal file
113
application/admin/controller/PayConfig.php
Normal file
@ -0,0 +1,113 @@
|
||||
<?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']) && $post['status'] == 1) {
|
||||
$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 ($post['status'] == 1) {
|
||||
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']) && $post['status'] == 1) {
|
||||
$this->_error('请选择支付图标');
|
||||
}
|
||||
PayConfigLogic::editAlipay($post);
|
||||
$this->_success('修改成功');
|
||||
}
|
||||
$this->assign('info', PayConfigLogic::info('alipay'));
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
}
|
143
application/admin/controller/Printer.php
Normal file
143
application/admin/controller/Printer.php
Normal 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\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($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
}
|
122
application/admin/controller/Recharge.php
Normal file
122
application/admin/controller/Recharge.php
Normal 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\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('修改失败');
|
||||
}
|
||||
|
||||
|
||||
}
|
59
application/admin/controller/RechargeLog.php
Normal file
59
application/admin/controller/RechargeLog.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?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();
|
||||
|
||||
}
|
||||
}
|
||||
|
106
application/admin/controller/Role.php
Normal file
106
application/admin/controller/Role.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
}
|
175
application/admin/controller/Seckill.php
Normal file
175
application/admin/controller/Seckill.php
Normal file
@ -0,0 +1,175 @@
|
||||
<?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('删除失败','');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
32
application/admin/controller/ServiceConfig.php
Normal file
32
application/admin/controller/ServiceConfig.php
Normal 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;
|
||||
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();
|
||||
}
|
||||
}
|
158
application/admin/controller/ShopSetting.php
Normal file
158
application/admin/controller/ShopSetting.php
Normal 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\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'),//详细地址
|
||||
'give_integral_scene' => ConfigServer::get('trading', 'give_integral_scene', 1), //赠送积分时机
|
||||
'give_growth_scene' => ConfigServer::get('trading', 'give_growth_scene', 1) //赠送成长值时机
|
||||
];
|
||||
$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']);//订单管理联系人手机
|
||||
|
||||
ConfigServer::set('trading', 'give_integral_scene', $post['give_integral_scene']);//赠送积分时机
|
||||
ConfigServer::set('trading', 'give_growth_scene', $post['give_growth_scene']);//赠送成长值时机
|
||||
$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');
|
||||
}
|
||||
}
|
151
application/admin/controller/SignDaily.php
Normal file
151
application/admin/controller/SignDaily.php
Normal 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\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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
31
application/admin/controller/Sites.php
Normal file
31
application/admin/controller/Sites.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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 '网站设置';
|
||||
}
|
||||
|
||||
}
|
60
application/admin/controller/Sms.php
Normal file
60
application/admin/controller/Sms.php
Normal 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\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();
|
||||
}
|
||||
}
|
60
application/admin/controller/Statistics.php
Normal file
60
application/admin/controller/Statistics.php
Normal 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();
|
||||
}
|
||||
}
|
171
application/admin/controller/StorageConfig.php
Normal file
171
application/admin/controller/StorageConfig.php
Normal file
@ -0,0 +1,171 @@
|
||||
<?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 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('切换成功');
|
||||
}
|
||||
}
|
||||
}
|
82
application/admin/controller/Supplier.php
Normal file
82
application/admin/controller/Supplier.php
Normal 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\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('删除失败');
|
||||
}
|
||||
}
|
||||
}
|
151
application/admin/controller/TeamActivity.php
Normal file
151
application/admin/controller/TeamActivity.php
Normal 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');
|
||||
}
|
||||
}
|
88
application/admin/controller/TeamFound.php
Normal file
88
application/admin/controller/TeamFound.php
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
30
application/admin/controller/TeamSet.php
Normal file
30
application/admin/controller/TeamSet.php
Normal 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('设置成功');
|
||||
}
|
||||
}
|
||||
}
|
167
application/admin/controller/User.php
Normal file
167
application/admin/controller/User.php
Normal file
@ -0,0 +1,167 @@
|
||||
<?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 exportFile()
|
||||
{
|
||||
$get = $this->request->get();
|
||||
$this->_success('', UserLogic::exportFile($get));
|
||||
}
|
||||
|
||||
/*
|
||||
* 设置分组
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
102
application/admin/controller/UserGroup.php
Normal file
102
application/admin/controller/UserGroup.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
99
application/admin/controller/UserLevel.php
Normal file
99
application/admin/controller/UserLevel.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?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('删除失败','');
|
||||
}
|
||||
}
|
||||
}
|
87
application/admin/controller/UserPrivilege.php
Normal file
87
application/admin/controller/UserPrivilege.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?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,'');
|
||||
}
|
||||
}
|
||||
}
|
95
application/admin/controller/WechatReply.php
Normal file
95
application/admin/controller/WechatReply.php
Normal 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\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('修改失败');
|
||||
}
|
||||
}
|
178
application/admin/controller/Withdraw.php
Normal file
178
application/admin/controller/Withdraw.php
Normal file
@ -0,0 +1,178 @@
|
||||
<?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('提现失败已回退佣金');
|
||||
}
|
||||
}
|
57
application/admin/http/middleware/Auth.php
Normal file
57
application/admin/http/middleware/Auth.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?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' => '权限不足,无法访问']);
|
||||
}
|
||||
}
|
74
application/admin/http/middleware/Login.php
Normal file
74
application/admin/http/middleware/Login.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?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') && !$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;
|
||||
}
|
||||
}
|
271
application/admin/logic/AccountLogLogic.php
Normal file
271
application/admin/logic/AccountLogLogic.php
Normal file
@ -0,0 +1,271 @@
|
||||
<?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\User;
|
||||
use app\api\model\Order;
|
||||
use app\api\model\OrderGoods;
|
||||
use app\common\model\AccountLog;
|
||||
use app\common\model\DistributionOrder;
|
||||
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'])]];
|
||||
}
|
||||
|
||||
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']);
|
||||
// 获取来源单号
|
||||
$item['order_sn'] = Db::name('order')->where(['del'=>0, 'id'=>$item['source_id']])->value('order_sn');
|
||||
}
|
||||
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' => '充值赠送成长值',
|
||||
],
|
||||
[
|
||||
'source' => AccountLog::order_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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//佣金记录
|
||||
public static function getDistributionLog($get)
|
||||
{
|
||||
$where = [];
|
||||
if (!empty($get['distribution_keyword_type']) and !empty($get['distribution_keyword']) and $get['distribution_keyword']) {
|
||||
switch ($get['distribution_keyword_type']) {
|
||||
case 'order_sn':
|
||||
$order_ids = Order::field('id,order_sn')->where('order_sn', $get['distribution_keyword'])->column('id');
|
||||
$og_ids = OrderGoods::field('id,order_id')->whereIn('id', $order_ids)->column('id');
|
||||
$where[] = ['order_goods_id', 'in', $og_ids];
|
||||
break;
|
||||
case 'nickname':
|
||||
$user_ids = User::field('id,sn,nickname')->where('nickname', 'like', '%'.$get['distribution_keyword'].'%')->column('id');
|
||||
$where[] = ['user_id', 'in', $user_ids];
|
||||
break;
|
||||
case 'user_sn':
|
||||
$user_ids = User::field('id,sn,nickname')->where('sn', 'like', '%'.$get['distribution_keyword'].'%')->column('id');
|
||||
$where[] = ['user_id', 'in', $user_ids];
|
||||
break;
|
||||
case 'mobile':
|
||||
$user_ids = User::field('id,sn,mobile')->where('mobile', '=', $get['distribution_keyword'])->column('id');
|
||||
$where[] = ['user_id', 'in', $user_ids];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($get['distribution_status']) and is_numeric($get['distribution_status'])) {
|
||||
$where[] = ['d.status', '=', $get['distribution_status']];
|
||||
}
|
||||
if (!empty($get['distribution_start_time']) and $get['distribution_start_time']) {
|
||||
$where[] = ['d.create_time', '>=', strtotime($get['distribution_start_time'])];
|
||||
}
|
||||
if (!empty($get['distribution_end_time']) and $get['distribution_end_time']) {
|
||||
$where[] = ['d.create_time', '<=', strtotime($get['distribution_end_time'])];
|
||||
}
|
||||
|
||||
// 查询结果
|
||||
$count = DistributionOrder::where($where)->alias('d')
|
||||
->join('order_goods og', 'order_goods_id = og.id')
|
||||
->count();
|
||||
$lists = DistributionOrder::field('d.*, og.order_id')
|
||||
->where($where)->alias('d')
|
||||
->join('order_goods og', 'order_goods_id = og.id')
|
||||
->with('user')
|
||||
->withAttr('order', function ($value, $data) {
|
||||
return Order::field('id,order_sn,order_amount')->where(['id'=>$data['order_id']])->find();
|
||||
})
|
||||
->page($get['page'], $get['limit'])
|
||||
->append(['order'])
|
||||
->order('d.id desc')
|
||||
->select();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['status_text'] = DistributionOrder::getOrderStatus($item['status']);
|
||||
$item['create_time'] = date('Y-m-d H:i:s', $item['create_time']);
|
||||
}
|
||||
return ['count'=>$count, 'lists'=>$lists];
|
||||
}
|
||||
|
||||
|
||||
//佣金统计
|
||||
public static function withdrawTotalCount($get)
|
||||
{
|
||||
// 今天开始和结束时间戳
|
||||
list($startToday, $endToday) = Time::today();
|
||||
// 本月开始和结束时间戳
|
||||
list($startMonth, $endMonth) = Time::month();
|
||||
|
||||
if ($get['type'] == 'distribution') {
|
||||
// 获取分销佣金总计
|
||||
$distributionToday = DistributionOrder::where('status', 'in', [DistributionOrder::STATUS_WAIT_HANDLE, DistributionOrder::STATUS_SUCCESS])
|
||||
->where('create_time', '>=', $startToday)
|
||||
->where('create_time', '<=', $endToday)
|
||||
->sum('money');
|
||||
|
||||
$distributionMonth = DistributionOrder::where('status', 'in', [DistributionOrder::STATUS_WAIT_HANDLE, DistributionOrder::STATUS_SUCCESS])
|
||||
->where('create_time', '>=', $startMonth)
|
||||
->where('create_time', '<=', $endMonth)
|
||||
->sum('money');
|
||||
|
||||
$distributionTotal = DistributionOrder::where('status', 'in', [DistributionOrder::STATUS_WAIT_HANDLE, DistributionOrder::STATUS_SUCCESS])
|
||||
->sum('money');
|
||||
|
||||
return ['today'=>$distributionToday, 'month'=>$distributionMonth, 'total'=>$distributionTotal];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
215
application/admin/logic/ActivityAreaLogic.php
Normal file
215
application/admin/logic/ActivityAreaLogic.php
Normal 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\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)
|
||||
->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')
|
||||
->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)
|
||||
{
|
||||
return Db::name('activity_goods')->insert([
|
||||
'activity_id' => $post['activity_id'],
|
||||
'goods_id' => $post['goods_id'][0],
|
||||
'del' => 0,
|
||||
'create_time' => time(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
295
application/admin/logic/AdLogic.php
Normal file
295
application/admin/logic/AdLogic.php
Normal file
@ -0,0 +1,295 @@
|
||||
<?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;
|
||||
$goods['image'] = UrlServer::getFileUrl($goods['image']);
|
||||
$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();
|
||||
}
|
||||
|
||||
}
|
214
application/admin/logic/AdPositionLogic.php
Normal file
214
application/admin/logic/AdPositionLogic.php
Normal file
@ -0,0 +1,214 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
168
application/admin/logic/AdminLogic.php
Normal file
168
application/admin/logic/AdminLogic.php
Normal file
@ -0,0 +1,168 @@
|
||||
<?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]);
|
||||
}
|
||||
}
|
448
application/admin/logic/AfterSaleLogic.php
Normal file
448
application/admin/logic/AfterSaleLogic.php
Normal file
@ -0,0 +1,448 @@
|
||||
<?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\api\logic\DistributionLogic;
|
||||
use app\common\logic\AccountLogLogic;
|
||||
use app\common\logic\OrderRefundLogic;
|
||||
use app\common\server\AreaServer;
|
||||
use app\common\server\ConfigServer;
|
||||
use app\common\server\UrlServer;
|
||||
use app\common\server\WeChatServer;
|
||||
use app\common\logic\AfterSaleLogLogic;
|
||||
use app\common\logic\PaymentLogic;
|
||||
use app\common\model\{AccountLog, AfterSale, AfterSaleLog, Goods, MessageScene_, NoticeSetting, Order, OrderGoods, Pay};
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use think\facade\Env;
|
||||
use think\facade\Hook;
|
||||
|
||||
class AfterSaleLogic
|
||||
{
|
||||
/**
|
||||
* Notes: 列表
|
||||
* @param $get
|
||||
* @author 段誉(2021/1/30 16:56)
|
||||
* @return array
|
||||
*/
|
||||
public static function lists($get)
|
||||
{
|
||||
$after_sale = new AfterSale();
|
||||
$where = [];
|
||||
|
||||
$where[] = ['a.del', '=', 0];
|
||||
//订单类型
|
||||
if ($get['type'] != '') {
|
||||
$where[] = ['status', '=', $get['type']];
|
||||
}
|
||||
|
||||
//订单搜素
|
||||
if (!empty($get['search_key']) && !empty($get['keyword'])) {
|
||||
$keyword = $get['keyword'];
|
||||
switch ($get['search_key']) {
|
||||
case 'sn':
|
||||
$where[] = ['a.sn', 'like', '%' . $keyword . '%'];
|
||||
break;
|
||||
case 'order_sn':
|
||||
$where[] = ['o.order_sn', 'like', '%' . $keyword . '%'];
|
||||
break;
|
||||
case 'goods_name':
|
||||
$where[] = ['g.goods_name', 'like', '%' . $keyword . '%'];
|
||||
break;
|
||||
case 'user_sn':
|
||||
$where[] = ['u.sn', 'like', '%' . $keyword . '%'];
|
||||
break;
|
||||
case 'nickname':
|
||||
$where[] = ['u.nickname', 'like', '%' . $keyword . '%'];
|
||||
break;
|
||||
case 'user_mobile':
|
||||
$where[] = ['u.mobile', 'like', '%' . $keyword . '%'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($get['status']) && $get['status'] != '') {
|
||||
$where[] = ['a.status', '=', $get['status']];
|
||||
}
|
||||
|
||||
//下单时间
|
||||
if (isset($get['start_time']) && $get['start_time'] != '') {
|
||||
$where[] = ['a.create_time', '>=', strtotime($get['start_time'])];
|
||||
}
|
||||
if (isset($get['end_time']) && $get['end_time'] != '') {
|
||||
$where[] = ['a.create_time', '<=', strtotime($get['end_time'])];
|
||||
}
|
||||
|
||||
$field = 'a.id,a.sn,a.status,a.order_id,a.order_goods_id,
|
||||
a.user_id,a.refund_type,a.create_time,a.refund_price,
|
||||
o.order_status,o.pay_way';
|
||||
|
||||
$count = $after_sale
|
||||
->alias('a')
|
||||
->join('order o', 'o.id = a.order_id')
|
||||
->join('user u', 'u.id = a.user_id')
|
||||
->join('order_goods g', 'g.id = a.order_goods_id')
|
||||
->with(['order_goods', 'user', 'order'])
|
||||
->where($where)
|
||||
->group('a.id')
|
||||
->count();
|
||||
|
||||
$lists = $after_sale
|
||||
->alias('a')
|
||||
->field($field)
|
||||
->join('order o', 'o.id = a.order_id')
|
||||
->join('user u', 'u.id = a.user_id')
|
||||
->join('order_goods g', 'g.id = a.order_goods_id')
|
||||
->with(['order_goods', 'user', 'order'])
|
||||
->where($where)
|
||||
->page($get['page'], $get['limit'])
|
||||
->order('a.id desc')
|
||||
->append(['user.base_avatar', 'order_goods.base_image'])
|
||||
->group('a.id')
|
||||
->select();
|
||||
|
||||
foreach ($lists as &$list) {
|
||||
$list['order']['pay_way'] = Pay::getPayWay($list['order']['pay_way']);
|
||||
$list['order']['order_status'] = Order::getOrderStatus($list['order']['order_status']);
|
||||
$list['refund_type'] = AfterSale::getRefundTypeDesc($list['refund_type']);
|
||||
$list['create_time'] = date('Y-m-d H:i:s', $list['create_time']);
|
||||
$list['status'] = AfterSale::getStatusDesc($list['status']);
|
||||
|
||||
foreach ($list['order_goods'] as &$good) {
|
||||
$info = json_decode($good['goods_info'], true);
|
||||
$good['goods_name'] = $info['goods_name'];
|
||||
$good['spec_value'] = $info['spec_value_str'];
|
||||
$good['image'] = empty($info['spec_image']) ?
|
||||
UrlServer::getFileUrl($info['image']) : UrlServer::getFileUrl($info['spec_image']);
|
||||
}
|
||||
}
|
||||
return ['count' => $count, 'lists' => $lists];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 详情
|
||||
* @param $id
|
||||
* @author 段誉(2021/1/30 16:56)
|
||||
* @return array
|
||||
*/
|
||||
public static function getDetail($id)
|
||||
{
|
||||
$after_sale = new AfterSale();
|
||||
$result = $after_sale
|
||||
->with(['order_goods', 'user', 'order', 'logs'])
|
||||
->where('id', $id)
|
||||
->find()->toArray();
|
||||
|
||||
$result['refund_type_text'] = AfterSale::getRefundTypeDesc($result['refund_type']);
|
||||
$result['status_text'] = AfterSale::getStatusDesc($result['status']);
|
||||
$result['order']['pay_way'] = Pay::getPayWay($result['order']['pay_way']);
|
||||
$result['order']['order_status'] = Order::getOrderStatus($result['order']['order_status']);
|
||||
$result['create_time'] = date('Y-m-d H:i:s', $result['create_time']);
|
||||
|
||||
foreach ($result['order_goods'] as &$good) {
|
||||
$info = json_decode($good['goods_info'], true);
|
||||
$good['goods_name'] = $info['goods_name'];
|
||||
$good['spec_value'] = $info['spec_value_str'];
|
||||
$good['image'] = empty($info['spec_image']) ?
|
||||
UrlServer::getFileUrl($info['image']) : UrlServer::getFileUrl($info['spec_image']);
|
||||
}
|
||||
|
||||
foreach ($result['order_goods'] as &$good) {
|
||||
$info = json_decode($good['goods_info'], true);
|
||||
$good['goods_name'] = $info['goods_name'];
|
||||
$good['spec_value'] = $info['spec_value_str'];
|
||||
$good['image'] = empty($info['spec_image']) ?
|
||||
UrlServer::getFileUrl($info['image']) : UrlServer::getFileUrl($info['spec_image']);
|
||||
}
|
||||
|
||||
foreach ($result['logs'] as &$log){
|
||||
$log['create_time'] = date('Y-m-d H:i:s', $log['create_time']);
|
||||
|
||||
$log['log_img'] = '';
|
||||
$log['log_remark'] = '';
|
||||
switch ($log['channel']){
|
||||
//会员申请售后
|
||||
case AfterSaleLog::USER_APPLY_REFUND:
|
||||
$log['log_img'] = empty($result['refund_image']) ? '' : UrlServer::getFileUrl($result['refund_image']);
|
||||
$refund_reason = empty($result['refund_reason']) ? '未知' : $result['refund_reason'];
|
||||
$refund_remark = empty($result['refund_remark']) ? '暂无' : $result['refund_remark'];
|
||||
$log['log_remark'] = '退款原因('.$refund_reason.')'.'退款说明('.$refund_remark.')';
|
||||
break;
|
||||
//会员发快递
|
||||
case AfterSaleLog::USER_SEND_EXPRESS:
|
||||
$log['log_img'] = empty($result['express_image']) ? '' : UrlServer::getFileUrl($result['express_image']);
|
||||
$express_name = $result['express_name'];
|
||||
$invoice_no = $result['invoice_no'];
|
||||
$express_remark = empty($result['express_remark']) ? '暂无' : $result['express_remark'];
|
||||
$log['log_remark'] = '快递公司('.$express_name.')'.'单号('.$invoice_no.')'.'备注说明('.$express_remark.')';
|
||||
break;
|
||||
//商家拒绝退款 //商家拒绝收货
|
||||
case AfterSaleLog::SHOP_REFUSE_REFUND:
|
||||
case AfterSaleLog::SHOP_REFUSE_TAKE_GOODS:
|
||||
$admin_remark = empty($result['admin_remark']) ? '暂无' : $result['admin_remark'];
|
||||
$log['log_remark'] = '备注:'.$admin_remark;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$result['shop_address'] = self::getShopAddress();
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 商家同意售后
|
||||
* @param $id
|
||||
* @param $admin_id
|
||||
* @author 段誉(2021/1/30 16:56)
|
||||
*/
|
||||
public static function agree($id, $admin_id)
|
||||
{
|
||||
$after_sale = AfterSale::get($id);
|
||||
|
||||
$after_sale->update_time = time();
|
||||
//仅退款
|
||||
if ($after_sale['refund_type'] == AfterSale::TYPE_ONLY_REFUND) {
|
||||
$after_sale->status = AfterSale::STATUS_WAIT_REFUND;//更新为等待退款状态
|
||||
}
|
||||
|
||||
//退款退货
|
||||
if ($after_sale['refund_type'] == AfterSale::TYPE_REFUND_RETURN) {
|
||||
$after_sale->status = AfterSale::STATUS_WAIT_RETURN_GOODS;//更新为商品待退货状态
|
||||
}
|
||||
|
||||
$after_sale->save();
|
||||
//记录日志
|
||||
AfterSaleLogLogic::record(
|
||||
AfterSaleLog::TYPE_SHOP,
|
||||
AfterSaleLog::SHOP_AGREE_REFUND,
|
||||
$after_sale['order_id'],
|
||||
$after_sale['id'],
|
||||
$admin_id,
|
||||
AfterSaleLog::SHOP_AGREE_REFUND
|
||||
);
|
||||
|
||||
// 仅退款;更新订单商品为等待退款
|
||||
if ($after_sale['refund_type'] == AfterSale::TYPE_ONLY_REFUND) {
|
||||
$order_goods = OrderGoods::get(['id' => $after_sale['order_goods_id']]);
|
||||
$order_goods->refund_status = OrderGoods::REFUND_STATUS_WAIT;//等待退款
|
||||
$order_goods->save();
|
||||
}
|
||||
|
||||
$mobile = Db::name('order')->where(['id'=>$after_sale->order_id])->value('mobile');
|
||||
//发送短信
|
||||
$nickname = Db::name('user')->where(['id' => $after_sale->user_id])->value('nickname');
|
||||
Hook::listen('sms_send', [
|
||||
'key' => NoticeSetting::PLATFORM_PASS_REFUND_NOTICE,
|
||||
'mobile' => $mobile,
|
||||
'user_id' => $after_sale['user_id'],
|
||||
'params' => ['nickname' => $nickname, 'order_sn' => $after_sale->sn],
|
||||
]);
|
||||
|
||||
//消息通知
|
||||
Hook::listen('notice', [
|
||||
'user_id' => $after_sale['user_id'],
|
||||
'order_id' => $after_sale['order_id'],
|
||||
'refund_amount' => $after_sale['refund_price'],
|
||||
'scene' => NoticeSetting::PLATFORM_PASS_REFUND_NOTICE,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 商家拒绝
|
||||
* @param $post
|
||||
* @param $admin_id
|
||||
* @author 段誉(2021/1/30 16:56)
|
||||
*/
|
||||
public static function refuse($post, $admin_id)
|
||||
{
|
||||
$id = $post['id'];
|
||||
$after_sale = AfterSale::get($id);
|
||||
$after_sale->update_time = time();
|
||||
$after_sale->status = AfterSale::STATUS_REFUSE_REFUND;//更新为拒绝退款状态
|
||||
$after_sale->admin_remark = isset($post['remark']) ? $post['remark'] : '';
|
||||
$after_sale->save();
|
||||
//记录日志
|
||||
AfterSaleLogLogic::record(
|
||||
AfterSaleLog::TYPE_SHOP,
|
||||
AfterSaleLog::SHOP_REFUSE_REFUND,
|
||||
$after_sale['order_id'],
|
||||
$after_sale['id'],
|
||||
$admin_id,
|
||||
AfterSaleLog::SHOP_REFUSE_REFUND
|
||||
);
|
||||
$nickname = Db::name('user')->where(['id' => $after_sale->user_id])->value('nickname');
|
||||
$mobile = Db::name('order')->where(['id'=>$after_sale->order_id])->value('mobile');
|
||||
//发送短信
|
||||
Hook::listen('sms_send', [
|
||||
'key' => NoticeSetting::PLATFORM_REFUSE_REFUND_NOTICE,
|
||||
'mobile' => $mobile,
|
||||
'user_id' => $after_sale['user_id'],
|
||||
'params' => ['nickname' => $nickname, 'order_sn' => $after_sale->sn],
|
||||
]);
|
||||
|
||||
//消息通知
|
||||
Hook::listen('notice', [
|
||||
'user_id' => $after_sale['user_id'],
|
||||
'order_id' => $after_sale['order_id'],
|
||||
'scene' => NoticeSetting::PLATFORM_REFUSE_REFUND_NOTICE,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 商家收货
|
||||
* @param $post
|
||||
* @param $admin_id
|
||||
* @author 段誉(2021/1/30 16:56)
|
||||
*/
|
||||
public static function takeGoods($post, $admin_id)
|
||||
{
|
||||
$id = $post['id'];
|
||||
$after_sale = AfterSale::get($id);
|
||||
$after_sale->update_time = time();
|
||||
$after_sale->status = AfterSale::STATUS_WAIT_REFUND;//更新为等待退款状态
|
||||
$after_sale->save();
|
||||
//记录日志
|
||||
AfterSaleLogLogic::record(
|
||||
AfterSaleLog::TYPE_SHOP,
|
||||
AfterSaleLog::SHOP_TAKE_GOODS,
|
||||
$after_sale['order_id'],
|
||||
$after_sale['id'],
|
||||
$admin_id,
|
||||
AfterSaleLog::SHOP_TAKE_GOODS
|
||||
);
|
||||
//更新订单商品为等待退款状态
|
||||
$order_goods = OrderGoods::get(['id' => $after_sale['order_goods_id']]);
|
||||
$order_goods->refund_status = OrderGoods::REFUND_STATUS_WAIT;//等待退款
|
||||
$order_goods->save();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 商家拒绝收货
|
||||
* @param $post
|
||||
* @param $admin_id
|
||||
* @author 段誉(2021/1/30 16:57)
|
||||
*/
|
||||
public static function refuseGoods($post, $admin_id)
|
||||
{
|
||||
$id = $post['id'];
|
||||
$after_sale = AfterSale::get($id);
|
||||
$after_sale->update_time = time();
|
||||
$after_sale->status = AfterSale::STATUS_REFUSE_RECEIVE_GOODS;//更新为拒绝收货状态
|
||||
$after_sale->admin_remark = isset($post['remark']) ? $post['remark'] : '';
|
||||
$after_sale->save();
|
||||
//记录日志
|
||||
AfterSaleLogLogic::record(
|
||||
AfterSaleLog::TYPE_SHOP,
|
||||
AfterSaleLog::SHOP_REFUSE_TAKE_GOODS,
|
||||
$after_sale['order_id'],
|
||||
$after_sale['id'],
|
||||
$admin_id,
|
||||
AfterSaleLog::SHOP_REFUSE_TAKE_GOODS
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 确认退款 ===> 退款
|
||||
* @param $id
|
||||
* @param $admin_id
|
||||
* @author 段誉(2021/1/30 16:57)
|
||||
* @return bool|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public static function confirm($id, $admin_id)
|
||||
{
|
||||
//售后记录状态
|
||||
$after_sale = AfterSale::get($id);
|
||||
$order = Order::get(['id' => $after_sale['order_id']]);
|
||||
$order_goods = OrderGoods::get(['id' => $after_sale['order_goods_id']]);
|
||||
|
||||
Db::startTrans();
|
||||
try {
|
||||
//更新售后为退款成功状态
|
||||
$after_sale->update_time = time();
|
||||
$after_sale->status = AfterSale::STATUS_SUCCESS_REFUND;
|
||||
$after_sale->save();
|
||||
//售后日志
|
||||
AfterSaleLogLogic::record(
|
||||
AfterSaleLog::TYPE_SHOP,
|
||||
AfterSaleLog::REFUND_SUCCESS,
|
||||
$after_sale['order_id'],
|
||||
$after_sale['id'],
|
||||
$admin_id,
|
||||
AfterSaleLog::REFUND_SUCCESS
|
||||
);
|
||||
//更新订单和订单商品状态
|
||||
OrderRefundLogic::afterSaleRefundUpdate($order, $order_goods['id'], $admin_id);
|
||||
//订单退款
|
||||
OrderRefundLogic::refund($order, $order['order_amount'], $after_sale['refund_price']);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
//增加退款失败记录
|
||||
OrderRefundLogic::addErrorRefund($order, $e->getMessage());
|
||||
//记录日志
|
||||
AfterSaleLogLogic::record(
|
||||
AfterSaleLog::TYPE_SHOP,
|
||||
AfterSaleLog::REFUND_ERROR,//退款失败
|
||||
$after_sale['order_id'],
|
||||
$after_sale['id'],
|
||||
$admin_id,
|
||||
AfterSaleLog::REFUND_ERROR,//退款失败
|
||||
$e->getMessage()
|
||||
);
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 获取商家地址
|
||||
* @author 段誉(2021/1/30 16:57)
|
||||
* @return string
|
||||
*/
|
||||
public static function getShopAddress()
|
||||
{
|
||||
$shop_province = ConfigServer::get('shop', 'province_id', '');
|
||||
$shop_city = ConfigServer::get('shop', 'city_id', '');
|
||||
$shop_district = ConfigServer::get('shop', 'district_id', '');
|
||||
$shop_address = ConfigServer::get('shop', 'address', '');
|
||||
$shop_contact = ConfigServer::get('shop', 'contact', '');
|
||||
$shop_mobile = ConfigServer::get('shop', 'mobile', '');
|
||||
$shop_address = AreaServer::getAddress([$shop_province, $shop_city, $shop_district], $shop_address);
|
||||
return $shop_address.'('.$shop_contact.','.$shop_mobile.')';
|
||||
}
|
||||
|
||||
}
|
117
application/admin/logic/ArticleCategoryLogic.php
Normal file
117
application/admin/logic/ArticleCategoryLogic.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?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\ArticleCategory;
|
||||
use think\Db;
|
||||
|
||||
class ArticleCategoryLogic
|
||||
{
|
||||
public static function lists($get)
|
||||
{
|
||||
$where = [];
|
||||
$where[] = ['del', '=', '0'];
|
||||
|
||||
$article_category = new ArticleCategory();
|
||||
$count = $article_category->where($where)->count();
|
||||
$list = $article_category->where($where)->page($get['page'], $get['limit'])->select();
|
||||
|
||||
foreach ($list as &$item) {
|
||||
$item['create_time'] = date('Y-m-d H:i:s', $item['create_time']);
|
||||
if ($item['is_show'] == 1) {
|
||||
$item['is_show_text'] = '启用';
|
||||
} else {
|
||||
$item['is_show_text'] = '停用';
|
||||
}
|
||||
}
|
||||
return ['count' => $count, 'lists' => $list];
|
||||
}
|
||||
|
||||
/**
|
||||
* Desc: 添加文章分类
|
||||
* @param $post array 文章分类数据
|
||||
* @return boolean
|
||||
*/
|
||||
public static function addArticleCategory($post)
|
||||
{
|
||||
$article_category = new ArticleCategory();
|
||||
$data = [
|
||||
'name' => $post['name'],
|
||||
'is_show' => $post['is_show'],
|
||||
'create_time' => time(),
|
||||
];
|
||||
return $article_category->save($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Desc: 编辑文章分类
|
||||
* @param $post array 文章分类数据
|
||||
* @return boolean
|
||||
*/
|
||||
public static function editArticleCategory($post)
|
||||
{
|
||||
$article_category = new ArticleCategory();
|
||||
$data = [
|
||||
'name' => $post['name'],
|
||||
'is_show' => $post['is_show'],
|
||||
'update_time' => time(),
|
||||
];
|
||||
return $article_category->save($data, ['id' => $post['id'], 'del' => 0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Desc: 删除文章分类
|
||||
* @param $id int 文章分类id
|
||||
* @return boolean
|
||||
*/
|
||||
public static function delArticleCategory($id)
|
||||
{
|
||||
$article_category = new ArticleCategory();
|
||||
$data = [
|
||||
'update_time' => time(),
|
||||
'del' => 1,
|
||||
];
|
||||
return $article_category->save($data, ['id' => $id, 'del' => 0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Desc: 获取单条文章分类
|
||||
* @param $id int 文章分类id
|
||||
* @return boolean
|
||||
*/
|
||||
public static function getArticleCategory($id = 0)
|
||||
{
|
||||
$where[] = ['del', '=', 0];
|
||||
if ($id) {
|
||||
$where[] = ['id', '=', $id];
|
||||
}
|
||||
$article_category = new ArticleCategory();
|
||||
return $article_category->where($where)->column('*', 'id');
|
||||
}
|
||||
|
||||
public static function switchStatus($post)
|
||||
{
|
||||
$data = [
|
||||
'is_show' => $post['is_show'],
|
||||
'update_time' => time(),
|
||||
];
|
||||
return Db::name('article_category')->where(['del' => 0, 'id' => $post['id']])->update($data);
|
||||
}
|
||||
}
|
137
application/admin/logic/ArticleLogic.php
Normal file
137
application/admin/logic/ArticleLogic.php
Normal file
@ -0,0 +1,137 @@
|
||||
<?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\Article;
|
||||
use app\common\server\UrlServer;
|
||||
use think\Db;
|
||||
|
||||
class ArticleLogic
|
||||
{
|
||||
|
||||
public static function lists($get, $category)
|
||||
{
|
||||
$article = Db::name('article');
|
||||
|
||||
$where = [];
|
||||
$where[] = ['del', '=', '0'];
|
||||
if (isset($get['is_notice']) && $get['is_notice'] != '') {
|
||||
$where[] = ['is_notice', '=', $get['is_notice']];
|
||||
}
|
||||
|
||||
if (isset($get['title']) && $get['title']) {
|
||||
$where[] = ['title', 'like', '%' . $get['title'] . '%'];
|
||||
}
|
||||
|
||||
if (isset($get['cid']) && $get['cid']) {
|
||||
$where[] = ['cid', '=', $get['cid']];
|
||||
}
|
||||
|
||||
|
||||
$count = $article->where($where)->count();
|
||||
$list = $article->where($where)->page($get['page'], $get['limit'])->order('id desc')->select();
|
||||
foreach ($list as &$item) {
|
||||
$item['image'] = UrlServer::getFileUrl($item['image']);
|
||||
$item['create_time'] = date('Y-m-d H:i:s', $item['create_time']);
|
||||
if (isset($category[$item['cid']])) {
|
||||
$item['cat_name'] = $category[$item['cid']]['name'];
|
||||
}
|
||||
if ($item['is_show'] == 1) {
|
||||
$item['is_show_text'] = '显示';
|
||||
} else {
|
||||
$item['is_show_text'] = '隐藏';
|
||||
}
|
||||
|
||||
if ($item['is_notice'] == 1) {
|
||||
$item['is_notice'] = '是';
|
||||
|
||||
} else if ($item['is_notice'] == 0) {
|
||||
$item['is_notice'] = '否';
|
||||
}
|
||||
}
|
||||
return ['count' => $count, 'lists' => $list];
|
||||
}
|
||||
|
||||
|
||||
public static function addArticle($post)
|
||||
{
|
||||
$article = new Article();
|
||||
|
||||
$data = [
|
||||
'title' => $post['title'],
|
||||
'cid' => $post['cid'],
|
||||
'image' => $post['image'],
|
||||
'content' => $post['content'],
|
||||
'is_show' => $post['is_show'],
|
||||
'is_notice' => $post['is_notice'],
|
||||
'create_time' => time(),
|
||||
'sort' => $post['sort'],
|
||||
'synopsis' => $post['synopsis']
|
||||
];
|
||||
return $article->save($data);
|
||||
}
|
||||
|
||||
public static function editArticle($post)
|
||||
{
|
||||
$article = new Article();
|
||||
$data = [
|
||||
'title' => $post['title'],
|
||||
'cid' => $post['cid'],
|
||||
'image' => $post['image'],
|
||||
'content' => $post['content'],
|
||||
'is_show' => $post['is_show'],
|
||||
'is_notice' => $post['is_notice'],
|
||||
'update_time' => time(),
|
||||
'sort' => $post['sort'],
|
||||
'synopsis' => $post['synopsis']
|
||||
|
||||
];
|
||||
return $article->save($data, ['id' => $post['id'], 'del' => 0]);
|
||||
}
|
||||
|
||||
public static function getArticle($id)
|
||||
{
|
||||
$article = new Article();
|
||||
$detail = $article::get(['id' => $id, 'del' => 0]);
|
||||
$detail['abs_image'] = UrlServer::getFileUrl($detail['image']);
|
||||
return $detail;
|
||||
}
|
||||
|
||||
public static function delArticle($id)
|
||||
{
|
||||
$article = new Article();
|
||||
|
||||
$data = [
|
||||
'del' => 1,
|
||||
'update_time' => time()
|
||||
];
|
||||
return $article->save($data, ['id' => $id, 'del' => 0]);
|
||||
}
|
||||
|
||||
public static function switchStatus($post)
|
||||
{
|
||||
$data = [
|
||||
'is_show' => $post['is_show'],
|
||||
'update_time' => time(),
|
||||
];
|
||||
return Db::name('article')->where(['del' => 0, 'id' => $post['id']])->update($data);
|
||||
}
|
||||
|
||||
}
|
243
application/admin/logic/AuthLogic.php
Normal file
243
application/admin/logic/AuthLogic.php
Normal 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\logic;
|
||||
|
||||
|
||||
use think\Db;
|
||||
|
||||
class AuthLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public static function lists()
|
||||
{
|
||||
$lists = Db::name('dev_auth')
|
||||
->where(['del' => 0])
|
||||
->field(['id', 'type', 'system', 'pid', 'name', 'sort', 'icon', 'uri', 'disable'])
|
||||
->order(['sort' => 'desc', 'type' => 'asc'])
|
||||
->select();
|
||||
$pids = Db::name('dev_auth')
|
||||
->where(['del'=>0,'type'=>1])
|
||||
->column('pid');
|
||||
foreach ($lists as $k => $v) {
|
||||
$lists[$k]['type_str'] = $v['type'] == 1 ? '菜单' : '权限';
|
||||
$lists[$k]['open'] = in_array($v['id'],$pids) ? true : false;
|
||||
}
|
||||
return linear_to_tree($lists);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单信息
|
||||
* @param $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($id)
|
||||
{
|
||||
return Db::name('dev_auth')
|
||||
->where(['del' => 0, 'id' => $id])
|
||||
->field(['id', 'pid', 'type', 'name', 'sort', 'icon', 'uri', 'disable'])
|
||||
->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单选项
|
||||
* @param string $id 当前编辑菜单id(选项不包含该菜单的子菜单)
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public static function chooseMenu($id = '')
|
||||
{
|
||||
$lists = Db::name('dev_auth')
|
||||
->field(['id', 'pid', 'name'])
|
||||
->where(['del' => 0, 'type' => 1])
|
||||
->select();
|
||||
if ($id) {
|
||||
$remove_ids = self::getChildIds($lists, $id);
|
||||
$remove_ids[] = $id;
|
||||
foreach ($lists as $key => $row) {
|
||||
if (in_array($row['id'], $remove_ids)) {
|
||||
unset($lists[$key]);
|
||||
}
|
||||
}
|
||||
$lists = array_values($lists);
|
||||
}
|
||||
return multilevel_linear_sort($lists, '|-');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子类id
|
||||
* @param $lists
|
||||
* @param $id
|
||||
* @return array
|
||||
*/
|
||||
private static function getChildIds($lists, $id)
|
||||
{
|
||||
$ids = [];
|
||||
foreach ($lists as $key => $row) {
|
||||
if ($row['pid'] == $id) {
|
||||
$ids[] = $row['id'];
|
||||
$child_ids = self::getChildIds($lists, $row['id']);
|
||||
foreach ($child_ids as $child_id) {
|
||||
$ids[] = $child_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加菜单
|
||||
* @param $post
|
||||
* @return int|string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public static function addMenu($post)
|
||||
{
|
||||
if ($post['type'] == 1) {
|
||||
$level = self::getParent($post['pid']);
|
||||
if ($level >= 3) {
|
||||
return '菜单不允许超出三级';
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
'pid' => $post['pid'],
|
||||
'type' => $post['type'],
|
||||
'name' => $post['name'],
|
||||
'icon' => $post['icon'],
|
||||
'sort' => $post['sort'],
|
||||
'uri' => $post['uri'],
|
||||
'disable' => $post['disable'],
|
||||
'create_time' => time(),
|
||||
];
|
||||
return Db::name('dev_auth')->insert($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 查找层级
|
||||
* @param $pid
|
||||
* @author 张无忌(2021/2/6 11:08)
|
||||
* @return int
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public static function getParent($pid)
|
||||
{
|
||||
static $count = 0;
|
||||
$auth = Db::name('dev_auth')->where(['id' => $pid])->find();
|
||||
if ($auth) {
|
||||
$count += 1;
|
||||
if ($count < 3) {
|
||||
self::getParent($auth['pid']);
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新菜单
|
||||
* @param $post
|
||||
* @return int|string
|
||||
* @throws \think\Exception
|
||||
* @throws \think\exception\PDOException
|
||||
*/
|
||||
public static function updateMenu($post)
|
||||
{
|
||||
if ($post['type'] == 1) {
|
||||
$level = self::getParent($post['pid']);
|
||||
if ($level >= 3) {
|
||||
return '菜单不允许超出三级';
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
'pid' => $post['pid'],
|
||||
'type' => $post['type'],
|
||||
'name' => $post['name'],
|
||||
'icon' => $post['icon'],
|
||||
'sort' => $post['sort'],
|
||||
'uri' => $post['uri'],
|
||||
'disable' => $post['disable'],
|
||||
'update_time' => time(),
|
||||
];
|
||||
return Db::name('dev_auth')
|
||||
->where(['id' => $post['id'], 'system' => 0])
|
||||
->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置菜单状态
|
||||
* @param $post
|
||||
* @return int|string
|
||||
* @throws \think\Exception
|
||||
* @throws \think\exception\PDOException
|
||||
*/
|
||||
public static function setStatus($post)
|
||||
{
|
||||
$data = [
|
||||
'disable' => $post['disable'],
|
||||
'update_time' => time(),
|
||||
];
|
||||
return Db::name('dev_auth')
|
||||
->where(['id' => $post['id'], 'system' => 0])
|
||||
->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
* @param $ids
|
||||
* @return int|string
|
||||
* @throws \think\Exception
|
||||
* @throws \think\exception\PDOException
|
||||
*/
|
||||
public static function delMenu($ids)
|
||||
{
|
||||
$lists = Db::name('dev_auth')
|
||||
->where(['del' => 0])
|
||||
->field(['id', 'pid', 'name', 'sort', 'icon', 'disable'])
|
||||
->select();
|
||||
$del_ids = $ids;
|
||||
foreach ($ids as $id) {
|
||||
$temp = self::getChildIds($lists, $id);
|
||||
$del_ids = array_merge($del_ids, $temp);
|
||||
}
|
||||
return Db::name('dev_auth')
|
||||
->where('id', 'in', $del_ids)
|
||||
->where(['del' => 0, 'system' => 0])
|
||||
->update(['del' => 1]);
|
||||
}
|
||||
|
||||
}
|
533
application/admin/logic/BargainLogic.php
Normal file
533
application/admin/logic/BargainLogic.php
Normal file
@ -0,0 +1,533 @@
|
||||
<?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\Bargain;
|
||||
use app\common\model\BargainItem;
|
||||
use app\common\model\BargainKnife;
|
||||
use app\common\model\BargainLaunch;
|
||||
use app\common\model\Goods as GoodsModel;
|
||||
use app\common\model\Order;
|
||||
use app\common\model\TeamActivity as TeamActivityModel;
|
||||
use app\common\model\User;
|
||||
use app\common\server\UrlServer;
|
||||
use think\Db;
|
||||
|
||||
class BargainLogic
|
||||
{
|
||||
protected static $error; //错误信息
|
||||
|
||||
/**
|
||||
* Notes: 错误错误信息
|
||||
* @author 张无忌(2021/1/12 16:01)
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getError()
|
||||
{
|
||||
return self::$error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 砍价活动列表
|
||||
* @param $get
|
||||
* @author 张无忌(2021/2/24 11:11)
|
||||
* @return array
|
||||
*/
|
||||
public static function activity($get) {
|
||||
|
||||
$where = [
|
||||
['del', '=', 0]
|
||||
];
|
||||
|
||||
// 查询条件
|
||||
if ( !empty($get['goods_name']) and $get['goods_name'] !== '') {
|
||||
$goodsModel = new GoodsModel();
|
||||
$ids = $goodsModel->field('id,name')->where([
|
||||
['name', 'like', '%' . $get['goods_name'] . '%']
|
||||
])->column('id');
|
||||
|
||||
$where[] = ['goods_id', 'in', $ids];
|
||||
}
|
||||
|
||||
if (isset($get['status']) and is_numeric($get['status'])) {
|
||||
$where[] = ['status', '=', (int)$get['status']];
|
||||
}
|
||||
|
||||
$bargainModel = new Bargain();
|
||||
$count = $bargainModel->where($where)->count('id');
|
||||
$lists = $bargainModel->field(true)
|
||||
->where($where)
|
||||
->with(['goods'])
|
||||
->withCount(['launchPeopleNumber', 'successKnifePeopleNumber'])
|
||||
->page($get['page'], $get['limit'])
|
||||
->select();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['goods']['image'] = UrlServer::getFileUrl($item['goods']['image']);
|
||||
$item['activity_start_time'] = date('Y-m-d H:i:s', $item['activity_start_time']);
|
||||
$item['activity_end_time'] = date('Y-m-d H:i:s', $item['activity_end_time']);
|
||||
}
|
||||
|
||||
return ['count'=>$count, 'lists'=>$lists];
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 获取砍价活动详细
|
||||
* @param $id
|
||||
* @author 张无忌(2021/2/24 11:11)
|
||||
* @return Bargain
|
||||
*/
|
||||
public static function getDetail($id)
|
||||
{
|
||||
$bargainModel = new Bargain();
|
||||
$bargainItemModel = new BargainItem();
|
||||
|
||||
$detail = $bargainModel->field(true)
|
||||
->where(['id'=>(int)$id])
|
||||
->with(['goods'])
|
||||
->find();
|
||||
|
||||
$goodItem = $bargainItemModel->field('t.*,gi.id as spec_item_id,
|
||||
gi.spec_value_str, gi.price as spec_item_price, gi.stock')
|
||||
->where(['bargain_id'=>(int)$id])
|
||||
->alias('t')
|
||||
->rightJoin('goods_item gi', 'gi.id = t.item_id')
|
||||
->select();
|
||||
|
||||
$detail['min_knife_price'] = 0;
|
||||
$detail['max_knife_price'] = 0;
|
||||
$detail['fixed_knife_price'] = 0;
|
||||
if ($detail['knife_type'] == 1) {
|
||||
$knife_price_arr = explode(',', $detail['knife_price']);
|
||||
$detail['min_knife_price'] = empty($knife_price_arr[0]) ? 0 : $knife_price_arr[0];
|
||||
$detail['max_knife_price'] = empty($knife_price_arr[1]) ? 0 : $knife_price_arr[1];
|
||||
} else {
|
||||
$detail['fixed_knife_price'] = $detail['knife_price'];
|
||||
}
|
||||
|
||||
// 处理判断商品规格是否已发生变化, 没变化是true, 否则false
|
||||
$detail['is_goods_item'] = true;
|
||||
foreach ($goodItem as $item) {
|
||||
if (!$item['spec_value_str'] || $item['spec_value_str'] == ''
|
||||
|| $item['spec_item_price'] == '') {
|
||||
$detail['is_goods_item'] = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$detail['item'] = $goodItem;
|
||||
$detail['goods']['image'] = UrlServer::getFileUrl($detail['goods']['image']);
|
||||
$detail['activity_start_time'] = date('Y-m-d H:i:s', $detail['activity_start_time']);
|
||||
$detail['activity_end_time'] = date('Y-m-d H:i:s', $detail['activity_end_time']);
|
||||
|
||||
return $detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 新增砍价活动
|
||||
* @param $post
|
||||
* @author 张无忌(2021/2/23 15:46)
|
||||
* @return bool
|
||||
*/
|
||||
public static function add($post)
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
// 校验拼团活动是否存在
|
||||
$teamActivityModel = new TeamActivityModel();
|
||||
$team = $teamActivityModel->where([
|
||||
'goods_id' => intval($post['goods_id']),
|
||||
'del' => 0
|
||||
])->find();
|
||||
|
||||
if ($team) {
|
||||
static::$error = '商品正在参与拼团活动, 请先移除活动再添加';
|
||||
return false;
|
||||
}
|
||||
|
||||
//秒杀验证
|
||||
$seckill_goods = Db::name('seckill_goods')
|
||||
->where(['goods_id'=>intval($post['goods_id']),'del'=>0])
|
||||
->find();
|
||||
if($seckill_goods){
|
||||
static::$error = '商品正在参与秒杀活动,无法修改';
|
||||
return false;
|
||||
}
|
||||
|
||||
// 每刀金额(随机 / 固定)
|
||||
$knife_price = 0;
|
||||
if ($post['knife_type'] == 1) {
|
||||
$knife_price = [$post['min_knife_price'], $post['max_knife_price']];
|
||||
$knife_price = implode(',', $knife_price);
|
||||
} else {
|
||||
$knife_price = $post['fixed_knife_price'];
|
||||
}
|
||||
|
||||
// 查出最大低价和最少价格
|
||||
$bargain_price = [];
|
||||
foreach ($post['floor_price'] as $key => $value) {
|
||||
foreach ($value as $K => $item) {
|
||||
array_push($bargain_price, $item);
|
||||
}
|
||||
}
|
||||
$bargain_max_price = !empty($bargain_price) ? max($bargain_price) : 0;
|
||||
$bargain_min_price = !empty($bargain_price) ? min($bargain_price) : 0;
|
||||
|
||||
// 新增砍价活动
|
||||
$bargainModel = new Bargain();
|
||||
$bargain_id = $bargainModel->insertGetId([
|
||||
'goods_id' => $post['goods_id'],
|
||||
'time_limit' => $post['time_limit'],
|
||||
'activity_start_time' => strtotime($post['activity_start_time']),
|
||||
'activity_end_time' => strtotime($post['activity_end_time']),
|
||||
'bargain_min_price' => $bargain_min_price,
|
||||
'bargain_max_price' => $bargain_max_price,
|
||||
'share_title' => empty($post['share_title']) ? '' : $post['share_title'],
|
||||
'share_intro' => empty($post['share_intro']) ? '' : $post['share_intro'],
|
||||
'payment_where' => $post['payment_where'],
|
||||
'knife_type' => $post['knife_type'],
|
||||
'knife_price' => $knife_price,
|
||||
'status' => $post['status'],
|
||||
'del' => 0,
|
||||
]);
|
||||
|
||||
// 新增砍价商品SKU
|
||||
$lists = [];
|
||||
foreach ($post['floor_price'] as $key => $value) {
|
||||
foreach ($value as $K => $item) {
|
||||
$lists[] = [
|
||||
'bargain_id' => $bargain_id,
|
||||
'goods_id' => $key,
|
||||
'item_id' => $K,
|
||||
'floor_price' => $item,
|
||||
'first_knife_price' => $post['first_knife_price'][$key][$K]
|
||||
];
|
||||
}
|
||||
}
|
||||
if ( !empty($lists)) {
|
||||
$bargainItemModel = new BargainItem();
|
||||
$bargainItemModel->saveAll($lists);
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
static::$error = $e->getMessage();
|
||||
Db::rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 编辑砍价活动
|
||||
* @param $post
|
||||
* @author 张无忌(2021/2/24 11:10)
|
||||
* @return bool
|
||||
*/
|
||||
public static function edit($post)
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
// 查询商品信息
|
||||
$goodsModel = new GoodsModel();
|
||||
$goods = $goodsModel->field('id,name,image')
|
||||
->where(['id' => (int)$post['goods_id']])->find();
|
||||
|
||||
if (!$goods) {
|
||||
static::$error = '选择的商品已不存在,可能已被删除';
|
||||
return false;
|
||||
}
|
||||
|
||||
// 每刀金额(随机 / 固定)
|
||||
$knife_price = 0;
|
||||
if ($post['knife_type'] == 1) {
|
||||
$knife_price = [$post['min_knife_price'], $post['max_knife_price']];
|
||||
$knife_price = implode(',', $knife_price);
|
||||
} else {
|
||||
$knife_price = $post['fixed_knife_price'];
|
||||
}
|
||||
|
||||
// 查出最大低价和最少价格
|
||||
$bargain_price = [];
|
||||
foreach ($post['floor_price'] as $key => $value) {
|
||||
foreach ($value as $K => $item) {
|
||||
array_push($bargain_price, $item);
|
||||
}
|
||||
}
|
||||
$bargain_max_price = !empty($bargain_price) ? max($bargain_price) : 0;
|
||||
$bargain_min_price = !empty($bargain_price) ? min($bargain_price) : 0;
|
||||
|
||||
// 新增砍价活动
|
||||
$bargainModel = new Bargain();
|
||||
$bargainModel->where(['id' => (int)$post['id']])->update([
|
||||
'goods_id' => $post['goods_id'],
|
||||
'time_limit' => $post['time_limit'],
|
||||
'activity_start_time' => strtotime($post['activity_start_time']),
|
||||
'activity_end_time' => strtotime($post['activity_end_time']),
|
||||
'bargain_min_price' => $bargain_min_price,
|
||||
'bargain_max_price' => $bargain_max_price,
|
||||
'share_title' => empty($post['share_title']) ? '' : $post['share_title'],
|
||||
'share_intro' => empty($post['share_intro']) ? '' : $post['share_intro'],
|
||||
'payment_where' => $post['payment_where'],
|
||||
'knife_type' => $post['knife_type'],
|
||||
'knife_price' => $knife_price,
|
||||
'status' => $post['status']
|
||||
]);
|
||||
|
||||
// 删除旧的SKU
|
||||
$bargainItemModel = new BargainItem();
|
||||
$bargainItemModel->where(['bargain_id' => (int)$post['id']])->delete();
|
||||
|
||||
// 新增砍价商品SKU
|
||||
$lists = [];
|
||||
foreach ($post['floor_price'] as $key => $value) {
|
||||
foreach ($value as $K => $item) {
|
||||
$lists[] = [
|
||||
'bargain_id' => $post['id'],
|
||||
'goods_id' => $key,
|
||||
'item_id' => $K,
|
||||
'floor_price' => $item,
|
||||
'first_knife_price' => $post['first_knife_price'][$key][$K]
|
||||
];
|
||||
}
|
||||
}
|
||||
if (!empty($lists)) {
|
||||
$bargainItemModel->saveAll($lists);
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
static::$error = $e->getMessage();
|
||||
Db::rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 软删除
|
||||
* @param int $id
|
||||
* @author 张无忌(2021/1/13 18:02)
|
||||
* @return bool
|
||||
*/
|
||||
public static function softDelete(int $id)
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$bargainModel = new Bargain();
|
||||
$bargainModel->where(['id'=>(int)$id])->update(['del'=>1]);
|
||||
|
||||
// 关闭活动未完成的
|
||||
$bargainLaunchModel = new BargainLaunch();
|
||||
$bargainLaunchModel->where(['bargain_id'=>$id, 'status'=>0])
|
||||
->update(['status'=>2]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
static::$error = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 切换状态
|
||||
* @param $post
|
||||
* @author 张无忌(2021/1/13 17:53)
|
||||
* @return bool
|
||||
*/
|
||||
public static function switchStatus($post)
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$bargainModel = new Bargain();
|
||||
// 切换状态
|
||||
$bargainModel->where(['id' => (int)$post['id']])
|
||||
->update([ $post['field'] => $post['status'] ]);
|
||||
// 关闭活动未完成的
|
||||
// if ($post['status']) {
|
||||
$bargainLaunchModel = new BargainLaunch();
|
||||
// $bargainLaunchModel->where(['bargain_id'=>$post['id'], 'status'=>0])
|
||||
// ->update(['status'=>2]);
|
||||
// }
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
static::$error = $e->getMessage();
|
||||
Db::rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 砍价列表
|
||||
* @param $get
|
||||
* @author 张无忌(2021/2/24 17:43)
|
||||
* @return array
|
||||
*/
|
||||
public static function getLaunch($get)
|
||||
{
|
||||
// 查询条件
|
||||
$where = [];
|
||||
|
||||
if (isset($get['bargain_id']) and $get['bargain_id']) {
|
||||
$where[] = ['bargain_id', '=', (int)$get['bargain_id']];
|
||||
}
|
||||
|
||||
if (isset($get['goods_name']) and $get['goods_name'] !== '') {
|
||||
$goodsModel = new GoodsModel();
|
||||
$ids = $goodsModel->field('id,name')->where([
|
||||
['name', 'like', '%' . $get['goods_name'] . '%']
|
||||
])->column('id');
|
||||
|
||||
$where[] = ['goods_id', 'in', $ids];
|
||||
}
|
||||
|
||||
if (isset($get['status']) and is_numeric($get['status'])) {
|
||||
$where[] = ['status', '=', (int)$get['status']];
|
||||
}
|
||||
|
||||
if (isset($get['launch_start_time']) and $get['launch_start_time'] !== '') {
|
||||
$where[] = ['launch_start_time', '>=', strtotime($get['launch_start_time'])];
|
||||
}
|
||||
|
||||
if (isset($get['launch_end_time']) and $get['launch_end_time'] !== '') {
|
||||
$where[] = ['launch_end_time', '<=', strtotime($get['launch_end_time'])];
|
||||
}
|
||||
|
||||
if (isset($get['type']) and $get['type'] !== '') {
|
||||
if (isset($get['keyword']) and $get['keyword'] !== '') {
|
||||
switch ($get['type']) {
|
||||
case 'sn':
|
||||
$uid = User::where('sn', '=', $get['keyword'])->column('id');
|
||||
$where[] = ['user_id', 'in', $uid];
|
||||
break;
|
||||
case 'nickname':
|
||||
$uid = User::where('nickname', 'like', '%' . $get['keyword'] . '%')->column('id');
|
||||
$where[] = ['user_id', 'in', $uid];
|
||||
break;
|
||||
case 'mobile':
|
||||
$uid = User::where('mobile', '=', $get['keyword'])->column('id');
|
||||
$where[] = ['user_id', 'in', $uid];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$model = new BargainLaunch();
|
||||
$count = $model->where($where)->count('id');
|
||||
$lists = $model->field(true)
|
||||
->where($where)
|
||||
->with(['user.level'])
|
||||
->order('id', 'desc')
|
||||
->page($get['page'], $get['limit'])
|
||||
->select();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['launch_start_time'] = date('Y-m-d H:i:s', $item['launch_start_time']);
|
||||
$item['launch_end_time'] = date('Y-m-d H:i:s', $item['launch_end_time']);
|
||||
$item['domain'] = UrlServer::getFileUrl('/');
|
||||
$item['status'] = BargainLaunch::getStatusDesc($item['status']);
|
||||
$item['goods_image'] = $item['goods_snap']['image'] == "" ? $item['goods_snap']['goods_iamge'] : $item['goods_snap']['image'] ;
|
||||
}
|
||||
|
||||
return ['count'=>$count, 'lists'=>$lists];
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 砍价详细
|
||||
* @param $id
|
||||
* @author 张无忌(2021/2/24 17:43)
|
||||
* @return array
|
||||
*/
|
||||
public static function getLaunchDetail($id)
|
||||
{
|
||||
$model = new BargainLaunch();
|
||||
$detail = $model->field(true)
|
||||
->where(['id'=>(int)$id])
|
||||
->with(['user.level'])
|
||||
->find()->toArray();
|
||||
|
||||
$detail['domain'] = UrlServer::getFileUrl();
|
||||
$detail['goods_snap']['goods_iamge'] = UrlServer::getFileUrl($detail['goods_snap']['goods_iamge']);
|
||||
$detail['launch_start_time'] = date('Y-m-d H:i:s', $detail['launch_start_time']);
|
||||
$detail['launch_end_time'] = date('Y-m-d H:i:s', $detail['launch_end_time']);
|
||||
$detail['payment_where'] = $detail['bargain_snap']['payment_where'] == 1 ? '任意金额购买' : '固定金额购买';
|
||||
$detail['status'] = BargainLaunch::getStatusDesc($detail['status']);
|
||||
return $detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 砍价订单
|
||||
* @param $launch_id
|
||||
* @param $get
|
||||
* @author 张无忌(2021/2/24 17:43)
|
||||
* @return array
|
||||
*/
|
||||
public static function getKnifeOrderRecord($launch_id, $get)
|
||||
{
|
||||
$model = new BargainLaunch();
|
||||
$count = $model->where(['id'=>(int)$launch_id])
|
||||
->where('order_id', '>', 0)->count('id');
|
||||
$lists = $model->field(true)
|
||||
->where(['id'=>(int)$launch_id])
|
||||
->where('order_id', '>', 0)
|
||||
->with(['user.level', 'order'])
|
||||
->page($get['page'], $get['limit'])
|
||||
->select();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['order_status'] = Order::getOrderStatus($item['order']['order_status']);
|
||||
}
|
||||
|
||||
return ['count'=>$count, 'lists'=>$lists];
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 砍价记录
|
||||
* @param $launch_id
|
||||
* @param $get
|
||||
* @author 张无忌(2021/2/24 15:48)
|
||||
* @return array
|
||||
*/
|
||||
public static function getKnifeRecord($launch_id, $get)
|
||||
{
|
||||
$model = new BargainKnife();
|
||||
|
||||
$count = $model->where(['launch_id'=>(int)$launch_id])->count();
|
||||
$lists = $model->field(true)
|
||||
->where(['launch_id'=>(int)$launch_id])
|
||||
->with(['user.level'])
|
||||
->page($get['page'], $get['limit'])
|
||||
->select();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['help_time'] = date('Y-m-d H:i:s', $item['help_time']);
|
||||
$item['help_price'] = '¥'.$item['help_price'];
|
||||
$item['surplus_price'] = '¥'.$item['surplus_price'];
|
||||
}
|
||||
|
||||
return ['count'=>$count, 'lists'=>$lists];
|
||||
}
|
||||
}
|
117
application/admin/logic/CommonLogic.php
Normal file
117
application/admin/logic/CommonLogic.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?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 CommonLogic{
|
||||
/**
|
||||
* note 修改制定表的某个字段
|
||||
* author cjh 2020/10/14 14:51
|
||||
* @param $table 表名
|
||||
* @param $pk_name id
|
||||
* @param $pk_value id的值
|
||||
* @param $field 需要修改的字段
|
||||
* @param $field_value 需要修改的值
|
||||
* @return bool
|
||||
* @throws \think\Exception
|
||||
* @throws \think\exception\PDOException
|
||||
*/
|
||||
public static function changeTableValue($table,$pk_name,$pk_value,$field,$field_value){
|
||||
//允许修改的字段
|
||||
$allow_field = [
|
||||
'is_show','sort','status','is_new','is_best','is_like','is_recommend'
|
||||
];
|
||||
if(!in_array($field,$allow_field)){
|
||||
return false;
|
||||
}
|
||||
if(is_array($pk_value)){
|
||||
$where[] = [$pk_name,'in',$pk_value];
|
||||
}else{
|
||||
$where[] = [$pk_name,'=',$pk_value];
|
||||
}
|
||||
|
||||
$data= [
|
||||
$field => $field_value,
|
||||
'update_time' => time(),
|
||||
];
|
||||
|
||||
if ($field == 'status' and $field_value == 0) {
|
||||
$res = Db::name('team_activity')
|
||||
->where(['goods_id'=>$pk_value])
|
||||
->find();
|
||||
if ($res) {
|
||||
return '该商品正在参与拼团,请先关闭后才允许下架';
|
||||
}
|
||||
}
|
||||
|
||||
$result = Db::name($table)->where($where)->update($data);
|
||||
return $result ? true : '修改失败';
|
||||
}
|
||||
|
||||
//获取商品列表
|
||||
public static function getGoodsList($get,$is_item = false){
|
||||
$where = [];
|
||||
$where[] = ['del', '=', '0'];
|
||||
$where[] = ['status','=',1];
|
||||
|
||||
if (isset($get['keyword']) && $get['keyword']) {
|
||||
$where[] = ['name', 'like', '%' . $get['keyword'] . '%'];
|
||||
}
|
||||
if(isset($get['cid']) && $get['cid']){
|
||||
$where[] = ['first_category_id|second_category_id|third_category_id','=',$get['cid']];
|
||||
}
|
||||
|
||||
$goods_count = Db::name('goods')
|
||||
->where($where)
|
||||
->count();
|
||||
|
||||
$goods_list = Db::name('goods')
|
||||
->where($where)
|
||||
->page($get['page'], $get['limit'])
|
||||
->column('*','id');
|
||||
|
||||
foreach ($goods_list as &$item) {
|
||||
$item['goods_item'] = [];
|
||||
$item['price'] = '¥'.$item['min_price'];
|
||||
if($item['max_price'] != $item['min_price']){
|
||||
$item['price'] = '¥'.$item['max_price'].'~'.'¥'.$item['min_price'];
|
||||
}
|
||||
$item['create_time_desc'] = date('Y-m-d H:i:s',$item['create_time']);
|
||||
$item['image'] = UrlServer::getFileUrl($item['image']);
|
||||
}
|
||||
|
||||
if($is_item){
|
||||
$goods_ids = array_keys($goods_list);
|
||||
$goods_item = Db::name('goods_item')->where(['goods_id'=>$goods_ids])->select();
|
||||
foreach ($goods_item as $items){
|
||||
if(isset($goods_list[$items['goods_id']])){
|
||||
if($items['image']){
|
||||
$items['image'] = UrlServer::getFileUrl($items['image']);
|
||||
}else{
|
||||
$items['image'] = $goods_list[$items['goods_id']]['image'];
|
||||
}
|
||||
$goods_list[$items['goods_id']]['goods_item'][] = $items;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ['count' => $goods_count, 'list' =>array_values($goods_list)];
|
||||
}
|
||||
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user