提交服务端基础框架
This commit is contained in:
5
Server/.gitignore
vendored
Normal file
5
Server/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
.idea
|
||||
.vscode
|
||||
composer.lock
|
||||
runtime
|
||||
public/upload
|
||||
1
Server/.htaccess
Executable file
1
Server/.htaccess
Executable file
@@ -0,0 +1 @@
|
||||
|
||||
927
Server/CHANGELOG.md
Executable file
927
Server/CHANGELOG.md
Executable 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
Server/LICENSE.txt
Executable file
32
Server/LICENSE.txt
Executable file
@@ -0,0 +1,32 @@
|
||||
|
||||
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
|
||||
版权所有Copyright © 2006-2018 by ThinkPHP (http://thinkphp.cn)
|
||||
All rights reserved。
|
||||
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
|
||||
|
||||
Apache Licence是著名的非盈利开源组织Apache采用的协议。
|
||||
该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
|
||||
允许代码修改,再作为开源或商业软件发布。需要满足
|
||||
的条件:
|
||||
1. 需要给代码的用户一份Apache Licence ;
|
||||
2. 如果你修改了代码,需要在被修改的文件中说明;
|
||||
3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
|
||||
带有原来代码中的协议,商标,专利声明和其他原来作者规
|
||||
定需要包含的说明;
|
||||
4. 如果再发布的产品中包含一个Notice文件,则在Notice文
|
||||
件中需要带有本协议内容。你可以在Notice中增加自己的
|
||||
许可,但不可以表现为对Apache Licence构成更改。
|
||||
具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
180
Server/README.md
Executable file
180
Server/README.md
Executable 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
Server/application/.htaccess
Executable file
1
Server/application/.htaccess
Executable file
@@ -0,0 +1 @@
|
||||
deny from all
|
||||
72
Server/application/api/controller/BaseController.php
Normal file
72
Server/application/api/controller/BaseController.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use think\Controller;
|
||||
|
||||
class BaseController extends Controller {
|
||||
|
||||
/**
|
||||
* 令牌
|
||||
*
|
||||
* @var null
|
||||
*/
|
||||
protected $token = NULL;
|
||||
|
||||
protected function initialize() {
|
||||
parent::initialize();
|
||||
|
||||
// 允许跨域
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Methods: *');
|
||||
header('Access-Control-Allow-Headers: *');
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口调用成功 JSON
|
||||
*
|
||||
* @param null $data
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
protected function jsonSucc($data = NULL) {
|
||||
return json([
|
||||
'code' => 0,
|
||||
'msg' => '操作成功',
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口调用错误 JSON
|
||||
*
|
||||
* @param $error
|
||||
* @param int $code
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
protected function jsonFail($error, $code = 500) {
|
||||
return json([
|
||||
'code' => $code,
|
||||
'msg' => $error,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取URL
|
||||
*
|
||||
* @param $url
|
||||
* @return string
|
||||
*/
|
||||
protected function absoluteUrl($url) {
|
||||
return (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . ($url{0} === '/' ? $url : '/' . $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小数格式化
|
||||
*
|
||||
* @param $float
|
||||
* @return float
|
||||
*/
|
||||
protected function floatFormat($float) {
|
||||
return floatval($float);
|
||||
}
|
||||
}
|
||||
10
Server/application/api/controller/BaseLoginController.php
Normal file
10
Server/application/api/controller/BaseLoginController.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
class BaseLoginController extends BaseController {
|
||||
|
||||
protected function initialize() {
|
||||
parent::initialize();
|
||||
}
|
||||
}
|
||||
128
Server/application/backend/controller/BaseController.php
Executable file
128
Server/application/backend/controller/BaseController.php
Executable file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\model\UserModel;
|
||||
use app\common\model\UserTokenModel;
|
||||
use think\Controller;
|
||||
|
||||
class BaseController extends Controller {
|
||||
|
||||
/**
|
||||
* 用户对象
|
||||
*
|
||||
* @var UserModel
|
||||
*/
|
||||
protected $userModel = NULL;
|
||||
|
||||
/**
|
||||
* 令牌对象
|
||||
*
|
||||
* @var UserTokenModel
|
||||
*/
|
||||
protected $tokenModel = NULL;
|
||||
|
||||
/**
|
||||
* 令牌
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $token = '';
|
||||
|
||||
protected function initialize() {
|
||||
parent::initialize();
|
||||
// 允许跨域
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Methods: *');
|
||||
header('Access-Control-Allow-Headers: *');
|
||||
|
||||
$this->token = !empty($_SERVER['HTTP_TOKEN'])
|
||||
? trim($_SERVER['HTTP_TOKEN'])
|
||||
: trim($this->request->param('token'));
|
||||
if (!empty($this->token)) {
|
||||
$this->tokenModel = UserTokenModel::get(['token' => $this->token]);
|
||||
if (!empty($this->tokenModel)) {
|
||||
$this->userModel = UserModel::get($this->tokenModel->user_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会员JSON
|
||||
*
|
||||
* @param UserModel $model
|
||||
* @return array
|
||||
*/
|
||||
protected function userJson(UserModel $model) {
|
||||
return array_merge($model->toArray(), [
|
||||
'password' => '',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口调用成功 JSON
|
||||
*
|
||||
* @param null $data
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function jsonSucc($data = NULL) {
|
||||
return json([
|
||||
'code' => 200,
|
||||
'msg' => '操作成功',
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口调用错误 JSON
|
||||
*
|
||||
* @param $error
|
||||
* @param int $code
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function jsonFail($error, $code = 500) {
|
||||
return json([
|
||||
'code' => $code,
|
||||
'msg' => $error,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取URL
|
||||
*
|
||||
* @param $url
|
||||
* @return string
|
||||
*/
|
||||
protected function absoluteUrl($url) {
|
||||
return (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . ($url{0} === '/' ? $url : '/' . $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小数格式化
|
||||
*
|
||||
* @param $float
|
||||
* @return float
|
||||
*/
|
||||
protected function floatFormat($float) {
|
||||
return floatval($float);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联数组转列表
|
||||
*
|
||||
* @param array $assoc
|
||||
* @param string $valueKey
|
||||
* @param string $labelKey
|
||||
* @return array
|
||||
*/
|
||||
protected function assocToList(array $assoc, $valueKey = 'value', $labelKey = 'label') {
|
||||
$list = [];
|
||||
foreach ($assoc as $value => $label) {
|
||||
$list[] = [
|
||||
$valueKey => $value,
|
||||
$labelKey => $label,
|
||||
];
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
class BaseLoginController extends BaseController {
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
*/
|
||||
protected function initialize() {
|
||||
parent::initialize();
|
||||
|
||||
if (empty($this->userModel)) {
|
||||
exit($this->jsonFail('尚未登录', 401)->send());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\model\CollectProductModel;
|
||||
use app\common\model\ProductGroupModel;
|
||||
use think\db\Query;
|
||||
|
||||
class CollectProductController extends BaseLoginController {
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function index() {
|
||||
$parentId = intval($this->request->param('parent_id'));
|
||||
$type = trim($this->request->param('type'));
|
||||
$video = trim($this->request->param('video'));
|
||||
$repeat = trim($this->request->param('repeat'));
|
||||
$groupId = intval($this->request->param('group_id'));
|
||||
$status = trim($this->request->param('status'));
|
||||
$keywords = trim($this->request->param('keywords'));
|
||||
$pageNo = intval($this->request->param('page'));
|
||||
$pageSize = intval($this->request->param('pageSize'));
|
||||
if ($pageNo <= 0) {
|
||||
$pageNo = 1;
|
||||
}
|
||||
if ($pageSize <= 0) {
|
||||
$pageSize = 30;
|
||||
}
|
||||
|
||||
$query = CollectProductModel::where(1);
|
||||
if (!empty($parentId)) {
|
||||
$query->where('parent_id', $parentId);
|
||||
} else {
|
||||
$query->where('parent_id', 0);
|
||||
}
|
||||
if (isset(CollectProductModel::typeAssoc()[$type])) {
|
||||
$query->where('type', $type);
|
||||
}
|
||||
if (isset(CollectProductModel::videoAssoc()[$video])) {
|
||||
$query->where('video', $video);
|
||||
}
|
||||
if (isset(CollectProductModel::repeatAssoc()[$repeat])) {
|
||||
$query->where('repeat', $repeat);
|
||||
}
|
||||
if (isset(CollectProductModel::statusAssoc()[$status])) {
|
||||
$query->where('status', $status);
|
||||
}
|
||||
if (!empty($groupId)) {
|
||||
$query->where('group_id', $groupId);
|
||||
}
|
||||
if (!empty($keywords)) {
|
||||
$query->where(function (Query $q) use ($keywords) {
|
||||
$q->whereLike('src_url', '%' . $keywords . '%', 'OR');
|
||||
$q->whereLike('title', '%' . $keywords . '%', 'OR');
|
||||
});
|
||||
}
|
||||
|
||||
$totalCount = $query->count();
|
||||
$pageCount = $totalCount > 0 ? ceil($totalCount / $pageSize) : 1;
|
||||
if ($pageNo > $pageCount) {
|
||||
$pageNo = $pageCount;
|
||||
}
|
||||
|
||||
$query->order('id', 'DESC');
|
||||
$query->limit(($pageNo - 1) * $pageSize, $pageSize);
|
||||
|
||||
$list = [];
|
||||
foreach ($query->select() as $model) {
|
||||
$list[] = array_merge($model->toArray(), [
|
||||
'product_num' => $model->productNum(),
|
||||
'status_name' => CollectProductModel::statusAssoc()[$model->status],
|
||||
'video_name' => CollectProductModel::videoAssoc()[$model->video],
|
||||
'repeat_name' => CollectProductModel::repeatAssoc()[$model->repeat],
|
||||
'platform_name' => CollectProductModel::platformAssoc()[$model->platform],
|
||||
'mark_up_rate' => floatval($model->mark_up_rate),
|
||||
'mark_up_val' => floatval($model->mark_up_val),
|
||||
'start_time' => $model->start_time > 0 ? date('Y-m-d H:i:s', $model->start_time) : '',
|
||||
'stop_time' => $model->stop_time > 0 ? date('Y-m-d H:i:s', $model->stop_time) : '',
|
||||
'group_name' => isset(ProductGroupModel::assoc()[$model->group_id])
|
||||
? ProductGroupModel::assoc()[$model->group_id]
|
||||
: '',
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'list' => $list,
|
||||
'page' => $pageNo,
|
||||
'pageCount' => $pageCount,
|
||||
'totalCount' => $totalCount,
|
||||
'statuses' => $this->assocToList(CollectProductModel::statusAssoc()),
|
||||
'platforms' => $this->assocToList(CollectProductModel::platformAssoc()),
|
||||
'videos' => $this->assocToList(CollectProductModel::videoAssoc()),
|
||||
'repeats' => $this->assocToList(CollectProductModel::repeatAssoc()),
|
||||
'groups' => $this->assocToList(ProductGroupModel::assoc()),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function save() {
|
||||
//$id = intval($this->request->param('id'));
|
||||
$type = trim($this->request->param('type'));
|
||||
$srcUrl = trim($this->request->param('src_url'));
|
||||
$video = intval($this->request->param('video'));
|
||||
$repeat = intval($this->request->param('repeat'));
|
||||
$markUpRate = intval($this->request->param('mark_up_rate'));
|
||||
$markUpVal = intval($this->request->param('mark_up_val'));
|
||||
$groupId = intval($this->request->param('group_id'));
|
||||
if (empty($srcUrl)
|
||||
OR !isset(CollectProductModel::typeAssoc()[$type])
|
||||
OR !isset(CollectProductModel::videoAssoc()[$video])
|
||||
OR !isset(CollectProductModel::repeatAssoc()[$repeat])) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
if (!empty($id)) {
|
||||
$model = CollectProductModel::get($id);
|
||||
if (empty($model)) {
|
||||
return $this->jsonFail('对象未找到');
|
||||
}
|
||||
} else {
|
||||
$model = new CollectProductModel();
|
||||
}
|
||||
|
||||
$platform = '';
|
||||
if ($type === CollectProductModel::TYPE_PRODUCT
|
||||
AND preg_match('#^https\:\/\/www\.goofish\.com\/item#', $srcUrl)) {
|
||||
$platform = CollectProductModel::PLATFORM_XIANYU;
|
||||
} elseif ($type === CollectProductModel::TYPE_SHOP
|
||||
AND preg_match('#^https\:\/\/www\.goofish\.com\/personal#', $srcUrl)) {
|
||||
$platform = CollectProductModel::PLATFORM_XIANYU;
|
||||
} else {
|
||||
return $this->jsonFail('采集链接错误');
|
||||
}
|
||||
|
||||
$model = new CollectProductModel();
|
||||
$model->type = $type;
|
||||
$model->src_url = $srcUrl;
|
||||
$model->platform = $platform;
|
||||
$model->target = CollectProductModel::TARGET_PRODUCT;
|
||||
$model->video = $video;
|
||||
$model->repeat = $repeat;
|
||||
$model->mark_up_rate = $markUpRate;
|
||||
$model->mark_up_val = $markUpVal;
|
||||
$model->group_id = $groupId;
|
||||
$model->user_id = $this->userModel->id;
|
||||
$model->save();
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
}
|
||||
92
Server/application/backend/controller/DeviceController.php
Normal file
92
Server/application/backend/controller/DeviceController.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\model\DeviceModel;
|
||||
use think\db\Query;
|
||||
|
||||
class DeviceController extends BaseLoginController {
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function index() {
|
||||
$isOnline = intval($this->request->param('is_online'));
|
||||
$status = trim($this->request->param('status'));
|
||||
$keywords = trim($this->request->param('keywords'));
|
||||
$pageNo = intval($this->request->param('page'));
|
||||
$pageSize = intval($this->request->param('pageSize'));
|
||||
if ($pageNo <= 0) {
|
||||
$pageNo = 1;
|
||||
}
|
||||
if ($pageSize <= 0) {
|
||||
$pageSize = 30;
|
||||
}
|
||||
|
||||
$onlines = [
|
||||
1 => '在线',
|
||||
2 => '离线',
|
||||
];
|
||||
|
||||
$query = DeviceModel::where(1);
|
||||
if (isset(DeviceModel::statusAssoc()[$status])) {
|
||||
$query->where('status', $status);
|
||||
}
|
||||
|
||||
if ($isOnline == 1) {
|
||||
$query->where('is_online', DeviceModel::IS_ONLINE_YES);
|
||||
$query->where('active_time', '>=', time() - DeviceModel::ACTIVE_TIME);
|
||||
} elseif ($isOnline == 2) {
|
||||
$query->where(function (Query $q) {
|
||||
$q->whereOr('is_online', DeviceModel::IS_ONLINE_NO);
|
||||
$q->whereOr('active_time', '<', time() - DeviceModel::ACTIVE_TIME);
|
||||
});
|
||||
}
|
||||
|
||||
if (!empty($keywords)) {
|
||||
$query->where(function (Query $q) use ($keywords) {
|
||||
$q->whereLike('number', '%' . $keywords . '%', 'OR');
|
||||
$q->whereLike('ip', '%' . $keywords . '%', 'OR');
|
||||
});
|
||||
}
|
||||
|
||||
$totalCount = $query->count();
|
||||
$pageCount = $totalCount > 0 ? ceil($totalCount / $pageSize) : 1;
|
||||
if ($pageNo > $pageCount) {
|
||||
$pageNo = $pageCount;
|
||||
}
|
||||
|
||||
$query->order('id', 'DESC');
|
||||
$query->limit(($pageNo - 1) * $pageSize, $pageSize);
|
||||
|
||||
$list = [];
|
||||
foreach ($query->select() as $model) {
|
||||
$list[] = array_merge($model->toArray(), [
|
||||
'is_online' => $model->isOnline() ? 1 : 2,
|
||||
'is_online_name' => $onlines[$model->isOnline() ? 1 : 2],
|
||||
'status_name' => DeviceModel::statusAssoc()[$model->status],
|
||||
'active_time' => date('Y-m-d H:i:s', $model->active_time),
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'list' => $list,
|
||||
'page' => $pageNo,
|
||||
'pageCount' => $pageCount,
|
||||
'totalCount' => $totalCount,
|
||||
'statuses' => $this->assocToList(DeviceModel::statusAssoc()),
|
||||
'onlines' => $this->assocToList($onlines),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关联数组
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function assoc() {
|
||||
return $this->jsonSucc($this->assocToList(DeviceModel::assoc()));
|
||||
}
|
||||
}
|
||||
151
Server/application/backend/controller/DeviceStatController.php
Normal file
151
Server/application/backend/controller/DeviceStatController.php
Normal file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use think\db\Query;
|
||||
|
||||
class DeviceStatController extends BaseLoginController {
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function index() {
|
||||
$keywords = trim($this->request->param('keywords'));
|
||||
$pageNo = intval($this->request->param('page'));
|
||||
$pageSize = intval($this->request->param('pageSize'));
|
||||
if ($pageNo <= 0) {
|
||||
$pageNo = 1;
|
||||
}
|
||||
if ($pageSize <= 0) {
|
||||
$pageSize = 30;
|
||||
}
|
||||
|
||||
$query = DeviceStatModel::where(1);
|
||||
if (!empty($keywords)) {
|
||||
$query->where(function (Query $q) use ($keywords) {
|
||||
$q->whereLike('days', '%' . $keywords . '%', 'OR');
|
||||
});
|
||||
}
|
||||
|
||||
$totalCount = $query->count();
|
||||
$pageCount = $totalCount > 0 ? ceil($totalCount / $pageSize) : 1;
|
||||
if ($pageNo > $pageCount) {
|
||||
$pageNo = $pageCount;
|
||||
}
|
||||
|
||||
$query->order('id', 'DESC');
|
||||
$query->limit(($pageNo - 1) * $pageSize, $pageSize);
|
||||
|
||||
$list = [];
|
||||
if ($pageNo <= 1) {
|
||||
$num = DeviceQqModel::where(1)
|
||||
->where('create_time', '>=', 1724860800)
|
||||
->count();
|
||||
$succNum = DeviceQqModel::where(1)
|
||||
->where('create_time', '>=', 1724860800)
|
||||
->where('status', DeviceQqModel::STATUS_SUCC)
|
||||
->count();
|
||||
$rewardTotal = floatval(DeviceQqModel::where(1)
|
||||
->where('create_time', '>=', 1724860800)
|
||||
->where('status', DeviceQqModel::STATUS_SUCC)
|
||||
->sum('reward'));
|
||||
$rewardPrice = 0;
|
||||
if ($succNum > 0) {
|
||||
$rewardPrice = round($rewardTotal / $succNum, 2);
|
||||
}
|
||||
$finishTime = intval(DeviceQqModel::where(1)
|
||||
->where('create_time', '>=', 1724860800)
|
||||
->where('finish_time', '>', 0)
|
||||
->avg('finish_time'));
|
||||
$createTime = intval(DeviceQqModel::where(1)
|
||||
->where('create_time', '>=', 1724860800)
|
||||
->where('finish_time', '>', 0)
|
||||
->avg('create_time'));
|
||||
$succFinishTime = intval(DeviceQqModel::where(1)
|
||||
->where('create_time', '>=', 1724860800)
|
||||
->where('status', DeviceQqModel::STATUS_SUCC)
|
||||
->where('finish_time', '>', 0)
|
||||
->avg('finish_time'));
|
||||
$succCreateTime = intval(DeviceQqModel::where(1)
|
||||
->where('create_time', '>=', 1724860800)
|
||||
->where('status', DeviceQqModel::STATUS_SUCC)
|
||||
->where('finish_time', '>', 0)
|
||||
->avg('create_time'));
|
||||
|
||||
$succRate = $num > 0 ? round($succNum / $num * 100, 2) : 0;
|
||||
$failNum = $num - $succNum;
|
||||
$failRate = $num > 0 ? round($failNum / $num * 100, 2) : 0;
|
||||
$succFailRate = 0;
|
||||
if ($num > $succNum) {
|
||||
$succFailRate = $succNum / ($num - $succNum);
|
||||
$succFailRate = round($succFailRate * 100, 2);
|
||||
}
|
||||
|
||||
$failInfo = [];
|
||||
foreach (DeviceQqModel::where(1)
|
||||
->field('remark, COUNT(id) AS num')
|
||||
->where('create_time', '>=', 1724860800)
|
||||
->whereNotIn('status', [DeviceQqModel::STATUS_REG, DeviceQqModel::STATUS_SUCC])
|
||||
->group('remark')
|
||||
->select() as $infoModel) {
|
||||
if ($infoModel->remark) {
|
||||
|
||||
$failInfo[] = [
|
||||
'title' => $infoModel->remark,
|
||||
'num' => $infoModel->num,
|
||||
'rate' => $num > 0 ? round($infoModel->num / $num * 100, 2) : 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$list[] = [
|
||||
'days' => '合计',
|
||||
'num' => $num,
|
||||
'succ_num' => $succNum,
|
||||
'reward_price' => $rewardPrice,
|
||||
'reward_total' => $rewardTotal,
|
||||
'avg_time' => $finishTime > $createTime ? $finishTime - $createTime : 0,
|
||||
'avg_succ_time' => $succFinishTime > $succCreateTime ? $succFinishTime - $succCreateTime : 0,
|
||||
'succ_fail_rate' => $succFailRate,
|
||||
'succ_rate' => $succRate,
|
||||
'fail_num' => $failNum,
|
||||
'fail_rate' => $failRate,
|
||||
'fail_info' => $failInfo,
|
||||
];
|
||||
}
|
||||
foreach ($query->select() as $model) {
|
||||
$succRate = 0;
|
||||
$failNum = $model->num > $model->succ_num ? $model->num - $model->succ_num : 0;
|
||||
$failRate = 0;
|
||||
$succFailRate = 0;
|
||||
if ($model->num > 0) {
|
||||
$succRate = $model->succ_num / $model->num;
|
||||
$succRate = round($succRate * 100, 2);
|
||||
$failRate = $failNum / $model->num;
|
||||
$failRate = round($failRate * 100, 2);
|
||||
}
|
||||
if ($model->num > $model->succ_num) {
|
||||
$succFailRate = $model->succ_num / ($model->num - $model->succ_num);
|
||||
$succFailRate = round($succFailRate * 100, 2);
|
||||
}
|
||||
|
||||
$list[] = array_merge($model->toArray(), [
|
||||
'reward_price' => floatval($model->reward_price),
|
||||
'reward_total' => floatval($model->reward_total),
|
||||
'succ_fail_rate' => $succFailRate,
|
||||
'fail_num' => $failNum,
|
||||
'succ_rate' => $succRate,
|
||||
'fail_rate' => $failRate,
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'list' => $list,
|
||||
'page' => $pageNo,
|
||||
'pageCount' => $pageCount,
|
||||
'totalCount' => $totalCount,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\model\TaskModel;
|
||||
|
||||
class MessageReplyController extends BaseLoginController {
|
||||
|
||||
/**
|
||||
* 关闭
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function close() {
|
||||
$devices = $this->request->param('devices');
|
||||
if (empty($devices) OR !is_array($devices)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
TaskModel::where(1)
|
||||
->whereIn('device_id', $devices)
|
||||
->where('platform', TaskModel::PLATFORM_XIANYU)
|
||||
->whereIn('status', [TaskModel::STATUS_AWAIT, TaskModel::STATUS_ALLOC])
|
||||
->where('is_deleted', TaskModel::IS_DELETED_NO)
|
||||
->update([
|
||||
'is_deleted' => TaskModel::IS_DELETED_YES,
|
||||
'update_time' => time(),
|
||||
]);
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\model\ProductContentPoolModel;
|
||||
|
||||
class ProductContentPoolController extends BaseLoginController {
|
||||
|
||||
/**
|
||||
* 获取关联数组
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function assoc() {
|
||||
return $this->jsonSucc(ProductContentPoolModel::assoc());
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @return \think\response\Json
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function save() {
|
||||
$contents = $this->request->param('contents');
|
||||
if (!is_array($contents)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= 6; $i ++) {
|
||||
if (isset($contents[$i])) {
|
||||
$content = trim($contents[$i]);
|
||||
$content = trim($content, '-');
|
||||
$content = trim($content);
|
||||
if (!empty($content)) {
|
||||
$model = ProductContentPoolModel::where(1)
|
||||
->where('number', $i)
|
||||
->find();
|
||||
if (empty($model)) {
|
||||
$model = new ProductContentPoolModel();
|
||||
}
|
||||
$model->number = $i;
|
||||
$model->content = trim($content);
|
||||
$model->save();
|
||||
} else {
|
||||
ProductContentPoolModel::where(1)
|
||||
->where('number', $i)
|
||||
->delete();
|
||||
}
|
||||
} else {
|
||||
ProductContentPoolModel::where(1)
|
||||
->where('number', $i)
|
||||
->delete();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
}
|
||||
361
Server/application/backend/controller/ProductController.php
Normal file
361
Server/application/backend/controller/ProductController.php
Normal file
@@ -0,0 +1,361 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\model\ProductGroupModel;
|
||||
use app\common\model\ProductModel;
|
||||
use think\db\Query;
|
||||
|
||||
class ProductController extends BaseLoginController {
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function index() {
|
||||
$groupId = trim($this->request->param('group_id'));
|
||||
$isUsed = trim($this->request->param('is_used'));
|
||||
$keywords = trim($this->request->param('keywords'));
|
||||
$pageNo = intval($this->request->param('page'));
|
||||
$pageSize = intval($this->request->param('pageSize'));
|
||||
if ($pageNo <= 0) {
|
||||
$pageNo = 1;
|
||||
}
|
||||
if ($pageSize <= 0) {
|
||||
$pageSize = 30;
|
||||
}
|
||||
|
||||
$query = ProductModel::where(1);
|
||||
if (strlen($groupId) > 0) {
|
||||
$query->where('group_id', $groupId);
|
||||
}
|
||||
if (isset(ProductModel::isUsedAssoc()[$isUsed])) {
|
||||
$query->where('is_used', $isUsed);
|
||||
}
|
||||
if (!empty($keywords)) {
|
||||
$query->where(function (Query $q) use ($keywords) {
|
||||
$q->whereLike('title', '%' . $keywords . '%', 'OR');
|
||||
});
|
||||
}
|
||||
|
||||
$totalCount = $query->count();
|
||||
$pageCount = $totalCount > 0 ? ceil($totalCount / $pageSize) : 1;
|
||||
if ($pageNo > $pageCount) {
|
||||
$pageNo = $pageCount;
|
||||
}
|
||||
|
||||
$query->order('id', 'DESC');
|
||||
$query->limit(($pageNo - 1) * $pageSize, $pageSize);
|
||||
|
||||
$list = [];
|
||||
foreach ($query->select() as $model) {
|
||||
$images = [];
|
||||
foreach ($model->images as $image) {
|
||||
$images[] = array_merge($image, [
|
||||
'url' => $this->absoluteUrl($image['path']),
|
||||
]);
|
||||
}
|
||||
|
||||
$list[] = array_merge($model->toArray(), [
|
||||
'images' => $images,
|
||||
'is_used_name' => ProductModel::isUsedAssoc()[$model->is_used],
|
||||
'group_name' => isset(ProductGroupModel::assoc()[$model->group_id])
|
||||
? ProductGroupModel::assoc()[$model->group_id]
|
||||
: '',
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'list' => $list,
|
||||
'page' => $pageNo,
|
||||
'pageCount' => $pageCount,
|
||||
'totalCount' => $totalCount,
|
||||
'groups' => $this->assocToList(ProductGroupModel::assoc()),
|
||||
'isUseds' => $this->assocToList(ProductModel::isUsedAssoc()),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改主题
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function theme() {
|
||||
$checked = $this->request->param('checked');
|
||||
$themes = $this->request->param('themes');
|
||||
if (empty($checked)
|
||||
OR !is_array($checked)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
if (empty($themes) OR !is_array($themes)) {
|
||||
$themes = [];
|
||||
}
|
||||
|
||||
ProductModel::where(1)
|
||||
->whereIn('id', $checked)
|
||||
->update([
|
||||
'themes' => json_encode($themes, JSON_UNESCAPED_UNICODE),
|
||||
'update_time' => time(),
|
||||
]);
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改标签
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function label() {
|
||||
$checked = $this->request->param('checked');
|
||||
$labels = $this->request->param('labels');
|
||||
if (empty($checked)
|
||||
OR !is_array($checked)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
if (empty($labels) OR !is_array($labels)) {
|
||||
$labels = [];
|
||||
}
|
||||
|
||||
ProductModel::where(1)
|
||||
->whereIn('id', $checked)
|
||||
->update([
|
||||
'labels' => json_encode($labels, JSON_UNESCAPED_UNICODE),
|
||||
'update_time' => time(),
|
||||
]);
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改标题
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function title() {
|
||||
$checked = $this->request->param('checked');
|
||||
$type = intval($this->request->param('type'));
|
||||
$title = trim($this->request->param('title'));
|
||||
if (empty($checked)
|
||||
OR !is_array($checked)
|
||||
OR !in_array($type, [0, 1])
|
||||
OR empty($title)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
foreach (ProductModel::where(1)
|
||||
->whereIn('id', $checked)
|
||||
->select() as $model) {
|
||||
if ($type == 0) {
|
||||
$model->title = $model->title . $title;
|
||||
} else {
|
||||
$model->title = $title . $model->title;
|
||||
}
|
||||
$model->save();
|
||||
}
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改描述
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function content() {
|
||||
$checked = $this->request->param('checked');
|
||||
$type = intval($this->request->param('type'));
|
||||
$content = trim($this->request->param('content'));
|
||||
if (empty($checked)
|
||||
OR !is_array($checked)
|
||||
OR !in_array($type, [0, 1])
|
||||
OR empty($content)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
foreach (ProductModel::where(1)
|
||||
->whereIn('id', $checked)
|
||||
->select() as $model) {
|
||||
if ($type == 0) {
|
||||
$model->content = $model->content . "\n" . $content;
|
||||
} else {
|
||||
$model->content = $content . "\n" . $model->content;
|
||||
}
|
||||
$model->save();
|
||||
}
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改库存
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function stock() {
|
||||
$checked = $this->request->param('checked');
|
||||
$stock = intval($this->request->param('stock'));
|
||||
if (empty($checked)
|
||||
OR !is_array($checked)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
if ($stock <= 0) {
|
||||
return $this->jsonFail('库存不可小于1');
|
||||
}
|
||||
|
||||
ProductModel::where(1)
|
||||
->whereIn('id', $checked)
|
||||
->update([
|
||||
'stock' => $stock,
|
||||
'update_time' => time(),
|
||||
]);
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改价格
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function price() {
|
||||
$checked = $this->request->param('checked');
|
||||
$type = intval($this->request->param('type'));
|
||||
$rate = floatval($this->request->param('rate'));
|
||||
$val = floatval($this->request->param('val'));
|
||||
$price = floatval($this->request->param('price'));
|
||||
if (empty($checked)
|
||||
OR !is_array($checked)
|
||||
OR !in_array($type, [0, 1, 2])) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
if ($type == 0 OR $type == 1) {
|
||||
if ($rate <= 0 AND $val <= 0) {
|
||||
return $this->jsonFail('请输入比例或数值');
|
||||
}
|
||||
} elseif ($type == 2) {
|
||||
if ($price <= 0) {
|
||||
return $this->jsonFail('请输入金额');
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ProductModel::where(1)
|
||||
->whereIn('id', $checked)
|
||||
->select() as $model) {
|
||||
if ($type == 0) {
|
||||
if ($rate > 0) {
|
||||
$model->price -= $model->price * $rate / 100;
|
||||
} else {
|
||||
$model->price -= $val;
|
||||
}
|
||||
} elseif ($type == 1) {
|
||||
if ($rate > 0) {
|
||||
$model->price += $model->price * $rate / 100;
|
||||
} else {
|
||||
$model->price += $val;
|
||||
}
|
||||
} elseif ($type == 2) {
|
||||
$model->price = $price;
|
||||
}
|
||||
$model->price = round($model->price, 2);
|
||||
if ($model->price > 0) {
|
||||
$model->save();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function save() {
|
||||
$id = intval($this->request->param('id'));
|
||||
$groupId = intval($this->request->param('group_id'));
|
||||
$title = trim($this->request->param('title'));
|
||||
$content = trim($this->request->param('content'));
|
||||
$cb = $this->request->param('cb');
|
||||
$images = $this->request->param('images');
|
||||
$labels = $this->request->param('labels');
|
||||
$themes = $this->request->param('themes');
|
||||
$opts = $this->request->param('opts');
|
||||
$address = trim($this->request->param('address'));
|
||||
$price = floatval($this->request->param('price'));
|
||||
$stock = intval($this->request->param('stock'));
|
||||
$shippingFee = floatval($this->request->param('shipping_fee'));
|
||||
$video = trim($this->request->param('video'));
|
||||
if (empty($title)
|
||||
OR $groupId < 0
|
||||
OR empty($content)
|
||||
OR !is_array($cb)
|
||||
OR !is_array($images)
|
||||
OR empty($images)
|
||||
OR !is_array($labels)
|
||||
OR !is_array($themes)
|
||||
OR !is_array($opts)
|
||||
OR $price < 0
|
||||
OR $stock < 0
|
||||
OR $shippingFee < 0) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
foreach ($images as $i => $image) {
|
||||
unset($images[$i]['url']);
|
||||
}
|
||||
|
||||
if (!empty($id)) {
|
||||
$model = ProductModel::get($id);
|
||||
if (empty($model)) {
|
||||
return $this->jsonFail('对象未找到');
|
||||
}
|
||||
} else {
|
||||
$model = new ProductModel();
|
||||
}
|
||||
|
||||
$model->group_id = $groupId;
|
||||
$model->title = $title;
|
||||
$model->content = $content;
|
||||
$model->cb = $cb;
|
||||
$model->video = $video;
|
||||
$model->images = $images;
|
||||
$model->labels = $labels;
|
||||
$model->themes = $themes;
|
||||
$model->address = $address;
|
||||
$model->price = $price;
|
||||
$model->stock = $stock;
|
||||
$model->shipping_fee = $shippingFee;
|
||||
$model->opts = $opts;
|
||||
$model->save();
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @return \think\response\Json
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function delete() {
|
||||
$id = intval($this->request->param('id'));
|
||||
if (empty($id)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
$model = ProductModel::get($id);
|
||||
if (empty($model)) {
|
||||
return $this->jsonFail('对象未找到');
|
||||
}
|
||||
|
||||
$model->delete();
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
}
|
||||
118
Server/application/backend/controller/ProductGroupController.php
Normal file
118
Server/application/backend/controller/ProductGroupController.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\model\CollectProductModel;
|
||||
use app\common\model\ProductGroupModel;
|
||||
use app\common\model\ProductModel;
|
||||
use think\db\Query;
|
||||
|
||||
class ProductGroupController extends BaseLoginController {
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function index() {
|
||||
$keywords = trim($this->request->param('keywords'));
|
||||
$pageNo = intval($this->request->param('page'));
|
||||
$pageSize = intval($this->request->param('pageSize'));
|
||||
if ($pageNo <= 0) {
|
||||
$pageNo = 1;
|
||||
}
|
||||
if ($pageSize <= 0) {
|
||||
$pageSize = 30;
|
||||
}
|
||||
|
||||
$query = ProductGroupModel::where(1);
|
||||
if (!empty($keywords)) {
|
||||
$query->where(function (Query $q) use ($keywords) {
|
||||
$q->whereLike('name', '%' . $keywords . '%', 'OR');
|
||||
});
|
||||
}
|
||||
|
||||
$totalCount = $query->count();
|
||||
$pageCount = $totalCount > 0 ? ceil($totalCount / $pageSize) : 1;
|
||||
if ($pageNo > $pageCount) {
|
||||
$pageNo = $pageCount;
|
||||
}
|
||||
|
||||
$query->order('id', 'DESC');
|
||||
$query->limit(($pageNo - 1) * $pageSize, $pageSize);
|
||||
|
||||
$list = [];
|
||||
foreach ($query->select() as $model) {
|
||||
$list[] = array_merge($model->toArray(), [
|
||||
'product_num' => $model->productNum(),
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'list' => $list,
|
||||
'page' => $pageNo,
|
||||
'pageCount' => $pageCount,
|
||||
'totalCount' => $totalCount,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function save() {
|
||||
$id = intval($this->request->param('id'));
|
||||
$name = trim($this->request->param('name'));
|
||||
if (empty($name)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
if (!empty($id)) {
|
||||
$model = ProductGroupModel::get($id);
|
||||
if (empty($model)) {
|
||||
return $this->jsonFail('对象未找到');
|
||||
}
|
||||
} else {
|
||||
$model = new ProductGroupModel();
|
||||
}
|
||||
|
||||
$model->name = $name;
|
||||
$model->save();
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @return \think\response\Json
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function delete() {
|
||||
$id = intval($this->request->param('id'));
|
||||
if (empty($id)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
$model = ProductGroupModel::get($id);
|
||||
if (empty($model)) {
|
||||
return $this->jsonFail('对象未找到');
|
||||
}
|
||||
|
||||
CollectProductModel::where(1)
|
||||
->where('group_id', $model->id)
|
||||
->update([
|
||||
'group_id' => 0,
|
||||
]);
|
||||
ProductModel::where(1)
|
||||
->where('group_id', $model->id)
|
||||
->update([
|
||||
'group_id' => 0,
|
||||
]);
|
||||
|
||||
$model->delete();
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\model\ProductModel;
|
||||
use app\common\model\ProductUseModel;
|
||||
use app\common\model\TaskModel;
|
||||
use app\common\task\ProductReleaseTask;
|
||||
|
||||
class ProductReleaseController extends BaseLoginController {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function save() {
|
||||
$devices = $this->request->param('devices');
|
||||
$params = ProductReleaseTask::params($this->request);
|
||||
if (empty($devices)
|
||||
OR !is_array($devices)
|
||||
OR is_null($params)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
foreach ($devices as $deviceId) {
|
||||
$pdts = [];
|
||||
for ($i = 0; $i < $params['release_num']; $i ++) {
|
||||
$product = array_shift($params['products']);
|
||||
if (!empty($product)) {
|
||||
$pdts[] = $product;
|
||||
}
|
||||
}
|
||||
if (!empty($pdts)) {
|
||||
$model = new TaskModel();
|
||||
$model->device_id = $deviceId;
|
||||
$model->platform = TaskModel::PLATFORM_XIANYU;
|
||||
$model->type = TaskModel::TYPE_PRODUCT_RELEASE;
|
||||
$model->params = array_merge($params, ['products' => $pdts]);
|
||||
$model->run_type = TaskModel::RUN_TYPE_ONCE;
|
||||
$model->run_time = '';
|
||||
if ($model->save()) {
|
||||
foreach ($pdts as $pdt) {
|
||||
$useModel = new ProductUseModel();
|
||||
$useModel->device_id = $deviceId;
|
||||
$useModel->release_id = $model->id;
|
||||
$useModel->product_id = $pdt['id'];
|
||||
$useModel->use_type = $model->platform;
|
||||
$useModel->save();
|
||||
|
||||
ProductModel::where(1)
|
||||
->where('id', $pdt['id'])
|
||||
->update([
|
||||
'is_used' => ProductModel::IS_USED_YES,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
}
|
||||
795
Server/application/backend/controller/StatController.php
Normal file
795
Server/application/backend/controller/StatController.php
Normal file
@@ -0,0 +1,795 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\CloneInfo;
|
||||
use app\common\model\MemberModel;
|
||||
use app\common\model\MemberMoneyModel;
|
||||
use app\common\model\MemberQrcodeModel;
|
||||
use app\common\model\MemberWithdrawModel;
|
||||
use app\common\model\StatisticsModel;
|
||||
use app\common\Utils;
|
||||
|
||||
class StatController extends BaseLoginController {
|
||||
|
||||
protected $chartColumns = [
|
||||
'register' => '用户注册',
|
||||
'qr_number' => '扫码企点号',
|
||||
'qr_member' => '扫码人数',
|
||||
'qrcode' => '取码次数',
|
||||
'qrcode_succ' => '取码成功',
|
||||
'clone_succ' => '克隆成功',
|
||||
'clone_error' => '克隆错误',
|
||||
'clone_timeout' => '克隆超时',
|
||||
'xinyue_select' => '选择克隆心悦数',
|
||||
'xinyue_clone' => '克隆成功心悦数',
|
||||
'reward_clone' => '克隆奖励笔数',
|
||||
'reward_invite1' => '一级奖励笔数',
|
||||
'reward_invite2' => '二级奖励笔数',
|
||||
'money_clone' => '克隆奖励金额',
|
||||
'money_invite1' => '一级奖励金额',
|
||||
'money_invite2' => '二级奖励金额',
|
||||
'withdraw' => '申请提现笔数',
|
||||
'withdraw_check' => '检测通过笔数',
|
||||
'withdraw_money' => '申请提现金额',
|
||||
'withdraw_money_check' => '检测通过金额',
|
||||
'withdraw_succ' => '提现成功笔数',
|
||||
'withdraw_succ_money' => '提现成功金额',
|
||||
'withdraw_fail' => '提现失败笔数',
|
||||
'withdraw_fail_money' => '提现失败金额',
|
||||
];
|
||||
|
||||
public function dayChartView() {
|
||||
$day = trim($this->request->param('day'));
|
||||
$columns = trim($this->request->param('columns'));
|
||||
$columns = explode('|', $columns);
|
||||
if (empty($day) OR empty($columns)) {
|
||||
exit('Page not found.');
|
||||
}
|
||||
|
||||
$legend = [];
|
||||
$xAxis = [];
|
||||
$series = [];
|
||||
for ($i = 0; $i <= 23; $i ++) {
|
||||
$xAxis[] = $i . '时';
|
||||
}
|
||||
foreach ($columns as $i => $column) {
|
||||
if (isset($this->chartColumns[$column])) {
|
||||
$legend[] = $this->chartColumns[$column];
|
||||
$series[$column] = [
|
||||
'name' => $this->chartColumns[$column],
|
||||
'type' => 'line',
|
||||
'stack' => 'Total',
|
||||
'data' => [],
|
||||
];
|
||||
} else {
|
||||
unset($columns[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
$list = $this->getDayData($day);
|
||||
$rows = [];
|
||||
foreach ($list as $row) {
|
||||
$rows[$row['hour']] = $row;
|
||||
}
|
||||
|
||||
foreach ($xAxis as $axi) {
|
||||
if (isset($rows[$axi])) {
|
||||
foreach ($columns as $column) {
|
||||
$series[$column]['data'][] = $rows[$axi][$column];
|
||||
}
|
||||
} else {
|
||||
foreach ($columns as $column) {
|
||||
$series[$column]['data'][] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->fetch('/chart-day', [
|
||||
'legend' => $legend,
|
||||
'xAxis' => $xAxis,
|
||||
'series' => array_values($series),
|
||||
]);
|
||||
}
|
||||
|
||||
public function monthChartView() {
|
||||
$month = trim($this->request->param('month'));
|
||||
$columns = trim($this->request->param('columns'));
|
||||
$columns = explode('|', $columns);
|
||||
if (empty($month) OR empty($columns)) {
|
||||
exit('Page not found.');
|
||||
}
|
||||
|
||||
$time = strtotime($month . '01');
|
||||
if ($time === FALSE) {
|
||||
exit('Page not found.');
|
||||
}
|
||||
|
||||
$days = date('t', $time);
|
||||
$legend = [];
|
||||
$xAxis = [];
|
||||
$series = [];
|
||||
for ($i = 1; $i <= $days; $i ++) {
|
||||
$xAxis[] = $i . '日';
|
||||
}
|
||||
foreach ($columns as $i => $column) {
|
||||
if (isset($this->chartColumns[$column])) {
|
||||
$legend[] = $this->chartColumns[$column];
|
||||
$series[$column] = [
|
||||
'name' => $this->chartColumns[$column],
|
||||
'type' => 'line',
|
||||
'stack' => 'Total',
|
||||
'data' => [],
|
||||
];
|
||||
} else {
|
||||
unset($columns[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
$list = $this->getMonthData($month);
|
||||
$rows = [];
|
||||
foreach ($list as $row) {
|
||||
$row['day'] = str_replace(['年', '月'], '-', $row['day']);
|
||||
$row['day'] = str_replace(['日'], '', $row['day']);
|
||||
$row['day'] = intval(date('d', strtotime($row['day']))) . '日';
|
||||
|
||||
$rows[$row['day']] = $row;
|
||||
}
|
||||
|
||||
foreach ($xAxis as $axi) {
|
||||
if (isset($rows[$axi])) {
|
||||
foreach ($columns as $column) {
|
||||
$series[$column]['data'][] = $rows[$axi][$column];
|
||||
}
|
||||
} else {
|
||||
foreach ($columns as $column) {
|
||||
$series[$column]['data'][] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->fetch('/chart-day', [
|
||||
'legend' => $legend,
|
||||
'xAxis' => $xAxis,
|
||||
'series' => array_values($series),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日统计图表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function dayChart() {
|
||||
$day = trim($this->request->param('day'));
|
||||
$columns = $this->request->param('columns');
|
||||
if (empty($day)) {
|
||||
$day = date('Y-m-d');
|
||||
}
|
||||
if (strtotime($day) === FALSE) {
|
||||
return $this->jsonFail('日期错误');
|
||||
}
|
||||
if (empty($columns)) {
|
||||
$columns = ['xinyue_select', 'xinyue_clone', 'money_clone'];
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'day' => $day,
|
||||
'columns' => $columns,
|
||||
'chartColumns' => $this->assocToList($this->chartColumns),
|
||||
'url' => $this->absoluteUrl('/backend/stat/dayChartView?token=' . $this->token . '&day=' . $day . '&columns=' . implode('|', $columns)),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 月统计图表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function monthChart() {
|
||||
$month = trim($this->request->param('month'));
|
||||
$columns = $this->request->param('columns');
|
||||
if (empty($month)) {
|
||||
$month = date('Ym');
|
||||
}
|
||||
if (empty($columns)) {
|
||||
$columns = ['xinyue_select', 'xinyue_clone', 'money_clone'];
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'month' => $month,
|
||||
'months' => $this->assocToList($this->getMonths()),
|
||||
'columns' => $columns,
|
||||
'chartColumns' => $this->assocToList($this->chartColumns),
|
||||
'url' => $this->absoluteUrl('/backend/stat/monthChartView?token=' . $this->token . '&month=' . $month . '&columns=' . implode('|', $columns)),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日统计列表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function dayIndex() {
|
||||
$day = trim($this->request->param('day'));
|
||||
if (empty($day)) {
|
||||
$day = date('Y-m-d');
|
||||
}
|
||||
if (strtotime($day) === FALSE) {
|
||||
return $this->jsonFail('日期错误');
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'list' => $this->getDayData($day),
|
||||
'day' => $day,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 月统计
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function monthIndex() {
|
||||
$month = trim($this->request->param('month'));
|
||||
if (empty($month)) {
|
||||
$month = date('Ym');
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'list' => $this->getMonthData($month),
|
||||
'month' => $month,
|
||||
'months' => $this->assocToList($this->getMonths()),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取统计信息
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function get() {
|
||||
$weekTime = time() - 7 * 24 * 3600;
|
||||
$monthTime = time() - 30 * 24 * 3600;
|
||||
|
||||
$memberTotal = MemberModel::where(1)
|
||||
->count();
|
||||
$memberToday = MemberModel::where(1)
|
||||
->where('create_time', '>=', strtotime(date('Y-m-d')))
|
||||
->count();
|
||||
$memberYesterday = MemberModel::where(1)
|
||||
->where('create_time', '>=', strtotime(date('Y-m-d')) - 24 * 3600)
|
||||
->where('create_time', '<', strtotime(date('Y-m-d')))
|
||||
->count();
|
||||
$memberWeek = MemberModel::where(1)
|
||||
->where('create_time', '>=', $weekTime)
|
||||
->count();
|
||||
$memberMonth = MemberModel::where(1)
|
||||
->where('create_time', '>=', $monthTime)
|
||||
->count();
|
||||
|
||||
/*$xinyueTotal = MemberQrcodeModel::where(1)
|
||||
->where('status', MemberQrcodeModel::STATUS_SUCCESS)
|
||||
->sum('select_xinyue_count');
|
||||
$xinyueToday = MemberQrcodeModel::where(1)
|
||||
->where('status', MemberQrcodeModel::STATUS_SUCCESS)
|
||||
->where('create_time', '>=', strtotime(date('Y-m-d')))
|
||||
->sum('select_xinyue_count');
|
||||
$xinyueYesterday = MemberQrcodeModel::where(1)
|
||||
->where('status', MemberQrcodeModel::STATUS_SUCCESS)
|
||||
->where('create_time', '>=', strtotime(date('Y-m-d')) - 24 * 3600)
|
||||
->where('create_time', '<', strtotime(date('Y-m-d')))
|
||||
->sum('select_xinyue_count');
|
||||
$xinyueWeek = MemberQrcodeModel::where(1)
|
||||
->where('status', MemberQrcodeModel::STATUS_SUCCESS)
|
||||
->where('create_time', '>=', $weekTime)
|
||||
->sum('select_xinyue_count');
|
||||
$xinyueMonth = MemberQrcodeModel::where(1)
|
||||
->where('status', MemberQrcodeModel::STATUS_SUCCESS)
|
||||
->where('create_time', '>=', $monthTime)
|
||||
->sum('select_xinyue_count');*/
|
||||
|
||||
$xinyueTotal = StatisticsModel::where(1)
|
||||
->sum('xinyue_select');
|
||||
$xinyueToday = StatisticsModel::where(1)
|
||||
->where('day', date('Ymd'))
|
||||
->sum('xinyue_select');
|
||||
$xinyueYesterday = StatisticsModel::where(1)
|
||||
->where('day', date('Ymd', time() - 24 * 3600))
|
||||
->sum('xinyue_select');
|
||||
$xinyueWeek = StatisticsModel::where(1)
|
||||
->where('day', '>=', date('Ymd', time() - 7 * 24 * 3600))
|
||||
->sum('xinyue_select');
|
||||
$xinyueMonth = StatisticsModel::where(1)
|
||||
->where('day', '>=', date('Ymd', time() - 30 * 24 * 3600))
|
||||
->sum('xinyue_select');
|
||||
|
||||
$moneyTotal = MemberMoneyModel::where(1)
|
||||
->where('money', '>', 0)
|
||||
->where('status', MemberMoneyModel::STATUS_SUCC)
|
||||
->sum('money');
|
||||
$moneyToday = MemberMoneyModel::where(1)
|
||||
->where('money', '>', 0)
|
||||
->where('status', MemberMoneyModel::STATUS_SUCC)
|
||||
->where('create_time', '>=', strtotime(date('Y-m-d')))
|
||||
->sum('money');
|
||||
$moneyYesterday = MemberMoneyModel::where(1)
|
||||
->where('money', '>', 0)
|
||||
->where('status', MemberMoneyModel::STATUS_SUCC)
|
||||
->where('create_time', '>=', strtotime(date('Y-m-d')) - 24 * 3600)
|
||||
->where('create_time', '<', strtotime(date('Y-m-d')))
|
||||
->sum('money');
|
||||
$moneyWeek = MemberMoneyModel::where(1)
|
||||
->where('money', '>', 0)
|
||||
->where('status', MemberMoneyModel::STATUS_SUCC)
|
||||
->where('create_time', '>=', $weekTime)
|
||||
->sum('money');
|
||||
$moneyMonth = MemberMoneyModel::where(1)
|
||||
->where('money', '>', 0)
|
||||
->where('status', MemberMoneyModel::STATUS_SUCC)
|
||||
->where('create_time', '>=', $monthTime)
|
||||
->sum('money');
|
||||
|
||||
$withdrawTotal = MemberMoneyModel::where(1)
|
||||
->whereIn('type', MemberMoneyModel::withdrawTypes())
|
||||
->whereIn('status', [MemberMoneyModel::STATUS_SUCC, MemberMoneyModel::STATUS_AWAIT])
|
||||
->sum('money');
|
||||
$withdrawToday = MemberMoneyModel::where(1)
|
||||
->whereIn('type', MemberMoneyModel::withdrawTypes())
|
||||
->whereIn('status', [MemberMoneyModel::STATUS_SUCC, MemberMoneyModel::STATUS_AWAIT])
|
||||
->where('create_time', '>=', strtotime(date('Y-m-d')))
|
||||
->sum('money');
|
||||
$withdrawYesterday = MemberMoneyModel::where(1)
|
||||
->whereIn('type', MemberMoneyModel::withdrawTypes())
|
||||
->whereIn('status', [MemberMoneyModel::STATUS_SUCC, MemberMoneyModel::STATUS_AWAIT])
|
||||
->where('create_time', '>=', strtotime(date('Y-m-d')) - 24 * 3600)
|
||||
->where('create_time', '<', strtotime(date('Y-m-d')))
|
||||
->sum('money');
|
||||
$withdrawWeek = MemberMoneyModel::where(1)
|
||||
->whereIn('type', MemberMoneyModel::withdrawTypes())
|
||||
->whereIn('status', [MemberMoneyModel::STATUS_SUCC, MemberMoneyModel::STATUS_AWAIT])
|
||||
->where('create_time', '>=', $weekTime)
|
||||
->sum('money');
|
||||
$withdrawMonth = MemberMoneyModel::where(1)
|
||||
->whereIn('type', MemberMoneyModel::withdrawTypes())
|
||||
->whereIn('status', [MemberMoneyModel::STATUS_SUCC, MemberMoneyModel::STATUS_AWAIT])
|
||||
->where('create_time', '>=', $monthTime)
|
||||
->sum('money');
|
||||
|
||||
$remitTotal = MemberWithdrawModel::where(1)
|
||||
//->whereIn('type', MemberMoneyModel::withdrawTypes())
|
||||
->whereIn('status', [MemberWithdrawModel::STATUS_SUCC, MemberWithdrawModel::STATUS_AUTO_SUCC])
|
||||
->sum('money');
|
||||
$remitToday = MemberWithdrawModel::where(1)
|
||||
//->whereIn('type', MemberMoneyModel::withdrawTypes())
|
||||
->whereIn('status', [MemberWithdrawModel::STATUS_SUCC, MemberWithdrawModel::STATUS_AUTO_SUCC])
|
||||
->where('verify_time', '>=', strtotime(date('Y-m-d')))
|
||||
->sum('money');
|
||||
$remitYesterday = MemberWithdrawModel::where(1)
|
||||
//->whereIn('type', MemberMoneyModel::withdrawTypes())
|
||||
->whereIn('status', [MemberWithdrawModel::STATUS_SUCC, MemberWithdrawModel::STATUS_AUTO_SUCC])
|
||||
->where('verify_time', '>=', strtotime(date('Y-m-d')) - 24 * 3600)
|
||||
->where('verify_time', '<', strtotime(date('Y-m-d')))
|
||||
->sum('money');
|
||||
$remitWeek = MemberWithdrawModel::where(1)
|
||||
//->whereIn('type', MemberMoneyModel::withdrawTypes())
|
||||
->whereIn('status', [MemberWithdrawModel::STATUS_SUCC, MemberWithdrawModel::STATUS_AUTO_SUCC])
|
||||
->where('verify_time', '>=', $weekTime)
|
||||
->sum('money');
|
||||
$remitMonth = MemberWithdrawModel::where(1)
|
||||
//->whereIn('type', MemberMoneyModel::withdrawTypes())
|
||||
->whereIn('status', [MemberWithdrawModel::STATUS_SUCC, MemberWithdrawModel::STATUS_AUTO_SUCC])
|
||||
->where('verify_time', '>=', $monthTime)
|
||||
->sum('money');
|
||||
|
||||
return $this->jsonSucc([
|
||||
'member_total' => $memberTotal,
|
||||
'member_today' => $memberToday,
|
||||
'member_yesterday' => $memberYesterday,
|
||||
'member_week' => $memberWeek,
|
||||
'member_month' => $memberMonth,
|
||||
'xinyue_total' => $xinyueTotal,
|
||||
'xinyue_today' => $xinyueToday,
|
||||
'xinyue_yesterday' => $xinyueYesterday,
|
||||
'xinyue_week' => $xinyueWeek,
|
||||
'xinyue_month' => $xinyueMonth,
|
||||
'money_total' => $moneyTotal,
|
||||
'money_today' => $moneyToday,
|
||||
'money_yesterday' => $moneyYesterday,
|
||||
'money_week' => $moneyWeek,
|
||||
'money_month' => $moneyMonth,
|
||||
'withdraw' => round($moneyTotal + $withdrawTotal, 2),
|
||||
'withdraw_total' => abs($withdrawTotal),
|
||||
'withdraw_today' => abs($withdrawToday),
|
||||
'withdraw_yesterday' => abs($withdrawYesterday),
|
||||
'withdraw_week' => abs($withdrawWeek),
|
||||
'withdraw_month' => abs($withdrawMonth),
|
||||
'remit_total' => abs($remitTotal),
|
||||
'remit_today' => abs($remitToday),
|
||||
'remit_yesterday' => abs($remitYesterday),
|
||||
'remit_week' => abs($remitWeek),
|
||||
'remit_month' => abs($remitMonth),
|
||||
'clone_total' => 'Loading...',
|
||||
'clone_today' => '-',
|
||||
'clone_today_nr' => '-',
|
||||
'clone_today_r' => '-',
|
||||
'clone_yesterday' => '-',
|
||||
'clone_week' => '-',
|
||||
'clone_month' => '-',
|
||||
'clone_today_pay' => '-',
|
||||
'clone_today_unpay' => '-',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取克隆统计信息
|
||||
*
|
||||
* @return \think\response\Json
|
||||
* @throws \think\Exception
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function getClone() {
|
||||
$cloneTotal = StatisticsModel::where(1)
|
||||
->sum('xinyue_clone');
|
||||
$cloneToday = StatisticsModel::where(1)
|
||||
->where('day', date('Ymd'))
|
||||
->sum('xinyue_clone');
|
||||
$cloneTodayNr = StatisticsModel::where(1)
|
||||
->where('day', date('Ymd'))
|
||||
->sum('xinyue_clone_nr');
|
||||
$cloneYesterday = StatisticsModel::where(1)
|
||||
->where('day', date('Ymd', time() - 24 * 3600))
|
||||
->sum('xinyue_clone');
|
||||
$cloneWeek = StatisticsModel::where(1)
|
||||
->where('day', '>=', date('Ymd', time() - 7 * 24 * 3600))
|
||||
->sum('xinyue_clone');
|
||||
$cloneMonth = StatisticsModel::where(1)
|
||||
->where('day', '>=', date('Ymd', time() - 30 * 24 * 3600))
|
||||
->sum('xinyue_clone');
|
||||
$cloneTodayUnpay = CloneInfo::getCloneSuccUnpayByTime(strtotime(date('Ymd')), time());
|
||||
$cloneTodayPay = CloneInfo::getCloneSuccPayByTime(strtotime(date('Ymd')), time());
|
||||
|
||||
return $this->jsonSucc([
|
||||
'clone_total' => $cloneTotal,
|
||||
'clone_today' => $cloneToday,
|
||||
'clone_today_nr' => $cloneTodayNr,
|
||||
'clone_today_r' => $cloneToday - $cloneTodayNr,
|
||||
'clone_yesterday' => $cloneYesterday,
|
||||
'clone_week' => $cloneWeek,
|
||||
'clone_month' => $cloneMonth,
|
||||
'clone_today_pay' => $cloneTodayPay,
|
||||
'clone_today_unpay' => $cloneTodayUnpay,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取日统计数据
|
||||
*
|
||||
* @param $day
|
||||
* @return array
|
||||
*/
|
||||
protected function getDayData($day) {
|
||||
$list = [];
|
||||
foreach (StatisticsModel::where(1)
|
||||
->where('day', date('Ymd', strtotime($day)))
|
||||
->order('hour', 'DESC')
|
||||
->select() as $model) {
|
||||
$xinyueClone = $model->xinyue_clone;
|
||||
$moneyTotal = $model->money_clone
|
||||
+ $model->money_invite1
|
||||
+ $model->money_invite2
|
||||
+ $model->money_jm
|
||||
+ $model->money_point;
|
||||
|
||||
$scan1CloneCount = $model->scan1_clone_count;
|
||||
$scan2CloneCount = $model->scan2_clone_count;
|
||||
$scan3CloneCount = $model->scan3_clone_count;
|
||||
|
||||
$list[] = array_merge($model->toArray(), [
|
||||
'day' => date('Y年m月d日', strtotime($model->day)),
|
||||
'hour' => $model->hour . '时',
|
||||
'reward_price' => $xinyueClone > 0 ? round($moneyTotal / $xinyueClone, 2) : 0,
|
||||
'scan1_price' => $scan1CloneCount > 0 ? round($model->scan1_money / $scan1CloneCount, 2) : 0,
|
||||
'scan2_price' => $scan2CloneCount > 0 ? round($model->scan2_money / $scan2CloneCount, 2) : 0,
|
||||
'scan3_price' => $scan3CloneCount > 0 ? round($model->scan3_money / $scan3CloneCount, 2) : 0,
|
||||
]);
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取月份
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getMonths() {
|
||||
$begin = 20240301;
|
||||
$months = [];
|
||||
$nowTime = time();
|
||||
while ($nowTime >= strtotime($begin)) {
|
||||
if (!isset($months[date('Ym', $nowTime)])) {
|
||||
$months[date('Ym', $nowTime)] = date('Y年m月', $nowTime);
|
||||
}
|
||||
|
||||
$nowTime -= 24 * 3600;
|
||||
}
|
||||
return $months;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取月统计数据
|
||||
*
|
||||
* @param $month
|
||||
* @return array|\think\response\Json
|
||||
*/
|
||||
protected function getMonthData($month) {
|
||||
$time = strtotime($month . '01');
|
||||
if ($time === FALSE) {
|
||||
return $this->jsonFail('月份错误');
|
||||
}
|
||||
|
||||
$today = date('Ymd');
|
||||
$days = [];
|
||||
for ($i = date('t', $time); $i >= 1; $i --) {
|
||||
$day = date('Ymd', strtotime(date('Y', $time) . '-' . date('m', $time) . '-' . $i));
|
||||
if ($day <= $today) {
|
||||
$days[] = $day;
|
||||
}
|
||||
}
|
||||
|
||||
$list = [];
|
||||
foreach ($days as $day) {
|
||||
$row = [
|
||||
'day' => date('Y年m月d日', strtotime($day)),
|
||||
'register' => 0,
|
||||
'qr_number' => 0,
|
||||
'qr_member' => 0,
|
||||
'qrcode' => 0,
|
||||
'qrcode_succ' => 0,
|
||||
'clone_succ' => 0,
|
||||
'clone_error' => 0,
|
||||
'clone_timeout' => 0,
|
||||
'xinyue_select' => 0,
|
||||
'xinyue_clone' => 0,
|
||||
'reward_clone' => 0,
|
||||
'reward_invite1' => 0,
|
||||
'reward_invite2' => 0,
|
||||
'money_clone' => 0,
|
||||
'money_invite1' => 0,
|
||||
'money_invite2' => 0,
|
||||
'money_jm' => 0,
|
||||
'money_point' => 0,
|
||||
'withdraw' => 0,
|
||||
'withdraw_check' => 0,
|
||||
'withdraw_money' => 0,
|
||||
'withdraw_money_check' => 0,
|
||||
'withdraw_succ' => 0,
|
||||
'withdraw_succ_money' => 0,
|
||||
'withdraw_fail' => 0,
|
||||
'withdraw_fail_money' => 0,
|
||||
'scan1_num' => 0,
|
||||
'scan2_num' => 0,
|
||||
'scan3_num' => 0,
|
||||
'scan1_xinyue_count' => 0,
|
||||
'scan2_xinyue_count' => 0,
|
||||
'scan3_xinyue_count' => 0,
|
||||
'scan1_clone_count' => 0,
|
||||
'scan2_clone_count' => 0,
|
||||
'scan3_clone_count' => 0,
|
||||
'scan1_money' => 0,
|
||||
'scan2_money' => 0,
|
||||
'scan3_money' => 0,
|
||||
'scan1_price' => 0,
|
||||
'scan2_price' => 0,
|
||||
'scan3_price' => 0,
|
||||
'first_settlement_count' => 0,
|
||||
'repeat_settlement_count' => 0,
|
||||
'first_reward_money' => 0,
|
||||
'repeat_reward_money' => 0,
|
||||
'first_clone_succ' => 0,
|
||||
'repeat_clone_succ' => 0,
|
||||
'first_price' => 0,
|
||||
'repeat_price' => 0,
|
||||
];
|
||||
|
||||
foreach (StatisticsModel::where(1)
|
||||
->where('day', $day)
|
||||
->select() as $model) {
|
||||
$row['register'] += $model->register;
|
||||
$row['qr_number'] += $model->qr_number;
|
||||
$row['qr_member'] += $model->qr_member;
|
||||
$row['qrcode'] += $model->qrcode;
|
||||
$row['qrcode_succ'] += $model->qrcode_succ;
|
||||
$row['clone_succ'] += $model->clone_succ;
|
||||
$row['clone_error'] += $model->clone_error;
|
||||
$row['clone_timeout'] += $model->clone_timeout;
|
||||
$row['xinyue_select'] += $model->xinyue_select;
|
||||
$row['xinyue_clone'] += $model->xinyue_clone;
|
||||
$row['reward_clone'] += $model->reward_clone;
|
||||
$row['reward_invite1'] += $model->reward_invite1;
|
||||
$row['reward_invite2'] += $model->reward_invite2;
|
||||
$row['money_clone'] += $model->money_clone;
|
||||
$row['money_invite1'] += $model->money_invite1;
|
||||
$row['money_invite2'] += $model->money_invite2;
|
||||
$row['money_jm'] += $model->money_jm;
|
||||
$row['money_point'] += $model->money_point;
|
||||
$row['withdraw'] += $model->withdraw;
|
||||
$row['withdraw_check'] += $model->withdraw_check;
|
||||
$row['withdraw_money'] += $model->withdraw_money;
|
||||
$row['withdraw_money_check'] += $model->withdraw_money_check;
|
||||
$row['withdraw_succ'] += $model->withdraw_succ;
|
||||
$row['withdraw_succ_money'] += $model->withdraw_succ_money;
|
||||
$row['withdraw_fail'] += $model->withdraw_fail;
|
||||
$row['withdraw_fail_money'] += $model->withdraw_fail_money;
|
||||
|
||||
$row['first_settlement_count'] += $model->first_settlement_count;
|
||||
$row['repeat_settlement_count'] += $model->repeat_settlement_count;
|
||||
$row['first_reward_money'] += $model->first_reward_money;
|
||||
$row['repeat_reward_money'] += $model->repeat_reward_money;
|
||||
$row['first_clone_succ'] += $model->first_clone_succ;
|
||||
$row['repeat_clone_succ'] += $model->repeat_clone_succ;
|
||||
/*$row['scan1_num'] += $model->scan1_num;
|
||||
$row['scan2_num'] += $model->scan2_num;
|
||||
$row['scan3_num'] += $model->scan3_num;
|
||||
$row['scan1_xinyue_count'] += $model->scan1_xinyue_count;
|
||||
$row['scan2_xinyue_count'] += $model->scan2_xinyue_count;
|
||||
$row['scan3_xinyue_count'] += $model->scan3_xinyue_count;
|
||||
$row['scan1_clone_count'] += $model->scan1_clone_count;
|
||||
$row['scan2_clone_count'] += $model->scan2_clone_count;
|
||||
$row['scan3_clone_count'] += $model->scan3_clone_count;
|
||||
$row['scan1_money'] += $model->scan1_money;
|
||||
$row['scan2_money'] += $model->scan2_money;
|
||||
$row['scan3_money'] += $model->scan3_money;*/
|
||||
}
|
||||
|
||||
$xinyueClone = $row['xinyue_clone'];
|
||||
$moneyTotal = $row['money_clone']
|
||||
+ $row['money_invite1']
|
||||
+ $row['money_invite2']
|
||||
+ $row['money_jm']
|
||||
+ $row['money_point'];
|
||||
|
||||
//$scan1CloneCount = $row['scan1_clone_count'];
|
||||
//$scan2CloneCount = $row['scan2_clone_count'];
|
||||
//$scan3CloneCount = $row['scan3_clone_count'];
|
||||
|
||||
$row['reward_price'] = $xinyueClone > 0 ? round($moneyTotal / $xinyueClone, 2) : 0;
|
||||
//$row['scan1_price'] = $scan1CloneCount > 0 ? round($row['scan1_money'] / $scan1CloneCount, 2) : 0;
|
||||
//$row['scan2_price'] = $scan2CloneCount > 0 ? round($row['scan2_money'] / $scan2CloneCount, 2) : 0;
|
||||
//$row['scan3_price'] = $scan3CloneCount > 0 ? round($row['scan3_money'] / $scan3CloneCount, 2) : 0;
|
||||
|
||||
$row['first_reward_money'] = round($row['first_reward_money'], 2);
|
||||
$row['repeat_reward_money'] = round($row['repeat_reward_money'], 2);
|
||||
if ($row['first_clone_succ'] > 0) {
|
||||
$row['first_price'] = round($row['first_reward_money'] / $row['first_clone_succ'], 2);
|
||||
}
|
||||
if ($row['repeat_clone_succ'] > 0) {
|
||||
$row['repeat_price'] = round($row['repeat_reward_money'] / $row['repeat_clone_succ'], 2);
|
||||
}
|
||||
|
||||
$list[] = $row;
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function scan() {
|
||||
$time = time();// - 24 * 3600;
|
||||
$ids0 = MemberQrcodeModel::where(1)
|
||||
->field('id')
|
||||
->where('create_time', '>=', strtotime(date('Ymd', $time)))
|
||||
->where('status', MemberQrcodeModel::STATUS_SUCCESS)
|
||||
->where('settlement_count1', '>', 0)
|
||||
->select()
|
||||
->column('id');
|
||||
$ids1 = MemberQrcodeModel::where(1)
|
||||
->field('id')
|
||||
->where('create_time', '>=', strtotime(date('Ymd', $time)))
|
||||
->where('status', MemberQrcodeModel::STATUS_SUCCESS)
|
||||
->where('settlement_count2', '>', 0)
|
||||
->select()
|
||||
->column('id');
|
||||
|
||||
$money0 = 0;
|
||||
$price0 = 0;
|
||||
$xinyue0 = 0;
|
||||
$cloneSucc0 = 0;
|
||||
$cloneFailRate0 = 0;
|
||||
if (!empty($ids0)) {
|
||||
$money0 = MemberQrcodeModel::where(1)
|
||||
->field('reward_price * reward_count AS reward_money0')
|
||||
->whereIn('id', $ids0)
|
||||
->select()
|
||||
->reduce(function ($money, $item) {
|
||||
return $money + $item['reward_money0'];
|
||||
});
|
||||
$xinyue0 = MemberQrcodeModel::where(1)
|
||||
->whereIn('id', $ids0)
|
||||
->sum('settlement_count1');
|
||||
$qrIds0 = MemberQrcodeModel::where(1)
|
||||
->field('qr_id')
|
||||
->whereIn('id', $ids0)
|
||||
->where('qr_id', '>', 0)
|
||||
->select()
|
||||
->column('qr_id');
|
||||
if (!empty($qrIds0)) {
|
||||
$cloneSucc0 = CloneInfo::getCloneSuccCount1ByQrIds($qrIds0);
|
||||
}
|
||||
|
||||
if ($xinyue0 > 0) {
|
||||
$cloneFailRate0 = round(($xinyue0 - $cloneSucc0) / $xinyue0, 4) * 100;
|
||||
}
|
||||
}
|
||||
|
||||
$money1 = 0;
|
||||
$price1 = 0;
|
||||
$xinyue1 = 0;
|
||||
$cloneSucc1 = 0;
|
||||
$cloneFailRate1 = 0;
|
||||
if (!empty($ids1)) {
|
||||
$money1 = MemberQrcodeModel::where(1)
|
||||
->field('reward_price2 * reward_count2 AS reward_money0')
|
||||
->whereIn('id', $ids1)
|
||||
->select()
|
||||
->reduce(function ($money, $item) {
|
||||
return $money + $item['reward_money0'];
|
||||
});
|
||||
$xinyue1 = MemberQrcodeModel::where(1)
|
||||
->whereIn('id', $ids1)
|
||||
->sum('settlement_count2');
|
||||
if ($cloneSucc1 > 0) {
|
||||
$price1 = floatval(round($money1 / $cloneSucc1, 2));
|
||||
}
|
||||
|
||||
$qrIds1 = MemberQrcodeModel::where(1)
|
||||
->field('qr_id')
|
||||
->whereIn('id', $ids1)
|
||||
->where('qr_id', '>', 0)
|
||||
->select()
|
||||
->column('qr_id');
|
||||
if (!empty($qrIds1)) {
|
||||
$cloneSucc1 = CloneInfo::getCloneSuccCount2ByQrIds($qrIds1);
|
||||
}
|
||||
|
||||
if ($xinyue1 > 0) {
|
||||
$cloneFailRate1 = round(($xinyue1 - $cloneSucc1) / $xinyue1, 4) * 100;
|
||||
}
|
||||
}
|
||||
|
||||
$total = floatval(MemberMoneyModel::where(1)
|
||||
->where('create_time', '>=', strtotime(date('Ymd', $time)))
|
||||
->whereIn('type', MemberMoneyModel::rewardTypes())
|
||||
->sum('money'));
|
||||
|
||||
Utils::allocNumber($total, $money0, $money1);
|
||||
|
||||
if ($cloneSucc0 > 0) {
|
||||
$price0 = floatval(round($money0 / $cloneSucc0, 2));
|
||||
}
|
||||
if ($cloneSucc1 > 0) {
|
||||
$price1 = floatval(round($money1 / $cloneSucc1, 2));
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'scan0' => [
|
||||
'num' => count($ids0),
|
||||
'money' => floatval(round($money0, 2)),
|
||||
'price' => $price0,
|
||||
'xinyue' => $xinyue0,
|
||||
'clone_succ' => $cloneSucc0,
|
||||
'rate_clone_fail' => $cloneFailRate0,
|
||||
],
|
||||
'scan1' => [
|
||||
'num' => count($ids1),
|
||||
'money' => floatval(round($money1, 2)),
|
||||
'price' => $price1,
|
||||
'xinyue' => $xinyue1,
|
||||
'clone_succ' => $cloneSucc1,
|
||||
'rate_clone_fail' => $cloneFailRate1,
|
||||
],
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
228
Server/application/backend/controller/TaskController.php
Normal file
228
Server/application/backend/controller/TaskController.php
Normal file
@@ -0,0 +1,228 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\model\DeviceModel;
|
||||
use app\common\model\LogModel;
|
||||
use app\common\model\TaskDetailModel;
|
||||
use app\common\model\TaskModel;
|
||||
|
||||
class TaskController extends BaseLoginController {
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function index() {
|
||||
$deviceId = intval($this->request->param('device_id'));
|
||||
$type = trim($this->request->param('type'));
|
||||
$runType = trim($this->request->param('run_type'));
|
||||
$status = trim($this->request->param('status'));
|
||||
$keywords = trim($this->request->param('keywords'));
|
||||
$pageNo = intval($this->request->param('page'));
|
||||
$pageSize = intval($this->request->param('pageSize'));
|
||||
if ($pageNo <= 0) {
|
||||
$pageNo = 1;
|
||||
}
|
||||
if ($pageSize <= 0) {
|
||||
$pageSize = 30;
|
||||
}
|
||||
|
||||
$query = TaskModel::where(1)
|
||||
->alias('t1')
|
||||
->field('t1.*')
|
||||
->leftJoin(
|
||||
DeviceModel::where(1)->getTable() . ' t2',
|
||||
't2.id = t1.device_id')
|
||||
->where('t1.is_deleted', TaskModel::IS_DELETED_NO);
|
||||
if (!empty($deviceId)) {
|
||||
$query->where('t1.device_id', $deviceId);
|
||||
}
|
||||
if (isset(TaskModel::typeAssoc()[$type])) {
|
||||
$query->where('t1.type', $type);
|
||||
}
|
||||
if (isset(TaskModel::statusAssoc()[$status])) {
|
||||
$query->where('t1.status', $status);
|
||||
}
|
||||
if (isset(TaskModel::runTypeAssoc()[$runType])) {
|
||||
$query->where('t1.run_type', $runType);
|
||||
}
|
||||
if (!empty($keywords)) {
|
||||
$query->whereLike('t2.number', '%' . $keywords . '%');
|
||||
}
|
||||
|
||||
$totalCount = $query->count();
|
||||
$pageCount = $totalCount > 0 ? ceil($totalCount / $pageSize) : 1;
|
||||
if ($pageNo > $pageCount) {
|
||||
$pageNo = $pageCount;
|
||||
}
|
||||
|
||||
$query->order('t1.id', 'DESC');
|
||||
$query->limit(($pageNo - 1) * $pageSize, $pageSize);
|
||||
|
||||
$list = [];
|
||||
foreach ($query->select() as $model) {
|
||||
$device = $model->device();
|
||||
$list[] = array_merge($model->toArray(), [
|
||||
'device_number' => $device ? $device->number : '',
|
||||
'device_name' => $device ? $device->name : '',
|
||||
'device_online' => ($device AND $device->isOnline()) ? '在线' : '离线',
|
||||
'type_name' => TaskModel::typeAssoc()[$model->type],
|
||||
'run_type_name' => TaskModel::runTypeAssoc()[$model->run_type],
|
||||
'status_name' => TaskModel::statusAssoc()[$model->status],
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'list' => $list,
|
||||
'page' => $pageNo,
|
||||
'pageCount' => $pageCount,
|
||||
'totalCount' => $totalCount,
|
||||
'platforms' => $this->assocToList(TaskModel::platformAssoc()),
|
||||
'types' => $this->assocToList(TaskModel::typeAssoc()),
|
||||
'runTypes' => $this->assocToList(TaskModel::runTypeAssoc()),
|
||||
'statuses' => $this->assocToList(TaskModel::statusAssoc()),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function log() {
|
||||
$id = intval($this->request->param('id'));
|
||||
if (empty($id)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
$detail = TaskDetailModel::where(1)
|
||||
->where('task_id', $id)
|
||||
->order('id', 'DESC')
|
||||
->find();
|
||||
if (empty($detail)) {
|
||||
return $this->jsonSucc([]);
|
||||
}
|
||||
|
||||
$list = [];
|
||||
foreach (LogModel::where(1)
|
||||
->where('task_id', $detail->id)
|
||||
->order('id', 'ASC')
|
||||
->select() as $model) {
|
||||
$list[] = [
|
||||
'id' => $model->id,
|
||||
'type' => $model->type,
|
||||
'message' => $model->message,
|
||||
'create_time' => $model->create_time,
|
||||
];
|
||||
}
|
||||
return $this->jsonSucc($list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function save() {
|
||||
$devices = $this->request->param('devices');
|
||||
$platform = trim($this->request->param('platform'));
|
||||
$type = trim($this->request->param('type'));
|
||||
$runType = trim($this->request->param('run_type'));
|
||||
$runTime = trim($this->request->param('run_time'));
|
||||
if (empty($devices)
|
||||
OR !is_array($devices)
|
||||
OR !isset(TaskModel::platformAssoc()[$platform])
|
||||
OR !isset(TaskModel::typeAssoc()[$type])
|
||||
OR !isset(TaskModel::runTypeAssoc()[$runType])) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
$timeTypes = [TaskModel::RUN_TYPE_TIMER, TaskModel::RUN_TYPE_DAILY];
|
||||
if (in_array($runType, $timeTypes)
|
||||
AND empty($runTime)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
$params = call_user_func_array(TaskModel::taskClasses()[$type] . '::params', [$this->request]);
|
||||
if (is_null($params)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
foreach ($devices as $deviceId) {
|
||||
$model = new TaskModel();
|
||||
$model->platform = $platform;
|
||||
$model->type = $type;
|
||||
$model->device_id = $deviceId;
|
||||
$model->params = $params;
|
||||
$model->run_type = $runType;
|
||||
$model->run_time = in_array($runType, $timeTypes) ? $runTime : '';
|
||||
$model->save();
|
||||
}
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function delete() {
|
||||
$id = intval($this->request->param('id'));
|
||||
if (empty($id)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
$model = TaskModel::get($id);
|
||||
if (empty($model)) {
|
||||
return $this->jsonFail('对象未找到');
|
||||
}
|
||||
|
||||
TaskDetailModel::where(1)
|
||||
->where('task_id', $model->id)
|
||||
->update([
|
||||
'is_deleted' => TaskModel::IS_DELETED_YES,
|
||||
]);
|
||||
|
||||
$model->is_deleted = TaskModel::IS_DELETED_YES;
|
||||
$model->save();
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function batchDelete() {
|
||||
$ids = $this->request->param('ids');
|
||||
if (empty($ids) OR !is_array($ids)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
TaskDetailModel::where(1)
|
||||
->whereIn('task_id', $ids)
|
||||
->update([
|
||||
'is_deleted' => TaskModel::IS_DELETED_YES,
|
||||
]);
|
||||
|
||||
TaskModel::where(1)
|
||||
->whereIn('id', $ids)
|
||||
->update([
|
||||
'is_deleted' => TaskModel::IS_DELETED_YES,
|
||||
]);
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取执行方式
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function runTypeAssoc() {
|
||||
return $this->jsonSucc($this->assocToList(TaskModel::runTypeAssoc()));
|
||||
}
|
||||
}
|
||||
54
Server/application/backend/controller/UploadController.php
Normal file
54
Server/application/backend/controller/UploadController.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
class UploadController extends BaseLoginController {
|
||||
|
||||
// 上传图片
|
||||
public function index() {
|
||||
if (!empty($_FILES)
|
||||
AND !empty($_FILES['file'])
|
||||
AND is_uploaded_file($_FILES['file']['tmp_name'])) {
|
||||
$ext = strtolower(trim(pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION)));
|
||||
$dir = ROOT_PATH . DS . 'public' . DS;
|
||||
$path = 'upload/' . $ext . '/' . date('Y-m-d') . '/' . time() . '-' . uniqid() . '.' . $ext;
|
||||
if (is_dir(dirname($dir . $path)) OR @mkdir(dirname($dir . $path), 0777, TRUE)) {
|
||||
if (move_uploaded_file($_FILES['file']['tmp_name'], $dir . $path)) {
|
||||
return json([
|
||||
'name' => $_FILES['file']['name'],
|
||||
'path' => $path,
|
||||
'url' => $this->absoluteUrl($path),
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($_FILES)) {
|
||||
return json([
|
||||
'url' => '',
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function editor() {
|
||||
if (!empty($_FILES)
|
||||
AND !empty($_FILES['upload'])
|
||||
AND is_uploaded_file($_FILES['upload']['tmp_name'])) {
|
||||
$ext = strtolower(trim(pathinfo($_FILES['upload']['name'], PATHINFO_EXTENSION)));
|
||||
$dir = ROOT_PATH . DS . 'public' . DS;
|
||||
$path = 'upload/' . $ext . '/' . date('Y-m-d') . '/' . time() . '-' . uniqid() . '.' . $ext;
|
||||
if (is_dir(dirname($dir . $path)) OR @mkdir(dirname($dir . $path), 0777, TRUE)) {
|
||||
if (move_uploaded_file($_FILES['upload']['tmp_name'], $dir . $path)) {
|
||||
return json([
|
||||
'uploaded' => true,
|
||||
'url' => $this->absoluteUrl($path),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return json([
|
||||
'uploaded' => false,
|
||||
'url' => '',
|
||||
]);
|
||||
}
|
||||
}
|
||||
114
Server/application/backend/controller/UserController.php
Executable file
114
Server/application/backend/controller/UserController.php
Executable file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\model\UserModel;
|
||||
use app\common\model\UserTokenModel;
|
||||
|
||||
class UserController extends BaseController {
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function login() {
|
||||
$username = trim($this->request->param('username'));
|
||||
$password = trim($this->request->param('password'));
|
||||
if (empty($username)
|
||||
OR empty($password)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
$user = UserModel::get([
|
||||
'username' => $username,
|
||||
'password' => md5($password),
|
||||
]);
|
||||
if (empty($user)) {
|
||||
return $this->jsonFail('账号/密码错误');
|
||||
}
|
||||
if ($user->status != UserModel::STATUS_ACTIVE) {
|
||||
return $this->jsonFail('账号不可用');
|
||||
}
|
||||
|
||||
$tokenModel = new UserTokenModel();
|
||||
$tokenModel->token = md5(time() . uniqid());
|
||||
$tokenModel->user_id = $user->id;
|
||||
if ($tokenModel->save()) {
|
||||
$user->login_time = time();
|
||||
$user->login_count += 1;
|
||||
$user->login_ip = $this->request->ip();
|
||||
if ($user->save()) {
|
||||
return $this->jsonSucc([
|
||||
'logged' => TRUE,
|
||||
'token' => $tokenModel->token,
|
||||
'token_expired' => 365 * 24 * 3600,
|
||||
'user' => $this->userJson($user),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->jsonFail('登录失败');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function get() {
|
||||
if (!empty($this->userModel)) {
|
||||
return $this->jsonSucc([
|
||||
'logged' => TRUE,
|
||||
'user' => $this->userJson($this->userModel),
|
||||
]);
|
||||
} else {
|
||||
return $this->jsonSucc([
|
||||
'logged' => FALSE,
|
||||
'user' => NULL,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置密码
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function password() {
|
||||
if (empty($this->userModel)) {
|
||||
return $this->jsonFail('未登录');
|
||||
}
|
||||
|
||||
$oldPassword = trim($this->request->param('oldPassword'));
|
||||
$newPassword = trim($this->request->param('newPassword'));
|
||||
if (empty($oldPassword)
|
||||
OR empty($newPassword)
|
||||
OR strlen($newPassword) < 6
|
||||
OR strlen($newPassword) > 16) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
if (md5($oldPassword) != $this->userModel->password) {
|
||||
return $this->jsonFail('原密码输入错误');
|
||||
}
|
||||
|
||||
$this->userModel->password = md5($newPassword);
|
||||
$this->userModel->save();
|
||||
|
||||
return $this->jsonSucc([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登出
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function logout() {
|
||||
if (!empty($this->tokenModel)) {
|
||||
$this->tokenModel->delete();
|
||||
}
|
||||
|
||||
return $this->jsonSucc([]);
|
||||
}
|
||||
}
|
||||
85
Server/application/backend/controller/XianyuController.php
Normal file
85
Server/application/backend/controller/XianyuController.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\model\XianyuModel;
|
||||
use think\db\Query;
|
||||
|
||||
class XianyuController extends BaseLoginController {
|
||||
|
||||
/**
|
||||
* 闲鱼列表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function index() {
|
||||
$keywords = trim($this->request->param('keywords'));
|
||||
$pageNo = intval($this->request->param('page'));
|
||||
$pageSize = intval($this->request->param('pageSize'));
|
||||
if ($pageNo <= 0) {
|
||||
$pageNo = 1;
|
||||
}
|
||||
if ($pageSize <= 0) {
|
||||
$pageSize = 30;
|
||||
}
|
||||
|
||||
$query = XianyuModel::where(1);
|
||||
if (!empty($keywords)) {
|
||||
$query->where(function (Query $q) use ($keywords) {
|
||||
$q->whereLike('username', '%' . $keywords . '%', 'OR');
|
||||
$q->whereLike('nickname', '%' . $keywords . '%', 'OR');
|
||||
$q->whereLike('remark', '%' . $keywords . '%', 'OR');
|
||||
});
|
||||
}
|
||||
|
||||
$totalCount = $query->count();
|
||||
$pageCount = $totalCount > 0 ? ceil($totalCount / $pageSize) : 1;
|
||||
if ($pageNo > $pageCount) {
|
||||
$pageNo = $pageCount;
|
||||
}
|
||||
|
||||
$query->order('id', 'DESC');
|
||||
$query->limit(($pageNo - 1) * $pageSize, $pageSize);
|
||||
|
||||
$list = [];
|
||||
foreach ($query->select() as $model) {
|
||||
$list[] = array_merge($model->toArray(), [
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'list' => $list,
|
||||
'page' => $pageNo,
|
||||
'pageCount' => $pageCount,
|
||||
'totalCount' => $totalCount,
|
||||
]);
|
||||
}
|
||||
|
||||
public function update() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function remark() {
|
||||
$id = intval($this->request->param('id'));
|
||||
$remark = trim($this->request->param('remark'));
|
||||
if (empty($id)) {
|
||||
return $this->jsonFail('参数错误');
|
||||
}
|
||||
|
||||
$model = XianyuModel::get($id);
|
||||
if (empty($model)) {
|
||||
return $this->jsonFail('对象未找到');
|
||||
}
|
||||
|
||||
$model->remark = $remark;
|
||||
$model->save();
|
||||
|
||||
return $this->jsonSucc();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\model\DeviceModel;
|
||||
use app\common\model\XianyuProductModel;
|
||||
use app\common\model\XianyuModel;
|
||||
use think\db\Query;
|
||||
|
||||
class XianyuProductController extends BaseLoginController {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function index() {
|
||||
$username = trim($this->request->param('username'));
|
||||
$onSale = trim($this->request->param('on_sale'));
|
||||
$keywords = trim($this->request->param('keywords'));
|
||||
$pageNo = intval($this->request->param('page'));
|
||||
$pageSize = intval($this->request->param('pageSize'));
|
||||
if ($pageNo <= 0) {
|
||||
$pageNo = 1;
|
||||
}
|
||||
if ($pageSize <= 0) {
|
||||
$pageSize = 30;
|
||||
}
|
||||
|
||||
$query = XianyuProductModel::where(1);
|
||||
if (!empty($username)) {
|
||||
$query->where('username', $username);
|
||||
}
|
||||
if (isset(XianyuProductModel::onSaleAssoc()[$onSale])) {
|
||||
$query->where('on_sale', $onSale);
|
||||
}
|
||||
|
||||
if (!empty($keywords)) {
|
||||
$query->where(function (Query $q) use ($keywords) {
|
||||
$q->whereLike('title', '%' . $keywords . '%', 'OR');
|
||||
});
|
||||
}
|
||||
|
||||
$totalCount = $query->count();
|
||||
$pageCount = $totalCount > 0 ? ceil($totalCount / $pageSize) : 1;
|
||||
if ($pageNo > $pageCount) {
|
||||
$pageNo = $pageCount;
|
||||
}
|
||||
|
||||
$query->order('id', 'DESC');
|
||||
$query->limit(($pageNo - 1) * $pageSize, $pageSize);
|
||||
|
||||
$list = [];
|
||||
foreach ($query->select() as $model) {
|
||||
$device = DeviceModel::get($model->device_id);
|
||||
$xianyu = XianyuModel::get(['username' => $model->username]);
|
||||
$list[] = array_merge($model->toArray(), [
|
||||
'device_number' => $device ? $device->number : '',
|
||||
'on_sale_name' => XianyuProductModel::onSaleAssoc()[$model->on_sale],
|
||||
'nickname' => $xianyu ? $xianyu->nickname : '',
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'list' => $list,
|
||||
'page' => $pageNo,
|
||||
'pageCount' => $pageCount,
|
||||
'totalCount' => $totalCount,
|
||||
'xianyus' => $this->assocToList(XianyuModel::assoc()),
|
||||
'onSales' => $this->assocToList(XianyuProductModel::onSaleAssoc()),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\model\DeviceModel;
|
||||
use app\common\model\XianyuModel;
|
||||
use app\common\model\XianyuShopModel;
|
||||
use think\db\Query;
|
||||
|
||||
class XianyuShopController extends BaseLoginController {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function index() {
|
||||
$username = trim($this->request->param('username'));
|
||||
$keywords = trim($this->request->param('keywords'));
|
||||
$pageNo = intval($this->request->param('page'));
|
||||
$pageSize = intval($this->request->param('pageSize'));
|
||||
if ($pageNo <= 0) {
|
||||
$pageNo = 1;
|
||||
}
|
||||
if ($pageSize <= 0) {
|
||||
$pageSize = 30;
|
||||
}
|
||||
|
||||
$query = XianyuShopModel::where(1);
|
||||
if (!empty($username)) {
|
||||
$query->where('username', $username);
|
||||
}
|
||||
if (!empty($keywords)) {
|
||||
$query->where(function (Query $q) use ($keywords) {
|
||||
//$q->whereLike('title', '%' . $keywords . '%', 'OR');
|
||||
});
|
||||
}
|
||||
|
||||
$totalCount = $query->count();
|
||||
$pageCount = $totalCount > 0 ? ceil($totalCount / $pageSize) : 1;
|
||||
if ($pageNo > $pageCount) {
|
||||
$pageNo = $pageCount;
|
||||
}
|
||||
|
||||
$query->order('id', 'DESC');
|
||||
$query->limit(($pageNo - 1) * $pageSize, $pageSize);
|
||||
|
||||
$list = [];
|
||||
foreach ($query->select() as $model) {
|
||||
$device = DeviceModel::get($model->device_id);
|
||||
$xianyu = XianyuModel::get(['username' => $model->username]);
|
||||
$list[] = array_merge($model->toArray(), [
|
||||
'device_number' => $device ? $device->number : '',
|
||||
'nickname' => $xianyu ? $xianyu->nickname : '',
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'list' => $list,
|
||||
'page' => $pageNo,
|
||||
'pageCount' => $pageCount,
|
||||
'totalCount' => $totalCount,
|
||||
'xianyus' => $this->assocToList(XianyuModel::assoc()),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use app\common\model\DeviceModel;
|
||||
use app\common\model\XianyuModel;
|
||||
use app\common\model\XianyuShopProductModel;
|
||||
use think\db\Query;
|
||||
|
||||
class XianyuShopProductController extends BaseLoginController {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function index() {
|
||||
$username = trim($this->request->param('username'));
|
||||
$pay = trim($this->request->param('pay'));
|
||||
$keywords = trim($this->request->param('keywords'));
|
||||
$pageNo = intval($this->request->param('page'));
|
||||
$pageSize = intval($this->request->param('pageSize'));
|
||||
if ($pageNo <= 0) {
|
||||
$pageNo = 1;
|
||||
}
|
||||
if ($pageSize <= 0) {
|
||||
$pageSize = 30;
|
||||
}
|
||||
|
||||
$query = XianyuShopProductModel::where(1);
|
||||
if (!empty($username)) {
|
||||
$query->where('username', $username);
|
||||
}
|
||||
if (isset(XianyuShopProductModel::payAssoc()[$pay])) {
|
||||
$query->where('pay', $pay);
|
||||
}
|
||||
|
||||
if (!empty($keywords)) {
|
||||
$query->where(function (Query $q) use ($keywords) {
|
||||
$q->whereLike('title', '%' . $keywords . '%', 'OR');
|
||||
});
|
||||
}
|
||||
|
||||
$totalCount = $query->count();
|
||||
$pageCount = $totalCount > 0 ? ceil($totalCount / $pageSize) : 1;
|
||||
if ($pageNo > $pageCount) {
|
||||
$pageNo = $pageCount;
|
||||
}
|
||||
|
||||
$query->order('id', 'DESC');
|
||||
$query->limit(($pageNo - 1) * $pageSize, $pageSize);
|
||||
|
||||
$list = [];
|
||||
foreach ($query->select() as $model) {
|
||||
$device = DeviceModel::get($model->device_id);
|
||||
$xianyu = XianyuModel::get(['username' => $model->username]);
|
||||
$list[] = array_merge($model->toArray(), [
|
||||
'device_number' => $device ? $device->number : '',
|
||||
'pay_name' => XianyuShopProductModel::payAssoc()[$model->pay],
|
||||
'nickname' => $xianyu ? $xianyu->nickname : '',
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->jsonSucc([
|
||||
'list' => $list,
|
||||
'page' => $pageNo,
|
||||
'pageCount' => $pageCount,
|
||||
'totalCount' => $totalCount,
|
||||
'xianyus' => $this->assocToList(XianyuModel::assoc()),
|
||||
'pays' => $this->assocToList(XianyuShopProductModel::payAssoc()),
|
||||
]);
|
||||
}
|
||||
}
|
||||
54
Server/application/backend/model/TimeRangeModel.php
Executable file
54
Server/application/backend/model/TimeRangeModel.php
Executable file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace app\backend\model;
|
||||
|
||||
class TimeRangeModel {
|
||||
|
||||
/**
|
||||
* 获取年
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
static public function getYears() {
|
||||
$years = [];
|
||||
$timeS = strtotime(date('Y') . '-01-01');
|
||||
$timeE = strtotime((date('Y', $timeS) + 1) . '-01-01') - 1;
|
||||
for ($i = 0; $i > -3; $i --) {
|
||||
$years[] = [
|
||||
'key' => $i,
|
||||
'label' => date('Y 年', $timeS),
|
||||
'timeS' => $timeS,
|
||||
'timeE' => $timeE,
|
||||
];
|
||||
|
||||
$timeE = $timeS - 1;
|
||||
$timeS = strtotime(date('Y', $timeE) . '-01-01');
|
||||
}
|
||||
|
||||
return $years;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取月份
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
static public function getMonths() {
|
||||
$months = [];
|
||||
$timeS = strtotime(date('Y-m') . '-01');
|
||||
$timeE = $timeS + date('t', $timeS) * 24 * 3600 - 1;
|
||||
for ($i = 0; $i > -24; $i --) {
|
||||
$months[] = [
|
||||
'key' => $i,
|
||||
'label' => date('Y 年 m 月', $timeS) . ' (' . date('Y.m.d', $timeS) . '-' . date('Y.m.d', $timeE) . ')',
|
||||
'timeS' => $timeS,
|
||||
'timeE' => $timeE,
|
||||
];
|
||||
|
||||
$timeS = strtotime(date('Y-m', $timeS - 1) . '-01');
|
||||
$timeE = $timeS + date('t', $timeS) * 24 * 3600 - 1;
|
||||
}
|
||||
|
||||
return $months;
|
||||
}
|
||||
}
|
||||
57
Server/application/backend/view/chart-day.php
Normal file
57
Server/application/backend/view/chart-day.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
#main {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="main"></div>
|
||||
</body>
|
||||
<script type="text/javascript" src="/static/echarts/echarts.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var chartDom = document.getElementById('main');
|
||||
var myChart = echarts.init(chartDom);
|
||||
var option = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: <?php echo json_encode($legend); ?>
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
saveAsImage: {}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: <?php echo json_encode($xAxis); ?>
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: <?php echo json_encode($series); ?>
|
||||
};
|
||||
|
||||
option && myChart.setOption(option);
|
||||
</script>
|
||||
</html>
|
||||
14
Server/application/command.php
Executable file
14
Server/application/command.php
Executable file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: yunwuxin <448901948@qq.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
'test' => 'app\common\command\TestCommand',
|
||||
];
|
||||
12
Server/application/common.php
Executable file
12
Server/application/common.php
Executable file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: 流年 <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// 应用公共文件
|
||||
65
Server/application/common/AliyunSMS.php
Executable file
65
Server/application/common/AliyunSMS.php
Executable file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace app\common;
|
||||
|
||||
use Darabonba\OpenApi\Models\Config;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Dysmsapi;
|
||||
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\SendSmsRequest;
|
||||
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
|
||||
|
||||
class AliyunSMS {
|
||||
|
||||
const ACCESS_KEY_ID = 'LTAI5tFjVRYAFmo6fayvv2Te';
|
||||
const ACCESS_KEY_SECRET = 'mdc7KETPGVon8PiA2kfM47rAOpJne8';
|
||||
const SIGN_NAME = '广州宏科网络';
|
||||
|
||||
const TC_VCODE = 'SMS_464445466';
|
||||
|
||||
static public function createClient() {
|
||||
$config = new Config([
|
||||
// AccessKey ID
|
||||
'accessKeyId' => static::ACCESS_KEY_ID,
|
||||
// AccessKey Secret
|
||||
'accessKeySecret' => static::ACCESS_KEY_SECRET
|
||||
]);
|
||||
|
||||
// 访问的域名
|
||||
$config->endpoint = 'dysmsapi.aliyuncs.com';
|
||||
|
||||
return new Dysmsapi($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送验证码
|
||||
*
|
||||
* @param $phoneNumbers
|
||||
* @param $templateCode
|
||||
* @param array $templateParam
|
||||
* @return bool
|
||||
*/
|
||||
static public function send($phoneNumbers, $templateCode, array $templateParam = array()) {
|
||||
$client = static::createClient();
|
||||
$sendSmsRequest = new SendSmsRequest([
|
||||
'phoneNumbers' => $phoneNumbers,
|
||||
'signName' => static::SIGN_NAME,
|
||||
'templateCode' => $templateCode,
|
||||
'templateParam' => json_encode($templateParam)
|
||||
]);
|
||||
$runtime = new RuntimeOptions([]);
|
||||
$logFile = ROOT_PATH . DS . 'aliyun-sms.txt';
|
||||
try {
|
||||
$data = $client->sendSmsWithOptions($sendSmsRequest, $runtime);
|
||||
if ($data->body->code === 'OK') {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$logData = print_r($data, TRUE);
|
||||
} catch (\Exception $ex) {
|
||||
$logData = print_r($ex, TRUE);
|
||||
}
|
||||
|
||||
file_put_contents($logFile, '[' . date('Y-m-d H:i:s') . ']' . PHP_EOL . $logData . PHP_EOL . PHP_EOL, FILE_APPEND);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
122
Server/application/common/Fork.php
Normal file
122
Server/application/common/Fork.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace app\common;
|
||||
|
||||
class Fork {
|
||||
|
||||
/**
|
||||
* 执行多条任务并等待所有任务执行完成后结束
|
||||
*
|
||||
* @param array $taskFuncs
|
||||
*/
|
||||
static public function wait(array $taskFuncs) {
|
||||
foreach ($taskFuncs as $i => $taskFunc) {
|
||||
$pid = pcntl_fork();
|
||||
if ($pid == -1) {
|
||||
exit('Could not fork.');
|
||||
} elseif ($pid == 0) {
|
||||
call_user_func_array($taskFunc, [$i]);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
foreach ($taskFuncs as $taskFunc) {
|
||||
pcntl_wait($status);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 并发执行多条任务
|
||||
*
|
||||
* @param array $taskFuncs
|
||||
*/
|
||||
static public function invoke(array $taskFuncs) {
|
||||
$taskRuns = [];
|
||||
$signal = FALSE;
|
||||
if (function_exists('pcntl_async_signals')) {
|
||||
pcntl_async_signals(TRUE);
|
||||
}
|
||||
while (TRUE) {
|
||||
foreach ($taskFuncs as $i => $taskFunc) {
|
||||
if (!in_array($i, $taskRuns)) {
|
||||
$pid = pcntl_fork();
|
||||
if ($pid == -1) {
|
||||
exit('Could not fork.');
|
||||
} elseif ($pid > 0) {
|
||||
$taskRuns[$pid] = $i;
|
||||
if (!$signal) {
|
||||
$signal = TRUE;
|
||||
static::signalHandler();
|
||||
}
|
||||
} else {
|
||||
call_user_func_array($taskFunc, [$i]);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($pid = pcntl_wait($status, WNOHANG)) {
|
||||
unset($taskRuns[$pid]);
|
||||
} else {
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按指定数量并发执行相同任务
|
||||
*
|
||||
* @param $count
|
||||
* @param $taskFunc
|
||||
* @param int $destroy
|
||||
*/
|
||||
static public function execute($count, $taskFunc, $destroy = 100) {
|
||||
$runSum = 0;
|
||||
$runNum = 0;
|
||||
$signal = FALSE;
|
||||
if (function_exists('pcntl_async_signals')) {
|
||||
pcntl_async_signals(TRUE);
|
||||
}
|
||||
while (TRUE) {
|
||||
if ($runNum >= $count) {
|
||||
if (pcntl_wait($status, WNOHANG) > 0) {
|
||||
$runNum --;
|
||||
} else {
|
||||
sleep(1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$pid = pcntl_fork();
|
||||
if ($pid == -1) {
|
||||
exit('Could not fork.');
|
||||
} elseif ($pid > 0) {
|
||||
$runSum ++;
|
||||
$runNum ++;
|
||||
if (!$signal) {
|
||||
$signal = TRUE;
|
||||
static::signalHandler();
|
||||
}
|
||||
} else {
|
||||
for ($i = 0; $i < $destroy; $i ++) {
|
||||
call_user_func_array($taskFunc, [$runSum % $count]);
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置信息处理器
|
||||
*
|
||||
*/
|
||||
static public function signalHandler() {
|
||||
$handler = function () {
|
||||
posix_kill(0, SIGKILL);
|
||||
exit(0);
|
||||
};
|
||||
pcntl_signal(SIGINT, $handler);
|
||||
pcntl_signal(SIGTERM, $handler);
|
||||
pcntl_signal(SIGUSR1, $handler);
|
||||
pcntl_signal(SIGUSR2, $handler);
|
||||
}
|
||||
}
|
||||
90
Server/application/common/Logger.php
Normal file
90
Server/application/common/Logger.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace app\common;
|
||||
|
||||
class Logger {
|
||||
|
||||
const INFO = 'INFO';
|
||||
const WARN = 'WARN';
|
||||
const ERROR = 'ERROR';
|
||||
|
||||
static protected $loggers = [];
|
||||
|
||||
/**
|
||||
* 获取日志对象
|
||||
*
|
||||
* @param $name
|
||||
* @return Logger
|
||||
*/
|
||||
static public function _($name) {
|
||||
$lower = strtolower($name);
|
||||
if (!isset(static::$loggers[$lower])) {
|
||||
static::$loggers[$lower] = new Logger($name);
|
||||
}
|
||||
return static::$loggers[$lower];
|
||||
}
|
||||
|
||||
protected $name;
|
||||
protected $print = TRUE;
|
||||
|
||||
/**
|
||||
* Logger constructor.
|
||||
*
|
||||
* @param $name
|
||||
*/
|
||||
protected function __construct($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入信息
|
||||
*
|
||||
* @param $message
|
||||
* @param array $params
|
||||
*/
|
||||
public function info($message, array $params = []) {
|
||||
$this->write(static::INFO, $message, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入警告
|
||||
*
|
||||
* @param $message
|
||||
* @param array $params
|
||||
*/
|
||||
public function warn($message, array $params = []) {
|
||||
$this->write(static::WARN, $message, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入错误
|
||||
*
|
||||
* @param $message
|
||||
* @param array $params
|
||||
*/
|
||||
public function error($message, array $params = []) {
|
||||
$this->write(static::ERROR, $message, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入日志
|
||||
*
|
||||
* @param $type
|
||||
* @param $message
|
||||
* @param array $params
|
||||
*/
|
||||
public function write($type, $message, array $params = []) {
|
||||
foreach ($params as $key => $value) {
|
||||
$message = str_replace('{' . $key . '}', $value, $message);
|
||||
}
|
||||
|
||||
$data = '[' . date('Y-m-d H:i:s') . '][' . $type . '] ' . $message . PHP_EOL;
|
||||
$file = ROOT_PATH . DS . 'runtime' . DS . $this->name . '_' . date('Ymd') . '.txt';
|
||||
|
||||
file_put_contents($file, $data, FILE_APPEND);
|
||||
|
||||
if ($this->print) {
|
||||
echo '[' . date('Y-m-d H:i:s') . '][' . $this->name . '][' . $type . '] ' . $message . PHP_EOL;;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Server/application/common/Utils.php
Normal file
36
Server/application/common/Utils.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace app\common;
|
||||
|
||||
class Utils {
|
||||
|
||||
/**
|
||||
* 获取URL
|
||||
*
|
||||
* @param $url
|
||||
* @return string
|
||||
*/
|
||||
static public function absoluteUrl($url) {
|
||||
if (!empty($_SERVER['HTTP_HOST'])) {
|
||||
return (!empty($_SERVER['HTTPS']) ? 'https' : 'http')
|
||||
. '://' . $_SERVER['HTTP_HOST']
|
||||
. ($url{0} === '/' ? $url : '/' . $url);
|
||||
} else {
|
||||
return config('config.domain') . ($url{0} === '/' ? $url : '/' . $url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算熟知
|
||||
*
|
||||
* @param $total
|
||||
* @param $number1
|
||||
* @param $number2
|
||||
*/
|
||||
static public function allocNumber($total, & $number1, & $number2) {
|
||||
if ($number1 > 0 OR $number2 > 0) {
|
||||
$number1 = $total * ($number1 / ($number1 + $number2));
|
||||
$number2 = $total - $number1;
|
||||
}
|
||||
}
|
||||
}
|
||||
101
Server/application/common/Video.php
Normal file
101
Server/application/common/Video.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace app\common;
|
||||
|
||||
class Video {
|
||||
|
||||
/**
|
||||
* 图片合成视频
|
||||
*
|
||||
* @param array $images
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
static public function compositing(array $images) {
|
||||
if (empty($images)) {
|
||||
throw new \Exception('图片列表不能为空');
|
||||
}
|
||||
|
||||
// 设置视频参数
|
||||
$width = 800;
|
||||
$height = 600; // 4:3 比例
|
||||
$frameRate = 30; // 调整帧率为30fps,使动画更流畅
|
||||
|
||||
// 创建临时文件夹
|
||||
$tempDir = ROOT_PATH . DS . 'runtime' . DS . 'video_temp';
|
||||
if (!is_dir($tempDir)) {
|
||||
mkdir($tempDir, 0777, true);
|
||||
}
|
||||
|
||||
// 生成唯一的输出文件名
|
||||
$outputFile = $tempDir . DS . uniqid() . '.mp4';
|
||||
|
||||
// 准备图片列表文件
|
||||
$listFile = $tempDir . DS . uniqid() . '.txt';
|
||||
$content = '';
|
||||
|
||||
// 生成临时图片序列目录
|
||||
$tempImagesDir = $tempDir . DS . uniqid();
|
||||
if (!is_dir($tempImagesDir)) {
|
||||
mkdir($tempImagesDir, 0777, true);
|
||||
}
|
||||
|
||||
// 处理每张图片,生成临时文件
|
||||
$tempImages = [];
|
||||
foreach ($images as $index => $image) {
|
||||
if (!file_exists($image)) {
|
||||
throw new \Exception('图片不存在:' . $image);
|
||||
}
|
||||
$tempImage = $tempImagesDir . DS . sprintf('%04d.jpg', $index);
|
||||
copy($image, $tempImage);
|
||||
$tempImages[] = $tempImage;
|
||||
}
|
||||
|
||||
// 构建 FFmpeg 命令
|
||||
$filterComplex = [];
|
||||
|
||||
// 处理所有输入流的格式和缩放
|
||||
foreach ($tempImages as $i => $image) {
|
||||
$filterComplex[] = sprintf('[%d:v]format=yuv420p,scale=%d:%d:force_original_aspect_ratio=decrease,pad=%d:%d:(ow-iw)/2:(oh-ih)/2[v%d]',
|
||||
$i, $width, $height, $width, $height, $i);
|
||||
}
|
||||
|
||||
// 构建转场效果链
|
||||
$lastOutput = 'v0';
|
||||
for ($i = 1; $i < count($tempImages); $i++) {
|
||||
$filterComplex[] = sprintf('[%s][v%d]xfade=transition=fade:duration=1:offset=%d[fade%d]',
|
||||
$lastOutput, $i, ($i * 3) - 1, $i);
|
||||
$lastOutput = sprintf('fade%d', $i);
|
||||
}
|
||||
|
||||
$inputFiles = '';
|
||||
foreach ($tempImages as $image) {
|
||||
$inputFiles .= sprintf('-loop 1 -t %d -i "%s" ', count($tempImages) * 3, $image);
|
||||
}
|
||||
|
||||
$duration = count($tempImages) * 3 - (count($tempImages) - 1); // 总时长计算
|
||||
|
||||
$cmd = sprintf(
|
||||
'ffmpeg5 %s -filter_complex "%s" -map "[%s]" -t %d -c:v libx264 -pix_fmt yuv420p -r %d "%s" 2>&1',
|
||||
$inputFiles,
|
||||
implode(';', $filterComplex),
|
||||
$lastOutput,
|
||||
$duration,
|
||||
$frameRate,
|
||||
$outputFile
|
||||
);
|
||||
|
||||
// 执行命令
|
||||
exec($cmd, $output, $returnCode);
|
||||
|
||||
// 清理临时文件
|
||||
array_map('unlink', glob($tempImagesDir . DS . '*'));
|
||||
rmdir($tempImagesDir);
|
||||
|
||||
if ($returnCode !== 0) {
|
||||
throw new \Exception('视频生成失败:' . implode("\n", $output));
|
||||
}
|
||||
|
||||
return $outputFile;
|
||||
}
|
||||
}
|
||||
31
Server/application/common/command/BaseCommand.php
Executable file
31
Server/application/common/command/BaseCommand.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
use think\console\Command;
|
||||
|
||||
class BaseCommand extends Command {
|
||||
|
||||
protected $logSave = 1; // 1: 文件,2: 打印
|
||||
|
||||
/**
|
||||
* 写入日志
|
||||
*
|
||||
* @param $type
|
||||
* @param $message
|
||||
*/
|
||||
public function log($type, $message) {
|
||||
$data = '[' . date('Y-m-d H:i:s') . ']' . PHP_EOL;
|
||||
$data .= '[' . $type . '] ' . $message . PHP_EOL . PHP_EOL;
|
||||
|
||||
if ($this->logSave === 1) {
|
||||
$name = get_class($this);
|
||||
$name = substr($name, strrpos($name, '\\') + 1);
|
||||
$file = ROOT_PATH . DS . 'runtime' . DS . $name . '_' . date('Ymd') . '.txt';
|
||||
|
||||
file_put_contents($file, $data, FILE_APPEND);
|
||||
} else {
|
||||
echo $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Server/application/common/command/TestCommand.php
Executable file
20
Server/application/common/command/TestCommand.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
|
||||
class TestCommand extends BaseCommand {
|
||||
|
||||
protected $logSave = 2;
|
||||
|
||||
protected function configure() {
|
||||
$this->setName('Test')
|
||||
->setDescription('command test.');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output) {
|
||||
print_r('hello test.');
|
||||
}
|
||||
}
|
||||
69
Server/application/common/model/DeviceModel.php
Normal file
69
Server/application/common/model/DeviceModel.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class DeviceModel extends Model {
|
||||
|
||||
const ACTIVE_TIME = 60;
|
||||
|
||||
const IS_ONLINE_NO = 0;
|
||||
const IS_ONLINE_YES = 10;
|
||||
|
||||
const STATUS_ACTIVE = 0;
|
||||
const STATUS_DISABLE = 99;
|
||||
|
||||
/**
|
||||
* 获取关联数组
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
static public function assoc() {
|
||||
static $assoc = NULL;
|
||||
if (is_null($assoc)) {
|
||||
$assoc = [];
|
||||
foreach (static::where(1)
|
||||
->order('id', 'DESC')
|
||||
->select() as $model) {
|
||||
$assoc[$model->getAttr('id')] = $model->getAttr('number')
|
||||
. ($model->isOnline() ? '[在线]' : '[离线]');
|
||||
}
|
||||
}
|
||||
return $assoc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否在线
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
static public function isOnlineAssoc() {
|
||||
return [
|
||||
static::IS_ONLINE_YES => '在线',
|
||||
static::IS_ONLINE_NO => '离线',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
static public function statusAssoc() {
|
||||
return [
|
||||
static::STATUS_ACTIVE => '正常',
|
||||
static::STATUS_DISABLE => '停用',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备是否在线
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isOnline() {
|
||||
return $this->getAttr('is_online') == static::IS_ONLINE_YES
|
||||
AND time() - $this->getAttr('active_time') <= static::ACTIVE_TIME;
|
||||
}
|
||||
}
|
||||
16
Server/application/common/model/TaskDetailModel.php
Normal file
16
Server/application/common/model/TaskDetailModel.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class TaskDetailModel extends Model {
|
||||
|
||||
const STATUS_AWAIT = 0;
|
||||
const STATUS_RUNNING = 10;
|
||||
const STATUS_SUCC = 20;
|
||||
const STATUS_FAIL = 99;
|
||||
|
||||
protected $json = ['params', 'info'];
|
||||
protected $jsonAssoc = TRUE;
|
||||
}
|
||||
159
Server/application/common/model/TaskModel.php
Normal file
159
Server/application/common/model/TaskModel.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class TaskModel extends Model {
|
||||
|
||||
const PLATFORM_XIANYU = 'XIANYU';
|
||||
|
||||
const TYPE_PRODUCT_RELEASE = 'PRODUCT_RELEASE';
|
||||
const TYPE_PRODUCT_POLISH = 'PRODUCT_POLISH';
|
||||
const TYPE_PRODUCT_ON = 'PRODUCT_ON';
|
||||
const TYPE_PRODUCT_OFF = 'PRODUCT_OFF';
|
||||
const TYPE_COIN_SIGN = 'COIN_SIGN';
|
||||
const TYPE_COIN_DEDUCT = 'COIN_DEDUCT';
|
||||
const TYPE_PRICE_CUT = 'PRICE_CUT';
|
||||
const TYPE_COMMENT_REMOVE = 'COMMENT_REMOVE';
|
||||
const TYPE_PRODUCT_RE_RELEASE = 'PRODUCT_RE_RELEASE';
|
||||
const TYPE_RAISE_XY = 'RAISE_XY';
|
||||
const TYPE_RAISE_XY_TZ = 'RAISE_XY_TZ';
|
||||
const TYPE_RAISE_XY_UNITY = 'RAISE_XY_UNITY';
|
||||
const TYPE_SYNC_USER = 'SYNC_USER';
|
||||
const TYPE_SYNC_SHOP = 'SYNC_SHOP';
|
||||
const TYPE_UPDATE_USER = 'UPDATE_USER';
|
||||
const TYPE_PRODUCT_WELFARE = 'PRODUCT_WELFARE';
|
||||
const TYPE_MESSAGE_REPLY = 'MESSAGE_REPLY';
|
||||
|
||||
const RUN_TYPE_ONCE = 'ONCE';
|
||||
const RUN_TYPE_TIMER = 'TIMER';
|
||||
const RUN_TYPE_DAILY = 'DAILY';
|
||||
|
||||
const STATUS_AWAIT = 0;
|
||||
const STATUS_ALLOC = 10;
|
||||
const STATUS_COMPLETE = 20;
|
||||
|
||||
const IS_DELETED_NO = 0;
|
||||
const IS_DELETED_YES = 10;
|
||||
|
||||
protected $json = ['params'];
|
||||
protected $jsonAssoc = TRUE;
|
||||
|
||||
/**
|
||||
* 获取类型
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
static public function typeAssoc() {
|
||||
return [
|
||||
static::TYPE_PRODUCT_RELEASE => '[闲鱼]发布商品',
|
||||
static::TYPE_PRODUCT_POLISH => '[闲鱼]擦亮商品',
|
||||
static::TYPE_PRODUCT_ON => '[闲鱼]上架商品',
|
||||
static::TYPE_PRODUCT_OFF => '[闲鱼]下架商品',
|
||||
static::TYPE_COIN_SIGN => '[闲鱼]签到鱼币',
|
||||
static::TYPE_COIN_DEDUCT => '[闲鱼]鱼币抵扣',
|
||||
static::TYPE_PRICE_CUT => '[闲鱼]一键降价',
|
||||
static::TYPE_COMMENT_REMOVE => '[闲鱼]删除留言',
|
||||
static::TYPE_PRODUCT_RE_RELEASE => '[闲鱼]编辑重复',
|
||||
static::TYPE_RAISE_XY => '[闲鱼]养号',
|
||||
static::TYPE_RAISE_XY_UNITY => '[闲鱼]互助养号',
|
||||
static::TYPE_RAISE_XY_TZ => '[闲鱼]会玩养号',
|
||||
static::TYPE_SYNC_USER => '[闲鱼]采集账号信息',
|
||||
static::TYPE_SYNC_SHOP => '[闲鱼]采集店铺信息',
|
||||
static::TYPE_UPDATE_USER => '[闲鱼]修改账号信息',
|
||||
static::TYPE_PRODUCT_WELFARE => '[闲鱼]公益宝贝',
|
||||
static::TYPE_MESSAGE_REPLY => '[闲鱼]消息回复',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
static public function statusAssoc() {
|
||||
return [
|
||||
static::STATUS_AWAIT => '加入队列',
|
||||
static::STATUS_ALLOC => '准备运行',
|
||||
static::STATUS_COMPLETE => '运行成功',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取执行方式
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
static public function runTypeAssoc() {
|
||||
return [
|
||||
static::RUN_TYPE_ONCE => '立刻执行',
|
||||
static::RUN_TYPE_TIMER => '定时执行',
|
||||
static::RUN_TYPE_DAILY => '每天执行',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
static public function platformAssoc() {
|
||||
return [
|
||||
static::PLATFORM_XIANYU => '闲鱼',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务类
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
static public function taskClasses() {
|
||||
return [
|
||||
static::TYPE_PRODUCT_RELEASE => '\app\common\task\ProductReleaseTask',
|
||||
static::TYPE_PRODUCT_POLISH => '\app\common\task\ProductPolishTask',
|
||||
static::TYPE_PRODUCT_ON => '\app\common\task\ProductOnTask',
|
||||
static::TYPE_PRODUCT_OFF => '\app\common\task\ProductOffTask',
|
||||
static::TYPE_COIN_SIGN => '\app\common\task\CoinSignTask',
|
||||
static::TYPE_COIN_DEDUCT => '\app\common\task\CoinDeductTask',
|
||||
static::TYPE_PRICE_CUT => '\app\common\task\PriceCutTask',
|
||||
static::TYPE_COMMENT_REMOVE => '\app\common\task\CommentRemoveTask',
|
||||
static::TYPE_PRODUCT_RE_RELEASE => '\app\common\task\ProductReReleaseTask',
|
||||
static::TYPE_RAISE_XY => '\app\common\task\RaiseXyTask',
|
||||
static::TYPE_RAISE_XY_UNITY => '\app\common\task\RaiseXyUnityTask',
|
||||
static::TYPE_RAISE_XY_TZ => '\app\common\task\RaiseXyTzTask',
|
||||
static::TYPE_SYNC_USER => '\app\common\task\SyncUserTask',
|
||||
static::TYPE_SYNC_SHOP => '\app\common\task\SyncShopTask',
|
||||
static::TYPE_UPDATE_USER => '\app\common\task\UpdateUserTask',
|
||||
static::TYPE_PRODUCT_WELFARE => '\app\common\task\ProductWelfareTask',
|
||||
static::TYPE_MESSAGE_REPLY => '\app\common\task\MessageReplyTask',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 分配到详情
|
||||
*
|
||||
* @param TaskModel $model
|
||||
* @return bool
|
||||
*/
|
||||
static public function toDetail(TaskModel $model) {
|
||||
$detail = new TaskDetailModel();
|
||||
$detail->setAttr('task_id', $model->getAttr('id'));
|
||||
$detail->setAttr('device_id', $model->getAttr('device_id'));
|
||||
$detail->setAttr('platform', $model->getAttr('platform'));
|
||||
$detail->setAttr('type', $model->getAttr('type'));
|
||||
$detail->setAttr('params', $model->getAttr('params'));
|
||||
$detail->setAttr('info', new \stdClass());
|
||||
return $detail->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备
|
||||
*
|
||||
* @return DeviceModel
|
||||
*/
|
||||
public function device() {
|
||||
return DeviceModel::get($this->getAttr('device_id'));
|
||||
}
|
||||
}
|
||||
39
Server/application/common/model/UserModel.php
Normal file
39
Server/application/common/model/UserModel.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class UserModel extends Model {
|
||||
|
||||
const STATUS_ACTIVE = 0; // 正常
|
||||
const STATUS_DISABLE = 99; // 禁用
|
||||
|
||||
/**
|
||||
* 获取状态
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public static function statusAssoc() {
|
||||
return [
|
||||
static::STATUS_ACTIVE => '正常',
|
||||
static::STATUS_DISABLE => '禁用',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 只读
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $readonly = ['username'];
|
||||
|
||||
/**
|
||||
* JSON 字段
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $json = ['roles'];
|
||||
|
||||
protected $jsonAssoc = TRUE;
|
||||
}
|
||||
9
Server/application/common/model/UserTokenModel.php
Normal file
9
Server/application/common/model/UserTokenModel.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class UserTokenModel extends Model {
|
||||
|
||||
}
|
||||
126
Server/application/common/socket/Events.php
Normal file
126
Server/application/common/socket/Events.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\socket;
|
||||
|
||||
use app\common\Logger;
|
||||
use app\common\model\DeviceModel;
|
||||
use \GatewayWorker\Lib\Gateway;
|
||||
use Workerman\Worker;
|
||||
|
||||
/**
|
||||
* Worker 命令行服务类
|
||||
*/
|
||||
class Events {
|
||||
|
||||
const LOGGER = 'WS';
|
||||
|
||||
/**
|
||||
* onConnect 事件回调
|
||||
* 当客户端连接上gateway进程时(TCP三次握手完毕时)触发
|
||||
*
|
||||
* @access public
|
||||
* @param int $client_id
|
||||
* @return void
|
||||
*/
|
||||
public static function onConnect($client_id) {
|
||||
//echo '---------';
|
||||
}
|
||||
|
||||
/**
|
||||
* onWebSocketConnect 事件回调
|
||||
* 当客户端连接上gateway完成websocket握手时触发
|
||||
*
|
||||
* @param integer $client_id 断开连接的客户端client_id
|
||||
* @param mixed $data
|
||||
* @return void
|
||||
*/
|
||||
public static function onWebSocketConnect($clientId, $data) {
|
||||
try {
|
||||
// 清除原会话数据
|
||||
Gateway::setSession($clientId, []);
|
||||
|
||||
// 设置会话数据
|
||||
//Gateway::setSession($clientId, $client);
|
||||
|
||||
Logger::_(static::LOGGER)->info('连接成功: {id}', [
|
||||
'id' => $clientId,
|
||||
]);
|
||||
} catch (\Exception $ex) {
|
||||
Gateway::closeClient($clientId);
|
||||
|
||||
Logger::_(static::LOGGER)->info('连接错误: {id}|{error}', [
|
||||
'id' => $clientId,
|
||||
'error' => $ex->getMessage() . '<' . $ex->getCode() . '>',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onMessage 事件回调
|
||||
* 当客户端发来数据(Gateway进程收到数据)后触发
|
||||
*
|
||||
* @access public
|
||||
* @param int $client_id
|
||||
* @param mixed $data
|
||||
* @return void
|
||||
*/
|
||||
public static function onMessage($clientId, $data) {
|
||||
$json = @json_decode($data, TRUE);
|
||||
if (!empty($json)
|
||||
AND !empty($json['type'])
|
||||
AND is_array($json['data'])) {
|
||||
$session = Gateway::getSession($clientId);
|
||||
if (empty($session)) {
|
||||
throw new \Exception('获取SESSION失败: ' . $clientId);
|
||||
}
|
||||
|
||||
} else {
|
||||
Gateway::closeClient($clientId);
|
||||
|
||||
Logger::_(static::LOGGER)->error('消息错误: {id}|{data}', [
|
||||
'id' => $clientId,
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onClose 事件回调 当用户断开连接时触发的方法
|
||||
*
|
||||
* @param integer $clientId 断开连接的客户端client_id
|
||||
* @return void
|
||||
*/
|
||||
public static function onClose($clientId) {
|
||||
Gateway::setSession($clientId, []);
|
||||
Logger::_(static::LOGGER)->info('连接关闭: {id}', [
|
||||
'id' => $clientId,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* onWorkerStart 事件回调
|
||||
* 当businessWorker进程启动时触发。每个进程生命周期内都只会触发一次
|
||||
*
|
||||
* @access public
|
||||
* @param \Workerman\Worker $businessWorker
|
||||
* @return void
|
||||
*/
|
||||
public static function onWorkerStart(Worker $businessWorker) {
|
||||
Logger::_(static::LOGGER)->info('进程启动: {id}', [
|
||||
'id' => $businessWorker->id,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* onWorkerStop 事件回调
|
||||
* 当businessWorker进程退出时触发。每个进程生命周期内都只会触发一次。
|
||||
*
|
||||
* @param \Workerman\Worker $businessWorker
|
||||
* @return void
|
||||
*/
|
||||
public static function onWorkerStop(Worker $businessWorker) {
|
||||
Logger::_(static::LOGGER)->info('进程关闭: {id}', [
|
||||
'id' => $businessWorker->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
16
Server/application/frontend/controller/IndexController.php
Executable file
16
Server/application/frontend/controller/IndexController.php
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace app\frontend\controller;
|
||||
|
||||
use think\Controller;
|
||||
|
||||
class IndexController extends Controller {
|
||||
|
||||
/**
|
||||
* 跳转至后台登录页
|
||||
*
|
||||
*/
|
||||
public function index() {
|
||||
return $this->redirect('/admin/');
|
||||
}
|
||||
}
|
||||
14
Server/application/provider.php
Executable file
14
Server/application/provider.php
Executable file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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 [
|
||||
];
|
||||
28
Server/application/tags.php
Executable file
28
Server/application/tags.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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 [
|
||||
// 应用初始化
|
||||
'app_init' => [],
|
||||
// 应用开始
|
||||
'app_begin' => [],
|
||||
// 模块初始化
|
||||
'module_init' => [],
|
||||
// 操作开始执行
|
||||
'action_begin' => [],
|
||||
// 视图内容过滤
|
||||
'view_filter' => [],
|
||||
// 日志写入
|
||||
'log_write' => [],
|
||||
// 应用结束
|
||||
'app_end' => [],
|
||||
];
|
||||
26
Server/build.php
Executable file
26
Server/build.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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 [
|
||||
// 生成应用公共文件
|
||||
'__file__' => ['common.php'],
|
||||
|
||||
// 定义demo模块的自动生成 (按照实际定义的文件名生成)
|
||||
'demo' => [
|
||||
'__file__' => ['common.php'],
|
||||
'__dir__' => ['behavior', 'controller', 'model', 'view'],
|
||||
'controller' => ['Index', 'Test', 'UserType'],
|
||||
'model' => ['User', 'UserType'],
|
||||
'view' => ['index/index'],
|
||||
],
|
||||
|
||||
// 其他更多的模块定义
|
||||
];
|
||||
42
Server/composer.json
Executable file
42
Server/composer.json
Executable file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "topthink/think",
|
||||
"description": "the new thinkphp framework",
|
||||
"type": "project",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"thinkphp",
|
||||
"ORM"
|
||||
],
|
||||
"homepage": "http://thinkphp.cn/",
|
||||
"license": "Apache-2.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "liu21st",
|
||||
"email": "liu21st@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.6.0",
|
||||
"topthink/framework": "5.1.*",
|
||||
"phpoffice/phpexcel": "^1.8",
|
||||
"endroid/qr-code": "^2.5",
|
||||
"alibabacloud/dysmsapi-20170525": "2.0.16",
|
||||
"hashids/hashids": "^3.0",
|
||||
"aliyuncs/oss-sdk-php": "^2.7",
|
||||
"topthink/think-worker": "2.0.*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"app\\": "application"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"think-path": "thinkphp"
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": "dist",
|
||||
"allow-plugins": {
|
||||
"topthink/think-installer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
146
Server/config/app.php
Executable file
146
Server/config/app.php
Executable file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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 [
|
||||
// 应用名称
|
||||
'app_name' => '',
|
||||
// 应用地址
|
||||
'app_host' => '',
|
||||
// 应用调试模式
|
||||
'app_debug' => true,
|
||||
// 应用Trace
|
||||
'app_trace' => false,
|
||||
// 是否支持多模块
|
||||
'app_multi_module' => true,
|
||||
// 入口自动绑定模块
|
||||
'auto_bind_module' => false,
|
||||
// 注册的根命名空间
|
||||
'root_namespace' => [],
|
||||
// 默认输出类型
|
||||
'default_return_type' => 'html',
|
||||
// 默认AJAX 数据返回格式,可选json xml ...
|
||||
'default_ajax_return' => 'json',
|
||||
// 默认JSONP格式返回的处理方法
|
||||
'default_jsonp_handler' => 'jsonpReturn',
|
||||
// 默认JSONP处理方法
|
||||
'var_jsonp_handler' => 'callback',
|
||||
// 默认时区
|
||||
'default_timezone' => 'Asia/Shanghai',
|
||||
// 是否开启多语言
|
||||
'lang_switch_on' => false,
|
||||
// 默认全局过滤方法 用逗号分隔多个
|
||||
'default_filter' => '',
|
||||
// 默认语言
|
||||
'default_lang' => 'zh-cn',
|
||||
// 应用类库后缀
|
||||
'class_suffix' => true,
|
||||
// 控制器类后缀
|
||||
'controller_suffix' => false,
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 模块设置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// 默认模块名
|
||||
'default_module' => 'frontend',
|
||||
// 禁止访问模块
|
||||
'deny_module_list' => ['common'],
|
||||
// 默认控制器名
|
||||
'default_controller' => 'Index',
|
||||
// 默认操作名
|
||||
'default_action' => 'index',
|
||||
// 默认验证器
|
||||
'default_validate' => '',
|
||||
// 默认的空模块名
|
||||
'empty_module' => '',
|
||||
// 默认的空控制器名
|
||||
'empty_controller' => 'Error',
|
||||
// 操作方法前缀
|
||||
'use_action_prefix' => false,
|
||||
// 操作方法后缀
|
||||
'action_suffix' => '',
|
||||
// 自动搜索控制器
|
||||
'controller_auto_search' => false,
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | URL设置
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// PATHINFO变量名 用于兼容模式
|
||||
'var_pathinfo' => 's',
|
||||
// 兼容PATH_INFO获取
|
||||
'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'],
|
||||
// pathinfo分隔符
|
||||
'pathinfo_depr' => '/',
|
||||
// HTTPS代理标识
|
||||
'https_agent_name' => '',
|
||||
// IP代理获取标识
|
||||
'http_agent_ip' => 'X-REAL-IP',
|
||||
// URL伪静态后缀
|
||||
'url_html_suffix' => '',
|
||||
// URL普通方式参数 用于自动生成
|
||||
'url_common_param' => true,
|
||||
// URL参数方式 0 按名称成对解析 1 按顺序解析
|
||||
'url_param_type' => 0,
|
||||
// 是否开启路由延迟解析
|
||||
'url_lazy_route' => false,
|
||||
// 是否强制使用路由
|
||||
'url_route_must' => false,
|
||||
// 合并路由规则
|
||||
'route_rule_merge' => false,
|
||||
// 路由是否完全匹配
|
||||
'route_complete_match' => false,
|
||||
// 使用注解路由
|
||||
'route_annotation' => false,
|
||||
// 域名根,如thinkphp.cn
|
||||
'url_domain_root' => '',
|
||||
// 是否自动转换URL中的控制器和操作名
|
||||
'url_convert' => true,
|
||||
// 默认的访问控制器层
|
||||
'url_controller_layer' => 'controller',
|
||||
// 表单请求类型伪装变量
|
||||
'var_method' => '_method',
|
||||
// 表单ajax伪装变量
|
||||
'var_ajax' => '_ajax',
|
||||
// 表单pjax伪装变量
|
||||
'var_pjax' => '_pjax',
|
||||
// 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
|
||||
'request_cache' => false,
|
||||
// 请求缓存有效期
|
||||
'request_cache_expire' => null,
|
||||
// 全局请求缓存排除规则
|
||||
'request_cache_except' => [],
|
||||
// 是否开启路由缓存
|
||||
'route_check_cache' => false,
|
||||
// 路由缓存的Key自定义设置(闭包),默认为当前URL和请求类型的md5
|
||||
'route_check_cache_key' => '',
|
||||
// 路由缓存类型及参数
|
||||
'route_cache_option' => [],
|
||||
|
||||
// 默认跳转页面对应的模板文件
|
||||
'dispatch_success_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl',
|
||||
'dispatch_error_tmpl' => Env::get('think_path') . 'tpl/dispatch_jump.tpl',
|
||||
|
||||
// 异常页面的模板文件
|
||||
'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl',
|
||||
|
||||
// 错误显示信息,非调试模式有效
|
||||
'error_message' => '页面错误!请稍后再试~',
|
||||
// 显示错误信息
|
||||
'show_error_msg' => false,
|
||||
// 异常处理handle类 留空使用 \think\exception\Handle
|
||||
'exception_handle' => '',
|
||||
|
||||
];
|
||||
25
Server/config/cache.php
Executable file
25
Server/config/cache.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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 [
|
||||
// 驱动方式
|
||||
'type' => 'File',
|
||||
// 缓存保存目录
|
||||
'path' => '',
|
||||
// 缓存前缀
|
||||
'prefix' => '',
|
||||
// 缓存有效期 0表示永久缓存
|
||||
'expire' => 0,
|
||||
];
|
||||
5
Server/config/config.php
Normal file
5
Server/config/config.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'domain' => 'http://192.168.3.75:8081'
|
||||
];
|
||||
20
Server/config/console.php
Executable file
20
Server/config/console.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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 [
|
||||
'name' => 'Think Console',
|
||||
'version' => '0.1',
|
||||
'user' => null,
|
||||
'auto_path' => env('app_path') . 'command' . DIRECTORY_SEPARATOR,
|
||||
];
|
||||
30
Server/config/cookie.php
Executable file
30
Server/config/cookie.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | Cookie设置
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
// cookie 名称前缀
|
||||
'prefix' => '',
|
||||
// cookie 保存时间
|
||||
'expire' => 0,
|
||||
// cookie 保存路径
|
||||
'path' => '/',
|
||||
// cookie 有效域名
|
||||
'domain' => '',
|
||||
// cookie 启用安全传输
|
||||
'secure' => false,
|
||||
// httponly设置
|
||||
'httponly' => '',
|
||||
// 是否使用 setcookie
|
||||
'setcookie' => true,
|
||||
];
|
||||
13
Server/config/cookies.php
Normal file
13
Server/config/cookies.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'xianyu' => [
|
||||
'cna=bjINIOOLP2QBASQOA6MRoWqz',
|
||||
'xlly_s=1',
|
||||
'_samesite_flag_=true',
|
||||
't=9aa5a7ca9fc23837b5f62366fb0e3c57',
|
||||
'_tb_token_=e834030feb9b3',
|
||||
'mtop_partitioned_detect=1',
|
||||
'tfstk=g0cKNh9DFFQLM2KvYXJgruGcYcYMId0e-DufZuqhFcntlqS3FXVn2Tnnz02WYWc-XD0jKJc-z_USP08UqeJi82PzNnxDoI0E8l7Ra4tgNUg_ZzQ98mhK82PP7NjWnAgF2BFTQWNSV5w_zrP5F76BWla4f6a5Ozs6Wlz7Nyw7FR6_orW7PkiS5FUzfuN7d0NswMOzfMZ5wxUi5afPUl15NfULCd0Qfs4K6yeac2GdN_6zJJEjRlK42WH4eDeKsBI4JAgxSynyg6PQeYG31Xt6N5gqIDatVnB8fxhEw-cpDtrITuoTnvKA9mnUP4USvI7YfX3-6JkGos3THfG3TAKAioMZPbes8nB4SYgmtYnHb_ZnHViTnfjGiSMqXbebGgJKijQhNiqYr9T9WTWzdPRiFilYSSQ0zPEDJ3WPURxaWoY9cTWzdPzTmFVNUTyMb'
|
||||
],
|
||||
];
|
||||
129
Server/config/database.php
Executable file
129
Server/config/database.php
Executable file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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 [
|
||||
// 数据库类型
|
||||
'type' => 'mysql',
|
||||
// 服务器地址
|
||||
'hostname' => '127.0.0.1',
|
||||
// 数据库名
|
||||
'database' => 'xianyu_script',
|
||||
// 用户名
|
||||
'username' => 'xianyu_script',
|
||||
// 密码
|
||||
'password' => 'Mddfts7ex3LCMRWb',
|
||||
// 端口
|
||||
'hostport' => '',
|
||||
// 连接dsn
|
||||
'dsn' => '',
|
||||
// 数据库连接参数
|
||||
'params' => [],
|
||||
// 数据库编码默认采用utf8
|
||||
'charset' => 'utf8mb4',
|
||||
// 数据库表前缀
|
||||
'prefix' => 'tk_',
|
||||
// 数据库调试模式
|
||||
'debug' => true,
|
||||
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
||||
'deploy' => 0,
|
||||
// 数据库读写是否分离 主从式有效
|
||||
'rw_separate' => false,
|
||||
// 读写分离后 主服务器数量
|
||||
'master_num' => 1,
|
||||
// 指定从服务器序号
|
||||
'slave_no' => '',
|
||||
// 自动读取主库数据
|
||||
'read_master' => false,
|
||||
// 是否严格检查字段是否存在
|
||||
'fields_strict' => true,
|
||||
// 数据集返回类型
|
||||
'resultset_type' => 'array',
|
||||
// 自动写入时间戳字段
|
||||
'auto_timestamp' => true,
|
||||
// 时间字段取出后的默认时间格式
|
||||
'datetime_format' => 'Y-m-d H:i:s',
|
||||
// 是否需要进行SQL性能分析
|
||||
'sql_explain' => false,
|
||||
// Builder类
|
||||
'builder' => '',
|
||||
// Query类
|
||||
'query' => '\\think\\db\\Query',
|
||||
// 是否需要断线重连
|
||||
'break_reconnect' => true,
|
||||
// 断线标识字符串
|
||||
'break_match_str' => [],
|
||||
'clone' => [
|
||||
// 数据库类型
|
||||
'type' => 'mysql',
|
||||
// 服务器地址
|
||||
'hostname' => 'gz-cynosdbmysql-grp-2k3icgxh.sql.tencentcdb.com',
|
||||
// 数据库名
|
||||
'database' => 'clone',
|
||||
// 数据库用户名
|
||||
'username' => 'root',
|
||||
// 数据库密码
|
||||
'password' => 'Lo.EQ{%t9G#v-1qv*Y',
|
||||
// 端口
|
||||
'hostport' => '20626',
|
||||
// 数据库编码默认采用utf8
|
||||
'charset' => 'utf8mb4',
|
||||
// 数据库表前缀
|
||||
'prefix' => '',
|
||||
],
|
||||
'pgsql' => [
|
||||
// 数据库类型
|
||||
'type' => 'pgsql',
|
||||
// 服务器地址
|
||||
'hostname' => 'pgm-7xv383pbm1orihnpfo.pg.rds.aliyuncs.com',
|
||||
// 数据库名
|
||||
'database' => 'aggregate_chat_system',
|
||||
// 数据库用户名
|
||||
'username' => 'postgres',
|
||||
// 数据库密码
|
||||
'password' => 'JYJ4Bz0dbWdPRVgq',
|
||||
// 数据库编码默认采用utf8
|
||||
'charset' => 'utf8',
|
||||
// 数据库表前缀
|
||||
'prefix' => '',
|
||||
],
|
||||
'xm_pgsql' => [
|
||||
// 数据库类型
|
||||
'type' => 'pgsql',
|
||||
// 服务器地址
|
||||
'hostname' => 'pgm-7xv383pbm1orihnpfo.pg.rds.aliyuncs.com',
|
||||
// 数据库名
|
||||
'database' => 'xm_aggregate_chat_system',
|
||||
// 数据库用户名
|
||||
'username' => 'postgres',
|
||||
// 数据库密码
|
||||
'password' => 'JYJ4Bz0dbWdPRVgq',
|
||||
// 数据库编码默认采用utf8
|
||||
'charset' => 'utf8',
|
||||
// 数据库表前缀
|
||||
'prefix' => '',
|
||||
],
|
||||
'shouyou' => [
|
||||
// 数据库类型
|
||||
'type' => 'mysql',
|
||||
// 服务器地址
|
||||
'hostname' => 'rm-7xv05155q5pa291l3vo.mysql.rds.aliyuncs.com',
|
||||
// 数据库名
|
||||
'database' => 'shouyou',
|
||||
// 数据库用户名
|
||||
'username' => 'root',
|
||||
// 数据库密码
|
||||
'password' => '320Azai609',
|
||||
// 数据库编码默认采用utf8
|
||||
'charset' => 'utf8',
|
||||
// 数据库表前缀
|
||||
'prefix' => '',
|
||||
],
|
||||
];
|
||||
46
Server/config/gateway_worker.php
Normal file
46
Server/config/gateway_worker.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
// +----------------------------------------------------------------------
|
||||
// | Workerman设置 仅对 php think worker:gateway 指令有效
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
// 扩展自身需要的配置
|
||||
'protocol' => 'websocket', // 协议 支持 tcp udp unix http websocket text
|
||||
'host' => '0.0.0.0', // 监听地址
|
||||
'port' => 2348, // 监听端口
|
||||
'socket' => '', // 完整监听地址
|
||||
'context' => [], // socket 上下文选项
|
||||
'register_deploy' => true, // 是否需要部署register
|
||||
'businessWorker_deploy' => true, // 是否需要部署businessWorker
|
||||
'gateway_deploy' => true, // 是否需要部署gateway
|
||||
|
||||
// Register配置
|
||||
'registerAddress' => '127.0.0.1:1236',
|
||||
|
||||
// Gateway配置
|
||||
'name' => 'thinkphp',
|
||||
'count' => 1,
|
||||
'lanIp' => '127.0.0.1',
|
||||
'startPort' => 2000,
|
||||
'daemonize' => false,
|
||||
'pingInterval' => 30,
|
||||
'pingNotResponseLimit' => 0,
|
||||
'pingData' => '{"type":"ping"}',
|
||||
|
||||
// BusinsessWorker配置
|
||||
'businessWorker' => [
|
||||
'name' => 'BusinessWorker',
|
||||
'count' => 1,
|
||||
'eventHandler' => '\app\common\socket\Events',
|
||||
],
|
||||
|
||||
'qdKey' => 'N2WhAkJ1pgDBM$Bq',
|
||||
];
|
||||
30
Server/config/log.php
Executable file
30
Server/config/log.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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 [
|
||||
// 日志记录方式,内置 file socket 支持扩展
|
||||
'type' => 'File',
|
||||
// 日志保存目录
|
||||
'path' => '',
|
||||
// 日志记录级别
|
||||
'level' => [],
|
||||
// 单文件日志写入
|
||||
'single' => false,
|
||||
// 独立日志级别
|
||||
'apart_level' => [],
|
||||
// 最大日志文件数量
|
||||
'max_files' => 0,
|
||||
// 是否关闭日志写入
|
||||
'close' => false,
|
||||
];
|
||||
18
Server/config/middleware.php
Executable file
18
Server/config/middleware.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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 [
|
||||
// 默认中间件命名空间
|
||||
'default_namespace' => 'app\\http\\middleware\\',
|
||||
];
|
||||
7
Server/config/robot.php
Normal file
7
Server/config/robot.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'keyId' => 'AKLTNzNiMzU2ZWMwMDYwNDNiZWJkMjFjOTFhYzFjY2JlZGU',
|
||||
'secretKey' => 'TXpjeVlqSTJNRFpoTUdZd05EY3lPRGsxWTJFMk0yRmpaalkyTWpFd05tUQ==',
|
||||
'model' => 'ep-20240522132057-rp6t4',
|
||||
];
|
||||
26
Server/config/session.php
Executable file
26
Server/config/session.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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 [
|
||||
'id' => '',
|
||||
// SESSION_ID的提交变量,解决flash上传跨域
|
||||
'var_session_id' => '',
|
||||
// SESSION 前缀
|
||||
'prefix' => 'think',
|
||||
// 驱动方式 支持redis memcache memcached
|
||||
'type' => '',
|
||||
// 是否自动开启 SESSION
|
||||
'auto_start' => true,
|
||||
];
|
||||
38
Server/config/template.php
Executable file
38
Server/config/template.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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 [
|
||||
// 模板引擎类型 支持 php think 支持扩展
|
||||
'type' => 'php',
|
||||
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
|
||||
'auto_rule' => 1,
|
||||
// 模板路径
|
||||
'view_path' => '',
|
||||
// 模板后缀
|
||||
'view_suffix' => 'php',
|
||||
// 模板文件名分隔符
|
||||
'view_depr' => DIRECTORY_SEPARATOR,
|
||||
// 模板引擎普通标签开始标记
|
||||
'tpl_begin' => '{{',
|
||||
// 模板引擎普通标签结束标记
|
||||
'tpl_end' => '}}',
|
||||
// 标签库标签开始标记
|
||||
'taglib_begin' => '{{',
|
||||
// 标签库标签结束标记
|
||||
'taglib_end' => '}}',
|
||||
|
||||
'layout_on' => true,
|
||||
'layout_name' => 'layout',
|
||||
];
|
||||
18
Server/config/trace.php
Executable file
18
Server/config/trace.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 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>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | Trace设置 开启 app_trace 后 有效
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
// 内置Html Console 支持扩展
|
||||
'type' => 'Html',
|
||||
];
|
||||
31
Server/config/worker.php
Normal file
31
Server/config/worker.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
use think\facade\Env;
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | Workerman设置 仅对 php think worker 指令有效
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
// 扩展自身需要的配置
|
||||
'host' => '0.0.0.0', // 监听地址
|
||||
'port' => 2346, // 监听端口
|
||||
'root' => '', // WEB 根目录 默认会定位public目录
|
||||
'app_path' => '', // 应用目录 守护进程模式必须设置(绝对路径)
|
||||
'file_monitor' => false, // 是否开启PHP文件更改监控(调试模式下自动开启)
|
||||
'file_monitor_interval' => 2, // 文件监控检测时间间隔(秒)
|
||||
'file_monitor_path' => [], // 文件监控目录 默认监控application和config目录
|
||||
|
||||
// 支持workerman的所有配置参数
|
||||
'name' => 'thinkphp',
|
||||
'count' => 4,
|
||||
'daemonize' => false,
|
||||
'pidFile' => Env::get('runtime_path') . 'worker.pid',
|
||||
];
|
||||
56
Server/config/worker_server.php
Normal file
56
Server/config/worker_server.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
use think\facade\Env;
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | Workerman设置 仅对 php think worker:server 指令有效
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
// 扩展自身需要的配置
|
||||
'protocol' => 'websocket', // 协议 支持 tcp udp unix http websocket text
|
||||
'host' => '0.0.0.0', // 监听地址
|
||||
'port' => 2345, // 监听端口
|
||||
'socket' => '', // 完整监听地址
|
||||
'context' => [], // socket 上下文选项
|
||||
'worker_class' => '', // 自定义Workerman服务类名 支持数组定义多个服务
|
||||
|
||||
// 支持workerman的所有配置参数
|
||||
'name' => 'thinkphp',
|
||||
'count' => 4,
|
||||
'daemonize' => false,
|
||||
'pidFile' => Env::get('runtime_path') . 'worker.pid',
|
||||
|
||||
// 支持事件回调
|
||||
// onWorkerStart
|
||||
'onWorkerStart' => function ($worker) {
|
||||
//\app\common\socket\MessageHandler::onWorkerStart($worker);
|
||||
},
|
||||
// onWorkerReload
|
||||
'onWorkerReload' => function ($worker) {
|
||||
//\app\common\socket\MessageHandler::onWorkerReload($worker);
|
||||
},
|
||||
// onConnect
|
||||
'onConnect' => function ($connection) {
|
||||
//\app\common\socket\MessageHandler::onConnect($connection);
|
||||
},
|
||||
// onMessage
|
||||
'onMessage' => function ($connection, $data) {
|
||||
//\app\common\socket\MessageHandler::onMessage($connection, $data);
|
||||
},
|
||||
// onClose
|
||||
'onClose' => function ($connection) {
|
||||
//\app\common\socket\MessageHandler::onClose($connection);
|
||||
},
|
||||
// onError
|
||||
'onError' => function ($connection, $code, $msg) {
|
||||
//\app\common\socket\MessageHandler::onError($connection);
|
||||
},
|
||||
];
|
||||
0
Server/extend/.gitignore
vendored
Executable file
0
Server/extend/.gitignore
vendored
Executable file
26
Server/extend/alipay-sdk-all/.gitignore
vendored
Normal file
26
Server/extend/alipay-sdk-all/.gitignore
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
*.iml
|
||||
.idea/
|
||||
target/
|
||||
33
Server/extend/alipay-sdk-all/README.md
Normal file
33
Server/extend/alipay-sdk-all/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# 支付宝开放平台服务端SDK FOR PHP
|
||||
|
||||
Alipay SDK for PHP SDK可以自动帮您满足能力调用过程中所需的证书校验、加签、验签、发送HTTP请求等非功能性要求。
|
||||
|
||||
支付宝目前提供 [v2](v2/README.md)、[v3](v3/README.md) 两个版本SDK,根据您的习惯自由选择。
|
||||
|
||||
## v2 & v3
|
||||
|
||||
v2版本将会发起基于v2协议的OpenAPI,v3版本将会发起基于v3协议的OpenAPI。
|
||||
|
||||
## 关于v3协议
|
||||
|
||||
相较于v2协议的支付宝API,主要区别是:
|
||||
- 使用RESTful设计风格,并通过OpenAPI规范(OAS)描述接口
|
||||
- 使用JSON作为数据交互的格式,不再使用XML和表单格式
|
||||
- 简化加验签逻辑,对http报文整体加验签
|
||||
- 简化加解密、文件上传等规范
|
||||
|
||||
更多有关v3协议的内容,可前往 [支付宝开发文档](https://opendocs.alipay.com/open-v3/054kaq) 了解更多。
|
||||
|
||||
### 关于OpenAPI规范(OAS)
|
||||
|
||||
OpenAPI规范(OAS),是定义一个标准的、与具体编程语言无关的RESTful API的规范,您可查阅 [OAS官网](https://www.openapis.org) 了解更多。
|
||||
|
||||
利用支付宝提供的OpenAPI描述文件,您可以用代码生成工具来自动生成各种编程语言代码,用自动测试工具进行测试等等。
|
||||
|
||||
v3 SDK是基于 [OpenAPI描述文件](v3/api/openapi.yaml) 、使用 [OpenAPI Generator](https://openapi-generator.tech) 生成的。
|
||||
|
||||
## 问题
|
||||
|
||||
不管您在使用SDK的过程中遇到任何问题,欢迎前往 [支付宝开放社区](https://forum.alipay.com/mini-app/channel/1100001) 发帖与支付宝工作人员和其他开发者一起交流。
|
||||
|
||||
注:为了提高开发者问题的响应时效,github本身的issue功能已关闭,支付宝开放社区中发帖的问题,通常会在2小时内响应。
|
||||
43
Server/extend/alipay-sdk-all/composer.json
Normal file
43
Server/extend/alipay-sdk-all/composer.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "alipaysdk/openapi",
|
||||
"version": "2.5.0",
|
||||
"description": "支付宝开放平台v3协议文档",
|
||||
"keywords": [
|
||||
"openapitools",
|
||||
"openapi-generator",
|
||||
"openapi",
|
||||
"php",
|
||||
"sdk",
|
||||
"rest",
|
||||
"api"
|
||||
],
|
||||
"homepage": "https://openapi-generator.tech",
|
||||
"license": "unlicense",
|
||||
"authors": [
|
||||
{
|
||||
"name": "OpenAPI-Generator contributors",
|
||||
"homepage": "https://openapi-generator.tech"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-openssl":"*",
|
||||
"ext-bcmath": "*",
|
||||
"ext-dom": "*",
|
||||
"guzzlehttp/guzzle": "^7.3",
|
||||
"guzzlehttp/psr7": "^1.7 || ^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.0 || ^9.0",
|
||||
"friendsofphp/php-cs-fixer": "^3.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Alipay\\OpenAPISDK\\" : "v3/src/" }
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": { "Alipay\\OpenAPISDK\\Test\\" : "v3/test/" }
|
||||
}
|
||||
}
|
||||
88
Server/extend/alipay-sdk-all/v2/README.md
Normal file
88
Server/extend/alipay-sdk-all/v2/README.md
Normal file
@@ -0,0 +1,88 @@
|
||||
欢迎使用 Alipay SDK for PHP 。
|
||||
|
||||
Alipay SDK for PHP让您不用复杂编程即可访支付宝开放平台开放的各项能力,SDK可以自动帮您满足能力调用过程中所需的证书校验、加签、验签、发送HTTP请求等非功能性要求。
|
||||
|
||||
这里向您介绍如何获取 Alipay SDK for PHP 并开始调用。
|
||||
如果您在使用 Alipay SDK for .PHP 的过程中遇到任何问题,欢迎在当前 GitHub [提交 Issues](https://github.com/alipay/alipay-sdk-php-all/issues/new)。
|
||||
|
||||
## 环境要求
|
||||
1. Alipay SDK for PHP 需要 PHP 5.5 以上的开发环境。
|
||||
|
||||
2. 使用 Alipay SDK for PHP 之前 ,您需要先前往[支付宝开发平台-开发者中心](https://openhome.alipay.com/platform/developerIndex.htm)完成开发者接入的一些准备工作,包括创建应用、为应用添加功能包、设置应用的接口加签方式等。
|
||||
|
||||
3. 准备工作完成后,注意保存如下信息,后续将作为使用SDK的输入。
|
||||
|
||||
* 加签模式为公钥证书模式时(推荐)
|
||||
|
||||
`AppID`、`应用的私钥`、`应用的公钥证书文件`、`支付宝公钥证书文件`、`支付宝根证书文件`
|
||||
|
||||
* 加签模式为公钥模式时
|
||||
|
||||
`AppId`、`应用的私钥`、`应用的公钥`、`支付宝公钥`
|
||||
|
||||
|
||||
## 快速使用
|
||||
以下这段代码示例向您展示了使用Alipay SDK for PHP调用一个API的3个主要步骤:
|
||||
1. 创建AopClient实例并初始化。
|
||||
2. 创建API请求对象并设置request参数。
|
||||
3. 发起请求并处理响应或异常。
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
require_once '../AopClient.php';
|
||||
require_once '../AopCertification.php';
|
||||
require_once '../request/AlipayTradeQueryRequest.php';
|
||||
require_once '../request/AlipayTradeWapPayRequest.php';
|
||||
require_once '../request/AlipayTradeAppPayRequest.php';
|
||||
|
||||
|
||||
/**
|
||||
* 证书类型AopClient功能方法使用测试
|
||||
* 1、execute 调用示例
|
||||
* 2、sdkExecute 调用示例
|
||||
* 3、pageExecute 调用示例
|
||||
*/
|
||||
|
||||
|
||||
//1、execute 使用
|
||||
$aop = new AopClient ();
|
||||
|
||||
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
|
||||
$aop->appId = '你的appid';
|
||||
$aop->rsaPrivateKey = '你的应用私钥';
|
||||
$aop->alipayrsaPublicKey = '你的支付宝公钥';
|
||||
$aop->apiVersion = '1.0';
|
||||
$aop->signType = 'RSA2';
|
||||
$aop->postCharset = 'utf-8';
|
||||
$aop->format = 'json';
|
||||
|
||||
$request = new AlipayTradeQueryRequest ();
|
||||
$request->setBizContent("{" .
|
||||
"\"out_trade_no\":\"20150320010101001\"," .
|
||||
"\"trade_no\":\"2014112611001004680 073956707\"," .
|
||||
"\"org_pid\":\"2088101117952222\"," .
|
||||
" \"query_options\":[" .
|
||||
" \"TRADE_SETTE_INFO\"" .
|
||||
" ]" .
|
||||
" }");
|
||||
$result = $aop->execute($request);
|
||||
echo $result;
|
||||
|
||||
```
|
||||
|
||||
## 文档
|
||||
[SDK文档首页](https://docs.open.alipay.com/54/103419/)
|
||||
|
||||
## 问题
|
||||
不管您在使用SDK的过程中遇到任何问题,欢迎前往 [支付宝开放社区](https://forum.alipay.com/mini-app/channel/1100001) 发帖与支付宝工作人员和其他开发者一起交流。
|
||||
|
||||
注:为了提高开发者问题的响应时效,github本身的issue功能已关闭,支付宝开放社区中发帖的问题,通常会在2小时内响应。
|
||||
|
||||
## 相关
|
||||
* [支付宝开放平台](https://open.alipay.com/platform/home.htm)
|
||||
* [支付宝开放平台文档中心](https://docs.open.alipay.com/catalog)
|
||||
* [最新源码](https://github.com/alipay/alipay-sdk-net-all)
|
||||
|
||||
## 许可证
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Falipay%2Falipay-sdk-net-all?ref=badge_large)
|
||||
197
Server/extend/alipay-sdk-all/v2/aop/AlipayConfig.php
Normal file
197
Server/extend/alipay-sdk-all/v2/aop/AlipayConfig.php
Normal file
@@ -0,0 +1,197 @@
|
||||
|
||||
<?php
|
||||
class AlipayConfig {
|
||||
/**
|
||||
* 网关地址
|
||||
* 线上:https://openapi.alipay.com/gateway.do
|
||||
* 沙箱:https://openapi.alipaydev.com/gateway.do
|
||||
*/
|
||||
private $serverUrl;
|
||||
|
||||
/**
|
||||
* 开放平台上创建的应用的ID
|
||||
*/
|
||||
private $appId;
|
||||
|
||||
/**
|
||||
* 报文格式,推荐:json
|
||||
*/
|
||||
private $format = "json";
|
||||
|
||||
/**
|
||||
* 字符串编码,推荐:utf-8
|
||||
*/
|
||||
private $charset = "utf-8";
|
||||
|
||||
/**
|
||||
* 签名算法类型,推荐:RSA2
|
||||
*/
|
||||
private $signType = "RSA2";
|
||||
|
||||
/**
|
||||
* 商户私钥
|
||||
*/
|
||||
private $privateKey;
|
||||
|
||||
/**
|
||||
* 支付宝公钥字符串(公钥模式下设置,证书模式下无需设置)
|
||||
*/
|
||||
private $alipayPublicKey;
|
||||
|
||||
/**
|
||||
* 商户应用公钥证书路径(证书模式下设置,公钥模式下无需设置)
|
||||
*/
|
||||
private $appCertPath;
|
||||
|
||||
/**
|
||||
* 支付宝公钥证书路径(证书模式下设置,公钥模式下无需设置)
|
||||
*/
|
||||
private $alipayPublicCertPath;
|
||||
|
||||
/**
|
||||
* 支付宝根证书路径(证书模式下设置,公钥模式下无需设置)
|
||||
*/
|
||||
private $rootCertPath;
|
||||
|
||||
/**
|
||||
* 指定商户公钥应用证书内容字符串,该字段与appCertPath只需指定一个,优先以该字段的值为准(证书模式下设置,公钥模式下无需设置)
|
||||
*/
|
||||
private $appCertContent;
|
||||
|
||||
/**
|
||||
* 指定支付宝公钥证书内容字符串,该字段与alipayPublicCertPath只需指定一个,优先以该字段的值为准(证书模式下设置,公钥模式下无需设置)
|
||||
*/
|
||||
private $alipayPublicCertContent;
|
||||
|
||||
/**
|
||||
* 指定根证书内容字符串,该字段与rootCertPath只需指定一个,优先以该字段的值为准(证书模式下设置,公钥模式下无需设置)
|
||||
*/
|
||||
private $rootCertContent;
|
||||
|
||||
/**
|
||||
* 敏感信息对称加密算法类型,推荐:AES
|
||||
*/
|
||||
private $encryptType = "AES";
|
||||
|
||||
/**
|
||||
* 敏感信息对称加密算法密钥
|
||||
*/
|
||||
private $encryptKey;
|
||||
|
||||
/**
|
||||
* 跳过加验签(小程序云免鉴权)
|
||||
*/
|
||||
private $skipSign = false;
|
||||
|
||||
|
||||
public function getServerUrl() {
|
||||
return $this->serverUrl;
|
||||
}
|
||||
|
||||
public function setServerUrl($serverUrl) {
|
||||
$this->serverUrl = $serverUrl;
|
||||
}
|
||||
public function getAppId(){
|
||||
return $this->appId;
|
||||
}
|
||||
public function setAppId($appId){
|
||||
$this->appId = $appId;
|
||||
}
|
||||
public function getFormat(){
|
||||
return $this->format;
|
||||
}
|
||||
public function setFormat($format){
|
||||
$this->format = $format;
|
||||
}
|
||||
public function getCharset() {
|
||||
return $this->charset;
|
||||
}
|
||||
|
||||
public function setCharset($charset) {
|
||||
$this->charset = $charset;
|
||||
}
|
||||
|
||||
public function getSignType() {
|
||||
return $this->signType;
|
||||
}
|
||||
|
||||
public function setSignType($signType) {
|
||||
$this->signType = $signType;
|
||||
}
|
||||
public function getEncryptKey() {
|
||||
return $this->encryptKey;
|
||||
}
|
||||
|
||||
public function setEncryptKey($encryptKey) {
|
||||
$this->encryptKey = $encryptKey;
|
||||
}
|
||||
public function getEncryptType() {
|
||||
return $this->encryptType;
|
||||
}
|
||||
public function setEncryptType($encryptType) {
|
||||
$this->encryptType = $encryptType;
|
||||
}
|
||||
public function getPrivateKey() {
|
||||
return $this->privateKey;
|
||||
}
|
||||
|
||||
public function setPrivateKey($privateKey) {
|
||||
$this->privateKey = $privateKey;
|
||||
}
|
||||
public function getAlipayPublicKey() {
|
||||
return $this->alipayPublicKey;
|
||||
}
|
||||
public function setAlipayPublicKey($alipayPublicKey) {
|
||||
$this->alipayPublicKey = $alipayPublicKey;
|
||||
}
|
||||
public function getAppCertPath() {
|
||||
return $this->appCertPath;
|
||||
}
|
||||
|
||||
public function setAppCertPath($appCertPath) {
|
||||
$this->appCertPath = $appCertPath;
|
||||
}
|
||||
|
||||
public function getAlipayPublicCertPath() {
|
||||
return $this->alipayPublicCertPath;
|
||||
}
|
||||
public function setAlipayPublicCertPath($alipayPublicCertPath) {
|
||||
$this->alipayPublicCertPath = $alipayPublicCertPath;
|
||||
}
|
||||
|
||||
public function getRootCertPath() {
|
||||
return $this->rootCertPath;
|
||||
}
|
||||
public function setRootCertPath($rootCertPath) {
|
||||
$this->rootCertPath = $rootCertPath;
|
||||
}
|
||||
public function getAppCertContent() {
|
||||
return $this->appCertContent;
|
||||
}
|
||||
public function setAppCertContent($appCertContent) {
|
||||
$this->appCertContent = $appCertContent;
|
||||
}
|
||||
public function getAlipayPublicCertContent() {
|
||||
return $this->alipayPublicCertContent;
|
||||
}
|
||||
public function setAlipayPublicCertContent($alipayPublicCertContent) {
|
||||
$this->alipayPublicCertContent = $alipayPublicCertContent;
|
||||
}
|
||||
public function getRootCertContent() {
|
||||
return $this->rootCertContent;
|
||||
}
|
||||
|
||||
public function setRootCertContent($rootCertContent) {
|
||||
$this->rootCertContent = $rootCertContent;
|
||||
}
|
||||
|
||||
public function isSkipSign()
|
||||
{
|
||||
return $this->skipSign;
|
||||
}
|
||||
|
||||
public function setSkipSign(bool $skipSign)
|
||||
{
|
||||
$this->skipSign = $skipSign;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 多媒体文件客户端
|
||||
* @author yikai.hu
|
||||
* @version $Id: AlipayMobilePublicMultiMediaClient.php, v 0.1 Aug 15, 2014 10:19:01 AM yikai.hu Exp $
|
||||
*/
|
||||
|
||||
include("AlipayMobilePublicMultiMediaExecute.php");
|
||||
|
||||
class AlipayMobilePublicMultiMediaClient
|
||||
{
|
||||
private $DEFAULT_CHARSET = 'UTF-8';
|
||||
private $METHOD_POST = "POST";
|
||||
private $METHOD_GET = "GET";
|
||||
private $SIGN = 'sign'; //get name
|
||||
|
||||
private $timeout = 10;// 超时时间
|
||||
private $serverUrl;
|
||||
private $appId;
|
||||
private $privateKey;
|
||||
private $prodCode;
|
||||
private $format = 'json'; //todo
|
||||
private $sign_type = 'RSA'; //todo
|
||||
|
||||
private $charset;
|
||||
private $apiVersion = "1.0";
|
||||
private $apiMethodName = "alipay.mobile.public.multimedia.download";
|
||||
private $media_id = "L21pZnMvVDFQV3hYWGJKWFhYYUNucHJYP3Q9YW13ZiZ4c2lnPTU0MzRhYjg1ZTZjNWJmZTMxZGJiNjIzNDdjMzFkNzkw575";
|
||||
//此处写死的,实际开发中,请传入
|
||||
|
||||
private $connectTimeout = 3000;
|
||||
private $readTimeout = 15000;
|
||||
|
||||
function __construct($serverUrl = '', $appId = '', $partner_private_key = '', $format = '', $charset = 'GBK')
|
||||
{
|
||||
$this->serverUrl = $serverUrl;
|
||||
$this->appId = $appId;
|
||||
$this->privateKey = $partner_private_key;
|
||||
$this->format = $format;
|
||||
$this->charset = $charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* getContents 获取网址内容
|
||||
* @param $request
|
||||
* @return text | bin
|
||||
*/
|
||||
public function getContents()
|
||||
{
|
||||
$datas = array(
|
||||
"app_id" => $this->appId,
|
||||
"method" => $this->METHOD_POST,
|
||||
"sign_type" => $this->sign_type,
|
||||
"version" => $this->apiVersion,
|
||||
"timestamp" => date('Y-m-d H:i:s'),//yyyy-MM-dd HH:mm:ss
|
||||
"biz_content" => '{"mediaId":"' . $this->media_id . '"}',
|
||||
"charset" => $this->charset
|
||||
);
|
||||
|
||||
//要提交的数据
|
||||
$data_sign = $this->buildGetUrl($datas);
|
||||
|
||||
$post_data = $data_sign;
|
||||
//初始化 curl
|
||||
$ch = curl_init();
|
||||
//设置目标服务器
|
||||
curl_setopt($ch, CURLOPT_URL, $this->serverUrl);
|
||||
curl_setopt($ch, CURLOPT_HEADER, TRUE);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
//超时时间
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
|
||||
|
||||
if ($this->METHOD_POST == 'POST') {
|
||||
// post数据
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
// post的变量
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
|
||||
}
|
||||
|
||||
|
||||
$output = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
echo $output;
|
||||
|
||||
$datas = explode("\r\n\r\n", $output, 2);
|
||||
$header = $datas[0];
|
||||
|
||||
if ($httpCode == '200') {
|
||||
$body = $datas[1];
|
||||
} else {
|
||||
$body = '';
|
||||
|
||||
}
|
||||
|
||||
return $this->execute($header, $body, $httpCode);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $request
|
||||
* @return text | bin
|
||||
*/
|
||||
public function execute($header = '', $body = '', $httpCode = '')
|
||||
{
|
||||
$exe = new AlipayMobilePublicMultiMediaExecute($header, $body, $httpCode);
|
||||
return $exe;
|
||||
}
|
||||
|
||||
public function buildGetUrl($query = array())
|
||||
{
|
||||
if (!is_array($query)) {
|
||||
//exit;
|
||||
}
|
||||
//排序参数,
|
||||
$data = $this->buildQuery($query);
|
||||
|
||||
// 私钥密码
|
||||
$passphrase = '';
|
||||
$key_width = 64;
|
||||
|
||||
//私钥
|
||||
$privateKey = $this->privateKey;
|
||||
$p_key = array();
|
||||
//如果私钥是 1行
|
||||
if (!stripos($privateKey, "\n")) {
|
||||
$i = 0;
|
||||
while ($key_str = substr($privateKey, $i * $key_width, $key_width)) {
|
||||
$p_key[] = $key_str;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
//echo '一行?';
|
||||
}
|
||||
$privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" . implode("\n", $p_key);
|
||||
$privateKey = $privateKey . "\n-----END RSA PRIVATE KEY-----";
|
||||
|
||||
//私钥
|
||||
$private_id = openssl_pkey_get_private($privateKey, $passphrase);
|
||||
|
||||
// 签名
|
||||
$signature = '';
|
||||
|
||||
if ("RSA2" == $this->sign_type) {
|
||||
|
||||
openssl_sign($data, $signature, $private_id, OPENSSL_ALGO_SHA256);
|
||||
} else {
|
||||
|
||||
openssl_sign($data, $signature, $private_id, OPENSSL_ALGO_SHA1);
|
||||
}
|
||||
|
||||
openssl_free_key($private_id);
|
||||
|
||||
//加密后的内容通常含有特殊字符,需要编码转换下
|
||||
$signature = base64_encode($signature);
|
||||
|
||||
$signature = urlencode($signature);
|
||||
|
||||
//$signature = 'XjUN6YM1Mc9HXebKMv7GTLy7gmyhktyOgKk2/Jf+cz4DtP6udkzTdpkjW2j/Z4ZSD7xD6CNYI1Spz4yS93HPT0a5X9LgFWYY8SaADqe+ArXg+FBSiTwUz49SE//Xd9+LEiIRsSFkbpkuiGoO6mqJmB7vXjlD5lx6qCM3nb41wb8=';
|
||||
|
||||
$out = $data . '&' . $this->SIGN . '=' . $signature;
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/*
|
||||
* 查询参数排序 a-z
|
||||
* */
|
||||
public function buildQuery($query)
|
||||
{
|
||||
if (!$query) {
|
||||
return null;
|
||||
}
|
||||
//将要 参数 排序
|
||||
ksort($query);
|
||||
|
||||
//重新组装参数
|
||||
$params = array();
|
||||
foreach ($query as $key => $value) {
|
||||
$params[] = $key . '=' . $value;
|
||||
}
|
||||
$data = implode('&', $params);
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 多媒体文件客户端
|
||||
* @author yuanwai.wang
|
||||
* @version $Id: AlipayMobilePublicMultiMediaExecute.php, v 0.1 Aug 15, 2014 10:19:01 AM yuanwai.wang Exp $
|
||||
*/
|
||||
|
||||
//namespace alipay\api ;
|
||||
|
||||
|
||||
class AlipayMobilePublicMultiMediaExecute
|
||||
{
|
||||
|
||||
private $code = 200;
|
||||
private $msg = '';
|
||||
private $body = '';
|
||||
private $params = '';
|
||||
|
||||
private $fileSuffix = array(
|
||||
"image/jpeg" => 'jpg', //+
|
||||
"text/plain" => 'text'
|
||||
);
|
||||
|
||||
/*
|
||||
* @$header : 头部
|
||||
* */
|
||||
function __construct($header, $body, $httpCode)
|
||||
{
|
||||
$this->code = $httpCode;
|
||||
$this->msg = '';
|
||||
$this->params = $header;
|
||||
$this->body = $body;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return text | bin
|
||||
*/
|
||||
public function getCode()
|
||||
{
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return text | bin
|
||||
*/
|
||||
public function getMsg()
|
||||
{
|
||||
return $this->msg;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return text | bin
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
$subject = $this->params;
|
||||
$pattern = '/Content\-Type:([^;]+)/';
|
||||
preg_match($pattern, $subject, $matches);
|
||||
if ($matches) {
|
||||
$type = $matches[1];
|
||||
} else {
|
||||
$type = 'application/download';
|
||||
}
|
||||
|
||||
return str_replace(' ', '', $type);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return text | bin
|
||||
*/
|
||||
public function getContentLength()
|
||||
{
|
||||
$subject = $this->params;
|
||||
$pattern = '/Content-Length:\s*([^\n]+)/';
|
||||
preg_match($pattern, $subject, $matches);
|
||||
return (int)(isset($matches[1]) ? $matches[1] : '');
|
||||
}
|
||||
|
||||
|
||||
public function getFileSuffix($fileType)
|
||||
{
|
||||
$type = isset($this->fileSuffix[$fileType]) ? $this->fileSuffix[$fileType] : 'text/plain';
|
||||
if (!$type) {
|
||||
$type = 'json';
|
||||
}
|
||||
return $type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return text | bin
|
||||
*/
|
||||
public function getBody()
|
||||
{
|
||||
//header('Content-type: image/jpeg');
|
||||
return $this->body;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参数
|
||||
* @return text | bin
|
||||
*/
|
||||
public function getParams()
|
||||
{
|
||||
return $this->params;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
1303
Server/extend/alipay-sdk-all/v2/aop/AopCertClient.php
Normal file
1303
Server/extend/alipay-sdk-all/v2/aop/AopCertClient.php
Normal file
File diff suppressed because it is too large
Load Diff
527
Server/extend/alipay-sdk-all/v2/aop/AopCertification.php
Normal file
527
Server/extend/alipay-sdk-all/v2/aop/AopCertification.php
Normal file
@@ -0,0 +1,527 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 验证支付宝公钥证书是否可信
|
||||
* @param $alipayCert 支付宝公钥证书
|
||||
* @param $rootCert 支付宝根证书
|
||||
*/
|
||||
function isTrusted($alipayCert, $rootCert)
|
||||
{
|
||||
$alipayCerts = readPemCertChain($alipayCert);
|
||||
$rootCerts = readPemCertChain($rootCert);
|
||||
if (verifyCertChain($alipayCerts, $rootCerts)) {
|
||||
return verifySignature($alipayCert, $rootCert);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function verifySignature($alipayCert, $rootCert)
|
||||
{
|
||||
$alipayCertArray = explode("-----END CERTIFICATE-----", $alipayCert);
|
||||
$rootCertArray = explode("-----END CERTIFICATE-----", $rootCert);
|
||||
$length = count($rootCertArray) - 1;
|
||||
$checkSign = isCertSigner($alipayCertArray[0] . "-----END CERTIFICATE-----", $alipayCertArray[1] . "-----END CERTIFICATE-----");
|
||||
if (!$checkSign) {
|
||||
$checkSign = isCertSigner($alipayCertArray[1] . "-----END CERTIFICATE-----", $alipayCertArray[0] . "-----END CERTIFICATE-----");
|
||||
if ($checkSign) {
|
||||
$issuer = openssl_x509_parse($alipayCertArray[0] . "-----END CERTIFICATE-----")['issuer'];
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$subject = openssl_x509_parse($rootCertArray[$i] . "-----END CERTIFICATE-----")['subject'];
|
||||
if ($issuer == $subject) {
|
||||
isCertSigner($alipayCertArray[0] . "-----END CERTIFICATE-----", $rootCertArray[$i] . $rootCertArray);
|
||||
return $checkSign;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return $checkSign;
|
||||
}
|
||||
} else {
|
||||
$issuer = openssl_x509_parse($alipayCertArray[1] . "-----END CERTIFICATE-----")['issuer'];
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$subject = openssl_x509_parse($rootCertArray[$i] . "-----END CERTIFICATE-----")['subject'];
|
||||
if ($issuer == $subject) {
|
||||
$checkSign = isCertSigner($alipayCertArray[1] . "-----END CERTIFICATE-----", $rootCertArray[$i] . "-----END CERTIFICATE-----");
|
||||
return $checkSign;
|
||||
}
|
||||
}
|
||||
return $checkSign;
|
||||
}
|
||||
}
|
||||
|
||||
function readPemCertChain($cert)
|
||||
{
|
||||
$array = explode("-----END CERTIFICATE-----", $cert);
|
||||
$certs[] = null;
|
||||
for ($i = 0; $i < count($array) - 1; $i++) {
|
||||
$certs[$i] = openssl_x509_parse($array[$i] . "-----END CERTIFICATE-----");
|
||||
}
|
||||
return $certs;
|
||||
}
|
||||
|
||||
function verifyCert($prev, $rootCerts)
|
||||
{
|
||||
$nowTime = time();
|
||||
if ($nowTime < $prev['validFrom_time_t']) {
|
||||
echo "证书未激活";
|
||||
return false;
|
||||
}
|
||||
if ($nowTime > $prev['validTo_time_t']) {
|
||||
echo "证书已经过期";
|
||||
return false;
|
||||
}
|
||||
$subjectMap = null;
|
||||
for ($i = 0; $i < count($rootCerts); $i++) {
|
||||
$subjectDN = array2string($rootCerts[$i]['subject']);
|
||||
$subjectMap[$subjectDN] = $rootCerts[$i];
|
||||
}
|
||||
$issuerDN = array2string(($prev['issuer']));
|
||||
if (!array_key_exists($issuerDN, $subjectMap)) {
|
||||
echo "证书链验证失败";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证证书链是否是信任证书库中证书签发的
|
||||
* @param $alipayCerts 目标验证证书列表
|
||||
* @param $rootCerts 可信根证书列表
|
||||
*/
|
||||
function verifyCertChain($alipayCerts, $rootCerts)
|
||||
{
|
||||
$sorted = sortByDn($alipayCerts);
|
||||
if (!$sorted) {
|
||||
echo "证书链验证失败:不是完整的证书链";
|
||||
return false;
|
||||
}
|
||||
//先验证第一个证书是不是信任库中证书签发的
|
||||
$prev = $alipayCerts[0];
|
||||
$firstOK = verifyCert($prev, $rootCerts);
|
||||
$length = count($alipayCerts);
|
||||
if (!$firstOK || $length == 1) {
|
||||
return $firstOK;
|
||||
}
|
||||
|
||||
$nowTime = time();
|
||||
//验证证书链
|
||||
for ($i = 1; $i < $length; $i++) {
|
||||
$cert = $alipayCerts[$i];
|
||||
if ($nowTime < $cert['validFrom_time_t']) {
|
||||
echo "证书未激活";
|
||||
return false;
|
||||
}
|
||||
if ($nowTime > $cert['validTo_time_t']) {
|
||||
echo "证书已经过期";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将证书链按照完整的签发顺序进行排序,排序后证书链为:[issuerA, subjectA]-[issuerA, subjectB]-[issuerB, subjectC]-[issuerC, subjectD]...
|
||||
* @param $certs 证书链
|
||||
*/
|
||||
function sortByDn(&$certs)
|
||||
{
|
||||
//是否包含自签名证书
|
||||
$hasSelfSignedCert = false;
|
||||
$subjectMap = null;
|
||||
$issuerMap = null;
|
||||
for ($i = 0; $i < count($certs); $i++) {
|
||||
if (isSelfSigned($certs[$i])) {
|
||||
if ($hasSelfSignedCert) {
|
||||
return false;
|
||||
}
|
||||
$hasSelfSignedCert = true;
|
||||
}
|
||||
$subjectDN = array2string($certs[$i]['subject']);
|
||||
$issuerDN = array2string(($certs[$i]['issuer']));
|
||||
$subjectMap[$subjectDN] = $certs[$i];
|
||||
$issuerMap[$issuerDN] = $certs[$i];
|
||||
}
|
||||
$certChain = null;
|
||||
addressingUp($subjectMap, $certChain, $certs[0]);
|
||||
addressingDown($issuerMap, $certChain, $certs[0]);
|
||||
|
||||
//说明证书链不完整
|
||||
if (count($certs) != count($certChain)) {
|
||||
return false;
|
||||
}
|
||||
//将证书链复制到原先的数据
|
||||
for ($i = 0; $i < count($certs); $i++) {
|
||||
$certs[$i] = $certChain[count($certs) - $i - 1];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证证书是否是自签发的
|
||||
* @param $cert 目标证书
|
||||
*/
|
||||
function isSelfSigned($cert)
|
||||
{
|
||||
$subjectDN = array2string($cert['subject']);
|
||||
$issuerDN = array2string($cert['issuer']);
|
||||
return ($subjectDN == $issuerDN);
|
||||
}
|
||||
|
||||
|
||||
function array2string($array)
|
||||
{
|
||||
$string = [];
|
||||
if ($array && is_array($array)) {
|
||||
foreach ($array as $key => $value) {
|
||||
$string[] = $key . '=' . $value;
|
||||
}
|
||||
}
|
||||
return implode(',', $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向上构造证书链
|
||||
* @param $subjectMap 主题和证书的映射
|
||||
* @param $certChain 证书链
|
||||
* @param $current 当前需要插入证书链的证书,include
|
||||
*/
|
||||
function addressingUp($subjectMap, &$certChain, $current)
|
||||
{
|
||||
$certChain[] = $current;
|
||||
if (isSelfSigned($current)) {
|
||||
return;
|
||||
}
|
||||
$issuerDN = array2string($current['issuer']);
|
||||
|
||||
if (!array_key_exists($issuerDN, $subjectMap)) {
|
||||
return;
|
||||
}
|
||||
addressingUp($subjectMap, $certChain, $subjectMap[$issuerDN]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向下构造证书链
|
||||
* @param $issuerMap 签发者和证书的映射
|
||||
* @param $certChain 证书链
|
||||
* @param $current 当前需要插入证书链的证书,exclude
|
||||
*/
|
||||
function addressingDown($issuerMap, &$certChain, $current)
|
||||
{
|
||||
$subjectDN = array2string($current['subject']);
|
||||
if (!array_key_exists($subjectDN, $issuerMap)) {
|
||||
return $certChain;
|
||||
}
|
||||
$certChain[] = $issuerMap[$subjectDN];
|
||||
addressingDown($issuerMap, $certChain, $issuerMap[$subjectDN]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extract signature from der encoded cert.
|
||||
* Expects x509 der encoded certificate consisting of a section container
|
||||
* containing 2 sections and a bitstream. The bitstream contains the
|
||||
* original encrypted signature, encrypted by the public key of the issuing
|
||||
* signer.
|
||||
* @param string $der
|
||||
* @return string on success
|
||||
* @return bool false on failures
|
||||
*/
|
||||
function extractSignature($der = false)
|
||||
{
|
||||
if (strlen($der) < 5) {
|
||||
return false;
|
||||
}
|
||||
// skip container sequence
|
||||
$der = substr($der, 4);
|
||||
// now burn through two sequences and the return the final bitstream
|
||||
while (strlen($der) > 1) {
|
||||
$class = ord($der[0]);
|
||||
$classHex = dechex($class);
|
||||
switch ($class) {
|
||||
// BITSTREAM
|
||||
case 0x03:
|
||||
$len = ord($der[1]);
|
||||
$bytes = 0;
|
||||
if ($len & 0x80) {
|
||||
$bytes = $len & 0x0f;
|
||||
$len = 0;
|
||||
for ($i = 0; $i < $bytes; $i++) {
|
||||
$len = ($len << 8) | ord($der[$i + 2]);
|
||||
}
|
||||
}
|
||||
return substr($der, 3 + $bytes, $len);
|
||||
break;
|
||||
// SEQUENCE
|
||||
case 0x30:
|
||||
$len = ord($der[1]);
|
||||
$bytes = 0;
|
||||
if ($len & 0x80) {
|
||||
$bytes = $len & 0x0f;
|
||||
$len = 0;
|
||||
for ($i = 0; $i < $bytes; $i++) {
|
||||
$len = ($len << 8) | ord($der[$i + 2]);
|
||||
}
|
||||
}
|
||||
$contents = substr($der, 2 + $bytes, $len);
|
||||
$der = substr($der, 2 + $bytes + $len);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get signature algorithm oid from der encoded signature data.
|
||||
* Expects decrypted signature data from a certificate in der format.
|
||||
* This ASN1 data should contain the following structure:
|
||||
* SEQUENCE
|
||||
* SEQUENCE
|
||||
* OID (signature algorithm)
|
||||
* NULL
|
||||
* OCTET STRING (signature hash)
|
||||
* @return bool false on failures
|
||||
* @return string oid
|
||||
*/
|
||||
function getSignatureAlgorithmOid($der = null)
|
||||
{
|
||||
// Validate this is the der we need...
|
||||
if (!is_string($der) or strlen($der) < 5) {
|
||||
return false;
|
||||
}
|
||||
$bit_seq1 = 0;
|
||||
$bit_seq2 = 2;
|
||||
$bit_oid = 4;
|
||||
if (ord($der[$bit_seq1]) !== 0x30) {
|
||||
die('Invalid DER passed to getSignatureAlgorithmOid()');
|
||||
}
|
||||
if (ord($der[$bit_seq2]) !== 0x30) {
|
||||
die('Invalid DER passed to getSignatureAlgorithmOid()');
|
||||
}
|
||||
if (ord($der[$bit_oid]) !== 0x06) {
|
||||
die('Invalid DER passed to getSignatureAlgorithmOid');
|
||||
}
|
||||
// strip out what we don't need and get the oid
|
||||
$der = substr($der, $bit_oid);
|
||||
// Get the oid
|
||||
$len = ord($der[1]);
|
||||
$bytes = 0;
|
||||
if ($len & 0x80) {
|
||||
$bytes = $len & 0x0f;
|
||||
$len = 0;
|
||||
for ($i = 0; $i < $bytes; $i++) {
|
||||
$len = ($len << 8) | ord($der[$i + 2]);
|
||||
}
|
||||
}
|
||||
$oid_data = substr($der, 2 + $bytes, $len);
|
||||
// Unpack the OID
|
||||
$oid = floor(ord($oid_data[0]) / 40);
|
||||
$oid .= '.' . ord($oid_data[0]) % 40;
|
||||
$value = 0;
|
||||
$i = 1;
|
||||
while ($i < strlen($oid_data)) {
|
||||
$value = $value << 7;
|
||||
$value = $value | (ord($oid_data[$i]) & 0x7f);
|
||||
if (!(ord($oid_data[$i]) & 0x80)) {
|
||||
$oid .= '.' . $value;
|
||||
$value = 0;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return $oid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get signature hash from der encoded signature data.
|
||||
* Expects decrypted signature data from a certificate in der format.
|
||||
* This ASN1 data should contain the following structure:
|
||||
* SEQUENCE
|
||||
* SEQUENCE
|
||||
* OID (signature algorithm)
|
||||
* NULL
|
||||
* OCTET STRING (signature hash)
|
||||
* @return bool false on failures
|
||||
* @return string hash
|
||||
*/
|
||||
function getSignatureHash($der = null)
|
||||
{
|
||||
// Validate this is the der we need...
|
||||
if (!is_string($der) or strlen($der) < 5) {
|
||||
return false;
|
||||
}
|
||||
if (ord($der[0]) !== 0x30) {
|
||||
die('Invalid DER passed to getSignatureHash()');
|
||||
}
|
||||
// strip out the container sequence
|
||||
$der = substr($der, 2);
|
||||
if (ord($der[0]) !== 0x30) {
|
||||
die('Invalid DER passed to getSignatureHash()');
|
||||
}
|
||||
// Get the length of the first sequence so we can strip it out.
|
||||
$len = ord($der[1]);
|
||||
$bytes = 0;
|
||||
if ($len & 0x80) {
|
||||
$bytes = $len & 0x0f;
|
||||
$len = 0;
|
||||
for ($i = 0; $i < $bytes; $i++) {
|
||||
$len = ($len << 8) | ord($der[$i + 2]);
|
||||
}
|
||||
}
|
||||
$der = substr($der, 2 + $bytes + $len);
|
||||
// Now we should have an octet string
|
||||
if (ord($der[0]) !== 0x04) {
|
||||
die('Invalid DER passed to getSignatureHash()');
|
||||
}
|
||||
$len = ord($der[1]);
|
||||
$bytes = 0;
|
||||
if ($len & 0x80) {
|
||||
$bytes = $len & 0x0f;
|
||||
$len = 0;
|
||||
for ($i = 0; $i < $bytes; $i++) {
|
||||
$len = ($len << 8) | ord($der[$i + 2]);
|
||||
}
|
||||
}
|
||||
return bin2hex(substr($der, 2 + $bytes, $len));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if one cert was used to sign another
|
||||
* Note that more than one CA cert can give a positive result, some certs
|
||||
* re-issue signing certs after having only changed the expiration dates.
|
||||
* @param string $cert - PEM encoded cert
|
||||
* @param string $caCert - PEM encoded cert that possibly signed $cert
|
||||
* @return bool
|
||||
*/
|
||||
function isCertSigner($certPem = null, $caCertPem = null)
|
||||
{
|
||||
if (!function_exists('openssl_pkey_get_public')) {
|
||||
die('Need the openssl_pkey_get_public() function.');
|
||||
}
|
||||
if (!function_exists('openssl_public_decrypt')) {
|
||||
die('Need the openssl_public_decrypt() function.');
|
||||
}
|
||||
if (!function_exists('hash')) {
|
||||
die('Need the php hash() function.');
|
||||
}
|
||||
if (empty($certPem) or empty($caCertPem)) {
|
||||
return false;
|
||||
}
|
||||
// Convert the cert to der for feeding to extractSignature.
|
||||
$certDer = pemToDer($certPem);
|
||||
if (!is_string($certDer)) {
|
||||
die('invalid certPem');
|
||||
}
|
||||
// Grab the encrypted signature from the der encoded cert.
|
||||
$encryptedSig = extractSignature($certDer);
|
||||
if (!is_string($encryptedSig)) {
|
||||
die('Failed to extract encrypted signature from certPem.');
|
||||
}
|
||||
// Extract the public key from the ca cert, which is what has
|
||||
// been used to encrypt the signature in the cert.
|
||||
$pubKey = openssl_pkey_get_public($caCertPem);
|
||||
if ($pubKey === false) {
|
||||
die('Failed to extract the public key from the ca cert.');
|
||||
}
|
||||
// Attempt to decrypt the encrypted signature using the CA's public
|
||||
// key, returning the decrypted signature in $decryptedSig. If
|
||||
// it can't be decrypted, this ca was not used to sign it for sure...
|
||||
$rc = openssl_public_decrypt($encryptedSig, $decryptedSig, $pubKey);
|
||||
if ($rc === false) {
|
||||
return false;
|
||||
}
|
||||
// We now have the decrypted signature, which is der encoded
|
||||
// asn1 data containing the signature algorithm and signature hash.
|
||||
// Now we need what was originally hashed by the issuer, which is
|
||||
// the original DER encoded certificate without the issuer and
|
||||
// signature information.
|
||||
$origCert = stripSignerAsn($certDer);
|
||||
if ($origCert === false) {
|
||||
die('Failed to extract unsigned cert.');
|
||||
}
|
||||
// Get the oid of the signature hash algorithm, which is required
|
||||
// to generate our own hash of the original cert. This hash is
|
||||
// what will be compared to the issuers hash.
|
||||
$oid = getSignatureAlgorithmOid($decryptedSig);
|
||||
if ($oid === false) {
|
||||
die('Failed to determine the signature algorithm.');
|
||||
}
|
||||
switch ($oid) {
|
||||
case '1.2.840.113549.2.2':
|
||||
$algo = 'md2';
|
||||
break;
|
||||
case '1.2.840.113549.2.4':
|
||||
$algo = 'md4';
|
||||
break;
|
||||
case '1.2.840.113549.2.5':
|
||||
$algo = 'md5';
|
||||
break;
|
||||
case '1.3.14.3.2.18':
|
||||
$algo = 'sha';
|
||||
break;
|
||||
case '1.3.14.3.2.26':
|
||||
$algo = 'sha1';
|
||||
break;
|
||||
case '2.16.840.1.101.3.4.2.1':
|
||||
$algo = 'sha256';
|
||||
break;
|
||||
case '2.16.840.1.101.3.4.2.2':
|
||||
$algo = 'sha384';
|
||||
break;
|
||||
case '2.16.840.1.101.3.4.2.3':
|
||||
$algo = 'sha512';
|
||||
break;
|
||||
default:
|
||||
die('Unknown signature hash algorithm oid: ' . $oid);
|
||||
break;
|
||||
}
|
||||
// Get the issuer generated hash from the decrypted signature.
|
||||
$decryptedHash = getSignatureHash($decryptedSig);
|
||||
// Ok, hash the original unsigned cert with the same algorithm
|
||||
// and if it matches $decryptedHash we have a winner.
|
||||
$certHash = hash($algo, $origCert);
|
||||
return ($decryptedHash === $certHash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert pem encoded certificate to DER encoding
|
||||
* @return string $derEncoded on success
|
||||
* @return bool false on failures
|
||||
*/
|
||||
function pemToDer($pem = null)
|
||||
{
|
||||
if (!is_string($pem)) {
|
||||
return false;
|
||||
}
|
||||
$cert_split = preg_split('/(-----((BEGIN)|(END)) CERTIFICATE-----)/', $pem);
|
||||
if (!isset($cert_split[1])) {
|
||||
return false;
|
||||
}
|
||||
return base64_decode($cert_split[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain der cert with issuer and signature sections stripped.
|
||||
* @param string $der - der encoded certificate
|
||||
* @return string $der on success
|
||||
* @return bool false on failures.
|
||||
*/
|
||||
function stripSignerAsn($der = null)
|
||||
{
|
||||
if (!is_string($der) or strlen($der) < 8) {
|
||||
return false;
|
||||
}
|
||||
$bit = 4;
|
||||
$len = ord($der[($bit + 1)]);
|
||||
$bytes = 0;
|
||||
if ($len & 0x80) {
|
||||
$bytes = $len & 0x0f;
|
||||
$len = 0;
|
||||
for ($i = 0; $i < $bytes; $i++) {
|
||||
$len = ($len << 8) | ord($der[$bit + $i + 2]);
|
||||
}
|
||||
}
|
||||
return substr($der, 4, $len + 4);
|
||||
}
|
||||
1330
Server/extend/alipay-sdk-all/v2/aop/AopClient.php
Normal file
1330
Server/extend/alipay-sdk-all/v2/aop/AopClient.php
Normal file
File diff suppressed because it is too large
Load Diff
78
Server/extend/alipay-sdk-all/v2/aop/AopEncrypt.php
Normal file
78
Server/extend/alipay-sdk-all/v2/aop/AopEncrypt.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* 加密工具类
|
||||
*
|
||||
* User: jiehua
|
||||
* Date: 16/3/30
|
||||
* Time: 下午3:25
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 加密方法
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
function encrypt($str, $screct_key)
|
||||
{
|
||||
//AES, 128 模式加密数据 CBC
|
||||
$screct_key = base64_decode($screct_key);
|
||||
$str = trim($str);
|
||||
$str = addPKCS7Padding($str);
|
||||
|
||||
//设置全0的IV
|
||||
|
||||
$iv = str_repeat("\0", 16);
|
||||
$encrypt_str = openssl_encrypt($str, 'aes-128-cbc', $screct_key, OPENSSL_NO_PADDING, $iv);
|
||||
return base64_encode($encrypt_str);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密方法
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
function decrypt($str, $screct_key)
|
||||
{
|
||||
//AES, 128 模式加密数据 CBC
|
||||
$str = base64_decode($str);
|
||||
$screct_key = base64_decode($screct_key);
|
||||
|
||||
//设置全0的IV
|
||||
$iv = str_repeat("\0", 16);
|
||||
$decrypt_str = openssl_decrypt($str, 'aes-128-cbc', $screct_key, OPENSSL_NO_PADDING, $iv);
|
||||
$decrypt_str = stripPKSC7Padding($decrypt_str);
|
||||
return $decrypt_str;
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充算法
|
||||
* @param string $source
|
||||
* @return string
|
||||
*/
|
||||
function addPKCS7Padding($source)
|
||||
{
|
||||
$source = trim($source);
|
||||
$block = 16;
|
||||
|
||||
$pad = $block - (strlen($source) % $block);
|
||||
if ($pad <= $block) {
|
||||
$char = chr($pad);
|
||||
$source .= str_repeat($char, $pad);
|
||||
}
|
||||
return $source;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移去填充算法
|
||||
* @param string $source
|
||||
* @return string
|
||||
*/
|
||||
function stripPKSC7Padding($source)
|
||||
{
|
||||
$char = substr($source, -1);
|
||||
$num = ord($char);
|
||||
if ($num == 62) return $source;
|
||||
$source = substr($source, 0, -$num);
|
||||
return $source;
|
||||
}
|
||||
18
Server/extend/alipay-sdk-all/v2/aop/EncryptParseItem.php
Normal file
18
Server/extend/alipay-sdk-all/v2/aop/EncryptParseItem.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* TODO 补充说明
|
||||
*
|
||||
* User: jiehua
|
||||
* Date: 16/3/30
|
||||
* Time: 下午8:55
|
||||
*/
|
||||
|
||||
class EncryptParseItem
|
||||
{
|
||||
public $startIndex;
|
||||
|
||||
public $endIndex;
|
||||
|
||||
public $encryptContent;
|
||||
|
||||
}
|
||||
16
Server/extend/alipay-sdk-all/v2/aop/EncryptResponseData.php
Normal file
16
Server/extend/alipay-sdk-all/v2/aop/EncryptResponseData.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* TODO 补充说明
|
||||
*
|
||||
* User: jiehua
|
||||
* Date: 16/3/30
|
||||
* Time: 下午8:51
|
||||
*/
|
||||
|
||||
class EncryptResponseData
|
||||
{
|
||||
public $realContent;
|
||||
|
||||
public $returnContent;
|
||||
|
||||
}
|
||||
15
Server/extend/alipay-sdk-all/v2/aop/SignData.php
Normal file
15
Server/extend/alipay-sdk-all/v2/aop/SignData.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: jiehua
|
||||
* Date: 15/5/2
|
||||
* Time: 下午6:21
|
||||
*/
|
||||
|
||||
class SignData
|
||||
{
|
||||
public $signSourceData = null;
|
||||
|
||||
public $sign = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: aft.aifin.fireeye.ocr.image.query request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-09-04 00:38:07
|
||||
*/
|
||||
class AftAifinFireeyeOcrImageQueryRequest
|
||||
{
|
||||
/**
|
||||
* OCR火眼识别
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "aft.aifin.fireeye.ocr.image.query";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: aft.aifin.newtest.query request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2019-02-18 13:15:00
|
||||
*/
|
||||
class AftAifinNewtestQueryRequest
|
||||
{
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "aft.aifin.newtest.query";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: aft.finsecure.riskplus.security.policy.query request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-08-24 23:02:30
|
||||
*/
|
||||
class AftFinsecureRiskplusSecurityPolicyQueryRequest
|
||||
{
|
||||
/**
|
||||
* 策略咨询服务输出
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "aft.finsecure.riskplus.security.policy.query";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alios.open.auto.info.query request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2024-03-28 00:40:42
|
||||
*/
|
||||
class AliosOpenAutoInfoQueryRequest
|
||||
{
|
||||
/**
|
||||
* 查询阿里车的车辆信息
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alios.open.auto.info.query";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.cashpool.account.bind request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2020-07-06 11:20:40
|
||||
*/
|
||||
class AlipayAccountCashpoolAccountBindRequest
|
||||
{
|
||||
/**
|
||||
* 账户资金池绑定
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.cashpool.account.bind";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.cashpool.allocaterule.create request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-08-21 01:26:57
|
||||
*/
|
||||
class AlipayAccountCashpoolAllocateruleCreateRequest
|
||||
{
|
||||
/**
|
||||
* 资金池调拨规则新增
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.cashpool.allocaterule.create";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.cashpool.allocaterule.pay request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-05-30 20:13:28
|
||||
*/
|
||||
class AlipayAccountCashpoolAllocaterulePayRequest
|
||||
{
|
||||
/**
|
||||
* 资金池调拨规则强制执行
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.cashpool.allocaterule.pay";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.cashpool.basic.query request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-05-31 03:29:46
|
||||
*/
|
||||
class AlipayAccountCashpoolBasicQueryRequest
|
||||
{
|
||||
/**
|
||||
* 查询资金池基本信息
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.cashpool.basic.query";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.cashpool.create request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-08-21 01:37:29
|
||||
*/
|
||||
class AlipayAccountCashpoolCreateRequest
|
||||
{
|
||||
/**
|
||||
* 资金池创建
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.cashpool.create";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.cashpool.delete request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-08-20 18:03:26
|
||||
*/
|
||||
class AlipayAccountCashpoolDeleteRequest
|
||||
{
|
||||
/**
|
||||
* 资金池删除
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.cashpool.delete";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.cashpool.detail.query request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-08-20 18:26:30
|
||||
*/
|
||||
class AlipayAccountCashpoolDetailQueryRequest
|
||||
{
|
||||
/**
|
||||
* 资金池详情查询
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.cashpool.detail.query";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.cashpool.rule.modify request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-08-21 01:46:46
|
||||
*/
|
||||
class AlipayAccountCashpoolRuleModifyRequest
|
||||
{
|
||||
/**
|
||||
* 资金池规则修改
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.cashpool.rule.modify";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.cashpool.rulegroup.create request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-05-31 03:12:19
|
||||
*/
|
||||
class AlipayAccountCashpoolRulegroupCreateRequest
|
||||
{
|
||||
/**
|
||||
* 资金池规则组新增
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.cashpool.rulegroup.create";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.cashpool.rulegroup.modify request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-08-21 03:52:46
|
||||
*/
|
||||
class AlipayAccountCashpoolRulegroupModifyRequest
|
||||
{
|
||||
/**
|
||||
* 资金池规则组修改
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.cashpool.rulegroup.modify";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.cashpool.status.modify request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-08-21 01:26:35
|
||||
*/
|
||||
class AlipayAccountCashpoolStatusModifyRequest
|
||||
{
|
||||
/**
|
||||
* 资金池状态修改
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.cashpool.status.modify";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.clearingcenter.payoff.modify request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-08-24 21:10:41
|
||||
*/
|
||||
class AlipayAccountClearingcenterPayoffModifyRequest
|
||||
{
|
||||
/**
|
||||
* 修改待解付登记薄
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.clearingcenter.payoff.modify";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.clearingcenter.payoff.query request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-08-21 01:16:09
|
||||
*/
|
||||
class AlipayAccountClearingcenterPayoffQueryRequest
|
||||
{
|
||||
/**
|
||||
* 查询解付登记薄信息
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.clearingcenter.payoff.query";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.exrate.advice.accept request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-08-21 02:05:59
|
||||
*/
|
||||
class AlipayAccountExrateAdviceAcceptRequest
|
||||
{
|
||||
/**
|
||||
* 标准的兑换交易受理接口
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.exrate.advice.accept";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.exrate.allclientrate.query request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-09-04 00:07:45
|
||||
*/
|
||||
class AlipayAccountExrateAllclientrateQueryRequest
|
||||
{
|
||||
/**
|
||||
* 查询客户的所有币种对最新有效汇率
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.exrate.allclientrate.query";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.exrate.collectcore.data.send request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-08-21 05:40:17
|
||||
*/
|
||||
class AlipayAccountExrateCollectcoreDataSendRequest
|
||||
{
|
||||
/**
|
||||
* 金融信息受理接口
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.exrate.collectcore.data.send";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* ALIPAY API: alipay.account.exrate.config.query request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2023-09-04 01:53:54
|
||||
*/
|
||||
class AlipayAccountExrateConfigQueryRequest
|
||||
{
|
||||
/**
|
||||
* 主站配置查询接口
|
||||
**/
|
||||
private $bizContent;
|
||||
|
||||
private $apiParas = array();
|
||||
private $terminalType;
|
||||
private $terminalInfo;
|
||||
private $prodCode;
|
||||
private $apiVersion="1.0";
|
||||
private $notifyUrl;
|
||||
private $returnUrl;
|
||||
private $needEncrypt=false;
|
||||
|
||||
|
||||
public function setBizContent($bizContent)
|
||||
{
|
||||
$this->bizContent = $bizContent;
|
||||
$this->apiParas["biz_content"] = $bizContent;
|
||||
}
|
||||
|
||||
public function getBizContent()
|
||||
{
|
||||
return $this->bizContent;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alipay.account.exrate.config.query";
|
||||
}
|
||||
|
||||
public function setNotifyUrl($notifyUrl)
|
||||
{
|
||||
$this->notifyUrl=$notifyUrl;
|
||||
}
|
||||
|
||||
public function getNotifyUrl()
|
||||
{
|
||||
return $this->notifyUrl;
|
||||
}
|
||||
|
||||
public function setReturnUrl($returnUrl)
|
||||
{
|
||||
$this->returnUrl=$returnUrl;
|
||||
}
|
||||
|
||||
public function getReturnUrl()
|
||||
{
|
||||
return $this->returnUrl;
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function getTerminalType()
|
||||
{
|
||||
return $this->terminalType;
|
||||
}
|
||||
|
||||
public function setTerminalType($terminalType)
|
||||
{
|
||||
$this->terminalType = $terminalType;
|
||||
}
|
||||
|
||||
public function getTerminalInfo()
|
||||
{
|
||||
return $this->terminalInfo;
|
||||
}
|
||||
|
||||
public function setTerminalInfo($terminalInfo)
|
||||
{
|
||||
$this->terminalInfo = $terminalInfo;
|
||||
}
|
||||
|
||||
public function getProdCode()
|
||||
{
|
||||
return $this->prodCode;
|
||||
}
|
||||
|
||||
public function setProdCode($prodCode)
|
||||
{
|
||||
$this->prodCode = $prodCode;
|
||||
}
|
||||
|
||||
public function setApiVersion($apiVersion)
|
||||
{
|
||||
$this->apiVersion=$apiVersion;
|
||||
}
|
||||
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
public function setNeedEncrypt($needEncrypt)
|
||||
{
|
||||
|
||||
$this->needEncrypt=$needEncrypt;
|
||||
|
||||
}
|
||||
|
||||
public function getNeedEncrypt()
|
||||
{
|
||||
return $this->needEncrypt;
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user