first commit

master
zhaocheng 4 years ago
parent 0d298f936a
commit dd98a98b57
  1. 8
      .gitignore
  2. 42
      .travis.yml
  3. 927
      CHANGELOG.md
  4. 32
      LICENSE.txt
  5. 52
      README.md
  6. 1
      app/.htaccess
  7. 22
      app/AppService.php
  8. 182
      app/BaseController.php
  9. 58
      app/ExceptionHandle.php
  10. 8
      app/Request.php
  11. 11
      app/common.php
  12. 86
      app/controller/Crontab.php
  13. 498
      app/controller/Index.php
  14. 498
      app/controller/Index.php.bak
  15. 615
      app/controller/Task.php
  16. 605
      app/controller/Task.php.bak
  17. 17
      app/event.php
  18. 41
      app/jobs/DelayQueue.php
  19. 10
      app/middleware.php
  20. 17
      app/model/CarInfoT.php
  21. 24
      app/model/CrontabT.php
  22. 12
      app/model/ExportLogT.php
  23. 0
      app/model/ExportLogT.php.bak
  24. 10
      app/model/JobsT.php
  25. 14
      app/model/PeerPhoneT.php
  26. 14
      app/model/RepeatFrameT.php
  27. 9
      app/provider.php
  28. 9
      app/service.php
  29. 170
      app/view/index/edit.html
  30. 170
      app/view/index/edit.html.bak
  31. 384
      app/view/index/index.html
  32. 365
      app/view/index/index.html.bak
  33. 10
      app/view/public/base.html
  34. 12
      app/view/public/header.html
  35. 12
      app/view/public/header.html.bak
  36. 38
      app/view/public/layout.html
  37. 4
      app/view/public/script.html
  38. 449
      app/view/task/index.html
  39. 444
      app/view/task/index.html.bak
  40. 26
      build.php
  41. 54
      composer.json
  42. 1557
      composer.lock
  43. 34
      config/app.php
  44. 29
      config/cache.php
  45. 11
      config/console.php
  46. 18
      config/cookie.php
  47. 62
      config/database.php
  48. 24
      config/filesystem.php
  49. 25
      config/lang.php
  50. 45
      config/log.php
  51. 8
      config/middleware.php
  52. 21
      config/queue.php
  53. 45
      config/route.php
  54. 19
      config/session.php
  55. 35
      config/template.php
  56. 10
      config/trace.php
  57. 25
      config/view.php
  58. 2
      extend/.gitignore
  59. 8
      public/.htaccess
  60. BIN
      public/favicon.ico
  61. 24
      public/index.php
  62. 2
      public/robots.txt
  63. 19
      public/router.php
  64. 2
      public/static/.gitignore
  65. 17
      route/app.php
  66. 21
      route/route.php
  67. 1
      runtime/session/sess_f0c35153899e626149d7aa338fcf92c5
  68. 433
      runtime/temp/2c7bddf2602390fe3491ea487d866ef2.php
  69. 499
      runtime/temp/4a1403173de2fcfc7cfff92a06a360dc.php
  70. 185
      runtime/temp/dc3e3ddb370b0b9564cb52310d05c516.php
  71. 10
      think
  72. 1
      view/README.md
  73. 1
      更新.bat

8
.gitignore vendored

@ -0,0 +1,8 @@
/.idea
/.vscode
/vendor
/public/export
/public/storage
/public/uploads
*.log
.env

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

@ -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多个字段批量数组查询的方式

@ -0,0 +1,32 @@
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
版权所有Copyright © 2006-2016 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.

@ -1,2 +1,52 @@
# excel_handle
ThinkPHP 6.0
===============
> 运行环境要求PHP7.1+。
## 主要新特性
* 采用`PHP7`强类型(严格模式)
* 支持更多的`PSR`规范
* 原生多应用支持
* 更强大和易用的查询
* 全新的事件系统
* 模型事件和数据库事件统一纳入事件系统
* 模板引擎分离出核心
* 内部功能中间件化
* SESSION/Cookie机制改进
* 对Swoole以及协程支持改进
* 对IDE更加友好
* 统一和精简大量用法
## 安装
~~~
composer create-project topthink/think tp 6.0.*
~~~
如果需要更新框架使用
~~~
composer update topthink/framework
~~~
## 文档
[完全开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content)
## 参与开发
请参阅 [ThinkPHP 核心框架包](https://github.com/top-think/framework)。
## 版权信息
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
本项目包含的第三方源码和二进制文件之版权信息另行标注。
版权所有Copyright © 2006-2020 by ThinkPHP (http://thinkphp.cn)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
更多细节参阅 [LICENSE.txt](LICENSE.txt)

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

@ -0,0 +1,22 @@
<?php
declare (strict_types = 1);
namespace app;
use think\Service;
/**
* 应用服务类
*/
class AppService extends Service
{
public function register()
{
// 服务注册
}
public function boot()
{
// 服务启动
}
}

@ -0,0 +1,182 @@
<?php
declare (strict_types = 1);
namespace app;
use Exception;
use think\App;
use think\exception\HttpResponseException;
use think\exception\ValidateException;
use think\facade\View;
use think\Validate;
/**
* 控制器基础类
*/
abstract class BaseController
{
/**
* Request实例
* @var \think\Request
*/
protected $request;
/**
* 应用实例
* @var \think\App
*/
protected $app;
/**
* 是否批量验证
* @var bool
*/
protected $batchValidate = false;
/**
* 控制器中间件
* @var array
*/
protected $middleware = [];
/**
* @var View
*/
protected $view;
/**
* @var array
*/
protected $layui_data;
/**
* @var array
*/
protected $json_data;
/**
* 构造方法
* @access public
* @param App $app 应用对象
*/
public function __construct(App $app)
{
$this->app = $app;
$this->request = $this->app->request;
$this->view = $this->app->view;
// 控制器初始化
$this->initialize();
}
// 初始化
protected function initialize()
{
if($this->request->isAjax() && $this->request->action() != 'login'){
$lastAction = session('last_action');
if (session('login_time') === null || time() - $lastAction > 600) {
session('login_time', null);
$this->json_data['code'] = '-1';
$this->json_data['msg'] = '登录超时';
throw new HttpResponseException(json($this->json_data));
}else if($this->request->action() != 'process'){
session('last_action', time());
}
}
$this->layui_data = [
'code' => 0,
'msg' => '请求成功',
'count' => 0,
'data' => [],
];
$this->json_data = ['code' => 1, 'msg' => '操作成功'];
}
/**
* 验证数据
* @access protected
* @param array $data 数据
* @param string|array $validate 验证器名或者验证规则数组
* @param array $message 提示信息
* @param bool $batch 是否批量验证
* @return array|string|true
* @throws ValidateException
*/
protected function validate(array $data, $validate, array $message = [], bool $batch = false)
{
if (is_array($validate)) {
$v = new Validate();
$v->rule($validate);
} else {
if (strpos($validate, '.')) {
// 支持场景
[$validate, $scene] = explode('.', $validate);
}
$class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate);
$v = new $class();
if (!empty($scene)) {
$v->scene($scene);
}
}
$v->message($message);
// 是否批量验证
if ($batch || $this->batchValidate) {
$v->batch(true);
}
return $v->failException(true)->check($data);
}
/**
* 加载模板输出
* @access protected
* @param string $template 模板文件名
* @param array $vars 模板输出变量
* @return string
* @throws Exception
*/
protected function fetch($template = '', $vars = [])
{
return $this->view->fetch($template, $vars);
}
/**
* 渲染内容输出
* @access protected
* @param string $content 模板内容
* @param array $vars 模板输出变量
* @return mixed
*/
protected function display($content = '', $vars = [])
{
return $this->view->display($content, $vars);
}
/**
* 模板变量赋值
* @access protected
* @param mixed $name 要显示的模板变量
* @param mixed $value 变量的值
* @return $this
*/
protected function assign($name, $value = '')
{
$this->view->assign($name, $value);
return $this;
}
/**
* 初始化模板引擎
* @access protected
* @param array|string $engine 引擎参数
* @return $this
*/
protected function engine($engine)
{
$this->view->engine($engine);
return $this;
}
}

@ -0,0 +1,58 @@
<?php
namespace app;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\exception\Handle;
use think\exception\HttpException;
use think\exception\HttpResponseException;
use think\exception\ValidateException;
use think\Response;
use Throwable;
/**
* 应用异常处理类
*/
class ExceptionHandle extends Handle
{
/**
* 不需要记录信息(日志)的异常类列表
* @var array
*/
protected $ignoreReport = [
HttpException::class,
HttpResponseException::class,
ModelNotFoundException::class,
DataNotFoundException::class,
ValidateException::class,
];
/**
* 记录异常信息(包括日志或者其它方式记录)
*
* @access public
* @param Throwable $exception
* @return void
*/
public function report(Throwable $exception): void
{
// 使用内置的方式记录异常日志
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @access public
* @param \think\Request $request
* @param Throwable $e
* @return Response
*/
public function render($request, Throwable $e): Response
{
// 添加自定义异常处理机制
// 其他错误交给系统处理
return parent::render($request, $e);
}
}

@ -0,0 +1,8 @@
<?php
namespace app;
// 应用请求对象类
class Request extends \think\Request
{
}

@ -0,0 +1,11 @@
<?php
// 应用公共文件
function startsWith($haystack, $needle)
{
return strncmp($haystack, $needle, strlen($needle)) === 0;
}
function endsWith($haystack, $needle)
{
return $haystack != '' && $needle != '' && substr_compare($haystack, $needle, -strlen($needle)) === 0;
}

@ -0,0 +1,86 @@
<?php
declare (strict_types = 1);
namespace app\controller;
use app\BaseController;
use think\Request;
class Crontab extends BaseController
{
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
//
}
/**
* 显示创建资源表单页.
*
* @return \think\Response
*/
public function create()
{
//
}
/**
* 保存新建的资源
*
* @param \think\Request $request
* @return \think\Response
*/
public function save(Request $request)
{
//
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
//
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return \think\Response
*/
public function edit($id)
{
//
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
//
}
}

@ -0,0 +1,498 @@
<?php
namespace app\controller;
use app\BaseController;
use app\model\CarInfoT;
use app\model\JobsT;
use app\model\PeerPhoneT;
use app\model\RepeatFrameT;
use library\Tree;
use think\facade\Db;
use think\facade\Filesystem;
use think\response\Json;
class Index extends BaseController
{
/**
* @var CarInfoT
*/
private $model;
public function initialize()
{
parent::initialize(); // TODO: Change the autogenerated stub
$this->model = new CarInfoT;
}
/**
* 显示资源列表
*
* @return string
* @throws \Exception
*/
public function index()
{
$peer_phone_count = PeerPhoneT::count();
$repeat_frame_count = RepeatFrameT::count();
$this->assign('peer_phone_count', $peer_phone_count);
$this->assign('repeat_frame_count', $repeat_frame_count);
return $this->fetch();
}
/**
* @return Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function carInfo(){
$params = $this->request->param();
$page = $this->request->param('page', 1);
$limit = $this->request->param('limit', 20);
if ($page <= 1) {
$page = 1;
}
$offset = ($page - 1) * $limit;
$map = $this->getQueryCondition($params);
$jobs_name = ['0' => ''];
if (isset($params['is_check_peer_phone']) && $params['is_check_peer_phone'] > 0) {
$params['data_check'] = 'car_phone_check';
}
if ((isset($params['is_check_repeat_frame']) && $params['is_check_repeat_frame'] > 0) ||
isset($params['is_delete_frame']) && $params['is_delete_frame'] > 0) {
$params['data_check'] = 'car_frame_check';
}
if(isset($params['data_check']) && $params['data_check'] == 'car_frame_check'){
$query = $this->model->rightJoin('repeat_frame_t','repeat_frame_t.car_frame_no = car_info_t.car_frame_no')->field('car_info_t.*')->where($map)->order('repeat_frame_t.car_frame_no desc');
if (isset($params['is_check_repeat_frame']) && $params['is_check_repeat_frame'] > 0) {
$jobs_info = JobsT::find($params['is_check_repeat_frame']);
$job_info_payload = json_decode($jobs_info->payload,true)['data']['params'];
if(isset($job_info_payload['export_date1']) && $job_info_payload['export_date1'] != ''){
$query = $query->where('car_info_t.register_date', '>=', $job_info_payload['export_date1']);
}
if(isset($job_info_payload['export_date2']) && $job_info_payload['export_date2'] != ''){
$query = $query->where('car_info_t.register_date', '<=', $job_info_payload['export_date2']);
}
$query = $query->where([
['repeat_frame_t.source', '=', $params['is_check_repeat_frame']]]);
} else if (isset($params['is_delete_frame']) && $params['is_delete_frame'] > 0) {
$query = $query->where('repeat_frame_t.is_delete', '=', $params['is_delete_frame']);
}
}else if(isset($params['data_check']) && $params['data_check'] == 'car_phone_check'){
$query = $this->model->rightJoin('peer_phone_t','peer_phone_t.phone = car_info_t.car_phone')->field('car_info_t.*')->where($map)->order('peer_phone_t.phone desc');
if (isset($params['is_check_peer_phone']) && $params['is_check_peer_phone'] > 0) {
$jobs_info = JobsT::find($params['is_check_peer_phone']);
$job_info_payload = json_decode($jobs_info->payload, true)['data']['params'];
if (isset($job_info_payload['export_date1']) && $job_info_payload['export_date1'] != '') {
$query = $query->where('car_info_t.register_date', '>=', $job_info_payload['export_date1']);
}
if (isset($job_info_payload['export_date2']) && $job_info_payload['export_date2'] != '') {
$query = $query->where('car_info_t.register_date', '<=', $job_info_payload['export_date2']);
}
$query = $query->where('peer_phone_t.source', '=', $params['is_check_peer_phone'])->where('car_info_t.car_number', 'REGEXP', '^[1-9][[:digit:]]{7}((0[[:digit:]])|(1[0-2]))(([0|1|2][[:digit:]])|3[0-1])[[:digit:]]{3}$|^[1-9][[:digit:]]{5}[1-9][[:digit:]]{3}((0[[:digit:]])|(1[0-2]))(([0|1|2][[:digit:]])|3[0-1])[[:digit:]]{3}([0-9]|X)$');
}
} else if (isset($params['export_name']) && $params['export_name'] != '') {
$export_name = JobsT::where('queue', 'like', '%' . $params['export_name'] . '%')->column('queue,download_times', 'id');
$ids = array_keys($export_name);
$query = $this->model->where($map)->where(function ($query) use ($ids) {
$query->whereOr(['car_info_t.is_export_bhx' => $ids, 'car_info_t.is_export_bmc' => $ids]);
})->field('*')->order('is_export_bhx desc,is_export_bmc desc');
} else {
$query = $this->model->where($map)->order('id desc');
}
$map_or1 = [];
$map_or2 = [];
$insurer_month1 = $params['insurer_month1']??'';
$insurer_day1 = $params['insurer_day1']??'';
$insurer_month2 = $params['insurer_month2']??'';
$insurer_day2 = $params['insurer_day2']??'';
if($insurer_month1 != '' && $insurer_day1 == '') {
$map_or1[] = [Db::raw('month(car_info_t.insurer1_date)'), '>=', $insurer_month1];
$map_or2[] = [Db::raw('month(car_info_t.insurer2_date)'), '>=', $insurer_month1];
} else if ($insurer_month1 == '' && $insurer_day1 != '') {
$map_or1[] = [Db::raw('day(car_info_t.insurer1_date)'), '>=', $insurer_day1];
$map_or2[] = [Db::raw('day(car_info_t.insurer2_date)'), '>=', $insurer_day1];
} else if ($insurer_month1 != '' && $insurer_day1 != '') {
$map_or1[] = [Db::raw('DATE_FORMAT(car_info_t.insurer1_date,"%m-%d")'), '>=', substr('0' . $insurer_month1, -2) . '-' . substr('0' . $insurer_day1, -2)];
$map_or2[] = [Db::raw('DATE_FORMAT(car_info_t.insurer2_date,"%m-%d")'), '>=', substr('0' . $insurer_month1, -2) . '-' . substr('0' . $insurer_day1, -2)];
}
if($insurer_month2 != '' && $insurer_day2 == '') {
$map_or1[] = [Db::raw('month(car_info_t.insurer1_date)'), '<=', $insurer_month2];
$map_or2[] = [Db::raw('month(car_info_t.insurer2_date)'), '<=', $insurer_month2];
} else if ($insurer_month2 == '' && $insurer_day2 != '') {
$map_or1[] = [Db::raw('day(car_info_t.insurer1_date)'), '<=', $insurer_day2];
$map_or2[] = [Db::raw('day(car_info_t.insurer2_date)'), '<=', $insurer_day2];
} else if ($insurer_month2 != '' && $insurer_day2 != '') {
$map_or1[] = [Db::raw('DATE_FORMAT(car_info_t.insurer1_date,"%m-%d")'), '<=', substr('0' . $insurer_month2, -2) . '-' . substr('0' . $insurer_day2, -2)];
$map_or2[] = [Db::raw('DATE_FORMAT(car_info_t.insurer2_date,"%m-%d")'), '<=', substr('0' . $insurer_month2, -2) . '-' . substr('0' . $insurer_day2, -2)];
}
if(count($map_or1) > 0){
$map_or1 = array_merge([['car_info_t.insurer1_date', '<>', '']],$map_or1);
}
if(count($map_or2) > 0){
$map_or2 = array_merge([['car_info_t.insurer1_date', '=', ''],['car_info_t.insurer2_date', '<>', '']],$map_or2);
}
if (count($map_or1) > 0 && count($map_or2) > 0) {
$query = $query->where(function ($query) use ($map_or1, $map_or2) {
if (count($map_or1) > 0 && count($map_or2) > 0) {
$query->whereOr([$map_or1, $map_or2]);
}
});
}
if (isset($params['data_filter']) && !empty($params['data_filter'])) {
$map = $this->getAddStatusQuery(array_flip($params['data_filter']));
if(count($map) > 1 ){
$query = $query->where(function ($query) use ($map) {
if (count($map) > 0){
$query->whereOr($map);
}
});
}else {
$query = $query->where($map);
}
}
$count = $query->count();
$list = $query->limit($offset, $limit)->select()->toArray();
if(isset($export_name) && count($export_name) > 0 ){
$jobs_name = $jobs_name + $export_name;
}
foreach ($list as &$item) {
$item['export_bhx_name'] = $jobs_name[$item['is_export_bhx']]['queue'] ?? '';
$item['export_bmc_name'] = $jobs_name[$item['is_export_bmc']]['queue'] ?? '';
$item['bhx_download_times'] = $jobs_name[$item['is_export_bhx']]['download_times'] ?? 0;
$item['bmc_download_times'] = $jobs_name[$item['is_export_bmc']]['download_times'] ?? 0;
}
$this->layui_data['data'] = $list;
$this->layui_data['count'] = $count;
return json($this->layui_data);
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function edit($id)
{
$car_info = $this->model->find($id);
if($this->request->isGet()){
$this->assign('info', $car_info);
return $this->fetch();
}else if($this->request->isPost()){
$data = $this->request->param();
$car_info->car_no = $data['car_no'] ?? $car_info->car_no;
$car_info->car_frame_no = $data['car_frame_no'] ?? $car_info->car_frame_no;
$car_info->engine_no = $data['engine_no'] ?? $car_info->engine_no;
$car_info->factory_model = $data['factory_model'] ?? $car_info->factory_model;
$car_info->register_date = $data['register_date'] ?? $car_info->register_date;
$car_info->purchase_price = $data['purchase_price'] ?? $car_info->purchase_price;
$car_info->company = $data['company'] ?? $car_info->company;
$car_info->insurer1_date = $data['insurer1_date'] ?? $car_info->insurer1_date;
$car_info->insurer2_date = $data['insurer2_date'] ?? $car_info->insurer2_date;
$car_info->car_man = $data['car_man'] ?? $car_info->car_man;
$car_info->car_number = $data['car_number'] ?? $car_info->car_number;
$car_info->car_phone = $data['car_phone'] ?? $car_info->car_phone;
$car_info->id_man = $data['id_man'] ?? $car_info->id_man;
$car_info->id_number = $data['id_number'] ?? $car_info->id_number;
$car_info->update_timestamp = date('Y-m-d H:i:s');
if($car_info->save()){
return json($this->json_data);
}else {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '保存失败';
return json($this->layui_data);
}
}
}
/**
* 删除指定资源
* @param $id
* @return Json
*/
public function delete($id)
{
//
$this->json_data['code'] = intval($this->model->destroy($id));
$this->json_data['msg'] = $this->json_data['code'] ? '删除成功' : '删除失败';
return json($this->json_data);
}
/**
* 批量删除
* @return Json
* @throws \Exception
*/
public function deletes()
{
//
$params = $this->request->param();
$map = $this->getQueryCondition($params);
if($this->model->where($map)->delete()){
$this->json_data['msg'] = '删除成功';
}else {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '删除失败';
}
return json($this->json_data);
}
/**
* 清除数据
* @return Json
*/
public function truncate(){
$ret = Db::execute("truncate table car_info_t");
if($ret === false){
$this->json_data['code'] = 0;
$this->json_data['msg'] = '删除失败';
}else {
$this->json_data['msg'] = '删除成功';
}
return json($this->json_data);
}
/**
* @param $id
* @return Json
*/
public function clearPhone($id){
$this->json_data['code'] = $this->model->where('id', $id)->update(['car_phone' => '']);
$this->json_data['msg'] = $this->json_data['code'] ? '操作成功' : '操作失败';
return json($this->json_data);
}
/**
* 保存更新的资源
*
* @param int $id
* @param $field
* @param $value
* @return \think\Response
*/
public function update($id, $field, $value)
{
$this->json_data['code'] = $this->model->where('id', $id)->update([$field => $value]);
$this->json_data['msg'] = $this->json_data['code'] ? '更新成功' : '更新失败';
return json($this->json_data);
}
public function login(){
$password = $this->request->param('password','');
if ($password === 'wuwei088277') {
session('login_time', time());
session('last_action', time());
}else {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '密码错误';
}
return json($this->json_data);
}
/**
* @param $params
* @return array
*/
private function getQueryCondition($params)
{
$map = [];
if (isset($params['car_man']) && $params['car_man'] != '') {
$car_man = explode(',', str_replace(',', '', $params['car_man']));
array_walk($car_man, function (&$value) {
$value = '%' . $value . '%';
});
$map[] = ['car_info_t.car_man', 'like', $car_man];
}
if (isset($params['factory_model']) && $params['factory_model'] != '') {
$factory_model = explode(',', str_replace(',', '', $params['factory_model']));
array_walk($factory_model, function (&$value) {
$value = '%' . $value . '%';
});
$map[] = ['car_info_t.factory_model', 'like', $factory_model];
}
if (isset($params['car_frame_no']) && $params['car_frame_no'] != '') {
$map[] = ['car_info_t.car_frame_no', '=', $params['car_frame_no']];
}
if (isset($params['car_no']) && $params['car_no'] != '') {
$map[] = ['car_info_t.car_no', '=', $params['car_no']];
}
if (isset($params['car_number']) && $params['car_number'] != '') {
$map[] = ['car_info_t.car_number', '=', $params['car_number']];
}
if (isset($params['car_phone']) && $params['car_phone'] != '') {
$map[] = ['car_info_t.car_phone', '=', $params['car_phone']];
}
if (isset($params['register_date']) && $params['register_date'] != '') {
$map[] = ['car_info_t.register_date', '=', $params['register_date']];
}
if (isset($params['car_phone_empty']) && $params['car_phone_empty'] == 'yes') {
$map[] = ['car_info_t.car_phone', '<>', ''];
}
if (isset($params['car_phone_empty']) && $params['car_phone_empty'] == 'no') {
$map[] = ['car_info_t.car_phone', '=', ''];
}
if (isset($params['car_phone_repeat']) && $params['car_phone_repeat'] == 'yes') {
$map[] = ['car_info_t.id', '=', 'peer_phone_t.id'];
}
if (isset($params['is_update_bhx']) && $params['is_update_bhx'] > 0 ) {
$map[] = ['car_info_t.is_update_bhx', '=', $params['is_update_bhx']];
}
if (isset($params['is_export_bhx']) && $params['is_export_bhx'] > 0 ) {
$map[] = ['car_info_t.is_export_bhx', '=', $params['is_export_bhx']];
}
if (isset($params['is_export_bmc']) && $params['is_export_bmc'] > 0 ) {
$map[] = ['car_info_t.is_export_bmc', '=', $params['is_export_bmc']];
}
if (isset($params['is_export_failed']) && $params['is_export_failed'] > 0 ) {
$map[] = ['car_info_t.is_export_failed', '=', $params['is_export_failed']];
}
if (isset($params['is_export_failed_bmc']) && $params['is_export_failed_bmc'] > 0 ) {
$map[] = ['car_info_t.is_export_failed_bmc', '=', $params['is_export_failed_bmc']];
}
if (isset($params['is_export_none_bmc']) && $params['is_export_none_bmc'] > 0 ) {
$map[] = ['car_info_t.is_export_none_bmc', '=', $params['is_export_none_bmc']];
}
if (isset($params['source']) && $params['source'] > 0 ) {
$map[] = ['car_info_t.source', '=', $params['source']];
}
if(isset($params['register_date1']) && $params['register_date1'] != ''){
$map[] = ['car_info_t.register_date', '>=', $params['register_date1']];
}
if(isset($params['register_date2']) && $params['register_date2'] != ''){
$map[] = ['car_info_t.register_date', '<=', $params['register_date2']];
}
if (isset($params['price1']) && $params['price1'] != '') {
$map[] = ['car_info_t.purchase_price', '>=', $params['price1'] * 10000];
}
if (isset($params['price2']) && $params['price2'] != '') {
$map[] = ['car_info_t.purchase_price', '<=', $params['price2'] * 10000];
}
return $map;
}
/**
* 添加状态筛选
* @param $data_filter
* @return array
*/
private function getAddStatusQuery($data_filter)
{
$tree = new Tree();
$tree->setNode(1, isset($data_filter['bhx']) ? [['car_info_t.is_export_bhx', '>', 0]] : []);
$tree->setNode(2, isset($data_filter['none']) ? [['car_info_t.is_export_bhx', '=', 0]] : []);
if(isset($data_filter['bhx_success'])){
$tree->setNode(3, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '>', 0],
]],1);
$tree->setNode(1, [], 0);
}else {
$tree->setNode(3, [],1);
}
if(isset($data_filter['bhx_failed'])){
$tree->setNode(4, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '<', 0],
]],1);
$tree->setNode(1, [], 0);
}else {
$tree->setNode(4, [],1);
}
if(isset($data_filter['bhx_none'])){
$tree->setNode(5, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '=', 0],
]],1);
$tree->setNode(1, [], 0);
}else {
$tree->setNode(5, [],1);
}
if(isset($data_filter['none_bmc'])){
$tree->setNode(6, [[
['car_info_t.is_export_bhx', '=', 0],
['car_info_t.is_export_none_bmc', '>', 0],
]],2);
$tree->setNode(2, [], 0);
}else {
$tree->setNode(6, [],2);
}
if(isset($data_filter['none_none'])){
$tree->setNode(7, [[
['car_info_t.is_export_bhx', '=', 0],
['car_info_t.is_export_none_bmc', '=', 0],
]],2);
$tree->setNode(2, [], 0);
}else {
$tree->setNode(7, [],2);
}
if(isset($data_filter['bhx_success_bmc'])){
$tree->setNode(8, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '>', 0],
['car_info_t.is_export_bmc', '>', 0],
]],3);
$tree->setNode(3, [], 0);
}else {
$tree->setNode(8, [],3);
}
if(isset($data_filter['bhx_success_none'])){
$tree->setNode(9, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '>', 0],
['car_info_t.is_export_bmc', '=', 0],
]],3);
$tree->setNode(3, [], 0);
}else {
$tree->setNode(9, [],3);
}
if(isset($data_filter['bhx_failed_bmc'])){
$tree->setNode(10, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '<', 0],
['car_info_t.is_export_bmc', '=', 0],
['car_info_t.is_export_failed', '=', 0],
['car_info_t.is_export_failed_bmc', '>', 0],
]],4);
$tree->setNode(4, [], 0);
}else {
$tree->setNode(10, [],4);
}
if(isset($data_filter['bhx_failed_bhx'])){
$tree->setNode(11, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '<', 0],
['car_info_t.is_export_bmc', '=', 0],
['car_info_t.is_export_failed', '>', 0],
]],4);
$tree->setNode(4, [], 0);
}else {
$tree->setNode(11, [],4);
}
if(isset($data_filter['bhx_failed_none'])){
$tree->setNode(12, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '<', 0],
['car_info_t.is_export_bmc', '=', 0],
['car_info_t.is_export_failed', '=', 0],
['car_info_t.is_export_failed_bmc', '=', 0],
]],4);
$tree->setNode(4, [], 0);
}else {
$tree->setNode(12, [],4);
}
$map = $tree->getAllChildrenNodes(0, function ($value) {
return count($value) > 0;
}, function ($value) {
return $value;
});
return array_column(array_filter($map), null);
}
}

@ -0,0 +1,498 @@
<?php
namespace app\controller;
use app\BaseController;
use app\model\CarInfoT;
use app\model\JobsT;
use app\model\PeerPhoneT;
use app\model\RepeatFrameT;
use library\Tree;
use think\facade\Db;
use think\facade\Filesystem;
use think\response\Json;
class Index extends BaseController
{
/**
* @var CarInfoT
*/
private $model;
public function initialize()
{
parent::initialize(); // TODO: Change the autogenerated stub
$this->model = new CarInfoT;
}
/**
* 显示资源列表
*
* @return string
* @throws \Exception
*/
public function index()
{
$peer_phone_count = PeerPhoneT::count();
$repeat_frame_count = RepeatFrameT::count();
$this->assign('peer_phone_count', $peer_phone_count);
$this->assign('repeat_frame_count', $repeat_frame_count);
return $this->fetch();
}
/**
* @return Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function carInfo(){
$params = $this->request->param();
$page = $this->request->param('page', 1);
$limit = $this->request->param('limit', 20);
if ($page <= 1) {
$page = 1;
}
$offset = ($page - 1) * $limit;
$map = $this->getQueryCondition($params);
$jobs_name = ['0' => ''];
if (isset($params['is_check_peer_phone']) && $params['is_check_peer_phone'] > 0) {
$params['data_check'] = 'car_phone_check';
}
if ((isset($params['is_check_repeat_frame']) && $params['is_check_repeat_frame'] > 0) ||
isset($params['is_delete_frame']) && $params['is_delete_frame'] > 0) {
$params['data_check'] = 'car_frame_check';
}
if(isset($params['data_check']) && $params['data_check'] == 'car_frame_check'){
$query = $this->model->rightJoin('repeat_frame_t','repeat_frame_t.car_frame_no = car_info_t.car_frame_no')->field('car_info_t.*')->where($map)->order('repeat_frame_t.car_frame_no desc');
if (isset($params['is_check_repeat_frame']) && $params['is_check_repeat_frame'] > 0) {
$jobs_info = JobsT::find($params['is_check_repeat_frame']);
$job_info_payload = json_decode($jobs_info->payload,true)['data']['params'];
if(isset($job_info_payload['export_date1']) && $job_info_payload['export_date1'] != ''){
$query = $query->where('car_info_t.register_date', '>=', $job_info_payload['export_date1']);
}
if(isset($job_info_payload['export_date2']) && $job_info_payload['export_date2'] != ''){
$query = $query->where('car_info_t.register_date', '<=', $job_info_payload['export_date2']);
}
$query = $query->where([
['repeat_frame_t.source', '=', $params['is_check_repeat_frame']]]);
} else if (isset($params['is_delete_frame']) && $params['is_delete_frame'] > 0) {
$query = $query->where('repeat_frame_t.is_delete', '=', $params['is_delete_frame']);
}
}else if(isset($params['data_check']) && $params['data_check'] == 'car_phone_check'){
$query = $this->model->rightJoin('peer_phone_t','peer_phone_t.phone = car_info_t.car_phone')->field('car_info_t.*')->where($map)->order('peer_phone_t.phone desc');
if (isset($params['is_check_peer_phone']) && $params['is_check_peer_phone'] > 0) {
$jobs_info = JobsT::find($params['is_check_peer_phone']);
$job_info_payload = json_decode($jobs_info->payload, true)['data']['params'];
if (isset($job_info_payload['export_date1']) && $job_info_payload['export_date1'] != '') {
$query = $query->where('car_info_t.register_date', '>=', $job_info_payload['export_date1']);
}
if (isset($job_info_payload['export_date2']) && $job_info_payload['export_date2'] != '') {
$query = $query->where('car_info_t.register_date', '<=', $job_info_payload['export_date2']);
}
$query = $query->where('peer_phone_t.source', '=', $params['is_check_peer_phone'])->where('car_info_t.car_number', 'REGEXP', '^[1-9][[:digit:]]{7}((0[[:digit:]])|(1[0-2]))(([0|1|2][[:digit:]])|3[0-1])[[:digit:]]{3}$|^[1-9][[:digit:]]{5}[1-9][[:digit:]]{3}((0[[:digit:]])|(1[0-2]))(([0|1|2][[:digit:]])|3[0-1])[[:digit:]]{3}([0-9]|X)$');
}
} else if (isset($params['export_name']) && $params['export_name'] != '') {
$export_name = JobsT::where('queue', 'like', '%' . $params['export_name'] . '%')->column('queue,download_times', 'id');
$ids = array_keys($export_name);
$query = $this->model->where($map)->where(function ($query) use ($ids) {
$query->whereOr(['car_info_t.is_export_bhx' => $ids, 'car_info_t.is_export_bmc' => $ids]);
})->field('*')->order('is_export_bhx desc,is_export_bmc desc');
} else {
$query = $this->model->where($map)->order('id desc');
}
$map_or1 = [];
$map_or2 = [];
$insurer_month1 = $params['insurer_month1']??'';
$insurer_day1 = $params['insurer_day1']??'';
$insurer_month2 = $params['insurer_month2']??'';
$insurer_day2 = $params['insurer_day2']??'';
if($insurer_month1 != '' && $insurer_day1 == '') {
$map_or1[] = [Db::raw('month(car_info_t.insurer1_date)'), '>=', $insurer_month1];
$map_or2[] = [Db::raw('month(car_info_t.insurer2_date)'), '>=', $insurer_month1];
} else if ($insurer_month1 == '' && $insurer_day1 != '') {
$map_or1[] = [Db::raw('day(car_info_t.insurer1_date)'), '>=', $insurer_day1];
$map_or2[] = [Db::raw('day(car_info_t.insurer2_date)'), '>=', $insurer_day1];
} else if ($insurer_month1 != '' && $insurer_day1 != '') {
$map_or1[] = [Db::raw('DATE_FORMAT(car_info_t.insurer1_date,"%m-%d")'), '>=', substr('0' . $insurer_month1, -2) . '-' . substr('0' . $insurer_day1, -2)];
$map_or2[] = [Db::raw('DATE_FORMAT(car_info_t.insurer2_date,"%m-%d")'), '>=', substr('0' . $insurer_month1, -2) . '-' . substr('0' . $insurer_day1, -2)];
}
if($insurer_month2 != '' && $insurer_day2 == '') {
$map_or1[] = [Db::raw('month(car_info_t.insurer1_date)'), '<=', $insurer_month2];
$map_or2[] = [Db::raw('month(car_info_t.insurer2_date)'), '<=', $insurer_month2];
} else if ($insurer_month2 == '' && $insurer_day2 != '') {
$map_or1[] = [Db::raw('day(car_info_t.insurer1_date)'), '<=', $insurer_day2];
$map_or2[] = [Db::raw('day(car_info_t.insurer2_date)'), '<=', $insurer_day2];
} else if ($insurer_month2 != '' && $insurer_day2 != '') {
$map_or1[] = [Db::raw('DATE_FORMAT(car_info_t.insurer1_date,"%m-%d")'), '<=', substr('0' . $insurer_month2, -2) . '-' . substr('0' . $insurer_day2, -2)];
$map_or2[] = [Db::raw('DATE_FORMAT(car_info_t.insurer2_date,"%m-%d")'), '<=', substr('0' . $insurer_month2, -2) . '-' . substr('0' . $insurer_day2, -2)];
}
if(count($map_or1) > 0){
$map_or1 = array_merge([['car_info_t.insurer1_date', '<>', '']],$map_or1);
}
if(count($map_or2) > 0){
$map_or2 = array_merge([['car_info_t.insurer1_date', '=', ''],['car_info_t.insurer2_date', '<>', '']],$map_or2);
}
if (count($map_or1) > 0 && count($map_or2) > 0) {
$query = $query->where(function ($query) use ($map_or1, $map_or2) {
if (count($map_or1) > 0 && count($map_or2) > 0) {
$query->whereOr([$map_or1, $map_or2]);
}
});
}
if (isset($params['data_filter']) && !empty($params['data_filter'])) {
$map = $this->getAddStatusQuery(array_flip($params['data_filter']));
if(count($map) > 1 ){
$query = $query->where(function ($query) use ($map) {
if (count($map) > 0){
$query->whereOr($map);
}
});
}else {
$query = $query->where($map);
}
}
$count = $query->count();
$list = $query->limit($offset, $limit)->select()->toArray();
if(isset($export_name) && count($export_name) > 0 ){
$jobs_name = $jobs_name + $export_name;
}
foreach ($list as &$item) {
$item['export_bhx_name'] = $jobs_name[$item['is_export_bhx']]['queue'] ?? '';
$item['export_bmc_name'] = $jobs_name[$item['is_export_bmc']]['queue'] ?? '';
$item['bhx_download_times'] = $jobs_name[$item['is_export_bhx']]['download_times'] ?? 0;
$item['bmc_download_times'] = $jobs_name[$item['is_export_bmc']]['download_times'] ?? 0;
}
$this->layui_data['data'] = $list;
$this->layui_data['count'] = $count;
return json($this->layui_data);
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function edit($id)
{
$car_info = $this->model->find($id);
if($this->request->isGet()){
$this->assign('info', $car_info);
return $this->fetch();
}else if($this->request->isPost()){
$data = $this->request->param();
$car_info->car_no = $data['car_no'] ?? $car_info->car_no;
$car_info->car_frame_no = $data['car_frame_no'] ?? $car_info->car_frame_no;
$car_info->engine_no = $data['engine_no'] ?? $car_info->engine_no;
$car_info->factory_model = $data['factory_model'] ?? $car_info->factory_model;
$car_info->register_date = $data['register_date'] ?? $car_info->register_date;
$car_info->purchase_price = $data['purchase_price'] ?? $car_info->purchase_price;
$car_info->company = $data['company'] ?? $car_info->company;
$car_info->insurer1_date = $data['insurer1_date'] ?? $car_info->insurer1_date;
$car_info->insurer2_date = $data['insurer2_date'] ?? $car_info->insurer2_date;
$car_info->car_man = $data['car_man'] ?? $car_info->car_man;
$car_info->car_number = $data['car_number'] ?? $car_info->car_number;
$car_info->car_phone = $data['car_phone'] ?? $car_info->car_phone;
$car_info->id_man = $data['id_man'] ?? $car_info->id_man;
$car_info->id_number = $data['id_number'] ?? $car_info->id_number;
$car_info->update_timestamp = date('Y-m-d H:i:s');
if($car_info->save()){
return json($this->json_data);
}else {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '保存失败';
return json($this->layui_data);
}
}
}
/**
* 删除指定资源
* @param $id
* @return Json
*/
public function delete($id)
{
//
$this->json_data['code'] = intval($this->model->destroy($id));
$this->json_data['msg'] = $this->json_data['code'] ? '删除成功' : '删除失败';
return json($this->json_data);
}
/**
* 批量删除
* @return Json
* @throws \Exception
*/
public function deletes()
{
//
$params = $this->request->param();
$map = $this->getQueryCondition($params);
if($this->model->where($map)->delete()){
$this->json_data['msg'] = '删除成功';
}else {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '删除失败';
}
return json($this->json_data);
}
/**
* 清除数据
* @return Json
*/
public function truncate(){
$ret = Db::execute("truncate table car_info_t");
if($ret === false){
$this->json_data['code'] = 0;
$this->json_data['msg'] = '删除失败';
}else {
$this->json_data['msg'] = '删除成功';
}
return json($this->json_data);
}
/**
* @param $id
* @return Json
*/
public function clearPhone($id){
$this->json_data['code'] = $this->model->where('id', $id)->update(['car_phone' => '']);
$this->json_data['msg'] = $this->json_data['code'] ? '操作成功' : '操作失败';
return json($this->json_data);
}
/**
* 保存更新的资源
*
* @param int $id
* @param $field
* @param $value
* @return \think\Response
*/
public function update($id, $field, $value)
{
$this->json_data['code'] = $this->model->where('id', $id)->update([$field => $value]);
$this->json_data['msg'] = $this->json_data['code'] ? '更新成功' : '更新失败';
return json($this->json_data);
}
public function login(){
$password = $this->request->param('password','');
if ($password === 'wuwei088277') {
session('login_time', time());
session('last_action', time());
}else {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '密码错误';
}
return json($this->json_data);
}
/**
* @param $params
* @return array
*/
private function getQueryCondition($params)
{
$map = [];
if (isset($params['car_man']) && $params['car_man'] != '') {
$car_man = explode(',', str_replace(',', '', $params['car_man']));
array_walk($car_man, function (&$value) {
$value = '%' . $value . '%';
});
$map[] = ['car_info_t.car_man', 'like', $car_man];
}
if (isset($params['factory_model']) && $params['factory_model'] != '') {
$factory_model = explode(',', str_replace(',', '', $params['factory_model']));
array_walk($factory_model, function (&$value) {
$value = '%' . $value . '%';
});
$map[] = ['car_info_t.factory_model', 'like', $factory_model];
}
if (isset($params['car_frame_no']) && $params['car_frame_no'] != '') {
$map[] = ['car_info_t.car_frame_no', '=', $params['car_frame_no']];
}
if (isset($params['car_no']) && $params['car_no'] != '') {
$map[] = ['car_info_t.car_no', '=', $params['car_no']];
}
if (isset($params['car_number']) && $params['car_number'] != '') {
$map[] = ['car_info_t.car_number', '=', $params['car_number']];
}
if (isset($params['car_phone']) && $params['car_phone'] != '') {
$map[] = ['car_info_t.car_phone', '=', $params['car_phone']];
}
if (isset($params['register_date']) && $params['register_date'] != '') {
$map[] = ['car_info_t.register_date', '=', $params['register_date']];
}
if (isset($params['car_phone_empty']) && $params['car_phone_empty'] == 'yes') {
$map[] = ['car_info_t.car_phone', '<>', ''];
}
if (isset($params['car_phone_empty']) && $params['car_phone_empty'] == 'no') {
$map[] = ['car_info_t.car_phone', '=', ''];
}
if (isset($params['car_phone_repeat']) && $params['car_phone_repeat'] == 'yes') {
$map[] = ['car_info_t.id', '=', 'peer_phone_t.id'];
}
if (isset($params['is_update_bhx']) && $params['is_update_bhx'] > 0 ) {
$map[] = ['car_info_t.is_update_bhx', '=', $params['is_update_bhx']];
}
if (isset($params['is_export_bhx']) && $params['is_export_bhx'] > 0 ) {
$map[] = ['car_info_t.is_export_bhx', '=', $params['is_export_bhx']];
}
if (isset($params['is_export_bmc']) && $params['is_export_bmc'] > 0 ) {
$map[] = ['car_info_t.is_export_bmc', '=', $params['is_export_bmc']];
}
if (isset($params['is_export_failed']) && $params['is_export_failed'] > 0 ) {
$map[] = ['car_info_t.is_export_failed', '=', $params['is_export_failed']];
}
if (isset($params['is_export_failed_bmc']) && $params['is_export_failed_bmc'] > 0 ) {
$map[] = ['car_info_t.is_export_failed_bmc', '=', $params['is_export_failed_bmc']];
}
if (isset($params['is_export_none_bmc']) && $params['is_export_none_bmc'] > 0 ) {
$map[] = ['car_info_t.is_export_none_bmc', '=', $params['is_export_none_bmc']];
}
if (isset($params['source']) && $params['source'] > 0 ) {
$map[] = ['car_info_t.source', '=', $params['source']];
}
if(isset($params['register_date1']) && $params['register_date1'] != ''){
$map[] = ['car_info_t.register_date', '>=', $params['register_date1']];
}
if(isset($params['register_date2']) && $params['register_date2'] != ''){
$map[] = ['car_info_t.register_date', '<=', $params['register_date2']];
}
if (isset($params['price1']) && $params['price1'] != '') {
$map[] = ['car_info_t.purchase_price', '>=', $params['price1'] * 10000];
}
if (isset($params['price2']) && $params['price2'] != '') {
$map[] = ['car_info_t.purchase_price', '<=', $params['price2'] * 10000];
}
return $map;
}
/**
* 添加状态筛选
* @param $data_filter
* @return array
*/
private function getAddStatusQuery($data_filter)
{
$tree = new Tree();
$tree->setNode(1, isset($data_filter['bhx']) ? [['car_info_t.is_export_bhx', '>', 0]] : []);
$tree->setNode(2, isset($data_filter['none']) ? [['car_info_t.is_export_bhx', '=', 0]] : []);
if(isset($data_filter['bhx_success'])){
$tree->setNode(3, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '>', 0],
]],1);
$tree->setNode(1, [], 0);
}else {
$tree->setNode(3, [],1);
}
if(isset($data_filter['bhx_failed'])){
$tree->setNode(4, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '<', 0],
]],1);
$tree->setNode(1, [], 0);
}else {
$tree->setNode(4, [],1);
}
if(isset($data_filter['bhx_none'])){
$tree->setNode(5, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '=', 0],
]],1);
$tree->setNode(1, [], 0);
}else {
$tree->setNode(5, [],1);
}
if(isset($data_filter['none_bmc'])){
$tree->setNode(6, [[
['car_info_t.is_export_bhx', '=', 0],
['car_info_t.is_export_none_bmc', '>', 0],
]],2);
$tree->setNode(2, [], 0);
}else {
$tree->setNode(6, [],2);
}
if(isset($data_filter['none_none'])){
$tree->setNode(7, [[
['car_info_t.is_export_bhx', '=', 0],
['car_info_t.is_export_none_bmc', '=', 0],
]],2);
$tree->setNode(2, [], 0);
}else {
$tree->setNode(7, [],2);
}
if(isset($data_filter['bhx_success_bmc'])){
$tree->setNode(8, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '>', 0],
['car_info_t.is_export_bmc', '>', 0],
]],3);
$tree->setNode(3, [], 0);
}else {
$tree->setNode(8, [],3);
}
if(isset($data_filter['bhx_success_none'])){
$tree->setNode(9, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '>', 0],
['car_info_t.is_export_bmc', '=', 0],
]],3);
$tree->setNode(3, [], 0);
}else {
$tree->setNode(9, [],3);
}
if(isset($data_filter['bhx_failed_bmc'])){
$tree->setNode(10, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '=', -1],
['car_info_t.is_export_bmc', '=', 0],
['car_info_t.is_export_failed', '=', 0],
['car_info_t.is_export_failed_bmc', '>', 0],
]],4);
$tree->setNode(4, [], 0);
}else {
$tree->setNode(10, [],4);
}
if(isset($data_filter['bhx_failed_bhx'])){
$tree->setNode(11, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '=', -1],
['car_info_t.is_export_bmc', '=', 0],
['car_info_t.is_export_failed', '>', 0],
]],4);
$tree->setNode(4, [], 0);
}else {
$tree->setNode(11, [],4);
}
if(isset($data_filter['bhx_failed_none'])){
$tree->setNode(12, [[
['car_info_t.is_export_bhx', '>', 0],
['car_info_t.is_update_bhx', '=', -1],
['car_info_t.is_export_bmc', '=', 0],
['car_info_t.is_export_failed', '=', 0],
['car_info_t.is_export_failed_bmc', '=', 0],
]],4);
$tree->setNode(4, [], 0);
}else {
$tree->setNode(12, [],4);
}
$map = $tree->getAllChildrenNodes(0, function ($value) {
return count($value) > 0;
}, function ($value) {
return $value;
});
return array_column(array_filter($map), null);
}
}

@ -0,0 +1,615 @@
<?php
declare (strict_types = 1);
namespace app\controller;
use app\BaseController;
use app\model\CarInfoT;
use app\model\ExportLogT;
use app\model\JobsT;
use app\model\PeerPhoneT;
use app\model\RepeatFrameT;
use excel\Excel;
use think\facade\Cache;
use think\facade\Db;
use think\facade\Filesystem;
use think\facade\Queue;
use think\Request;
use think\response\Json;
class Task extends BaseController
{
/**
* @var JobsT
*/
private $model;
public function initialize()
{
parent::initialize(); // TODO: Change the autogenerated stub
$this->model = new JobsT;
}
public function test(){
return Db::table('jobs_t')->where('id',8917)->update(['payload' => '{"job":"app\\jobs\\DelayQueue","maxTries":null,"timeout":null,"data":{"params":{"task_type":"5","original_filename":"\u5bfc\u51fa\u6e05\u6d17\u5931\u8d252019-02-01\u20142019-02-28\u7b2c3\u62791472\u6761(\u6267\u884c\u7ed3\u679c)","filename":"uploads\/20201122\\88559f1802f684d14c2e9aa1def8353e.xlsx"},"controller":"service\\CarInfoHandle","action":"carInfoUpdate"}}']);
}
/**
* 显示资源列表
*
* @return string
* @throws \Exception
*/
public function index()
{
return $this->fetch();
}
/**
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function taskInfo(){
$page = $this->request->param('page', 1);
$limit = $this->request->param('limit', 20);
$queue = $this->request->param('queue', '');
if ($page <= 1) {
$page = 1;
}
$offset = ($page - 1) * $limit;
$query = $this->model->field(['id','payload','remark', 'type', 'queue', 'download_times',
"(case `status` when 2 then '100' else '0' end)" => 'process',
'date_format(from_unixtime(create_time),"%Y-%m-%d %H:%i:%s") as create_timestamp',
"(case `type` when 1 then '导入' when 2 then '导出' when 3 then '同行电话' when 4 then '重复车架号' when 5 then '更新车辆信息' when 6 then '清除重复电话' when 7 then '删除重复数据' else '' end)" => 'type_txt',
"(case `status` when 0 then '排队中' when 1 then '处理中' when 2 then '已完成' when 3 then '失败' else '' end)" => 'status', 'create_time']);
if($queue != ''){
$query = $query->where('queue','like','%'. $queue .'%')->whereOr('payload','like','%'. str_replace(['\\','"'],['_',''],json_encode($queue)) .'%');
}
$count = $query->count();
$list = $query->limit($offset, (int)$limit)->order('id desc')->select()->toArray();
foreach ($list as &$item){
if($item['type'] == 1 || $item['type'] == 5){
$item['type_txt'] = json_decode($item['payload'],true)['data']['params']['original_filename'] ?? '';
}
if ($item['type'] == 2) {
$item['type_txt'] = $item['queue'] != 'default' ? $item['queue']: $item['type_txt'];
}
if($item['type'] == 3){
$item['info_num'] = PeerPhoneT::where(['source' => $item['id']])->count();
}
if($item['type'] == 4){
$item['info_num'] = RepeatFrameT::where(['source' => $item['id'], 'is_delete' => 0])->count();
}
}
$this->layui_data['data'] = $list;
$this->layui_data['count'] = $count;
return json($this->layui_data);
}
/**
* 显示创建资源表单页.
*
*/
public function create()
{
}
/**
* 保存新建的资源
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function save()
{
$params = $this->request->param();
$type = $this->request->param('task_type', '0');
$original_filename = $this->request->param('original_filename');
$filename = $this->request->param('filename');
$peer_phone_number = $this->request->param('peer_phone_number');
$queue = $this->request->param('queue', '');
if(isset($params['source_id']) && $params['source_id'] > 0) {
$job_info = JobsT::find($params['source_id']);
$job_info_payload = json_decode($job_info->payload,true)['data']['params'];
$params = [];
$params['export_type'] = 'repeat';
$params['export_limit'] = 0;
$params['export_table'] = $job_info->type == 3? 'peer_phone_t': ($job_info->type == 4?'repeat_frame_t':'');
$params['source_id'] = $job_info->id;
$params['export_date1'] = $job_info_payload['export_date1'];
$params['export_date2'] = $job_info_payload['export_date2'];
}
if (($type == 1 || $type == 5) && ( $filename == '' || ($filename != '' && !file_exists(public_path('public/storage') . $filename)))) {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '导入文件不存在';
return json($this->json_data);
} else if ($type == 1 || $type == 5) {
$original_filename = basename($original_filename);
$original_filename = str_replace(strrchr($original_filename, '.'), '', $original_filename);
$params['original_filename'] = $original_filename;
}
if ($type == 2 && (!isset($params['source_id']) || $params['source_id'] <= 0) && $params['export_date1'] == '' && $params['export_date2'] == '') {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '请先填写注册日期';
return json($this->json_data);
} else if ($type == 2 && isset($params['export_type']) && $params['export_type'] != '' && !in_array($params['export_type'], ['bhx', 'bmc', 'failed', 'repeat', 'failed_bmc', 'none_bmc'])) {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '导出类型错误,请选择正确的导出类型';
return json($this->json_data);
} else if ($type == 2) {
if(trim($params['export_limit']) === ''){
$this->json_data['code'] = 0;
$this->json_data['msg'] = '导出数量必填';
return json($this->json_data);
}
$where = [];
$map_or1 = [];
$map_or2 = [];
if(isset($params['export_date1']) && $params['export_date1'] != ''){
$where[] = ['car_info_t.register_date', '>=', $params['export_date1']];
}
if(isset($params['export_date2']) && $params['export_date2'] != ''){
$where[] = ['car_info_t.register_date', '<=', $params['export_date2']];
}
if (isset($params['price1']) && $params['price1'] != '') {
$where[] = ['car_info_t.purchase_price', '>=', $params['price1'] * 10000];
}
if (isset($params['price2']) && $params['price2'] != '') {
$where[] = ['car_info_t.purchase_price', '<=', $params['price2'] * 10000];
}
if(isset($params['empty_phone_check']) && $params['empty_phone_check'] == 'yes'){
$where[] = ['car_phone', '<>', ''];
}
if(isset($params['export_field'])){
foreach ($params['export_field'] as $item){
$where[] = [$item, '<>', ''];
}
}
if(isset($params['export_type']) && $params['export_type'] != '' && $params['export_limit'] != 0){
if($params['export_type'] == 'bhx'){
$where[] = ['is_export_bhx', '=', 0];
$where[] = ['is_update_bhx', '=', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed', '=', 0];
$where[] = ['is_export_failed_bmc', '=', 0];
}
if($params['export_type'] == 'bmc'){
$where[] = ['is_export_bhx', '>', 0];
$where[] = ['is_update_bhx', '>', 0];
$where[] = ['is_export_bmc', '=', 0];
}
if ($params['export_type'] == 'failed') {
$where[] = ['is_export_bhx', '>', 0];
$where[] = ['is_update_bhx', '<', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed', '=', 0];
}
if ($params['export_type'] == 'failed_bmc') {
$where[] = ['is_export_bhx', '>', 0];
$where[] = ['is_update_bhx', '<', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed_bmc', '=', 0];
}
if ($params['export_type'] == 'none_bmc') {
$where[] = ['is_export_bhx', '=', 0];
$where[] = ['is_update_bhx', '=', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed', '=', 0];
$where[] = ['is_export_failed_bmc', '=', 0];
$where[] = ['is_export_none_bmc', '=', 0];
}
}
$insurer_month1 = $params['insurer_month1']??'';
$insurer_day1 = $params['insurer_day1']??'';
$insurer_month2 = $params['insurer_month2']??'';
$insurer_day2 = $params['insurer_day2']??'';
if($insurer_month1 != '' && $insurer_day1 == '') {
$map_or1[] = [Db::raw('month(car_info_t.insurer1_date)'), '>=', $insurer_month1];
$map_or2[] = [Db::raw('month(car_info_t.insurer2_date)'), '>=', $insurer_month1];
} else if ($insurer_month1 == '' && $insurer_day1 != '') {
$map_or1[] = [Db::raw('day(car_info_t.insurer1_date)'), '>=', $insurer_day1];
$map_or2[] = [Db::raw('day(car_info_t.insurer2_date)'), '>=', $insurer_day1];
} else if ($insurer_month1 != '' && $insurer_day1 != '') {
$map_or1[] = [Db::raw('DATE_FORMAT(car_info_t.insurer1_date,"%m-%d")'), '>=', substr('0' . $insurer_month1, -2) . '-' . substr('0' . $insurer_day1, -2)];
$map_or2[] = [Db::raw('DATE_FORMAT(car_info_t.insurer2_date,"%m-%d")'), '>=', substr('0' . $insurer_month1, -2) . '-' . substr('0' . $insurer_day1, -2)];
}
if($insurer_month2 != '' && $insurer_day2 == '') {
$map_or1[] = [Db::raw('month(car_info_t.insurer1_date)'), '<=', $insurer_month2];
$map_or2[] = [Db::raw('month(car_info_t.insurer2_date)'), '<=', $insurer_month2];
} else if ($insurer_month2 == '' && $insurer_day2 != '') {
$map_or1[] = [Db::raw('day(car_info_t.insurer1_date)'), '<=', $insurer_day2];
$map_or2[] = [Db::raw('day(car_info_t.insurer2_date)'), '<=', $insurer_day2];
} else if ($insurer_month2 != '' && $insurer_day2 != '') {
$map_or1[] = [Db::raw('DATE_FORMAT(car_info_t.insurer1_date,"%m-%d")'), '<=', substr('0' . $insurer_month2, -2) . '-' . substr('0' . $insurer_day2, -2)];
$map_or2[] = [Db::raw('DATE_FORMAT(car_info_t.insurer2_date,"%m-%d")'), '<=', substr('0' . $insurer_month2, -2) . '-' . substr('0' . $insurer_day2, -2)];
}
if(count($map_or1) > 0){
$map_or1 = array_merge([['car_info_t.insurer1_date', '<>', '']],$map_or1);
}
if(count($map_or2) > 0){
$map_or2 = array_merge([['car_info_t.insurer1_date', '=', ''],['car_info_t.insurer2_date', '<>', '']],$map_or2);
}
$query = CarInfoT::where($where)->where(function ($query) use ($map_or1, $map_or2) {
if (count($map_or1) > 0 && count($map_or2) > 0){
$query->whereOr([$map_or1, $map_or2]);
}
});
$count = $query->count();
if ($count < $params['export_limit']) {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '当前导出数量为' . $count . ', 不足' . $params['export_limit'] . ',请检查条件';
return json($this->json_data);
}
}
if ($type == 3 && $peer_phone_number <= 0) {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '请填写正确的个人电话重复数';
return json($this->json_data);
}
if ($type == 3 || $type == 4) {
$where = [];
if($params['export_date1'] != ''){
$where[] = ['car_info_t.register_date', '>=', $params['export_date1']];
}
if($params['export_date2'] != ''){
$where[] = ['car_info_t.register_date', '<=', $params['export_date2']];
}
$count = CarInfoT::where($where)->count();
if ($count <= 0) {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '当前待处理数据为空,请检查条件';
return json($this->json_data);
}
}
$action = [
'1'=>'import',
'2'=>'export',
'3'=>'peerPhones',
'4'=>'carFrameNo',
'5'=>'carInfoUpdate',
'6'=>'deletePeerPhones',
'7'=>'deleteCarFrameNo',
];
$id = Queue::push(
'app\jobs\DelayQueue',
['params' => $params, 'controller' => 'service\\CarInfoHandle', 'action' => $action[$type]],
$queue, $type);
if (!$id) {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '任务创建失败';
}
return json($this->json_data);
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
//
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return \think\Response
*/
public function edit($id)
{
//
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
//
}
/**
* @return Json
*/
public function upload(){
$file = request()->file('file');
$savename = Filesystem::disk('public')->putFile('uploads', $file);
$filename = public_path('public\storage') . $savename;
if ($this->checkUploadTpl($filename, $this->request->param('task_type'))) {
$this->json_data['msg'] = '上传成功';
$this->json_data['original_filename'] = $file->getOriginalName();
$this->json_data['filename'] = $savename;
} else {
@unlink($filename);
$this->json_data['code'] = 0;
$this->json_data['msg'] = '上传文件[' . $file->getOriginalName() . ']与模板不匹配,请检查文件重新上传';
}
return json($this->json_data);
}
public function clearSubTable(){
Db::startTrans();
try {
Db::execute("truncate table jobs_t;");
Db::execute("truncate table peer_phone_t;");
Db::execute("truncate table repeat_frame_t;");
$this->json_data['msg'] = '删除成功';
Db::commit();
} catch (\Exception $e) {
Db::rollback();
$this->json_data['code'] = 0;
$this->json_data['msg'] = '删除失败';
}
return json($this->json_data);
}
public function download($id)
{
$job_info = JobsT::find($id);
$job_info->download_times = Db::raw('download_times+1');
$downloadName = $this->downloadName($job_info);
$job_info->save();
return download(root_path(). 'public' . $job_info->remark, $downloadName);
}
public function process(){
$list = JobsT::where('status', '=', 1)
->whereOr('create_time', '>=', strtotime(date('Y-m-d')))
->order('create_time desc')
->select();
foreach ($list as $item) {
$process = cache('shell_process_' . $item['id']);
if($item->status == 1 || $process){
$this->json_data['data'][] = [
'id' => $item['id'],
'process' => $process,
];
}
if($process >= 100){
Cache::delete('shell_process_' . $item['id']);
}
}
return json($this->json_data);
}
/**
* 导出名称
* @return \think\response\Json
*/
public function exportName()
{
$export_date1 = $this->request->param('export_date1');
$export_date2 = $this->request->param('export_date2');
if ($export_date1 == '' || $export_date2 == '') {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '注册日期范围不能为空';
return json($this->json_data);
}
$type = $this->request->param('export_type');
$export_limit = $this->request->param('export_limit');
$name = '';
if ($type == 'bhx') {
$name = '导出清洗';
} else if ($type == 'failed') {
$name = '导出清洗失败';
} else if ($type == 'bmc') {
$name = '导出清洗成功至上传';
} else if ($type == 'failed_bmc') {
$name = '导出清洗失败至上传';
} else if ($type == 'none_bmc') {
$name = '导出未处理至上传';
}
$count = ExportLogT::where('name','like', $name . $export_date1 . '—' . $export_date2 . '%')->count();
$name .= $export_date1 . '—' . $export_date2 . '第' . ($count + 1) . '批' . $export_limit . '条';
$this->json_data['name'] = $name;
return json($this->json_data);
}
/**
* 任务操作
* @param $jobId
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function taskBtn($jobId){
$job_info = JobsT::find($jobId);
if($job_info->type == 2){
$this->json_data['btns'] = '<a class="layui-btn" href="' . url('task/download', ['id' => $job_info->id]) . '">下载文件</a>';
}else if($job_info->type == 3 && PeerPhoneT::where(['source' => $job_info->id])->count() > 0){
$this->json_data['btns'] = '
<button type="button" class="layui-btn" onclick="task_create(2,' . $job_info->id . ')">导出</button>
<button type="button" class="layui-btn layui-btn-danger" onclick="task_create(6,' . $job_info->id . ')">清除重复电话</button>
';
}else if($job_info->type == 4 && RepeatFrameT::where(['source' => $job_info->id, 'is_delete' => 0])->count() > 0){
$this->json_data['btns'] = '
<button type="button" class="layui-btn" onclick="task_create(2,' . $job_info->id . ')">导出</button>
<button type="button" class="layui-btn layui-btn-danger" onclick="task_create(7,' . $job_info->id . ')">删除重复数据</button>
';
}
return json($this->json_data);
}
public function exportNum(){
$params = $this->request->param();
$where = [];
$map_or1 = [];
$map_or2 = [];
if(isset($params['export_date1']) && $params['export_date1'] != ''){
$where[] = ['car_info_t.register_date', '>=', $params['export_date1']];
}
if(isset($params['export_date2']) && $params['export_date2'] != ''){
$where[] = ['car_info_t.register_date', '<=', $params['export_date2']];
}
if (isset($params['price1']) && $params['price1'] != '') {
$where[] = ['car_info_t.purchase_price', '>=', $params['price1'] * 10000];
}
if (isset($params['price2']) && $params['price2'] != '') {
$where[] = ['car_info_t.purchase_price', '<=', $params['price2'] * 10000];
}
if(isset($params['empty_phone_check']) && $params['empty_phone_check'] == 'yes'){
$where[] = ['car_phone', '<>', ''];
}
if(isset($params['export_field'])){
foreach ($params['export_field'] as $item){
$where[] = [$item, '<>', ''];
}
}
if(isset($params['export_type']) && $params['export_type'] != ''){
if($params['export_type'] == 'bhx'){
$where[] = ['is_export_bhx', '=', 0];
$where[] = ['is_update_bhx', '=', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed', '=', 0];
$where[] = ['is_export_failed_bmc', '=', 0];
}
if($params['export_type'] == 'bmc'){
$where[] = ['is_export_bhx', '>', 0];
$where[] = ['is_update_bhx', '>', 0];
$where[] = ['is_export_bmc', '=', 0];
}
if ($params['export_type'] == 'failed') {
$where[] = ['is_export_bhx', '>', 0];
$where[] = ['is_update_bhx', '<', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed', '=', 0];
}
if ($params['export_type'] == 'failed_bmc') {
$where[] = ['is_export_bhx', '>', 0];
$where[] = ['is_update_bhx', '<', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed_bmc', '=', 0];
}
if ($params['export_type'] == 'none_bmc') {
$where[] = ['is_export_bhx', '=', 0];
$where[] = ['is_update_bhx', '=', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed', '=', 0];
$where[] = ['is_export_failed_bmc', '=', 0];
$where[] = ['is_export_none_bmc', '=', 0];
}
}
$insurer_month1 = $params['insurer_month1']??'';
$insurer_day1 = $params['insurer_day1']??'';
$insurer_month2 = $params['insurer_month2']??'';
$insurer_day2 = $params['insurer_day2']??'';
if($insurer_month1 != '' && $insurer_day1 == '') {
$map_or1[] = [Db::raw('month(car_info_t.insurer1_date)'), '>=', $insurer_month1];
$map_or2[] = [Db::raw('month(car_info_t.insurer2_date)'), '>=', $insurer_month1];
} else if ($insurer_month1 == '' && $insurer_day1 != '') {
$map_or1[] = [Db::raw('day(car_info_t.insurer1_date)'), '>=', $insurer_day1];
$map_or2[] = [Db::raw('day(car_info_t.insurer2_date)'), '>=', $insurer_day1];
} else if ($insurer_month1 != '' && $insurer_day1 != '') {
$map_or1[] = [Db::raw('DATE_FORMAT(car_info_t.insurer1_date,"%m-%d")'), '>=', substr('0' . $insurer_month1, -2) . '-' . substr('0' . $insurer_day1, -2)];
$map_or2[] = [Db::raw('DATE_FORMAT(car_info_t.insurer2_date,"%m-%d")'), '>=', substr('0' . $insurer_month1, -2) . '-' . substr('0' . $insurer_day1, -2)];
}
if($insurer_month2 != '' && $insurer_day2 == '') {
$map_or1[] = [Db::raw('month(car_info_t.insurer1_date)'), '<=', $insurer_month2];
$map_or2[] = [Db::raw('month(car_info_t.insurer2_date)'), '<=', $insurer_month2];
} else if ($insurer_month2 == '' && $insurer_day2 != '') {
$map_or1[] = [Db::raw('day(car_info_t.insurer1_date)'), '<=', $insurer_day2];
$map_or2[] = [Db::raw('day(car_info_t.insurer2_date)'), '<=', $insurer_day2];
} else if ($insurer_month2 != '' && $insurer_day2 != '') {
$map_or1[] = [Db::raw('DATE_FORMAT(car_info_t.insurer1_date,"%m-%d")'), '<=', substr('0' . $insurer_month2, -2) . '-' . substr('0' . $insurer_day2, -2)];
$map_or2[] = [Db::raw('DATE_FORMAT(car_info_t.insurer2_date,"%m-%d")'), '<=', substr('0' . $insurer_month2, -2) . '-' . substr('0' . $insurer_day2, -2)];
}
if(count($map_or1) > 0){
$map_or1 = array_merge([['car_info_t.insurer1_date', '<>', '']],$map_or1);
}
if(count($map_or2) > 0){
$map_or2 = array_merge([['car_info_t.insurer1_date', '=', ''],['car_info_t.insurer2_date', '<>', '']],$map_or2);
}
$query = CarInfoT::where($where)->where(function ($query) use ($map_or1, $map_or2) {
if (count($map_or1) > 0 && count($map_or2) > 0){
$query->whereOr([$map_or1, $map_or2]);
}
});
$this->json_data['data'] = $query->count();
$this->json_data['sql'] = CarInfoT::getLastSql();
return json($this->json_data);
}
public function checkIsExistName($name,$type){
if($name == ''){
$this->json_data['code'] = 0;
$this->json_data['msg'] = '文件名为空,请检查';
return json($this->json_data);
}
if($type == 'update'){
$name = basename($name);
$name = str_replace(strrchr($name, '.'), '', $name);
}
$count = $this->model->where('queue', '=', $name)
->whereOr('payload', 'like', '%' . str_replace(['\\', '"'], ['_', ''], json_encode($name)) . '%')
->count();
if ($count > 0) {
$this->json_data['msg'] = $type == 'upload' ? '当前文件已处理,确定继续?' : '当前任务名已存在,是否继续';
}else {
$this->json_data['code'] = 2;
}
return json($this->json_data);
}
private function downloadName(JobsT $job_info){
$job_params = json_decode($job_info->payload,true)['data']['params'];
list(,$ext) = explode('.', $job_info->remark);
$downloadName = $job_params['export_date1'] . '-' . $job_params['export_date2'];
if($job_info->queue != 'default'){
$downloadName = $job_info->queue;
}else if($job_params['export_type'] == 'repeat' && $job_params['export_table'] == 'repeat_frame_t'){
$downloadName = '重复车架' . $downloadName;
} else if($job_params['export_type'] == 'repeat' && $job_params['export_table'] == 'peer_phone_t'){
$downloadName = '重复电话' . $downloadName;
}
$downloadName .= '.' . $ext;
return $downloadName;
}
private function checkUploadTpl($file, $type)
{
$path_info = pathinfo($file);
if ($type == 1 && $path_info['extension'] == 'csv') {
$title = \file\FileSystem::getFileBlockData($file,0,1);
$tpl_title = ['税号', '初登日期', '车主', '证件号', '电话号码', '车架号', '车牌号', '发动机号', '车型', '新车购置价'];
// $tpl_title = ['区域', '购车日期', '客户姓名', '证件号码', '联系方式', '车架号', '车牌号', '发动机号', '品牌型号', '新车购置价', '保险公司', '商业止保日期', '交强止保日期', '被保险人', '被保险人证件号'];
$title = explode(',', trim($title[0]));
if (count(array_diff($tpl_title, $title)) > 0) {
return false;
}
} else if ($type == 5 && $path_info['extension'] == 'xlsx') {
$spreadsheetReader = Excel::loadFile($file);
$sheet = $spreadsheetReader->getSheet(0);
$highestColumn = $sheet->getHighestColumn(); // e.g 'F'
$title = $sheet->rangeToArray("A1:{$highestColumn}1")[0];
$tpl_title = ['车牌号','车主','品牌型号','发动机号','车架号','注册日期','上年承保公司','商业险到期日期','交强险到期日期','被保险人姓名','被保险人证件号'];
if (count(array_diff($tpl_title, $title)) > 0) {
return false;
}
}
return true;
}
}

@ -0,0 +1,605 @@
<?php
declare (strict_types = 1);
namespace app\controller;
use app\BaseController;
use app\model\CarInfoT;
use app\model\ExportLogT;
use app\model\JobsT;
use app\model\PeerPhoneT;
use app\model\RepeatFrameT;
use excel\Excel;
use think\facade\Cache;
use think\facade\Db;
use think\facade\Filesystem;
use think\facade\Queue;
use think\Request;
use think\response\Json;
class Task extends BaseController
{
/**
* @var JobsT
*/
private $model;
public function initialize()
{
parent::initialize(); // TODO: Change the autogenerated stub
$this->model = new JobsT;
}
/**
* 显示资源列表
*
* @return string
* @throws \Exception
*/
public function index()
{
return $this->fetch();
}
/**
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function taskInfo(){
$page = $this->request->param('page', 1);
$limit = $this->request->param('limit', 20);
$queue = $this->request->param('queue', '');
if ($page <= 1) {
$page = 1;
}
$offset = ($page - 1) * $limit;
$query = $this->model->field(['id','payload','remark', 'type', 'queue', 'download_times',
"(case `status` when 2 then '100' else '0' end)" => 'process',
'date_format(from_unixtime(create_time),"%Y-%m-%d %H:%i:%s") as create_timestamp',
"(case `type` when 1 then '导入' when 2 then '导出' when 3 then '同行电话' when 4 then '重复车架号' when 5 then '更新车辆信息' when 6 then '清除重复电话' when 7 then '删除重复数据' else '' end)" => 'type_txt',
"(case `status` when 0 then '排队中' when 1 then '处理中' when 2 then '已完成' when 3 then '失败' else '' end)" => 'status', 'create_time']);
if($queue != ''){
$query = $query->where('queue','like','%'. $queue .'%')->whereOr('payload','like','%'. str_replace(['\\','"'],['_',''],json_encode($queue)) .'%');
}
$count = $query->count();
$list = $query->limit($offset, (int)$limit)->order('id desc')->select()->toArray();
foreach ($list as &$item){
if($item['type'] == 1 || $item['type'] == 5){
$item['type_txt'] = json_decode($item['payload'],true)['data']['params']['original_filename'] ?? '';
}
if ($item['type'] == 2) {
$item['type_txt'] = $item['queue'] != 'default' ? $item['queue']: $item['type_txt'];
}
if($item['type'] == 3){
$item['info_num'] = PeerPhoneT::where(['source' => $item['id']])->count();
}
if($item['type'] == 4){
$item['info_num'] = RepeatFrameT::where(['source' => $item['id'], 'is_delete' => 0])->count();
}
}
$this->layui_data['data'] = $list;
$this->layui_data['count'] = $count;
return json($this->layui_data);
}
/**
* 显示创建资源表单页.
*
*/
public function create()
{
}
/**
* 保存新建的资源
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function save()
{
$params = $this->request->param();
$type = $this->request->param('task_type', '0');
$original_filename = $this->request->param('original_filename');
$filename = $this->request->param('filename');
$peer_phone_number = $this->request->param('peer_phone_number');
$queue = $this->request->param('queue', '');
if(isset($params['source_id']) && $params['source_id'] > 0) {
$job_info = JobsT::find($params['source_id']);
$job_info_payload = json_decode($job_info->payload,true)['data']['params'];
$params = [];
$params['export_type'] = 'repeat';
$params['export_limit'] = 0;
$params['export_table'] = $job_info->type == 3? 'peer_phone_t': ($job_info->type == 4?'repeat_frame_t':'');
$params['source_id'] = $job_info->id;
$params['export_date1'] = $job_info_payload['export_date1'];
$params['export_date2'] = $job_info_payload['export_date2'];
}
if (($type == 1 || $type == 5) && ( $filename == '' || ($filename != '' && !file_exists(public_path('public/storage') . $filename)))) {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '导入文件不存在';
return json($this->json_data);
} else if ($type == 1 || $type == 5) {
$original_filename = basename($original_filename);
$original_filename = str_replace(strrchr($original_filename, '.'), '', $original_filename);
$params['original_filename'] = $original_filename;
}
if ($type == 2 && (!isset($params['source_id']) || $params['source_id'] <= 0) && $params['export_date1'] == '' && $params['export_date2'] == '') {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '请先填写注册日期';
return json($this->json_data);
} else if ($type == 2 && isset($params['export_type']) && $params['export_type'] != '' && !in_array($params['export_type'], ['bhx', 'bmc', 'failed', 'repeat', 'failed_bmc', 'none_bmc'])) {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '导出类型错误,请选择正确的导出类型';
return json($this->json_data);
} else if ($type == 2) {
$where = [];
$map_or1 = [];
$map_or2 = [];
if(isset($params['export_date1']) && $params['export_date1'] != ''){
$where[] = ['car_info_t.register_date', '>=', $params['export_date1']];
}
if(isset($params['export_date2']) && $params['export_date2'] != ''){
$where[] = ['car_info_t.register_date', '<=', $params['export_date2']];
}
if (isset($params['price1']) && $params['price1'] != '') {
$where[] = ['car_info_t.purchase_price', '>=', $params['price1'] * 10000];
}
if (isset($params['price2']) && $params['price2'] != '') {
$where[] = ['car_info_t.purchase_price', '<=', $params['price2'] * 10000];
}
if(isset($params['empty_phone_check']) && $params['empty_phone_check'] == 'yes'){
$where[] = ['car_phone', '<>', ''];
}
if(isset($params['export_field'])){
foreach ($params['export_field'] as $item){
$where[] = [$item, '<>', ''];
}
}
if(isset($params['export_type']) && $params['export_type'] != '' && $params['export_limit'] != 0){
if($params['export_type'] == 'bhx'){
$where[] = ['is_export_bhx', '=', 0];
$where[] = ['is_update_bhx', '=', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed', '=', 0];
$where[] = ['is_export_failed_bmc', '=', 0];
}
if($params['export_type'] == 'bmc'){
$where[] = ['is_export_bhx', '>', 0];
$where[] = ['is_update_bhx', '>', 0];
$where[] = ['is_export_bmc', '=', 0];
}
if ($params['export_type'] == 'failed') {
$where[] = ['is_export_bhx', '>', 0];
$where[] = ['is_update_bhx', '<', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed', '=', 0];
}
if ($params['export_type'] == 'failed_bmc') {
$where[] = ['is_export_bhx', '>', 0];
$where[] = ['is_update_bhx', '<', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed_bmc', '=', 0];
}
if ($params['export_type'] == 'none_bmc') {
$where[] = ['is_export_bhx', '=', 0];
$where[] = ['is_update_bhx', '=', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed', '=', 0];
$where[] = ['is_export_failed_bmc', '=', 0];
$where[] = ['is_export_none_bmc', '=', 0];
}
}
$insurer_month1 = $params['insurer_month1']??'';
$insurer_day1 = $params['insurer_day1']??'';
$insurer_month2 = $params['insurer_month2']??'';
$insurer_day2 = $params['insurer_day2']??'';
if($insurer_month1 != '' && $insurer_day1 == '') {
$map_or1[] = [Db::raw('month(car_info_t.insurer1_date)'), '>=', $insurer_month1];
$map_or2[] = [Db::raw('month(car_info_t.insurer2_date)'), '>=', $insurer_month1];
} else if ($insurer_month1 == '' && $insurer_day1 != '') {
$map_or1[] = [Db::raw('day(car_info_t.insurer1_date)'), '>=', $insurer_day1];
$map_or2[] = [Db::raw('day(car_info_t.insurer2_date)'), '>=', $insurer_day1];
} else if ($insurer_month1 != '' && $insurer_day1 != '') {
$map_or1[] = [Db::raw('DATE_FORMAT(car_info_t.insurer1_date,"%m-%d")'), '>=', substr('0' . $insurer_month1, -2) . '-' . substr('0' . $insurer_day1, -2)];
$map_or2[] = [Db::raw('DATE_FORMAT(car_info_t.insurer2_date,"%m-%d")'), '>=', substr('0' . $insurer_month1, -2) . '-' . substr('0' . $insurer_day1, -2)];
}
if($insurer_month2 != '' && $insurer_day2 == '') {
$map_or1[] = [Db::raw('month(car_info_t.insurer1_date)'), '<=', $insurer_month2];
$map_or2[] = [Db::raw('month(car_info_t.insurer2_date)'), '<=', $insurer_month2];
} else if ($insurer_month2 == '' && $insurer_day2 != '') {
$map_or1[] = [Db::raw('day(car_info_t.insurer1_date)'), '<=', $insurer_day2];
$map_or2[] = [Db::raw('day(car_info_t.insurer2_date)'), '<=', $insurer_day2];
} else if ($insurer_month2 != '' && $insurer_day2 != '') {
$map_or1[] = [Db::raw('DATE_FORMAT(car_info_t.insurer1_date,"%m-%d")'), '<=', substr('0' . $insurer_month2, -2) . '-' . substr('0' . $insurer_day2, -2)];
$map_or2[] = [Db::raw('DATE_FORMAT(car_info_t.insurer2_date,"%m-%d")'), '<=', substr('0' . $insurer_month2, -2) . '-' . substr('0' . $insurer_day2, -2)];
}
if(count($map_or1) > 0){
$map_or1 = array_merge([['car_info_t.insurer1_date', '<>', '']],$map_or1);
}
if(count($map_or2) > 0){
$map_or2 = array_merge([['car_info_t.insurer1_date', '=', ''],['car_info_t.insurer2_date', '<>', '']],$map_or2);
}
$query = CarInfoT::where($where)->where(function ($query) use ($map_or1, $map_or2) {
if (count($map_or1) > 0 && count($map_or2) > 0){
$query->whereOr([$map_or1, $map_or2]);
}
});
$count = $query->count();
if ($count < $params['export_limit']) {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '当前导出数量为' . $count . ', 不足' . $params['export_limit'] . ',请检查条件';
return json($this->json_data);
}
}
if ($type == 3 && $peer_phone_number <= 0) {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '请填写正确的个人电话重复数';
return json($this->json_data);
}
if ($type == 3 || $type == 4) {
$where = [];
if($params['export_date1'] != ''){
$where[] = ['car_info_t.register_date', '>=', $params['export_date1']];
}
if($params['export_date2'] != ''){
$where[] = ['car_info_t.register_date', '<=', $params['export_date2']];
}
$count = CarInfoT::where($where)->count();
if ($count <= 0) {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '当前待处理数据为空,请检查条件';
return json($this->json_data);
}
}
$action = [
'1'=>'import',
'2'=>'export',
'3'=>'peerPhones',
'4'=>'carFrameNo',
'5'=>'carInfoUpdate',
'6'=>'deletePeerPhones',
'7'=>'deleteCarFrameNo',
];
$id = Queue::push(
'app\jobs\DelayQueue',
['params' => $params, 'controller' => 'service\\CarInfoHandle', 'action' => $action[$type]],
$queue, $type);
if (!$id) {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '任务创建失败';
}
return json($this->json_data);
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
//
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return \think\Response
*/
public function edit($id)
{
//
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
//
}
/**
* @return Json
*/
public function upload(){
$file = request()->file('file');
$savename = Filesystem::disk('public')->putFile('uploads', $file);
$filename = public_path('public\storage') . $savename;
if ($this->checkUploadTpl($filename, $this->request->param('task_type'))) {
$this->json_data['msg'] = '上传成功';
$this->json_data['original_filename'] = $file->getOriginalName();
$this->json_data['filename'] = $savename;
} else {
@unlink($filename);
$this->json_data['code'] = 0;
$this->json_data['msg'] = '上传文件[' . $file->getOriginalName() . ']与模板不匹配,请检查文件重新上传';
}
return json($this->json_data);
}
public function clearSubTable(){
Db::startTrans();
try {
Db::execute("truncate table jobs_t;");
Db::execute("truncate table peer_phone_t;");
Db::execute("truncate table repeat_frame_t;");
$this->json_data['msg'] = '删除成功';
Db::commit();
} catch (\Exception $e) {
Db::rollback();
$this->json_data['code'] = 0;
$this->json_data['msg'] = '删除失败';
}
return json($this->json_data);
}
public function download($id)
{
$job_info = JobsT::find($id);
$job_info->download_times = Db::raw('download_times+1');
$downloadName = $this->downloadName($job_info);
$job_info->save();
return download(root_path(). 'public' . $job_info->remark, $downloadName);
}
public function process(){
$list = JobsT::where('status', '=', 1)
->whereOr('create_time', '>=', strtotime(date('Y-m-d')))
->order('create_time desc')
->select();
foreach ($list as $item) {
$process = cache('shell_process_' . $item['id']);
if($item->status == 1 || $process){
$this->json_data['data'][] = [
'id' => $item['id'],
'process' => $process,
];
}
if($process >= 100){
Cache::delete('shell_process_' . $item['id']);
}
}
return json($this->json_data);
}
/**
* 导出名称
* @return \think\response\Json
*/
public function exportName()
{
$export_date1 = $this->request->param('export_date1');
$export_date2 = $this->request->param('export_date2');
if ($export_date1 == '' || $export_date2 == '') {
$this->json_data['code'] = 0;
$this->json_data['msg'] = '注册日期范围不能为空';
return json($this->json_data);
}
$type = $this->request->param('export_type');
$export_limit = $this->request->param('export_limit');
$name = '';
if ($type == 'bhx') {
$name = '导出清洗';
} else if ($type == 'failed') {
$name = '导出清洗失败';
} else if ($type == 'bmc') {
$name = '导出清洗成功至上传';
} else if ($type == 'failed_bmc') {
$name = '导出清洗失败至上传';
} else if ($type == 'none_bmc') {
$name = '导出未处理至上传';
}
$count = ExportLogT::where('name','like', $name . $export_date1 . '—' . $export_date2 . '%')->count();
$name .= $export_date1 . '—' . $export_date2 . '第' . ($count + 1) . '批' . $export_limit . '条';
$this->json_data['name'] = $name;
return json($this->json_data);
}
/**
* 任务操作
* @param $jobId
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function taskBtn($jobId){
$job_info = JobsT::find($jobId);
if($job_info->type == 2){
$this->json_data['btns'] = '<a class="layui-btn" href="' . url('task/download', ['id' => $job_info->id]) . '">下载文件</a>';
}else if($job_info->type == 3 && PeerPhoneT::where(['source' => $job_info->id])->count() > 0){
$this->json_data['btns'] = '
<button type="button" class="layui-btn" onclick="task_create(2,' . $job_info->id . ')">导出</button>
<button type="button" class="layui-btn layui-btn-danger" onclick="task_create(6,' . $job_info->id . ')">清除重复电话</button>
';
}else if($job_info->type == 4 && RepeatFrameT::where(['source' => $job_info->id, 'is_delete' => 0])->count() > 0){
$this->json_data['btns'] = '
<button type="button" class="layui-btn" onclick="task_create(2,' . $job_info->id . ')">导出</button>
<button type="button" class="layui-btn layui-btn-danger" onclick="task_create(7,' . $job_info->id . ')">删除重复数据</button>
';
}
return json($this->json_data);
}
public function exportNum(){
$params = $this->request->param();
$where = [];
$map_or1 = [];
$map_or2 = [];
if(isset($params['export_date1']) && $params['export_date1'] != ''){
$where[] = ['car_info_t.register_date', '>=', $params['export_date1']];
}
if(isset($params['export_date2']) && $params['export_date2'] != ''){
$where[] = ['car_info_t.register_date', '<=', $params['export_date2']];
}
if (isset($params['price1']) && $params['price1'] != '') {
$where[] = ['car_info_t.purchase_price', '>=', $params['price1'] * 10000];
}
if (isset($params['price2']) && $params['price2'] != '') {
$where[] = ['car_info_t.purchase_price', '<=', $params['price2'] * 10000];
}
if(isset($params['empty_phone_check']) && $params['empty_phone_check'] == 'yes'){
$where[] = ['car_phone', '<>', ''];
}
if(isset($params['export_field'])){
foreach ($params['export_field'] as $item){
$where[] = [$item, '<>', ''];
}
}
if(isset($params['export_type']) && $params['export_type'] != ''){
if($params['export_type'] == 'bhx'){
$where[] = ['is_export_bhx', '=', 0];
$where[] = ['is_update_bhx', '=', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed', '=', 0];
$where[] = ['is_export_failed_bmc', '=', 0];
}
if($params['export_type'] == 'bmc'){
$where[] = ['is_export_bhx', '>', 0];
$where[] = ['is_update_bhx', '>', 0];
$where[] = ['is_export_bmc', '=', 0];
}
if ($params['export_type'] == 'failed') {
$where[] = ['is_export_bhx', '>', 0];
$where[] = ['is_update_bhx', '<', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed', '=', 0];
}
if ($params['export_type'] == 'failed_bmc') {
$where[] = ['is_export_bhx', '>', 0];
$where[] = ['is_update_bhx', '<', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed_bmc', '=', 0];
}
if ($params['export_type'] == 'none_bmc') {
$where[] = ['is_export_bhx', '=', 0];
$where[] = ['is_update_bhx', '=', 0];
$where[] = ['is_export_bmc', '=', 0];
$where[] = ['is_export_failed', '=', 0];
$where[] = ['is_export_failed_bmc', '=', 0];
$where[] = ['is_export_none_bmc', '=', 0];
}
}
$insurer_month1 = $params['insurer_month1']??'';
$insurer_day1 = $params['insurer_day1']??'';
$insurer_month2 = $params['insurer_month2']??'';
$insurer_day2 = $params['insurer_day2']??'';
if($insurer_month1 != '' && $insurer_day1 == '') {
$map_or1[] = [Db::raw('month(car_info_t.insurer1_date)'), '>=', $insurer_month1];
$map_or2[] = [Db::raw('month(car_info_t.insurer2_date)'), '>=', $insurer_month1];
} else if ($insurer_month1 == '' && $insurer_day1 != '') {
$map_or1[] = [Db::raw('day(car_info_t.insurer1_date)'), '>=', $insurer_day1];
$map_or2[] = [Db::raw('day(car_info_t.insurer2_date)'), '>=', $insurer_day1];
} else if ($insurer_month1 != '' && $insurer_day1 != '') {
$map_or1[] = [Db::raw('DATE_FORMAT(car_info_t.insurer1_date,"%m-%d")'), '>=', substr('0' . $insurer_month1, -2) . '-' . substr('0' . $insurer_day1, -2)];
$map_or2[] = [Db::raw('DATE_FORMAT(car_info_t.insurer2_date,"%m-%d")'), '>=', substr('0' . $insurer_month1, -2) . '-' . substr('0' . $insurer_day1, -2)];
}
if($insurer_month2 != '' && $insurer_day2 == '') {
$map_or1[] = [Db::raw('month(car_info_t.insurer1_date)'), '<=', $insurer_month2];
$map_or2[] = [Db::raw('month(car_info_t.insurer2_date)'), '<=', $insurer_month2];
} else if ($insurer_month2 == '' && $insurer_day2 != '') {
$map_or1[] = [Db::raw('day(car_info_t.insurer1_date)'), '<=', $insurer_day2];
$map_or2[] = [Db::raw('day(car_info_t.insurer2_date)'), '<=', $insurer_day2];
} else if ($insurer_month2 != '' && $insurer_day2 != '') {
$map_or1[] = [Db::raw('DATE_FORMAT(car_info_t.insurer1_date,"%m-%d")'), '<=', substr('0' . $insurer_month2, -2) . '-' . substr('0' . $insurer_day2, -2)];
$map_or2[] = [Db::raw('DATE_FORMAT(car_info_t.insurer2_date,"%m-%d")'), '<=', substr('0' . $insurer_month2, -2) . '-' . substr('0' . $insurer_day2, -2)];
}
if(count($map_or1) > 0){
$map_or1 = array_merge([['car_info_t.insurer1_date', '<>', '']],$map_or1);
}
if(count($map_or2) > 0){
$map_or2 = array_merge([['car_info_t.insurer1_date', '=', ''],['car_info_t.insurer2_date', '<>', '']],$map_or2);
}
$query = CarInfoT::where($where)->where(function ($query) use ($map_or1, $map_or2) {
if (count($map_or1) > 0 && count($map_or2) > 0){
$query->whereOr([$map_or1, $map_or2]);
}
});
$this->json_data['data'] = $query->count();
return json($this->json_data);
}
public function checkIsExistName($name,$type){
if($name == ''){
$this->json_data['code'] = 0;
$this->json_data['msg'] = '文件名为空,请检查';
return json($this->json_data);
}
if($type == 'update'){
$name = basename($name);
$name = str_replace(strrchr($name, '.'), '', $name);
}
$count = $this->model->where('queue', '=', $name)
->whereOr('payload', 'like', '%' . str_replace(['\\', '"'], ['_', ''], json_encode($name)) . '%')
->count();
if ($count > 0) {
$this->json_data['msg'] = $type == 'upload' ? '当前文件已处理,确定继续?' : '当前任务名已存在,是否继续';
}else {
$this->json_data['code'] = 2;
}
return json($this->json_data);
}
private function downloadName(JobsT $job_info){
$job_params = json_decode($job_info->payload,true)['data']['params'];
list(,$ext) = explode('.', $job_info->remark);
$downloadName = $job_params['export_date1'] . '-' . $job_params['export_date2'];
if($job_info->queue != 'default'){
$downloadName = $job_info->queue;
}else if($job_params['export_type'] == 'repeat' && $job_params['export_table'] == 'repeat_frame_t'){
$downloadName = '重复车架' . $downloadName;
} else if($job_params['export_type'] == 'repeat' && $job_params['export_table'] == 'peer_phone_t'){
$downloadName = '重复电话' . $downloadName;
}
$downloadName .= '.' . $ext;
return $downloadName;
}
private function checkUploadTpl($file, $type)
{
$path_info = pathinfo($file);
if ($type == 1 && $path_info['extension'] == 'csv') {
$title = \file\FileSystem::getFileBlockData($file,0,1);
$tpl_title = ['税号', '初登日期', '车主', '证件号', '电话号码', '车架号', '车牌号', '发动机号', '车型', '新车购置价'];
// $tpl_title = ['区域', '购车日期', '客户姓名', '证件号码', '联系方式', '车架号', '车牌号', '发动机号', '品牌型号', '新车购置价', '保险公司', '商业止保日期', '交强止保日期', '被保险人', '被保险人证件号'];
$title = explode(',', trim($title[0]));
if (count(array_diff($tpl_title, $title)) > 0) {
return false;
}
} else if ($type == 5 && $path_info['extension'] == 'xlsx') {
$spreadsheetReader = Excel::loadFile($file);
$sheet = $spreadsheetReader->getSheet(0);
$highestColumn = $sheet->getHighestColumn(); // e.g 'F'
$title = $sheet->rangeToArray("A1:{$highestColumn}1")[0];
$tpl_title = ['车牌号','车主','品牌型号','发动机号','车架号','注册日期','上年承保公司','商业险到期日期','交强险到期日期','被保险人姓名','被保险人证件号'];
if (count(array_diff($tpl_title, $title)) > 0) {
return false;
}
}
return true;
}
}

@ -0,0 +1,17 @@
<?php
// 事件定义文件
return [
'bind' => [
],
'listen' => [
'AppInit' => [],
'HttpRun' => [],
'HttpEnd' => [],
'LogLevel' => [],
'LogWrite' => [],
],
'subscribe' => [
],
];

@ -0,0 +1,41 @@
<?php
declare (strict_types=1);
namespace app\jobs;
use think\facade\Db;
use think\facade\Cache;
use think\queue\Job;
class DelayQueue
{
/**
* The job handler instance.
* @var mixed
*/
protected $instance;
public function fire(Job $job, $data)
{
//执行业务处理
$result = $this->doJob($job, $data);
if ($result['code'] == 1) {
$job->finish(2, $result['msg']);
} else {
$job->finish(3, $result['msg']);
}
}
private function doJob(Job $job, $data)
{
ini_set('memory_limit', '2048M');
$class = $data['controller'];
$method = $data['action'];
$this->instance = app()->make($class);
if ($this->instance) {
return ['code' => 1, 'msg' => $this->instance->{$method}($data['params'], $job->getJobId())];
}
return ['code' => 0, 'msg' => '处理类不存在'];
}
}

@ -0,0 +1,10 @@
<?php
// 全局中间件定义文件
return [
// 全局请求缓存
// \think\middleware\CheckRequestCache::class,
// 多语言加载
// \think\middleware\LoadLangPack::class,
// Session初始化
\think\middleware\SessionInit::class
];

@ -0,0 +1,17 @@
<?php
namespace app\model;
use think\Model;
class CarInfoT extends Model
{
protected $createTime = 'create_timestamp';
protected $updateTime = 'update_timestamp';
public function importLog()
{
return $this->hasOne('ImportLog','id','batch_id');
}
}

@ -0,0 +1,24 @@
<?php
namespace app\model;
use crontab\CronParser;
use think\Model;
/**
* Class CrontabT
* @property string $crontab_str
* @package crontab
*/
class CrontabT extends Model
{
public function getNextRunDate()
{
if (!CronParser::check($this->crontab_str)) {
return ['code' => 0, 'msg' => "格式错误: {$this->crontab_str}"];
}
return CronParser::formatToDate($this->crontab_str, 1)[0];
}
}

@ -0,0 +1,12 @@
<?php
namespace app\model;
use think\Model;
class ExportLogT extends Model
{
}

@ -0,0 +1,10 @@
<?php
namespace app\model;
use think\Model;
class JobsT extends Model
{
//
}

@ -0,0 +1,14 @@
<?php
declare (strict_types = 1);
namespace app\model;
use think\Model;
/**
* @mixin think\Model
*/
class PeerPhoneT extends Model
{
//
}

@ -0,0 +1,14 @@
<?php
declare (strict_types = 1);
namespace app\model;
use think\Model;
/**
* @mixin think\Model
*/
class RepeatFrameT extends Model
{
//
}

@ -0,0 +1,9 @@
<?php
use app\ExceptionHandle;
use app\Request;
// 容器Provider定义文件
return [
'think\Request' => Request::class,
'think\exception\Handle' => ExceptionHandle::class,
];

@ -0,0 +1,9 @@
<?php
use app\AppService;
// 系统服务定义文件
// 服务在完成全局初始化之后执行
return [
AppService::class,
];

@ -0,0 +1,170 @@
{extend name="public/base" /}
{block name="header"}
<style>
.layui-form-label {
width: 100px;
}
.layui-badge {
height: 28px;
line-height: 28px;
font-size: 14px;
}
</style>
{/block}
{block name="body"}
<div class="layui-card">
<div class="layui-card-header"></div>
<div class="layui-card-body layui-form">
<input type="hidden" name="id" value="{$info.id}">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">车牌号</label>
<div class="layui-input-inline">
<input type="text" name="car_no" value="{$info.car_no}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">车架号</label>
<div class="layui-input-inline">
<input type="text" name="car_frame_no" value="{$info.car_frame_no}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">发动机号</label>
<div class="layui-input-inline">
<input type="text" name="engine_no" value="{$info.engine_no}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">厂牌型号</label>
<div class="layui-input-inline">
<input type="text" name="factory_model" value="{$info.factory_model}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">初登日期</label>
<div class="layui-input-inline">
<input type="text" name="register_date" id="register_date" value="{$info.register_date}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">新车购置价</label>
<div class="layui-input-inline">
<input type="text" name="purchase_price" value="{$info.purchase_price}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">车主姓名</label>
<div class="layui-input-inline">
<input type="text" name="car_man" value="{$info.car_man}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">车主证件号</label>
<div class="layui-input-inline">
<input type="text" name="car_number" value="{$info.car_number}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">车主联系方式</label>
<div class="layui-input-inline">
<input type="text" name="car_phone" value="{$info.car_phone}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">上年承保公司</label>
<div class="layui-input-inline">
<input type="text" name="company" value="{$info.company}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">商业止保日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer1_date" id="insurer1_date" value="{$info.insurer1_date}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">交强止保日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer2_date" id="insurer2_date" value="{$info.insurer2_date}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">被保险人</label>
<div class="layui-input-inline">
<input type="text" name="id_man" value="{$info.id_man}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">被保险人证件号</label>
<div class="layui-input-inline">
<input type="text" name="id_number" value="{$info.id_number}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数据状态</label>
<div class="layui-input-block" style="height: 36px; line-height: 36px;">
{if $info.is_export_bhx == 0 && $info.is_update_bhx == 0 && $info.is_export_bmc == 0 &&
$info.is_export_failed == 0 && $info.is_export_none_bmc == 0 && $info.is_export_failed_bmc == 0}
<span class="layui-badge layui-bg-green">未处理</span>
{/if}
{if $info.is_export_bhx > 0 /}
<span class="layui-badge layui-bg-green">导出至清洗</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_update_bhx > 0 /}
<span class="layui-badge layui-bg-green">清洗成功</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_update_bhx < 0 /}
<span class="layui-badge layui-bg-green">清洗失败</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_export_failed > 0 /}
<span class="layui-badge layui-bg-green">导出清洗失败</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_export_failed_bmc > 0 /}
<span class="layui-badge layui-bg-green">导出清洗失败至上传</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_update_bhx > 0 && $info.is_export_bmc > 0 /}
<span class="layui-badge layui-bg-green">导出清洗成功至上传</span>
{/if}
{if $info.is_export_none_bmc > 0 /}
<span class="layui-badge layui-bg-green">导出未处理至上传</span>
{/if}
</div>
</div>
<div class="layui-form-item" style="margin-top: 60px; text-align: center">
<button type="submit" class="layui-btn" lay-submit="" lay-filter="car-info">立即提交</button>
<button type="button" class="layui-btn layui-btn-danger" onclick="location.reload();">重置</button>
<button type="button" class="layui-btn layui-btn-danger" onclick="window.parent.layer.closeAll();">关闭</button>
</div>
</div>
</div>
{/block}
{block name="script"}
<script>
layui.laydate.render({
elem: '#register_date'
});
layui.form.on('submit(car-info)', function(data){
$.post('{:url("index/edit")}',data.field,function(ret){
layer.msg(ret['msg'],function(){
if(ret['code'] == 1){
window.parent.layer.closeAll();
window.parent.layui.table.reload('carInfo');
}
delete ret;
});
});
return false;
});
</script>
{/block}

@ -0,0 +1,170 @@
{extend name="public/base" /}
{block name="header"}
<style>
.layui-form-label {
width: 100px;
}
.layui-badge {
height: 28px;
line-height: 28px;
font-size: 14px;
}
</style>
{/block}
{block name="body"}
<div class="layui-card">
<div class="layui-card-header"></div>
<div class="layui-card-body layui-form">
<input type="hidden" name="id" value="{$info.id}">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">车牌号</label>
<div class="layui-input-inline">
<input type="text" name="car_no" value="{$info.car_no}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">车架号</label>
<div class="layui-input-inline">
<input type="text" name="car_frame_no" value="{$info.car_frame_no}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">发动机号</label>
<div class="layui-input-inline">
<input type="text" name="engine_no" value="{$info.engine_no}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">厂牌型号</label>
<div class="layui-input-inline">
<input type="text" name="factory_model" value="{$info.factory_model}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">初登日期</label>
<div class="layui-input-inline">
<input type="text" name="register_date" id="register_date" value="{$info.register_date}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">新车购置价</label>
<div class="layui-input-inline">
<input type="text" name="purchase_price" value="{$info.purchase_price}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">车主姓名</label>
<div class="layui-input-inline">
<input type="text" name="car_man" value="{$info.car_man}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">车主证件号</label>
<div class="layui-input-inline">
<input type="text" name="car_number" value="{$info.car_number}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">车主联系方式</label>
<div class="layui-input-inline">
<input type="text" name="car_phone" value="{$info.car_phone}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">上年承保公司</label>
<div class="layui-input-inline">
<input type="text" name="company" value="{$info.company}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">商业止保日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer1_date" id="insurer1_date" value="{$info.insurer1_date}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">交强止保日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer2_date" id="insurer2_date" value="{$info.insurer2_date}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">被保险人</label>
<div class="layui-input-inline">
<input type="text" name="id_man" value="{$info.id_man}" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">被保险人证件号</label>
<div class="layui-input-inline">
<input type="text" name="id_number" value="{$info.id_number}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数据状态</label>
<div class="layui-input-block" style="height: 36px; line-height: 36px;">
{if $info.is_export_bhx == 0 && $info.is_update_bhx == 0 && $info.is_export_bmc == 0 &&
$info.is_export_failed == 0 && $info.is_export_none_bmc == 0 && $info.is_export_failed_bmc == 0}
<span class="layui-badge layui-bg-green">未处理</span>
{/if}
{if $info.is_export_bhx > 0 /}
<span class="layui-badge layui-bg-green">导出至清洗</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_update_bhx > 0 /}
<span class="layui-badge layui-bg-green">清洗成功</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_update_bhx == -1 /}
<span class="layui-badge layui-bg-green">清洗失败</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_export_failed > 0 /}
<span class="layui-badge layui-bg-green">导出清洗失败</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_export_failed_bmc > 0 /}
<span class="layui-badge layui-bg-green">导出清洗失败至上传</span>
{/if}
{if $info.is_export_bhx > 0 && $info.is_update_bhx > 0 && $info.is_export_bmc > 0 /}
<span class="layui-badge layui-bg-green">导出清洗成功至上传</span>
{/if}
{if $info.is_export_none_bmc > 0 /}
<span class="layui-badge layui-bg-green">导出未处理至上传</span>
{/if}
</div>
</div>
<div class="layui-form-item" style="margin-top: 60px; text-align: center">
<button type="submit" class="layui-btn" lay-submit="" lay-filter="car-info">立即提交</button>
<button type="button" class="layui-btn layui-btn-danger" onclick="location.reload();">重置</button>
<button type="button" class="layui-btn layui-btn-danger" onclick="window.parent.layer.closeAll();">关闭</button>
</div>
</div>
</div>
{/block}
{block name="script"}
<script>
layui.laydate.render({
elem: '#register_date'
});
layui.form.on('submit(car-info)', function(data){
$.post('{:url("index/edit")}',data.field,function(ret){
layer.msg(ret['msg'],function(){
if(ret['code'] == 1){
window.parent.layer.closeAll();
window.parent.layui.table.reload('carInfo');
}
delete ret;
});
});
return false;
});
</script>
{/block}

@ -0,0 +1,384 @@
{extend name="public/layout" /}
{block name="header"}
<style>
.layui-table-cell {
padding: 0 5px;
}
</style>
{/block}
{block name="body"}
<div class="layui-card">
<div class="layui-card-header layui-card-header-auto layui-form">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">车牌号</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_no" id="car_no" autocomplete="off" class="layui-input"
value="{$params.car_no | default=''}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">车架号</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_frame_no" id="car_frame_no" autocomplete="off"
class="layui-input" value="{$params.car_frame_no | default=''}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">厂牌型号</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="factory_model" id="factory_model" autocomplete="off"
class="layui-input" value="{$params.factory_model | default=''}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">注册日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="register_date" id="register_date" autocomplete="off"
class="layui-input layui-date-elem" value="{$params.register_date | default=''}">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">车主姓名</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_man" id="car_man" autocomplete="off"
class="layui-input" value="{$params.car_man | default=''}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">身份证号</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_number" id="car_number" autocomplete="off"
class="layui-input" value="{$params.car_number | default=''}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">联系电话</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_phone" id="car_phone" autocomplete="off"
class="layui-input" value="{$params.car_phone | default=''}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">导出文件名</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_name" id="export_name" autocomplete="off"
class="layui-input" value="{$params.export_name | default=''}">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline" style="width: 695px;">
<label class="layui-form-label" style="width: 100px;">初登日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="register_date1" id="register-date1" class="layui-input layui-date-elem">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="register_date2" id="register-date2" class="layui-input layui-date-elem">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">保险日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer_month1" class="layui-input" style="display: inline-block; width: 60px;">
<input type="text" name="insurer_day1" class="layui-input" style="display: inline-block; width: 60px;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" name="insurer_month2" class="layui-input" style="display: inline-block; width: 60px;">
<input type="text" name="insurer_day2" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline" style="width: 100%;">
<label class="layui-form-label" style="width: 100px;">数据状态</label>
<div class="layui-input-inline" style="width: 1100px;">
<table class="layui-table">
<tr>
<td colspan="3"><input type="checkbox" name="data_filter[]" value="bhx" title="已导出清洗"></td>
<td colspan="2"><input type="checkbox" name="data_filter[]" value="none" title="未处理"></td>
</tr>
<tr>
<td><input type="checkbox" name="data_filter[]" value="bhx_success" title="已清洗成功"></td>
<td><input type="checkbox" name="data_filter[]" value="bhx_failed" title="已清洗失败"></td>
<td><input type="checkbox" name="data_filter[]" value="bhx_none" title="未处理"></td>
<td><input type="checkbox" name="data_filter[]" value="none_bmc" title="已上传"></td>
<td><input type="checkbox" name="data_filter[]" value="none_none" title="未处理"></td>
</tr>
<tr>
<td><input type="checkbox" name="data_filter[]" value="bhx_success_bmc" title="已上传">
<input type="checkbox" name="data_filter[]" value="bhx_success_none" title="未上传"></td>
<td><input type="checkbox" name="data_filter[]" value="bhx_failed_bmc" title="已上传">
<input type="checkbox" name="data_filter[]" value="bhx_failed_bhx" title="已导出清洗">
<input type="checkbox" name="data_filter[]" value="bhx_failed_none" title="未处理"></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">新车购置价</label>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price1" class="layui-input" style="display: inline-block; width: 60px;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price2" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">电话检测</label>
<div class="layui-input-inline" style="width: 300px">
<input type="radio" class="layui-input" name="car_phone_empty" value="all" title="全部" checked>
<input type="radio" class="layui-input" name="car_phone_empty" value="yes" title="不为空">
<input type="radio" class="layui-input" name="car_phone_empty" value="no" title="空">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">重复数据检测</label>
<div class="layui-input-inline" style="width: 400px;">
<input type="radio" class="layui-input" name="data_check" value="no" title="否" checked>
{if $repeat_frame_count > 0 }
<input type="radio" class="layui-input" name="data_check" value="car_frame_check" title="车架号">
{/if}
{if $peer_phone_count > 0 }
<input type="radio" class="layui-input" name="data_check" value="car_phone_check" title="个人电话">
{/if}
</div>
</div>
<div class="layui-input-block layui-text-right" id="tool-bar">
<button type="button" class="layui-btn" id="search-btn">搜索</button>
<a href="{:url('index/index')}" class="layui-btn" id="reset-btn">重置条件</a>
<button type="button" class="layui-btn layui-btn-danger" id="deletes-btn">批量删除</button>
<button type="button" class="layui-btn layui-btn-danger" id="clear-btn">清空数据</button>
</div>
</div>
</div>
<div class="layui-card-body layui-form">
<table class="layui-hide" id="car-info" lay-filter="car-info"></table>
</div>
</div>
{/block}
{block name="script"}
<!--Core Javascript -->
<script type="text/html" id="table-bar">
<a class="layui-btn layui-btn-xs" lay-event="detail">详情</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/html" id="BmcNameTpl">
{{# if(d.bmc_download_times > 0){ }}
<span style="color: #01AAED;">{{ d.export_bmc_name }}</span>
{{# } else { }}
<span style="color: #ed0e1b;">{{ d.export_bmc_name }}</span>
{{# } }}
</script>
<script type="text/html" id="BhxNameTpl">
{{# if(d.bhx_download_times > 0){ }}
<span style="color: #01AAED;">{{ d.export_bhx_name }}</span>
{{# } else { }}
<span style="color: #ed0e1b;">{{ d.export_bhx_name }}</span>
{{# } }}
</script>
<script>
$(function () {
layui.form.on('checkbox(dataStatus)', function(data){
if(data.elem.checked){
if(data.value == 'is_none_handle'){
$(data.elem).siblings().attr('disabled',true);
}else{
if(data.value == 'is_update_success'){
$(data.elem).siblings('[value="is_update_failed"]').removeAttr('checked').attr('disabled',true);
}
if(data.value == 'is_update_failed'){
$(data.elem).siblings('[value="is_update_success"]').removeAttr('checked').attr('disabled',true);
}
$(data.elem).siblings('[value="is_none_handle"]').attr('disabled',true);
}
}else {
if(data.value == 'is_none_handle'){
$(data.elem).siblings().removeAttr('disabled');
}else{
if(data.value == 'is_update_success'){
$(data.elem).siblings('[value="is_update_failed"]').removeAttr('disabled');
}
if(data.value == 'is_update_failed'){
$(data.elem).siblings('[value="is_update_success"]').removeAttr('disabled');
}
if($(data.elem).siblings(':checked').length == 0){
$(data.elem).siblings('[value="is_none_handle"]').removeAttr('disabled');
}
}
}
});
var tableIns = layui.table.render({
id: 'carInfo',
elem: '#car-info',
title:'车辆信息',
url: '{:url("/index/carInfo/")}', //数据接口
where: getUrlParam('Object'),
page: true, //开启分页
limit: 20,
loading: true,
cols: [[ //表头
// {type: 'checkbox', fixed: 'left'},
{field: 'car_no', title: '车牌号', width: 100, edit: 'text', fixed: 'left'},
{field: 'car_frame_no', title: '车架号', width: 180, edit: 'text'},
{field: 'engine_no', title: '发动机号', width: 100, edit: 'text'},
{field: 'factory_model', title: '厂牌型号', width: 200, edit: 'text'},
{field: 'register_date', title: '注册日期', width: 100, edit: 'text'},
{field: 'car_man', title: '车主', width: 80, edit: 'text'},
{field: 'car_number', title: '车主证件号', width: 160, edit: 'text'},
{field: 'car_phone', title: '车主电话', width: 120, edit: 'text'},
{field: 'purchase_price', title: '新车购置价', width: 100, edit: 'text'},
{field: 'export_bhx_name', title: '导出清洗', width: 140, edit: 'text', templet:'#BhxNameTpl'},
{field: 'export_bmc_name', title: '导出上传', width: 140, edit: 'text', templet:'#BmcNameTpl'},
{fixed: 'right', width: 100, align:'center', toolbar: '#table-bar'}
]],
done: function (res, curr, count) {
if(res.code == -1){
$('#lock-screen').css('display','flex');
}
}
});
//监听行工具事件
layui.table.on('tool(car-info)', function(obj){ //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
var data = obj.data, //获得当前行数据
layEvent = obj.event; //获得 lay-event 对应的值
if(layEvent === 'clear_phone'){
layer.confirm('确定要清楚此项手机吗', function(index){
layer.close(index);
index = layer.load();
$.post('{:url("index/clearPhone")}', {id: data.id}, function (res) {
layer.close(index);
layer.msg(res.msg,function () {
layui.table.reload('carInfo');
});
})
});
} else if(layEvent === 'del'){
layer.confirm('真的删除行么', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('{:url("index/delete")}', {id: data.id}, function (res) {
layer.close(index);
layer.msg(res.msg,function () {
obj.del(); //删除对应行(tr)的DOM结构
});
})
});
} else if(layEvent === 'detail'){
layer.open({
type: 2,
title: '车辆信息--' + data.car_no,
area: ['1100px','600px'],
shade: 0,
maxmin: true,
content: '{:url("index/edit")}?id=' + data.id,
zIndex: layer.zIndex,
success: function(layero){
layer.setTop(layero);
}
});
}
});
//监听单元格编辑
layui.table.on('edit(car-info)', function(obj){
var data = {
id : obj.data.id,
field: obj.field,
value: obj.value
};
if (data.value < 0) {
layer.msg('值不能为负数', {icon: 5});
layer.msg(res.msg,function () {
layui.table.reload('carInfo');
});
return false;
}
$.post('{:url("index/update")}', data, function (res) {
layer.msg(res.msg,function () {
layui.table.reload('carInfo');
});
});
});
var urlParams = getUrlParam('Object');
var jobId = 0;
if(urlParams.is_check_peer_phone > 0){
jobId = urlParams.is_check_peer_phone;
}else if(urlParams.is_check_repeat_frame > 0){
jobId = urlParams.is_check_repeat_frame;
}else if(urlParams.is_export_bhx > 0){
jobId = urlParams.is_export_bhx;
}
if(jobId > 0){
$.get('{:url("task/taskBtn")}?job_id=' + jobId,function(ret){
if(ret.code){
$('#tool-bar').prepend($.trim(ret.btns));
}
});
}
$('.layui-date-elem').each(function (i, d) {
layui.laydate.render({
elem: d,
});
});
$('#search-btn').on('click', function(){
var param = $('.layui-card-header').find(':input').serializeObject();
param['data_filter[]'] = param['data_filter[]']?param['data_filter[]']:'';
//执行重载
tableIns.reload({
page: {
curr: 1 //重新从第 1 页开始
},
where: param,
}, 'data');
});
$('#deletes-btn').on('click', function () {
layer.confirm('真的删除行么', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('{:url("index/deletes/")}', $('.layui-card-header').find(':input').serialize(), function (ret) {
layer.close(index);
layer.msg(ret.msg, function () {
layui.table.reload('carInfo');
});
});
});
});
$('#clear-btn').on('click', function () {
layer.confirm('清空数据将不能恢复,确认清空车辆信息吗?', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('{:url("index/truncate/")}', function (ret) {
layer.close(index);
layer.msg(ret.msg, function () {
layui.table.reload('carInfo');
});
});
});
});
});
function task_create(type,id = 0){
$.post('{:url("task/save")}', {task_type: type,source_id: id}, function (ret) {
layer.msg(ret['msg'],function(){
layui.table.reload('taskInfo');
});
});
}
</script>
{/block}

@ -0,0 +1,365 @@
{extend name="public/layout" /}
{block name="header"}
<style>
.layui-table-cell {
padding: 0 5px;
}
</style>
{/block}
{block name="body"}
<div class="layui-card">
<div class="layui-card-header layui-card-header-auto layui-form">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">车牌号</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_no" id="car_no" autocomplete="off" class="layui-input"
value="{$params.car_no | default=''}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">车架号</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_frame_no" id="car_frame_no" autocomplete="off"
class="layui-input" value="{$params.car_frame_no | default=''}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">厂牌型号</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="factory_model" id="factory_model" autocomplete="off"
class="layui-input" value="{$params.factory_model | default=''}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">注册日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="register_date" id="register_date" autocomplete="off"
class="layui-input layui-date-elem" value="{$params.register_date | default=''}">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">车主姓名</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_man" id="car_man" autocomplete="off"
class="layui-input" value="{$params.car_man | default=''}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">身份证号</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_number" id="car_number" autocomplete="off"
class="layui-input" value="{$params.car_number | default=''}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">联系电话</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_phone" id="car_phone" autocomplete="off"
class="layui-input" value="{$params.car_phone | default=''}">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">新车购置价</label>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price1" class="layui-input" style="display: inline-block; width: 60px;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price2" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline" style="width: 695px;">
<label class="layui-form-label" style="width: 100px;">初登日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="register_date1" id="register-date1" class="layui-input layui-date-elem">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="register_date2" id="register-date2" class="layui-input layui-date-elem">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">商业保险日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer_month1" class="layui-input" style="display: inline-block; width: 60px;">
<input type="text" name="insurer_day1" class="layui-input" style="display: inline-block; width: 60px;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" name="insurer_month2" class="layui-input" style="display: inline-block; width: 60px;">
<input type="text" name="insurer_day2" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline" style="width: 695px;">
<label class="layui-form-label" style="width: 100px;">筛选类型</label>
<div class="layui-input-inline" style="width: 550px;">
<input type="checkbox" name="data_filter[]" value="is_export_bhx" title="已导出清洗">
<input type="checkbox" name="data_filter[]" value="is_update_bhx" title="清洗成功">
<input type="checkbox" name="data_filter[]" value="is_update_faild" title="清洗失败">
<input type="checkbox" name="data_filter[]" value="is_export_bmc" title="已导出上传">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">导出文件名</label>
<div class="layui-input-inline" style="width: 400px;">
<input type="text" name="export_name" id="export_name" autocomplete="off"
class="layui-input" value="{$params.export_name | default=''}">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">电话检测</label>
<div class="layui-input-inline" style="width: 300px">
<input type="radio" class="layui-input" name="car_phone_empty" value="all" title="全部" checked>
<input type="radio" class="layui-input" name="car_phone_empty" value="yes" title="不为空">
<input type="radio" class="layui-input" name="car_phone_empty" value="no" title="空">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">重复数据检测</label>
<div class="layui-input-inline" style="width: 400px;">
<input type="radio" class="layui-input" name="data_check" value="no" title="否" checked>
{if $repeat_frame_count > 0 }
<input type="radio" class="layui-input" name="data_check" value="car_frame_check" title="车架号">
{/if}
{if $peer_phone_count > 0 }
<input type="radio" class="layui-input" name="data_check" value="car_phone_check" title="个人电话">
{/if}
</div>
</div>
<div class="layui-input-block layui-text-right" id="tool-bar">
<button type="button" class="layui-btn" id="search-btn">搜索</button>
<a href="{:url('index/index')}" class="layui-btn" id="reset-btn">重置条件</a>
<button type="button" class="layui-btn layui-btn-danger" id="deletes-btn">批量删除</button>
<button type="button" class="layui-btn layui-btn-danger" id="clear-btn">清空数据</button>
</div>
</div>
</div>
<div class="layui-card-body layui-form">
<table class="layui-hide" id="car-info" lay-filter="car-info"></table>
</div>
</div>
{/block}
{block name="script"}
<!--Core Javascript -->
<script type="text/html" id="table-bar">
<a class="layui-btn layui-btn-xs" lay-event="detail">详情</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/html" id="BmcNameTpl">
{{# if(d.bmc_download_times > 0){ }}
<span style="color: #01AAED;">{{ d.export_bmc_name }}</span>
{{# } else { }}
<span style="color: #ed0e1b;">{{ d.export_bmc_name }}</span>
{{# } }}
</script>
<script type="text/html" id="BhxNameTpl">
{{# if(d.bhx_download_times > 0){ }}
<span style="color: #01AAED;">{{ d.export_bhx_name }}</span>
{{# } else { }}
<span style="color: #ed0e1b;">{{ d.export_bhx_name }}</span>
{{# } }}
</script>
<script>
$(function () {
layui.form.on('checkbox(dataStatus)', function(data){
if(data.elem.checked){
if(data.value == 'is_none_handle'){
$(data.elem).siblings().attr('disabled',true);
}else{
if(data.value == 'is_update_success'){
$(data.elem).siblings('[value="is_update_failed"]').removeAttr('checked').attr('disabled',true);
}
if(data.value == 'is_update_failed'){
$(data.elem).siblings('[value="is_update_success"]').removeAttr('checked').attr('disabled',true);
}
$(data.elem).siblings('[value="is_none_handle"]').attr('disabled',true);
}
}else {
if(data.value == 'is_none_handle'){
$(data.elem).siblings().removeAttr('disabled');
}else{
if(data.value == 'is_update_success'){
$(data.elem).siblings('[value="is_update_failed"]').removeAttr('disabled');
}
if(data.value == 'is_update_failed'){
$(data.elem).siblings('[value="is_update_success"]').removeAttr('disabled');
}
if($(data.elem).siblings(':checked').length == 0){
$(data.elem).siblings('[value="is_none_handle"]').removeAttr('disabled');
}
}
}
});
//转换静态表格
layui.table.render({
id: 'carInfo',
elem: '#car-info',
title:'车辆信息',
url: '{:url("/index/carInfo/")}', //数据接口
where: $.extend($('.layui-card-header').find(':input').serializeObject(),getUrlParam('Object')),
page: true, //开启分页
limit: 20,
loading: true,
cols: [[ //表头
// {type: 'checkbox', fixed: 'left'},
{field: 'car_no', title: '车牌号', width: 100, edit: 'text', fixed: 'left'},
{field: 'car_frame_no', title: '车架号', width: 180, edit: 'text'},
{field: 'engine_no', title: '发动机号', width: 100, edit: 'text'},
{field: 'factory_model', title: '厂牌型号', width: 200, edit: 'text'},
{field: 'register_date', title: '注册日期', width: 100, edit: 'text'},
{field: 'car_man', title: '车主', width: 80, edit: 'text'},
{field: 'car_number', title: '车主证件号', width: 160, edit: 'text'},
{field: 'car_phone', title: '车主电话', width: 120, edit: 'text'},
{field: 'purchase_price', title: '新车购置价', width: 100, edit: 'text'},
{field: 'export_bhx_name', title: '导出清洗', width: 140, edit: 'text', templet:'#BhxNameTpl'},
{field: 'export_bmc_name', title: '导出上传', width: 140, edit: 'text', templet:'#BmcNameTpl'},
{fixed: 'right', width: 100, align:'center', toolbar: '#table-bar'}
]],
done: function (res, curr, count) {
if(res.code == -1){
$('#lock-screen').css('display','flex');
}
}
});
//监听行工具事件
layui.table.on('tool(car-info)', function(obj){ //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
var data = obj.data, //获得当前行数据
layEvent = obj.event; //获得 lay-event 对应的值
if(layEvent === 'clear_phone'){
layer.confirm('确定要清楚此项手机吗', function(index){
layer.close(index);
index = layer.load();
$.post('{:url("index/clearPhone")}', {id: data.id}, function (res) {
layer.close(index);
layer.msg(res.msg,function () {
layui.table.reload('carInfo');
});
})
});
} else if(layEvent === 'del'){
layer.confirm('真的删除行么', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('{:url("index/delete")}', {id: data.id}, function (res) {
layer.close(index);
layer.msg(res.msg,function () {
obj.del(); //删除对应行(tr)的DOM结构
});
})
});
} else if(layEvent === 'detail'){
layer.open({
type: 2,
title: '车辆信息--' + data.car_no,
area: ['1100px','600px'],
shade: 0,
maxmin: true,
content: '{:url("index/edit")}?id=' + data.id,
zIndex: layer.zIndex,
success: function(layero){
layer.setTop(layero);
}
});
}
});
//监听单元格编辑
layui.table.on('edit(car-info)', function(obj){
var data = {
id : obj.data.id,
field: obj.field,
value: obj.value
};
if (data.value < 0) {
layer.msg('值不能为负数', {icon: 5});
layer.msg(res.msg,function () {
layui.table.reload('carInfo');
});
return false;
}
$.post('{:url("index/update")}', data, function (res) {
layer.msg(res.msg,function () {
layui.table.reload('carInfo');
});
});
});
var urlParams = getUrlParam('Object');
var jobId = 0;
if(urlParams.is_check_peer_phone > 0){
jobId = urlParams.is_check_peer_phone;
}else if(urlParams.is_check_repeat_frame > 0){
jobId = urlParams.is_check_repeat_frame;
}else if(urlParams.is_export_bhx > 0){
jobId = urlParams.is_export_bhx;
}
if(jobId > 0){
$.get('{:url("task/taskBtn")}?job_id=' + jobId,function(ret){
if(ret.code){
$('#tool-bar').prepend($.trim(ret.btns));
}
});
}
$('.layui-date-elem').each(function (i, d) {
layui.laydate.render({
elem: d,
});
});
$('#search-btn').on('click', function(){
//执行重载
layui.table.reload('carInfo', {
page: {
curr: 1 //重新从第 1 页开始
},
where: $.extend($('.layui-card-header').find(':input').serializeObject(),getUrlParam('Object'))
}, 'data');
});
$('#deletes-btn').on('click', function () {
layer.confirm('真的删除行么', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('{:url("index/deletes/")}', $('.layui-card-header').find(':input').serialize(), function (ret) {
layer.close(index);
layer.msg(ret.msg, function () {
layui.table.reload('carInfo');
});
});
});
});
$('#clear-btn').on('click', function () {
layer.confirm('清空数据将不能恢复,确认清空车辆信息吗?', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('{:url("index/truncate/")}', function (ret) {
layer.close(index);
layer.msg(ret.msg, function () {
layui.table.reload('carInfo');
});
});
});
});
});
function task_create(type,id = 0){
$.post('{:url("task/save")}', {task_type: type,source_id: id}, function (ret) {
layer.msg(ret['msg'],function(){
layui.table.reload('taskInfo');
});
});
}
</script>
{/block}

@ -0,0 +1,10 @@
{include file="public/header" /}
<!-- Core stylesheets -->
{block name="header"}{/block}
</head>
<body class="layui-layout-body">
{block name="body"}{/block}
{include file="public/script" /}
{block name="script"}{/block}
</body>
</html>

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="none">
<title>粮仓</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
<link rel="stylesheet" href="/static/css/default.css">

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="none">
<title>数据处理</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
<link rel="stylesheet" href="/static/css/default.css">

@ -0,0 +1,38 @@
{include file="public/header" /}
<!-- Core stylesheets -->
{block name="header"}{/block}
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
<div class="layui-header">
<div class="layui-logo">车辆数据处理</div>
<ul class="layui-nav layui-layout-left">
<li class="layui-nav-item"><a href="{:url('index/index')}">数据中心</a></li>
<li class="layui-nav-item"><a href="{:url('task/index')}">任务中心</a></li>
</ul>
</div>
<div class="layui-container-fluid" id="layui-content">
{block name="body"}{/block}
</div>
<div class="layui-footer">
© zcstatham
</div>
</div>
<div id="lock-screen">
<div class="lock-screen">
<div class="layui-form-item">
<label class="layui-form-label">锁屏密码</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="password" name="password" id="password" class="layui-input">
</div>
<div class="layui-input-inline" style="width: auto;">
<button type="button" class="layui-btn" onclick="login(event)">解锁</button>
</div>
</div>
</div>
</div>
{include file="public/script" /}
{block name="script"}{/block}
</body>
</html>

@ -0,0 +1,4 @@
<!--Global Javascript -->
<script src="/static/plugins//layui/layui.all.js"></script>
<script src="/static/plugins/jquery/jquery.min.js"></script>
<script src="/static/js/default.js"></script>

@ -0,0 +1,449 @@
{extend name="public/layout" /}
{block name="header"}
{/block}
{block name="body"}
<div class="layui-card">
<div class="layui-card-header layui-card-header-auto layui-form">
<div id="task-model-add" class="layui-form">
<div class="layui-form-item active">
<label class="layui-form-label" style="width: 140px;">任务类型</label>
<div class="layui-input-block">
<input type="radio" lay-filter="task_type" name="task_type" value="1" title="导入处理" checked>
<input type="radio" lay-filter="task_type" name="task_type" value="2" title="导出处理">
<input type="radio" lay-filter="task_type" name="task_type" value="3" title="重复电话处理">
<input type="radio" lay-filter="task_type" name="task_type" value="4" title="重复车架处理">
<input type="radio" lay-filter="task_type" name="task_type" value="5" title="更新数据">
</div>
</div>
<div class="layui-form-item task-param active" id="task-import">
<label class="layui-form-label" style="width: 140px;">上传文件</label>
<div class="layui-input-inline" style="width: 405px;">
<input type="text" name="original_filename" id="original_filename" class="layui-input" readonly>
<input type="hidden" name="filename" id="filename" autocomplete="off" class="layui-input">
</div>
<div class="layui-input-inline" style="width: 200px;">
<button type="button" class="layui-btn" id="upload">
<i class="layui-icon">&#xe67c;</i>上传CSV文件
</button>
</div>
<a href="/static/tpl.csv" download="车辆信息导入模板.csv" style="color: #009688;">[下载车辆信息导入模板]</a>
</div>
<div class="task-param" id="task-export" style="display: none;">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">初登日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date1" class="layui-input export-date1">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date2" class="layui-input export-date2">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">保险日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer_month1" class="layui-input" style="display: inline-block; width: 60px;">
<input type="text" name="insurer_day1" class="layui-input" style="display: inline-block; width: 60px;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" name="insurer_month2" class="layui-input" style="display: inline-block; width: 60px;">
<input type="text" name="insurer_day2" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">导出类型</label>
<div class="layui-input-inline" style="width: 780px;">
<input type="radio" lay-filter="export_type" name="export_type" value="bhx" class="layui-input" title="导出清洗" checked>
<input type="radio" lay-filter="export_type" name="export_type" value="failed" class="layui-input" title="导出清洗失败">
<input type="radio" lay-filter="export_type" name="export_type" value="bmc" class="layui-input" title="导出清洗成功至上传">
<input type="radio" lay-filter="export_type" name="export_type" value="success_bmc" class="layui-input" title="导出清洗成功">
<!-- <input type="radio" lay-filter="export_type" name="export_type" value="failed_bmc" class="layui-input" title="导出清洗失败至上传">
<input type="radio" lay-filter="export_type" name="export_type" value="none_bmc" class="layui-input" title="导出未处理至上传">
-->
</div>
</div>
<div class="layui-inline" id="sub_export_type">
<label class="layui-form-label" style="width: 100px;">导出字段</label>
<div class="layui-input-inline" style="width: 210px;">
<input type="checkbox" name="export_field[]" lay-filter="export_field" value="car_no" title="车牌号">
<input type="checkbox" name="export_field[]" lay-filter="export_field" value="car_frame_no" title="车架号" checked>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">导出数量</label>
<div class="layui-input-inline">
<input type="text" name="export_limit" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">导出文件名</label>
<div class="layui-input-inline" style="width: 450px;">
<input type="text" name="queue" id="queue-name" class="layui-input" style="display:inline-block; width: 325px;">
<button type="button" class="layui-btn" onclick="getExportName(event)">生成文件名</button>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">导出总计:</label>
<div class="layui-input-inline" style="width: 120px;">
<input type="text" name="num" id="count" class="layui-input" disabled>
</div>
<div class="layui-input-inline">
<button type="button" class="layui-btn" onclick="export_num(event)">获取总数</button>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">新车购置价</label>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price1" class="layui-input" style="display: inline-block; width: 60px;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price2" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">空电话检测</label>
<div class="layui-input-inline" style="width: 80px;">
<input type="checkbox" name="empty_phone_check" lay-skin="switch" lay-filter="empty_phone_check" value="yes" lay-text="开启|关闭" checked>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">是否EXCEL</label>
<div class="layui-input-inline" style="width: 80px;">
<input type="checkbox" name="is_excel" lay-skin="switch" value="yes" lay-text="开启|关闭" checked>
</div>
</div>
</div>
</div>
<div class="task-param" id="task-peer-phone" style="display: none;">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">初登日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date1" class="layui-input export-date1">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date2" class="layui-input export-date2">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">个人电话重复次数</label>
<div class="layui-input-inline">
<input type="number" name="peer_phone_number" required lay-verify="required" class="layui-input">
</div>
</div>
</div>
</div>
<div class="task-param" id="task-repeat_frame" style="display: none;">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">初登日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date1" class="layui-input export-date1">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date2" class="layui-input export-date2">
</div>
</div>
</div>
</div>
</div>
<div class="layui-form-item" style="margin:24px 0 -15px;">
<div class="layui-inline" style="float: left;position: relative;z-index: 999;">
<label class="layui-form-label" style="width: 65px;"></label>
<div class="layui-input-inline" style="width: 405px">
<input type="text" name="queue" id="queue" class="layui-input">
</div>
<div class="layui-input-inline" style="">
<button type="button" class="layui-btn" onclick="search(event)">查询</button>
</div>
</div>
<div class="layui-input-block layui-text-right">
<button type="button" class="layui-btn" onclick="task_add()">立即提交</button>
<button type="button" class="layui-btn layui-btn-danger" id="clear-btn">清空数据</button>
</div>
</div>
</div>
<div class="layui-card-body layui-form">
<table class="layui-hide" id="task-info" lay-filter="task-info"></table>
</div>
</div>
{/block}
{block name="script"}
<!--Core Javascript -->
<script type="text/html" id="table-bar">
{{#
var payload = JSON.parse(d.payload);
var export_date1 = payload['data']['params']['export_date1'];
var export_date2 = payload['data']['params']['export_date2'];
var ext = d.remark.split('.')[1];
}}
{{# if(d.type == 2){ }}
{{# if(payload['data']['params']['export_limit'] > 0){ }}
{{#
var arrParam = [];
var exportUrlParam = '';
exportUrlParam += 'export_date1=' + export_date1 + '&';
exportUrlParam += 'export_date2=' + export_date2 + '&';
exportUrlParam += 'insurer_month1=' + payload['data']['params']['insurer_month1'] + '&';
exportUrlParam += 'insurer_day1=' + payload['data']['params']['insurer_day1'] + '&';
exportUrlParam += 'insurer_month2=' + payload['data']['params']['insurer_month2'] + '&';
exportUrlParam += 'insurer_day2=' + payload['data']['params']['insurer_day2'] + '&';
exportUrlParam += 'is_export_' + payload['data']['params']['export_type'] + '=' + d.id;
}}
<a class="layui-btn layui-btn-xs" href="/index/index.html?{{exportUrlParam}}">查看</a>
{{# } }}
{{# if(d.download_times > 0){ }}
<buton class="layui-btn layui-btn-xs" onclick="layer.confirm('已下载过,是否继续',function(index){layer.close(index);window.open('{:url(\'task/download\')}?id={{d.id}}');window.location.reload();});">下载文件</buton>
{{# }else { }}
<buton class="layui-btn layui-btn-xs" onclick="window.open('{:url(\'task/download\')}?id={{d.id}}');window.location.reload();">下载文件</buton>
{{# } }}
{{# }else if(d.type == 3){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?is_check_peer_phone={{d.id}}">查看</a>
{{# if(d.info_num > 0){ }}
<button type="button" class="layui-btn layui-btn-xs" onclick="task_create(2,{{d.id}})">导出</button>
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" onclick="task_create(6,{{d.id}})">清除重复</button>
{{# } }}
{{# }else if(d.type == 4){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?is_check_repeat_frame={{d.id}}">查看</a>
{{# if(d.info_num > 0){ }}
<button type="button" class="layui-btn layui-btn-xs" onclick="task_create(2,{{d.id}})">导出</button>
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" onclick="task_create(7,{{d.id}})">删除重复</button>
{{# } }}
{{# }else if(d.type == 5){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?is_update_bhx={{d.id}}">查看</a>
{{# }else if(d.type == 7){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?is_delete_frame={{d.id}}">查看</a>
{{# }else if(d.type == 1){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?source={{d.id}}">查看</a>
{{# } }}
</script>
<script type="text/html" id="process-tpl">
<div class="layui-progress layui-progress-big" lay-filter="process-{{d.id}}" lay-showPercent="yes">
<div class="layui-progress-bar layui-bg-green" lay-percent="{{d.process}}%"></div>
</div>
</script>
<script>
layui.form.on('radio(task_type)', function(data){
$('#task-model-add').find('.task-param').removeClass('active').hide();
switch (+data.value) {
case 1:
$('#task-import').addClass('active').show();
break;
case 2:
$('#task-export').addClass('active').show();
break;
case 3:
$('#task-peer-phone').addClass('active').show();
break;
case 4:
$('#task-repeat_frame').addClass('active').show();
break;
case 5:
$('#task-import').addClass('active').show();
break;
}
});
layui.form.on('radio(export_type)', function(data){
if(['bmc','failed_bmc','none_bmc'].indexOf(data.value) != -1){
$('#sub_export_type').hide();
$('#sub_export_type').find(':input').attr('disabled',true);
}else if(data.value == 'success_bmc'){
$('#sub_export_type').hide();
$('#sub_export_type').find(':input').attr('disabled',true);
}else {
$('#sub_export_type').show();
$('#sub_export_type').find(':input').removeAttr('disabled');
}
});
var tableIns = layui.table.render({
id: 'taskInfo',
elem: '#task-info',
title:'车辆信息',
url: '{:url("/task/taskInfo/")}', //数据接口
page: true, //开启分页
limit: 20,
loading: true,
cols: [[ //表头
// {type: 'checkbox', fixed: 'left'},
{field: 'id', title: '序号', fixed: 'left', width: 100},
{field: 'type_txt', title: '任务名称', sort: true, width: 400},
{field: 'process', title: '处理进度', templet: '#process-tpl'},
{field: 'remark', title: '任务结果', sort: true},
{field: 'create_timestamp', title: '创建时间', sort: true, width: 200},
{field: 'status', title: '任务状态', sort: true, width: 100},
{field: 'download_times', title: '下载次数', sort: true, width: 100},
{fixed: 'right', width: 240, align:'center', toolbar: '#table-bar'}
]],
done: function (res, curr, count) {
layui.element.render();
var timer = setInterval(function(){
$.get('{:url("task/process")}', function (ret) {
if(!ret.data || ret.data.length == 0 ){
clearInterval(timer);
delete timer;
}else {
$.each(ret.data,function(i,d){
d.process = d.process > 100 ? 100 : d.process;
layui.element.progress('process-' + d.id, +d.process + '%');
if(d.process >= 100){
layui.table.reload('taskInfo');
}
})
}
});
},3000)
}
});
//监听行工具事件
layui.table.on('tool(task-info)', function(obj){ //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
var data = obj.data, //获得当前行数据
layEvent = obj.event; //获得 lay-event 对应的值
if(layEvent === 'detail'){
layer.confirm('确定要清楚此项手机吗', function(index){
layer.close(index);
index = layer.load();
$.post('{:url("index/clearPhone")}', {id: data.id}, function (res) {
layer.close(index);
layer.msg(res.msg,function () {
layui.table.reload('taskInfo');
});
})
});
}
});
layui.upload.render({
elem: '#upload', //绑定元素
accept: 'file',
url: '{:url("task/upload")}', //上传接口
data: {
task_type: function () {
return $("input[name='task_type']:checked").val();
}
},
done: function (res) {
if (res.code == -1) {
$('#lock-screen').css('display', 'flex');
} else if (res.code == 0) {
layer.alert(res.msg);
} else if (res.code == 1) {
$('#original_filename').val(res.original_filename);
$('#filename').val(res.filename);
return true;
}
},
error: function (res) {
//请求异常回调
layer.alert(res.msg);
}
});
$(function(){
$('.export-date1,.export-date2').each(function (i, d) {
layui.laydate.render({
elem: d,
});
});
$('#clear-btn').on('click', function () {
layer.confirm('清空数据将不能恢复,确认清空附属表吗?', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('{:url("task/clearSubTable/")}', function (ret) {
layer.close(index);
layer.msg(ret.msg, function () {
layui.table.reload('taskInfo');
});
});
});
});
});
function export_num(){
if($('[name="export_date1"]').val() == '' && $('[name="export_date1"]').val() == ''){
layer.msg('请先填写初登日期');
return false;
}
$.post('{:url("task/exportNum")}', $('#task-export').find(':input').serialize(), function (ret) {
layer.msg(ret['msg']);
$('#count').val(ret.data);
});
}
function task_create(type,id = 0){
$.post('{:url("task/save")}', {task_type: type,source_id: id}, function (ret) {
layer.msg(ret['msg'],function(){
layui.table.reload('taskInfo');
});
});
}
function task_add() {
var task_type = $('[name="task_type"]:checked').val();
if (task_type == 5 || task_type == 2) {
var name = task_type == 5 ? $('#original_filename').val() : $('#queue-name').val();
var type = task_type == 5 ? 'update' : 'export';
$.get('{:url("task/checkIsExistName")}?name=' + name + '&type=' + type, function (ret) {
if (ret.code == 1) {
layer.confirm(ret.msg, function (index) {
layer.close(index);
submitForm();
});
}else if (ret.code == 0) {
layer.alert(ret.msg);
}else if (ret.code == 2) {
submitForm();
}
});
}else {
submitForm();
}
}
function submitForm(){
$.post('{:url("task/save")}', $('#task-model-add').find('.active :input').serialize(), function (ret) {
if(ret.code == 0){
layer.alert(ret.msg);
}else {
layer.msg(ret['msg'],function(){
layui.table.reload('taskInfo');
});
}
});
}
function search(event){
tableIns.reload({
page: {
curr: 1 //重新从第 1 页开始
},
where: {queue: $('#queue').val()},
}, 'data');
}
function getExportName(event) {
var target = event.target;
$.get('{:url("task/exportName")}', $('#task-export').find(':input').serialize(), function (ret) {
if(ret.code == 0){
layer.alert(ret.msg);
}else {
$(target).prev('input[name="queue"]').val(ret.name);
}
});
}
</script>
{/block}

@ -0,0 +1,444 @@
{extend name="public/layout" /}
{block name="header"}
{/block}
{block name="body"}
<div class="layui-card">
<div class="layui-card-header layui-card-header-auto layui-form">
<div id="task-model-add" class="layui-form">
<div class="layui-form-item active">
<label class="layui-form-label" style="width: 140px;">任务类型</label>
<div class="layui-input-block">
<input type="radio" lay-filter="task_type" name="task_type" value="1" title="导入处理" checked>
<input type="radio" lay-filter="task_type" name="task_type" value="2" title="导出处理">
<input type="radio" lay-filter="task_type" name="task_type" value="3" title="重复电话处理">
<input type="radio" lay-filter="task_type" name="task_type" value="4" title="重复车架处理">
<input type="radio" lay-filter="task_type" name="task_type" value="5" title="更新数据">
</div>
</div>
<div class="layui-form-item task-param active" id="task-import">
<label class="layui-form-label" style="width: 140px;">上传文件</label>
<div class="layui-input-inline" style="width: 405px;">
<input type="text" name="original_filename" id="original_filename" class="layui-input" readonly>
<input type="hidden" name="filename" id="filename" autocomplete="off" class="layui-input">
</div>
<div class="layui-input-inline" style="width: 200px;">
<button type="button" class="layui-btn" id="upload">
<i class="layui-icon">&#xe67c;</i>上传CSV文件
</button>
</div>
<a href="/static/tpl.csv" download="车辆信息导入模板.csv" style="color: #009688;">[下载车辆信息导入模板]</a>
</div>
<div class="task-param" id="task-export" style="display: none;">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">初登日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date1" class="layui-input export-date1">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date2" class="layui-input export-date2">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">商业保险日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer_month1" class="layui-input" style="display: inline-block; width: 60px;">
<input type="text" name="insurer_day1" class="layui-input" style="display: inline-block; width: 60px;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" name="insurer_month2" class="layui-input" style="display: inline-block; width: 60px;">
<input type="text" name="insurer_day2" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">导出类型</label>
<div class="layui-input-inline" style="width: 780px;">
<input type="radio" lay-filter="export_type" name="export_type" value="bhx" class="layui-input" title="导出清洗" checked>
<input type="radio" lay-filter="export_type" name="export_type" value="failed" class="layui-input" title="导出清洗失败">
<input type="radio" lay-filter="export_type" name="export_type" value="bmc" class="layui-input" title="导出清洗成功至上传">
<input type="radio" lay-filter="export_type" name="export_type" value="failed_bmc" class="layui-input" title="导出清洗失败至上传">
<input type="radio" lay-filter="export_type" name="export_type" value="none_bmc" class="layui-input" title="导出未处理至上传">
</div>
</div>
<div class="layui-inline" id="sub_export_type">
<label class="layui-form-label" style="width: 100px;">导出字段</label>
<div class="layui-input-inline" style="width: 210px;">
<input type="checkbox" name="export_field[]" lay-filter="export_field" value="car_no" title="车牌号" checked>
<input type="checkbox" name="export_field[]" lay-filter="export_field" value="car_frame_no" title="车架号" checked>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">导出数量</label>
<div class="layui-input-inline">
<input type="text" name="export_limit" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">导出文件名</label>
<div class="layui-input-inline" style="width: 450px;">
<input type="text" name="queue" id="queue-name" class="layui-input" style="display:inline-block; width: 325px;">
<button type="button" class="layui-btn" onclick="getExportName(event)">生成文件名</button>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">导出总计:</label>
<div class="layui-input-inline" style="width: 120px;">
<input type="text" name="num" id="count" class="layui-input" disabled>
</div>
<div class="layui-input-inline">
<button type="button" class="layui-btn" onclick="export_num(event)">获取总数</button>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">新车购置价</label>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price1" class="layui-input" style="display: inline-block; width: 60px;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price2" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">空电话检测</label>
<div class="layui-input-inline" style="width: 80px;">
<input type="checkbox" name="empty_phone_check" lay-skin="switch" lay-filter="empty_phone_check" value="yes" lay-text="开启|关闭" checked>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">是否EXCEL</label>
<div class="layui-input-inline" style="width: 80px;">
<input type="checkbox" name="is_excel" lay-skin="switch" value="yes" lay-text="开启|关闭" checked>
</div>
</div>
</div>
</div>
<div class="task-param" id="task-peer-phone" style="display: none;">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">初登日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date1" class="layui-input export-date1">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date2" class="layui-input export-date2">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">个人电话重复次数</label>
<div class="layui-input-inline">
<input type="number" name="peer_phone_number" required lay-verify="required" class="layui-input">
</div>
</div>
</div>
</div>
<div class="task-param" id="task-repeat_frame" style="display: none;">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">初登日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date1" class="layui-input export-date1">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date2" class="layui-input export-date2">
</div>
</div>
</div>
</div>
</div>
<div class="layui-form-item" style="margin:24px 0 -15px;">
<div class="layui-inline" style="float: left;position: relative;z-index: 999;">
<label class="layui-form-label" style="width: 65px;"></label>
<div class="layui-input-inline" style="width: 405px">
<input type="text" name="queue" id="queue" class="layui-input">
</div>
<div class="layui-input-inline" style="">
<button type="button" class="layui-btn" onclick="search(event)">查询</button>
</div>
</div>
<div class="layui-input-block layui-text-right">
<button type="button" class="layui-btn" onclick="task_add()">立即提交</button>
<button type="button" class="layui-btn layui-btn-danger" id="clear-btn">清空数据</button>
</div>
</div>
</div>
<div class="layui-card-body layui-form">
<table class="layui-hide" id="task-info" lay-filter="task-info"></table>
</div>
</div>
{/block}
{block name="script"}
<!--Core Javascript -->
<script type="text/html" id="table-bar">
{{#
var payload = JSON.parse(d.payload);
var export_date1 = payload['data']['params']['export_date1'];
var export_date2 = payload['data']['params']['export_date2'];
var ext = d.remark.split('.')[1];
}}
{{# if(d.type == 2){ }}
{{# if(payload['data']['params']['export_limit'] > 0){ }}
{{#
var arrParam = [];
var exportUrlParam = '';
exportUrlParam += 'export_date1=' + export_date1 + '&';
exportUrlParam += 'export_date2=' + export_date2 + '&';
exportUrlParam += 'insurer_month1=' + payload['data']['params']['insurer_month1'] + '&';
exportUrlParam += 'insurer_day1=' + payload['data']['params']['insurer_day1'] + '&';
exportUrlParam += 'insurer_month2=' + payload['data']['params']['insurer_month2'] + '&';
exportUrlParam += 'insurer_day2=' + payload['data']['params']['insurer_day2'] + '&';
exportUrlParam += 'is_export_' + payload['data']['params']['export_type'] + '=' + d.id;
}}
<a class="layui-btn layui-btn-xs" href="/index/index.html?{{exportUrlParam}}">查看</a>
{{# } }}
{{# if(d.download_times > 0){ }}
<buton class="layui-btn layui-btn-xs" onclick="layer.confirm('已下载过,是否继续',function(index){layer.close(index);window.open('{:url(\'task/download\')}?id={{d.id}}');window.location.reload();});">下载文件</buton>
{{# }else { }}
<buton class="layui-btn layui-btn-xs" onclick="window.open('{:url(\'task/download\')}?id={{d.id}}');window.location.reload();">下载文件</buton>
{{# } }}
{{# }else if(d.type == 3){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?is_check_peer_phone={{d.id}}">查看</a>
{{# if(d.info_num > 0){ }}
<button type="button" class="layui-btn layui-btn-xs" onclick="task_create(2,{{d.id}})">导出</button>
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" onclick="task_create(6,{{d.id}})">清除重复</button>
{{# } }}
{{# }else if(d.type == 4){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?is_check_repeat_frame={{d.id}}">查看</a>
{{# if(d.info_num > 0){ }}
<button type="button" class="layui-btn layui-btn-xs" onclick="task_create(2,{{d.id}})">导出</button>
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" onclick="task_create(7,{{d.id}})">删除重复</button>
{{# } }}
{{# }else if(d.type == 5){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?is_update_bhx={{d.id}}">查看</a>
{{# }else if(d.type == 7){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?is_delete_frame={{d.id}}">查看</a>
{{# }else if(d.type == 1){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?source={{d.id}}">查看</a>
{{# } }}
</script>
<script type="text/html" id="process-tpl">
<div class="layui-progress layui-progress-big" lay-filter="process-{{d.id}}" lay-showPercent="yes">
<div class="layui-progress-bar layui-bg-green" lay-percent="{{d.process}}%"></div>
</div>
</script>
<script>
layui.form.on('radio(task_type)', function(data){
$('#task-model-add').find('.task-param').removeClass('active').hide();
switch (+data.value) {
case 1:
$('#task-import').addClass('active').show();
break;
case 2:
$('#task-export').addClass('active').show();
break;
case 3:
$('#task-peer-phone').addClass('active').show();
break;
case 4:
$('#task-repeat_frame').addClass('active').show();
break;
case 5:
$('#task-import').addClass('active').show();
break;
}
});
layui.form.on('radio(export_type)', function(data){
if(['bmc','failed_bmc','none_bmc'].indexOf(data.value) != -1){
$('#sub_export_type').hide();
$('#sub_export_type').find(':input').attr('disabled',true);
}else {
$('#sub_export_type').show();
$('#sub_export_type').find(':input').removeAttr('disabled');
}
});
var tableIns = layui.table.render({
id: 'taskInfo',
elem: '#task-info',
title:'车辆信息',
url: '{:url("/task/taskInfo/")}', //数据接口
page: true, //开启分页
limit: 20,
loading: true,
cols: [[ //表头
// {type: 'checkbox', fixed: 'left'},
{field: 'id', title: '序号', fixed: 'left', width: 100},
{field: 'type_txt', title: '任务名称', sort: true, width: 400},
{field: 'process', title: '处理进度', templet: '#process-tpl'},
{field: 'remark', title: '任务结果', sort: true},
{field: 'create_timestamp', title: '创建时间', sort: true, width: 200},
{field: 'status', title: '任务状态', sort: true, width: 100},
{field: 'download_times', title: '下载次数', sort: true, width: 100},
{fixed: 'right', width: 240, align:'center', toolbar: '#table-bar'}
]],
done: function (res, curr, count) {
layui.element.render();
var timer = setInterval(function(){
$.get('{:url("task/process")}', function (ret) {
if(!ret.data || ret.data.length == 0 ){
clearInterval(timer);
delete timer;
}else {
$.each(ret.data,function(i,d){
d.process = d.process > 100 ? 100 : d.process;
layui.element.progress('process-' + d.id, +d.process + '%');
if(d.process >= 100){
layui.table.reload('taskInfo');
}
})
}
});
},3000)
}
});
//监听行工具事件
layui.table.on('tool(task-info)', function(obj){ //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
var data = obj.data, //获得当前行数据
layEvent = obj.event; //获得 lay-event 对应的值
if(layEvent === 'detail'){
layer.confirm('确定要清楚此项手机吗', function(index){
layer.close(index);
index = layer.load();
$.post('{:url("index/clearPhone")}', {id: data.id}, function (res) {
layer.close(index);
layer.msg(res.msg,function () {
layui.table.reload('taskInfo');
});
})
});
}
});
layui.upload.render({
elem: '#upload', //绑定元素
accept: 'file',
url: '{:url("task/upload")}', //上传接口
data: {
task_type: function () {
return $("input[name='task_type']:checked").val();
}
},
done: function (res) {
if (res.code == -1) {
$('#lock-screen').css('display', 'flex');
} else if (res.code == 0) {
layer.alert(res.msg);
} else if (res.code == 1) {
$('#original_filename').val(res.original_filename);
$('#filename').val(res.filename);
return true;
}
},
error: function (res) {
//请求异常回调
layer.alert(res.msg);
}
});
$(function(){
$('.export-date1,.export-date2').each(function (i, d) {
layui.laydate.render({
elem: d,
});
});
$('#clear-btn').on('click', function () {
layer.confirm('清空数据将不能恢复,确认清空附属表吗?', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('{:url("task/clearSubTable/")}', function (ret) {
layer.close(index);
layer.msg(ret.msg, function () {
layui.table.reload('taskInfo');
});
});
});
});
});
function export_num(){
if($('[name="export_date1"]').val() == '' && $('[name="export_date1"]').val() == ''){
layer.msg('请先填写初登日期');
return false;
}
$.post('{:url("task/exportNum")}', $('#task-export').find(':input').serialize(), function (ret) {
layer.msg(ret['msg']);
$('#count').val(ret.data);
});
}
function task_create(type,id = 0){
$.post('{:url("task/save")}', {task_type: type,source_id: id}, function (ret) {
layer.msg(ret['msg'],function(){
layui.table.reload('taskInfo');
});
});
}
function task_add() {
var task_type = $('[name="task_type"]:checked').val();
if (task_type == 5 || task_type == 2) {
var name = task_type == 5 ? $('#original_filename').val() : $('#queue-name').val();
var type = task_type == 5 ? 'update' : 'export';
$.get('{:url("task/checkIsExistName")}?name=' + name + '&type=' + type, function (ret) {
if (ret.code == 1) {
layer.confirm(ret.msg, function (index) {
layer.close(index);
submitForm();
});
}else if (ret.code == 0) {
layer.alert(ret.msg);
}else if (ret.code == 2) {
submitForm();
}
});
}else {
submitForm();
}
}
function submitForm(){
$.post('{:url("task/save")}', $('#task-model-add').find('.active :input').serialize(), function (ret) {
if(ret.code == 0){
layer.alert(ret.msg);
}else {
layer.msg(ret['msg'],function(){
layui.table.reload('taskInfo');
});
}
});
}
function search(event){
tableIns.reload({
page: {
curr: 1 //重新从第 1 页开始
},
where: {queue: $('#queue').val()},
}, 'data');
}
function getExportName(event) {
var target = event.target;
$.get('{:url("task/exportName")}', $('#task-export').find(':input').serialize(), function (ret) {
if(ret.code == 0){
layer.alert(ret.msg);
}else {
$(target).prev('input[name="queue"]').val(ret.name);
}
});
}
</script>
{/block}

@ -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'],
],
// 其他更多的模块定义
];

@ -0,0 +1,54 @@
{
"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"
},
{
"name": "yunwuxin",
"email": "448901948@qq.com"
}
],
"require": {
"php": ">=7.1.0",
"topthink/framework": "^6.0.0",
"topthink/think-orm": "^2.0",
"topthink/think-multi-app": "^1.0",
"topthink/think-template": "^2.0",
"topthink/think-view": "^1.0",
"topthink/think-queue": "^3.0",
"nuovo/spreadsheet-reader": "^0.5.11",
"phpoffice/phpspreadsheet": "^1.10"
},
"require-dev": {
"symfony/var-dumper": "^4.2",
"topthink/think-trace":"^1.0"
},
"autoload": {
"psr-4": {
"app\\": "app"
},
"psr-0": {
"": "extend/"
}
},
"config": {
"preferred-install": "dist"
},
"scripts": {
"post-autoload-dump": [
"@php think service:discover",
"@php think vendor:publish"
]
}
}

1557
composer.lock generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | 应用设置
// +----------------------------------------------------------------------
return [
// 应用地址
'app_host' => env('app.host', ''),
// 应用的命名空间
'app_namespace' => '',
// 是否启用路由
'with_route' => true,
// 是否启用事件
'with_event' => true,
// 默认应用
'default_app' => 'index',
// 默认时区
'default_timezone' => 'Asia/Shanghai',
// 应用映射(自动多应用模式有效)
'app_map' => [],
// 域名绑定(自动多应用模式有效)
'domain_bind' => [],
// 禁止URL访问的应用列表(自动多应用模式有效)
'deny_app_list' => [],
// 异常页面的模板文件
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
// 错误显示信息,非调试模式有效
'error_message' => '页面错误!请稍后再试~',
// 显示错误信息
'show_error_msg' => false,
];

@ -0,0 +1,29 @@
<?php
// +----------------------------------------------------------------------
// | 缓存设置
// +----------------------------------------------------------------------
return [
// 默认缓存驱动
'default' => env('cache.driver', 'file'),
// 缓存连接方式配置
'stores' => [
'file' => [
// 驱动方式
'type' => 'File',
// 缓存保存目录
'path' => '',
// 缓存前缀
'prefix' => '',
// 缓存有效期 0表示永久缓存
'expire' => 0,
// 缓存标签前缀
'tag_prefix' => 'tag:',
// 序列化机制 例如 ['serialize', 'unserialize']
'serialize' => [],
],
// 更多的缓存连接
],
];

@ -0,0 +1,11 @@
<?php
// +----------------------------------------------------------------------
// | 控制台配置
// +----------------------------------------------------------------------
return [
// 指令定义
'commands' => [
'crontab' => 'app\command\Crontab',
'hello' => 'app\command\Hello',
],
];

@ -0,0 +1,18 @@
<?php
// +----------------------------------------------------------------------
// | Cookie设置
// +----------------------------------------------------------------------
return [
// cookie 保存时间
'expire' => 0,
// cookie 保存路径
'path' => '/',
// cookie 有效域名
'domain' => '',
// cookie 启用安全传输
'secure' => false,
// httponly设置
'httponly' => false,
// 是否使用 setcookie
'setcookie' => true,
];

@ -0,0 +1,62 @@
<?php
return [
// 默认使用的数据库连接配置
'default' => env('database.driver', 'mysql'),
// 自定义时间查询规则
'time_query_rule' => [],
// 自动写入时间戳字段
// true为自动识别类型 false关闭
// 字符串则明确指定时间字段类型 支持 int timestamp datetime date
'auto_timestamp' => true,
// 时间字段取出后的默认时间格式
'datetime_format' => 'Y-m-d H:i:s',
// 数据库连接配置信息
'connections' => [
'mysql' => [
// 数据库类型
'type' => env('database.type', 'mysql'),
// 服务器地址
'hostname' => env('database.hostname', '127.0.0.1'),
// 数据库名
'database' => env('database.database', ''),
// 用户名
'username' => env('database.username', 'root'),
// 密码
'password' => env('database.password', ''),
// 端口
'hostport' => env('database.hostport', '3306'),
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => env('database.charset', 'utf8'),
// 数据库表前缀
'prefix' => env('database.prefix', ''),
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 是否严格检查字段是否存在
'fields_strict' => true,
// 是否需要断线重连
'break_reconnect' => false,
// 监听SQL
'trigger_sql' => env('app_debug', true),
// 开启字段缓存
'fields_cache' => false,
// 字段缓存路径
'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
],
// 更多的数据库配置信息
],
];

@ -0,0 +1,24 @@
<?php
return [
// 默认磁盘
'default' => env('filesystem.driver', 'local'),
// 磁盘列表
'disks' => [
'local' => [
'type' => 'local',
'root' => app()->getRuntimePath() . 'storage',
],
'public' => [
// 磁盘类型
'type' => 'local',
// 磁盘路径
'root' => app()->getRootPath() . 'public/storage',
// 磁盘路径对应的外部URL路径
'url' => '/storage',
// 可见性
'visibility' => 'public',
],
// 更多的磁盘配置信息
],
];

@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | 多语言设置
// +----------------------------------------------------------------------
return [
// 默认语言
'default_lang' => env('lang.default_lang', 'zh-cn'),
// 允许的语言列表
'allow_lang_list' => [],
// 多语言自动侦测变量名
'detect_var' => 'lang',
// 是否使用Cookie记录
'use_cookie' => true,
// 多语言cookie变量
'cookie_var' => 'think_lang',
// 扩展语言包
'extend_list' => [],
// Accept-Language转义为对应语言包名称
'accept_language' => [
'zh-hans-cn' => 'zh-cn',
],
// 是否支持语言分组
'allow_group' => false,
];

@ -0,0 +1,45 @@
<?php
// +----------------------------------------------------------------------
// | 日志设置
// +----------------------------------------------------------------------
return [
// 默认日志记录通道
'default' => env('log.channel', 'file'),
// 日志记录级别
'level' => [],
// 日志类型记录的通道 ['error'=>'email',...]
'type_channel' => [],
// 关闭全局日志写入
'close' => false,
// 全局日志处理 支持闭包
'processor' => null,
// 日志通道列表
'channels' => [
'file' => [
// 日志记录方式
'type' => 'File',
// 日志保存目录
'path' => '',
// 单文件日志写入
'single' => false,
// 独立日志级别
'apart_level' => [],
// 最大日志文件数量
'max_files' => env('log.max_files', 0),
// 使用JSON格式记录
'json' => false,
// 日志处理
'processor' => null,
// 关闭通道日志写入
'close' => false,
// 日志输出格式化
'format' => '[%s][%s] %s',
// 是否实时写入
'realtime_write' => false,
],
// 其它日志通道配置
],
];

@ -0,0 +1,8 @@
<?php
// 中间件配置
return [
// 别名或分组
'alias' => [],
// 优先级设置,此数组中的中间件会按照数组中的顺序优先执行
'priority' => [],
];

@ -0,0 +1,21 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | 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 [
'default' => 'database',
'connections' => [
'database' => [
'type' => 'database',
'queue' => 'default',
'table' => 'jobs_t',
],
],
];

@ -0,0 +1,45 @@
<?php
// +----------------------------------------------------------------------
// | 路由设置
// +----------------------------------------------------------------------
return [
// pathinfo分隔符
'pathinfo_depr' => '/',
// URL伪静态后缀
'url_html_suffix' => 'html',
// URL普通方式参数 用于自动生成
'url_common_param' => true,
// 是否开启路由延迟解析
'url_lazy_route' => false,
// 是否强制使用路由
'url_route_must' => false,
// 合并路由规则
'route_rule_merge' => false,
// 路由是否完全匹配
'route_complete_match' => false,
// 访问控制器层名称
'controller_layer' => 'controller',
// 空控制器名
'empty_controller' => 'Error',
// 是否使用控制器后缀
'controller_suffix' => false,
// 默认的路由变量规则
'default_route_pattern' => '[\w\.]+',
// 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
'request_cache' => false,
// 请求缓存有效期
'request_cache_expire' => null,
// 全局请求缓存排除规则
'request_cache_except' => [],
// 默认控制器名
'default_controller' => 'Index',
// 默认操作名
'default_action' => 'index',
// 操作方法后缀
'action_suffix' => '',
// 默认JSONP格式返回的处理方法
'default_jsonp_handler' => 'jsonpReturn',
// 默认JSONP处理方法
'var_jsonp_handler' => 'callback',
];

@ -0,0 +1,19 @@
<?php
// +----------------------------------------------------------------------
// | 会话设置
// +----------------------------------------------------------------------
return [
// session name
'name' => 'PHPSESSID',
// SESSION_ID的提交变量,解决flash上传跨域
'var_session_id' => '',
// 驱动方式 支持file cache
'type' => 'file',
// 存储连接标识 当type使用cache的时候有效
'store' => null,
// 过期时间
'expire' => 1440,
// 前缀
'prefix' => '',
];

@ -0,0 +1,35 @@
<?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' => 'Think',
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
'auto_rule' => 1,
// 模板路径
'view_path' => '',
// 模板后缀
'view_suffix' => 'html',
// 模板文件名分隔符
'view_depr' => DIRECTORY_SEPARATOR,
// 模板引擎普通标签开始标记
'tpl_begin' => '{',
// 模板引擎普通标签结束标记
'tpl_end' => '}',
// 标签库标签开始标记
'taglib_begin' => '{',
// 标签库标签结束标记
'taglib_end' => '}',
];

@ -0,0 +1,10 @@
<?php
// +----------------------------------------------------------------------
// | Trace设置 开启调试模式后有效
// +----------------------------------------------------------------------
return [
// 内置Html和Console两种方式 支持扩展
'type' => 'Html',
// 读取的日志通道名
'channel' => '',
];

@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------
// | 模板设置
// +----------------------------------------------------------------------
return [
// 模板引擎类型使用Think
'type' => 'Think',
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
'auto_rule' => 1,
// 模板目录名
'view_dir_name' => 'view',
// 模板后缀
'view_suffix' => 'html',
// 模板文件名分隔符
'view_depr' => DIRECTORY_SEPARATOR,
// 模板引擎普通标签开始标记
'tpl_begin' => '{',
// 模板引擎普通标签结束标记
'tpl_end' => '}',
// 标签库标签开始标记
'taglib_begin' => '{',
// 标签库标签结束标记
'taglib_end' => '}',
];

2
extend/.gitignore vendored

@ -0,0 +1,2 @@
*
!.gitignore

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,24 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// [ 应用入口文件 ]
namespace think;
require __DIR__ . '/../vendor/autoload.php';
// 执行HTTP应用并响应
$http = (new App())->http;
$response = $http->run();
$response->send();
$http->end($response);

@ -0,0 +1,2 @@
User-agent: *
Disallow:

@ -0,0 +1,19 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// $Id$
if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) {
return false;
} else {
$_SERVER["SCRIPT_FILENAME"] = __DIR__ . '/index.php';
require __DIR__ . "/index.php";
}

@ -0,0 +1,2 @@
*
!.gitignore

@ -0,0 +1,17 @@
<?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>
// +----------------------------------------------------------------------
use think\facade\Route;
Route::get('think', function () {
return 'hello,ThinkPHP6!';
});
Route::get('hello/:name', 'index/hello');

@ -0,0 +1,21 @@
<?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>
// +----------------------------------------------------------------------
use think\facade\Route;
Route::get('think', function () {
return 'hello,ThinkPHP5!';
});
Route::get('hello/:name', 'index/hello');
return [
];

@ -0,0 +1 @@
a:2:{s:10:"login_time";i:1613982663;s:11:"last_action";i:1613982691;}

@ -0,0 +1,433 @@
<?php /*a:4:{s:52:"D:\htdocs_new\excel-handle\app\view\index\index.html";i:1613834390;s:54:"D:\htdocs_new\excel-handle\app\view\public\layout.html";i:1582189092;s:54:"D:\htdocs_new\excel-handle\app\view\public\header.html";i:1583504952;s:54:"D:\htdocs_new\excel-handle\app\view\public\script.html";i:1581330838;}*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="none">
<title>粮仓</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
<link rel="stylesheet" href="/static/css/default.css">
<!-- Core stylesheets -->
<style>
.layui-table-cell {
padding: 0 5px;
}
</style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
<div class="layui-header">
<div class="layui-logo">车辆数据处理</div>
<ul class="layui-nav layui-layout-left">
<li class="layui-nav-item"><a href="<?php echo url('index/index'); ?>">数据中心</a></li>
<li class="layui-nav-item"><a href="<?php echo url('task/index'); ?>">任务中心</a></li>
</ul>
</div>
<div class="layui-container-fluid" id="layui-content">
<div class="layui-card">
<div class="layui-card-header layui-card-header-auto layui-form">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">车牌号</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_no" id="car_no" autocomplete="off" class="layui-input"
value="<?php echo htmlentities((isset($params['car_no']) && ($params['car_no'] !== '')?$params['car_no']:'')); ?>">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">车架号</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_frame_no" id="car_frame_no" autocomplete="off"
class="layui-input" value="<?php echo htmlentities((isset($params['car_frame_no']) && ($params['car_frame_no'] !== '')?$params['car_frame_no']:'')); ?>">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">厂牌型号</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="factory_model" id="factory_model" autocomplete="off"
class="layui-input" value="<?php echo htmlentities((isset($params['factory_model']) && ($params['factory_model'] !== '')?$params['factory_model']:'')); ?>">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">注册日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="register_date" id="register_date" autocomplete="off"
class="layui-input layui-date-elem" value="<?php echo htmlentities((isset($params['register_date']) && ($params['register_date'] !== '')?$params['register_date']:'')); ?>">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">车主姓名</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_man" id="car_man" autocomplete="off"
class="layui-input" value="<?php echo htmlentities((isset($params['car_man']) && ($params['car_man'] !== '')?$params['car_man']:'')); ?>">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">身份证号</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_number" id="car_number" autocomplete="off"
class="layui-input" value="<?php echo htmlentities((isset($params['car_number']) && ($params['car_number'] !== '')?$params['car_number']:'')); ?>">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">联系电话</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="car_phone" id="car_phone" autocomplete="off"
class="layui-input" value="<?php echo htmlentities((isset($params['car_phone']) && ($params['car_phone'] !== '')?$params['car_phone']:'')); ?>">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">导出文件名</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_name" id="export_name" autocomplete="off"
class="layui-input" value="<?php echo htmlentities((isset($params['export_name']) && ($params['export_name'] !== '')?$params['export_name']:'')); ?>">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline" style="width: 695px;">
<label class="layui-form-label" style="width: 100px;">初登日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="register_date1" id="register-date1" class="layui-input layui-date-elem">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="register_date2" id="register-date2" class="layui-input layui-date-elem">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">保险日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer_month1" class="layui-input" style="display: inline-block; width: 60px;">
<input type="text" name="insurer_day1" class="layui-input" style="display: inline-block; width: 60px;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" name="insurer_month2" class="layui-input" style="display: inline-block; width: 60px;">
<input type="text" name="insurer_day2" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline" style="width: 100%;">
<label class="layui-form-label" style="width: 100px;">数据状态</label>
<div class="layui-input-inline" style="width: 1100px;">
<table class="layui-table">
<tr>
<td colspan="3"><input type="checkbox" name="data_filter[]" value="bhx" title="已导出清洗"></td>
<td colspan="2"><input type="checkbox" name="data_filter[]" value="none" title="未处理"></td>
</tr>
<tr>
<td><input type="checkbox" name="data_filter[]" value="bhx_success" title="已清洗成功"></td>
<td><input type="checkbox" name="data_filter[]" value="bhx_failed" title="已清洗失败"></td>
<td><input type="checkbox" name="data_filter[]" value="bhx_none" title="未处理"></td>
<td><input type="checkbox" name="data_filter[]" value="none_bmc" title="已上传"></td>
<td><input type="checkbox" name="data_filter[]" value="none_none" title="未处理"></td>
</tr>
<tr>
<td><input type="checkbox" name="data_filter[]" value="bhx_success_bmc" title="已上传">
<input type="checkbox" name="data_filter[]" value="bhx_success_none" title="未上传"></td>
<td><input type="checkbox" name="data_filter[]" value="bhx_failed_bmc" title="已上传">
<input type="checkbox" name="data_filter[]" value="bhx_failed_bhx" title="已导出清洗">
<input type="checkbox" name="data_filter[]" value="bhx_failed_none" title="未处理"></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">新车购置价</label>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price1" class="layui-input" style="display: inline-block; width: 60px;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price2" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">电话检测</label>
<div class="layui-input-inline" style="width: 300px">
<input type="radio" class="layui-input" name="car_phone_empty" value="all" title="全部" checked>
<input type="radio" class="layui-input" name="car_phone_empty" value="yes" title="不为空">
<input type="radio" class="layui-input" name="car_phone_empty" value="no" title="空">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">重复数据检测</label>
<div class="layui-input-inline" style="width: 400px;">
<input type="radio" class="layui-input" name="data_check" value="no" title="否" checked>
<?php if($repeat_frame_count > 0): ?>
<input type="radio" class="layui-input" name="data_check" value="car_frame_check" title="车架号">
<?php endif; if($peer_phone_count > 0): ?>
<input type="radio" class="layui-input" name="data_check" value="car_phone_check" title="个人电话">
<?php endif; ?>
</div>
</div>
<div class="layui-input-block layui-text-right" id="tool-bar">
<button type="button" class="layui-btn" id="search-btn">搜索</button>
<a href="<?php echo url('index/index'); ?>" class="layui-btn" id="reset-btn">重置条件</a>
<button type="button" class="layui-btn layui-btn-danger" id="deletes-btn">批量删除</button>
<button type="button" class="layui-btn layui-btn-danger" id="clear-btn">清空数据</button>
</div>
</div>
</div>
<div class="layui-card-body layui-form">
<table class="layui-hide" id="car-info" lay-filter="car-info"></table>
</div>
</div>
</div>
<div class="layui-footer">
© zcstatham
</div>
</div>
<div id="lock-screen">
<div class="lock-screen">
<div class="layui-form-item">
<label class="layui-form-label">锁屏密码</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="password" name="password" id="password" class="layui-input">
</div>
<div class="layui-input-inline" style="width: auto;">
<button type="button" class="layui-btn" onclick="login(event)">解锁</button>
</div>
</div>
</div>
</div>
<!--Global Javascript -->
<script src="/static/plugins//layui/layui.all.js"></script>
<script src="/static/plugins/jquery/jquery.min.js"></script>
<script src="/static/js/default.js"></script>
<!--Core Javascript -->
<script type="text/html" id="table-bar">
<a class="layui-btn layui-btn-xs" lay-event="detail">详情</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/html" id="BmcNameTpl">
{{# if(d.bmc_download_times > 0){ }}
<span style="color: #01AAED;">{{ d.export_bmc_name }}</span>
{{# } else { }}
<span style="color: #ed0e1b;">{{ d.export_bmc_name }}</span>
{{# } }}
</script>
<script type="text/html" id="BhxNameTpl">
{{# if(d.bhx_download_times > 0){ }}
<span style="color: #01AAED;">{{ d.export_bhx_name }}</span>
{{# } else { }}
<span style="color: #ed0e1b;">{{ d.export_bhx_name }}</span>
{{# } }}
</script>
<script>
$(function () {
layui.form.on('checkbox(dataStatus)', function(data){
if(data.elem.checked){
if(data.value == 'is_none_handle'){
$(data.elem).siblings().attr('disabled',true);
}else{
if(data.value == 'is_update_success'){
$(data.elem).siblings('[value="is_update_failed"]').removeAttr('checked').attr('disabled',true);
}
if(data.value == 'is_update_failed'){
$(data.elem).siblings('[value="is_update_success"]').removeAttr('checked').attr('disabled',true);
}
$(data.elem).siblings('[value="is_none_handle"]').attr('disabled',true);
}
}else {
if(data.value == 'is_none_handle'){
$(data.elem).siblings().removeAttr('disabled');
}else{
if(data.value == 'is_update_success'){
$(data.elem).siblings('[value="is_update_failed"]').removeAttr('disabled');
}
if(data.value == 'is_update_failed'){
$(data.elem).siblings('[value="is_update_success"]').removeAttr('disabled');
}
if($(data.elem).siblings(':checked').length == 0){
$(data.elem).siblings('[value="is_none_handle"]').removeAttr('disabled');
}
}
}
});
var tableIns = layui.table.render({
id: 'carInfo',
elem: '#car-info',
title:'车辆信息',
url: '<?php echo url("/index/carInfo/"); ?>', //数据接口
where: getUrlParam('Object'),
page: true, //开启分页
limit: 20,
loading: true,
cols: [[ //表头
// {type: 'checkbox', fixed: 'left'},
{field: 'car_no', title: '车牌号', width: 100, edit: 'text', fixed: 'left'},
{field: 'car_frame_no', title: '车架号', width: 180, edit: 'text'},
{field: 'engine_no', title: '发动机号', width: 100, edit: 'text'},
{field: 'factory_model', title: '厂牌型号', width: 200, edit: 'text'},
{field: 'register_date', title: '注册日期', width: 100, edit: 'text'},
{field: 'car_man', title: '车主', width: 80, edit: 'text'},
{field: 'car_number', title: '车主证件号', width: 160, edit: 'text'},
{field: 'car_phone', title: '车主电话', width: 120, edit: 'text'},
{field: 'purchase_price', title: '新车购置价', width: 100, edit: 'text'},
{field: 'export_bhx_name', title: '导出清洗', width: 140, edit: 'text', templet:'#BhxNameTpl'},
{field: 'export_bmc_name', title: '导出上传', width: 140, edit: 'text', templet:'#BmcNameTpl'},
{fixed: 'right', width: 100, align:'center', toolbar: '#table-bar'}
]],
done: function (res, curr, count) {
if(res.code == -1){
$('#lock-screen').css('display','flex');
}
}
});
//监听行工具事件
layui.table.on('tool(car-info)', function(obj){ //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
var data = obj.data, //获得当前行数据
layEvent = obj.event; //获得 lay-event 对应的值
if(layEvent === 'clear_phone'){
layer.confirm('确定要清楚此项手机吗', function(index){
layer.close(index);
index = layer.load();
$.post('<?php echo url("index/clearPhone"); ?>', {id: data.id}, function (res) {
layer.close(index);
layer.msg(res.msg,function () {
layui.table.reload('carInfo');
});
})
});
} else if(layEvent === 'del'){
layer.confirm('真的删除行么', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('<?php echo url("index/delete"); ?>', {id: data.id}, function (res) {
layer.close(index);
layer.msg(res.msg,function () {
obj.del(); //删除对应行(tr)的DOM结构
});
})
});
} else if(layEvent === 'detail'){
layer.open({
type: 2,
title: '车辆信息--' + data.car_no,
area: ['1100px','600px'],
shade: 0,
maxmin: true,
content: '<?php echo url("index/edit"); ?>?id=' + data.id,
zIndex: layer.zIndex,
success: function(layero){
layer.setTop(layero);
}
});
}
});
//监听单元格编辑
layui.table.on('edit(car-info)', function(obj){
var data = {
id : obj.data.id,
field: obj.field,
value: obj.value
};
if (data.value < 0) {
layer.msg('值不能为负数', {icon: 5});
layer.msg(res.msg,function () {
layui.table.reload('carInfo');
});
return false;
}
$.post('<?php echo url("index/update"); ?>', data, function (res) {
layer.msg(res.msg,function () {
layui.table.reload('carInfo');
});
});
});
var urlParams = getUrlParam('Object');
var jobId = 0;
if(urlParams.is_check_peer_phone > 0){
jobId = urlParams.is_check_peer_phone;
}else if(urlParams.is_check_repeat_frame > 0){
jobId = urlParams.is_check_repeat_frame;
}else if(urlParams.is_export_bhx > 0){
jobId = urlParams.is_export_bhx;
}
if(jobId > 0){
$.get('<?php echo url("task/taskBtn"); ?>?job_id=' + jobId,function(ret){
if(ret.code){
$('#tool-bar').prepend($.trim(ret.btns));
}
});
}
$('.layui-date-elem').each(function (i, d) {
layui.laydate.render({
elem: d,
});
});
$('#search-btn').on('click', function(){
var param = $('.layui-card-header').find(':input').serializeObject();
param['data_filter[]'] = param['data_filter[]']?param['data_filter[]']:'';
//执行重载
tableIns.reload({
page: {
curr: 1 //重新从第 1 页开始
},
where: param,
}, 'data');
});
$('#deletes-btn').on('click', function () {
layer.confirm('真的删除行么', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('<?php echo url("index/deletes/"); ?>', $('.layui-card-header').find(':input').serialize(), function (ret) {
layer.close(index);
layer.msg(ret.msg, function () {
layui.table.reload('carInfo');
});
});
});
});
$('#clear-btn').on('click', function () {
layer.confirm('清空数据将不能恢复,确认清空车辆信息吗?', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('<?php echo url("index/truncate/"); ?>', function (ret) {
layer.close(index);
layer.msg(ret.msg, function () {
layui.table.reload('carInfo');
});
});
});
});
});
function task_create(type,id = 0){
$.post('<?php echo url("task/save"); ?>', {task_type: type,source_id: id}, function (ret) {
layer.msg(ret['msg'],function(){
layui.table.reload('taskInfo');
});
});
}
</script>
</body>
</html>

@ -0,0 +1,499 @@
<?php /*a:4:{s:51:"D:\htdocs_new\excel-handle\app\view\task\index.html";i:1613836009;s:54:"D:\htdocs_new\excel-handle\app\view\public\layout.html";i:1582189092;s:54:"D:\htdocs_new\excel-handle\app\view\public\header.html";i:1583504952;s:54:"D:\htdocs_new\excel-handle\app\view\public\script.html";i:1581330838;}*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="none">
<title>粮仓</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
<link rel="stylesheet" href="/static/css/default.css">
<!-- Core stylesheets -->
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
<div class="layui-header">
<div class="layui-logo">车辆数据处理</div>
<ul class="layui-nav layui-layout-left">
<li class="layui-nav-item"><a href="<?php echo url('index/index'); ?>">数据中心</a></li>
<li class="layui-nav-item"><a href="<?php echo url('task/index'); ?>">任务中心</a></li>
</ul>
</div>
<div class="layui-container-fluid" id="layui-content">
<div class="layui-card">
<div class="layui-card-header layui-card-header-auto layui-form">
<div id="task-model-add" class="layui-form">
<div class="layui-form-item active">
<label class="layui-form-label" style="width: 140px;">任务类型</label>
<div class="layui-input-block">
<input type="radio" lay-filter="task_type" name="task_type" value="1" title="导入处理" checked>
<input type="radio" lay-filter="task_type" name="task_type" value="2" title="导出处理">
<input type="radio" lay-filter="task_type" name="task_type" value="3" title="重复电话处理">
<input type="radio" lay-filter="task_type" name="task_type" value="4" title="重复车架处理">
<input type="radio" lay-filter="task_type" name="task_type" value="5" title="更新数据">
</div>
</div>
<div class="layui-form-item task-param active" id="task-import">
<label class="layui-form-label" style="width: 140px;">上传文件</label>
<div class="layui-input-inline" style="width: 405px;">
<input type="text" name="original_filename" id="original_filename" class="layui-input" readonly>
<input type="hidden" name="filename" id="filename" autocomplete="off" class="layui-input">
</div>
<div class="layui-input-inline" style="width: 200px;">
<button type="button" class="layui-btn" id="upload">
<i class="layui-icon">&#xe67c;</i>上传CSV文件
</button>
</div>
<a href="/static/tpl.csv" download="车辆信息导入模板.csv" style="color: #009688;">[下载车辆信息导入模板]</a>
</div>
<div class="task-param" id="task-export" style="display: none;">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">初登日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date1" class="layui-input export-date1">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date2" class="layui-input export-date2">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">保险日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer_month1" class="layui-input" style="display: inline-block; width: 60px;">
<input type="text" name="insurer_day1" class="layui-input" style="display: inline-block; width: 60px;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" name="insurer_month2" class="layui-input" style="display: inline-block; width: 60px;">
<input type="text" name="insurer_day2" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">导出类型</label>
<div class="layui-input-inline" style="width: 780px;">
<input type="radio" lay-filter="export_type" name="export_type" value="bhx" class="layui-input" title="导出清洗" checked>
<input type="radio" lay-filter="export_type" name="export_type" value="failed" class="layui-input" title="导出清洗失败">
<input type="radio" lay-filter="export_type" name="export_type" value="bmc" class="layui-input" title="导出清洗成功至上传">
<input type="radio" lay-filter="export_type" name="export_type" value="success_bmc" class="layui-input" title="导出清洗成功">
<!-- <input type="radio" lay-filter="export_type" name="export_type" value="failed_bmc" class="layui-input" title="导出清洗失败至上传">
<input type="radio" lay-filter="export_type" name="export_type" value="none_bmc" class="layui-input" title="导出未处理至上传">
-->
</div>
</div>
<div class="layui-inline" id="sub_export_type">
<label class="layui-form-label" style="width: 100px;">导出字段</label>
<div class="layui-input-inline" style="width: 210px;">
<input type="checkbox" name="export_field[]" lay-filter="export_field" value="car_no" title="车牌号">
<input type="checkbox" name="export_field[]" lay-filter="export_field" value="car_frame_no" title="车架号" checked>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">导出数量</label>
<div class="layui-input-inline">
<input type="text" name="export_limit" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 100px;">导出文件名</label>
<div class="layui-input-inline" style="width: 450px;">
<input type="text" name="queue" id="queue-name" class="layui-input" style="display:inline-block; width: 325px;">
<button type="button" class="layui-btn" onclick="getExportName(event)">生成文件名</button>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">导出总计:</label>
<div class="layui-input-inline" style="width: 120px;">
<input type="text" name="num" id="count" class="layui-input" disabled>
</div>
<div class="layui-input-inline">
<button type="button" class="layui-btn" onclick="export_num(event)">获取总数</button>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">新车购置价</label>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price1" class="layui-input" style="display: inline-block; width: 60px;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: auto;">
<input type="text" name="price2" class="layui-input" style="display: inline-block; width: 60px;">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">空电话检测</label>
<div class="layui-input-inline" style="width: 80px;">
<input type="checkbox" name="empty_phone_check" lay-skin="switch" lay-filter="empty_phone_check" value="yes" lay-text="开启|关闭" checked>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">是否EXCEL</label>
<div class="layui-input-inline" style="width: 80px;">
<input type="checkbox" name="is_excel" lay-skin="switch" value="yes" lay-text="开启|关闭" checked>
</div>
</div>
</div>
</div>
<div class="task-param" id="task-peer-phone" style="display: none;">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">初登日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date1" class="layui-input export-date1">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date2" class="layui-input export-date2">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">个人电话重复次数</label>
<div class="layui-input-inline">
<input type="number" name="peer_phone_number" required lay-verify="required" class="layui-input">
</div>
</div>
</div>
</div>
<div class="task-param" id="task-repeat_frame" style="display: none;">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" style="width: 140px;">初登日期</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date1" class="layui-input export-date1">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="export_date2" class="layui-input export-date2">
</div>
</div>
</div>
</div>
</div>
<div class="layui-form-item" style="margin:24px 0 -15px;">
<div class="layui-inline" style="float: left;position: relative;z-index: 999;">
<label class="layui-form-label" style="width: 65px;"></label>
<div class="layui-input-inline" style="width: 405px">
<input type="text" name="queue" id="queue" class="layui-input">
</div>
<div class="layui-input-inline" style="">
<button type="button" class="layui-btn" onclick="search(event)">查询</button>
</div>
</div>
<div class="layui-input-block layui-text-right">
<button type="button" class="layui-btn" onclick="task_add()">立即提交</button>
<button type="button" class="layui-btn layui-btn-danger" id="clear-btn">清空数据</button>
</div>
</div>
</div>
<div class="layui-card-body layui-form">
<table class="layui-hide" id="task-info" lay-filter="task-info"></table>
</div>
</div>
</div>
<div class="layui-footer">
© zcstatham
</div>
</div>
<div id="lock-screen">
<div class="lock-screen">
<div class="layui-form-item">
<label class="layui-form-label">锁屏密码</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="password" name="password" id="password" class="layui-input">
</div>
<div class="layui-input-inline" style="width: auto;">
<button type="button" class="layui-btn" onclick="login(event)">解锁</button>
</div>
</div>
</div>
</div>
<!--Global Javascript -->
<script src="/static/plugins//layui/layui.all.js"></script>
<script src="/static/plugins/jquery/jquery.min.js"></script>
<script src="/static/js/default.js"></script>
<!--Core Javascript -->
<script type="text/html" id="table-bar">
{{#
var payload = JSON.parse(d.payload);
var export_date1 = payload['data']['params']['export_date1'];
var export_date2 = payload['data']['params']['export_date2'];
var ext = d.remark.split('.')[1];
}}
{{# if(d.type == 2){ }}
{{# if(payload['data']['params']['export_limit'] > 0){ }}
{{#
var arrParam = [];
var exportUrlParam = '';
exportUrlParam += 'export_date1=' + export_date1 + '&';
exportUrlParam += 'export_date2=' + export_date2 + '&';
exportUrlParam += 'insurer_month1=' + payload['data']['params']['insurer_month1'] + '&';
exportUrlParam += 'insurer_day1=' + payload['data']['params']['insurer_day1'] + '&';
exportUrlParam += 'insurer_month2=' + payload['data']['params']['insurer_month2'] + '&';
exportUrlParam += 'insurer_day2=' + payload['data']['params']['insurer_day2'] + '&';
exportUrlParam += 'is_export_' + payload['data']['params']['export_type'] + '=' + d.id;
}}
<a class="layui-btn layui-btn-xs" href="/index/index.html?{{exportUrlParam}}">查看</a>
{{# } }}
{{# if(d.download_times > 0){ }}
<buton class="layui-btn layui-btn-xs" onclick="layer.confirm('已下载过,是否继续',function(index){layer.close(index);window.open('<?php echo url('task/download'); ?>?id={{d.id}}');window.location.reload();});">下载文件</buton>
{{# }else { }}
<buton class="layui-btn layui-btn-xs" onclick="window.open('<?php echo url('task/download'); ?>?id={{d.id}}');window.location.reload();">下载文件</buton>
{{# } }}
{{# }else if(d.type == 3){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?is_check_peer_phone={{d.id}}">查看</a>
{{# if(d.info_num > 0){ }}
<button type="button" class="layui-btn layui-btn-xs" onclick="task_create(2,{{d.id}})">导出</button>
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" onclick="task_create(6,{{d.id}})">清除重复</button>
{{# } }}
{{# }else if(d.type == 4){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?is_check_repeat_frame={{d.id}}">查看</a>
{{# if(d.info_num > 0){ }}
<button type="button" class="layui-btn layui-btn-xs" onclick="task_create(2,{{d.id}})">导出</button>
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" onclick="task_create(7,{{d.id}})">删除重复</button>
{{# } }}
{{# }else if(d.type == 5){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?is_update_bhx={{d.id}}">查看</a>
{{# }else if(d.type == 7){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?is_delete_frame={{d.id}}">查看</a>
{{# }else if(d.type == 1){ }}
<a class="layui-btn layui-btn-xs" href="/index/index.html?source={{d.id}}">查看</a>
{{# } }}
</script>
<script type="text/html" id="process-tpl">
<div class="layui-progress layui-progress-big" lay-filter="process-{{d.id}}" lay-showPercent="yes">
<div class="layui-progress-bar layui-bg-green" lay-percent="{{d.process}}%"></div>
</div>
</script>
<script>
layui.form.on('radio(task_type)', function(data){
$('#task-model-add').find('.task-param').removeClass('active').hide();
switch (+data.value) {
case 1:
$('#task-import').addClass('active').show();
break;
case 2:
$('#task-export').addClass('active').show();
break;
case 3:
$('#task-peer-phone').addClass('active').show();
break;
case 4:
$('#task-repeat_frame').addClass('active').show();
break;
case 5:
$('#task-import').addClass('active').show();
break;
}
});
layui.form.on('radio(export_type)', function(data){
if(['bmc','failed_bmc','none_bmc'].indexOf(data.value) != -1){
$('#sub_export_type').hide();
$('#sub_export_type').find(':input').attr('disabled',true);
}else if(data.value == 'success_bmc'){
$('#sub_export_type').hide();
$('#sub_export_type').find(':input').attr('disabled',true);
}else {
$('#sub_export_type').show();
$('#sub_export_type').find(':input').removeAttr('disabled');
}
});
var tableIns = layui.table.render({
id: 'taskInfo',
elem: '#task-info',
title:'车辆信息',
url: '<?php echo url("/task/taskInfo/"); ?>', //数据接口
page: true, //开启分页
limit: 20,
loading: true,
cols: [[ //表头
// {type: 'checkbox', fixed: 'left'},
{field: 'id', title: '序号', fixed: 'left', width: 100},
{field: 'type_txt', title: '任务名称', sort: true, width: 400},
{field: 'process', title: '处理进度', templet: '#process-tpl'},
{field: 'remark', title: '任务结果', sort: true},
{field: 'create_timestamp', title: '创建时间', sort: true, width: 200},
{field: 'status', title: '任务状态', sort: true, width: 100},
{field: 'download_times', title: '下载次数', sort: true, width: 100},
{fixed: 'right', width: 240, align:'center', toolbar: '#table-bar'}
]],
done: function (res, curr, count) {
layui.element.render();
var timer = setInterval(function(){
$.get('<?php echo url("task/process"); ?>', function (ret) {
if(!ret.data || ret.data.length == 0 ){
clearInterval(timer);
delete timer;
}else {
$.each(ret.data,function(i,d){
d.process = d.process > 100 ? 100 : d.process;
layui.element.progress('process-' + d.id, +d.process + '%');
if(d.process >= 100){
layui.table.reload('taskInfo');
}
})
}
});
},3000)
}
});
//监听行工具事件
layui.table.on('tool(task-info)', function(obj){ //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
var data = obj.data, //获得当前行数据
layEvent = obj.event; //获得 lay-event 对应的值
if(layEvent === 'detail'){
layer.confirm('确定要清楚此项手机吗', function(index){
layer.close(index);
index = layer.load();
$.post('<?php echo url("index/clearPhone"); ?>', {id: data.id}, function (res) {
layer.close(index);
layer.msg(res.msg,function () {
layui.table.reload('taskInfo');
});
})
});
}
});
layui.upload.render({
elem: '#upload', //绑定元素
accept: 'file',
url: '<?php echo url("task/upload"); ?>', //上传接口
data: {
task_type: function () {
return $("input[name='task_type']:checked").val();
}
},
done: function (res) {
if (res.code == -1) {
$('#lock-screen').css('display', 'flex');
} else if (res.code == 0) {
layer.alert(res.msg);
} else if (res.code == 1) {
$('#original_filename').val(res.original_filename);
$('#filename').val(res.filename);
return true;
}
},
error: function (res) {
//请求异常回调
layer.alert(res.msg);
}
});
$(function(){
$('.export-date1,.export-date2').each(function (i, d) {
layui.laydate.render({
elem: d,
});
});
$('#clear-btn').on('click', function () {
layer.confirm('清空数据将不能恢复,确认清空附属表吗?', function(index){
layer.close(index);
index = layer.load();
//向服务端发送删除指令
$.post('<?php echo url("task/clearSubTable/"); ?>', function (ret) {
layer.close(index);
layer.msg(ret.msg, function () {
layui.table.reload('taskInfo');
});
});
});
});
});
function export_num(){
if($('[name="export_date1"]').val() == '' && $('[name="export_date1"]').val() == ''){
layer.msg('请先填写初登日期');
return false;
}
$.post('<?php echo url("task/exportNum"); ?>', $('#task-export').find(':input').serialize(), function (ret) {
layer.msg(ret['msg']);
$('#count').val(ret.data);
});
}
function task_create(type,id = 0){
$.post('<?php echo url("task/save"); ?>', {task_type: type,source_id: id}, function (ret) {
layer.msg(ret['msg'],function(){
layui.table.reload('taskInfo');
});
});
}
function task_add() {
var task_type = $('[name="task_type"]:checked').val();
if (task_type == 5 || task_type == 2) {
var name = task_type == 5 ? $('#original_filename').val() : $('#queue-name').val();
var type = task_type == 5 ? 'update' : 'export';
$.get('<?php echo url("task/checkIsExistName"); ?>?name=' + name + '&type=' + type, function (ret) {
if (ret.code == 1) {
layer.confirm(ret.msg, function (index) {
layer.close(index);
submitForm();
});
}else if (ret.code == 0) {
layer.alert(ret.msg);
}else if (ret.code == 2) {
submitForm();
}
});
}else {
submitForm();
}
}
function submitForm(){
$.post('<?php echo url("task/save"); ?>', $('#task-model-add').find('.active :input').serialize(), function (ret) {
if(ret.code == 0){
layer.alert(ret.msg);
}else {
layer.msg(ret['msg'],function(){
layui.table.reload('taskInfo');
});
}
});
}
function search(event){
tableIns.reload({
page: {
curr: 1 //重新从第 1 页开始
},
where: {queue: $('#queue').val()},
}, 'data');
}
function getExportName(event) {
var target = event.target;
$.get('<?php echo url("task/exportName"); ?>', $('#task-export').find(':input').serialize(), function (ret) {
if(ret.code == 0){
layer.alert(ret.msg);
}else {
$(target).prev('input[name="queue"]').val(ret.name);
}
});
}
</script>
</body>
</html>

@ -0,0 +1,185 @@
<?php /*a:4:{s:51:"D:\htdocs_new\excel-handle\app\view\index\edit.html";i:1594302886;s:52:"D:\htdocs_new\excel-handle\app\view\public\base.html";i:1582187582;s:54:"D:\htdocs_new\excel-handle\app\view\public\header.html";i:1583504952;s:54:"D:\htdocs_new\excel-handle\app\view\public\script.html";i:1581330838;}*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="none">
<title>粮仓</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
<link rel="stylesheet" href="/static/css/default.css">
<!-- Core stylesheets -->
<style>
.layui-form-label {
width: 100px;
}
.layui-badge {
height: 28px;
line-height: 28px;
font-size: 14px;
}
</style>
</head>
<body class="layui-layout-body">
<div class="layui-card">
<div class="layui-card-header"></div>
<div class="layui-card-body layui-form">
<input type="hidden" name="id" value="<?php echo htmlentities($info['id']); ?>">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">车牌号</label>
<div class="layui-input-inline">
<input type="text" name="car_no" value="<?php echo htmlentities($info['car_no']); ?>" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">车架号</label>
<div class="layui-input-inline">
<input type="text" name="car_frame_no" value="<?php echo htmlentities($info['car_frame_no']); ?>" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">发动机号</label>
<div class="layui-input-inline">
<input type="text" name="engine_no" value="<?php echo htmlentities($info['engine_no']); ?>" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">厂牌型号</label>
<div class="layui-input-inline">
<input type="text" name="factory_model" value="<?php echo htmlentities($info['factory_model']); ?>" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">初登日期</label>
<div class="layui-input-inline">
<input type="text" name="register_date" id="register_date" value="<?php echo htmlentities($info['register_date']); ?>" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">新车购置价</label>
<div class="layui-input-inline">
<input type="text" name="purchase_price" value="<?php echo htmlentities($info['purchase_price']); ?>" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">车主姓名</label>
<div class="layui-input-inline">
<input type="text" name="car_man" value="<?php echo htmlentities($info['car_man']); ?>" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">车主证件号</label>
<div class="layui-input-inline">
<input type="text" name="car_number" value="<?php echo htmlentities($info['car_number']); ?>" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">车主联系方式</label>
<div class="layui-input-inline">
<input type="text" name="car_phone" value="<?php echo htmlentities($info['car_phone']); ?>" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">上年承保公司</label>
<div class="layui-input-inline">
<input type="text" name="company" value="<?php echo htmlentities($info['company']); ?>" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">商业止保日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer1_date" id="insurer1_date" value="<?php echo htmlentities($info['insurer1_date']); ?>" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">交强止保日期</label>
<div class="layui-input-inline">
<input type="text" name="insurer2_date" id="insurer2_date" value="<?php echo htmlentities($info['insurer2_date']); ?>" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">被保险人</label>
<div class="layui-input-inline">
<input type="text" name="id_man" value="<?php echo htmlentities($info['id_man']); ?>" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">被保险人证件号</label>
<div class="layui-input-inline">
<input type="text" name="id_number" value="<?php echo htmlentities($info['id_number']); ?>" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数据状态</label>
<div class="layui-input-block" style="height: 36px; line-height: 36px;">
<?php if($info['is_export_bhx'] == 0 && $info['is_update_bhx'] == 0 && $info['is_export_bmc'] == 0 &&
$info['is_export_failed'] == 0 && $info['is_export_none_bmc'] == 0 && $info['is_export_failed_bmc'] == 0): ?>
<span class="layui-badge layui-bg-green">未处理</span>
<?php endif; if($info['is_export_bhx'] > 0): ?>
<span class="layui-badge layui-bg-green">导出至清洗</span>
<?php endif; if($info['is_export_bhx'] > 0 && $info['is_update_bhx'] > 0): ?>
<span class="layui-badge layui-bg-green">清洗成功</span>
<?php endif; if($info['is_export_bhx'] > 0 && $info['is_update_bhx'] < 0): ?>
<span class="layui-badge layui-bg-green">清洗失败</span>
<?php endif; if($info['is_export_bhx'] > 0 && $info['is_export_failed'] > 0): ?>
<span class="layui-badge layui-bg-green">导出清洗失败</span>
<?php endif; if($info['is_export_bhx'] > 0 && $info['is_export_failed_bmc'] > 0): ?>
<span class="layui-badge layui-bg-green">导出清洗失败至上传</span>
<?php endif; if($info['is_export_bhx'] > 0 && $info['is_update_bhx'] > 0 && $info['is_export_bmc'] > 0): ?>
<span class="layui-badge layui-bg-green">导出清洗成功至上传</span>
<?php endif; if($info['is_export_none_bmc'] > 0): ?>
<span class="layui-badge layui-bg-green">导出未处理至上传</span>
<?php endif; ?>
</div>
</div>
<div class="layui-form-item" style="margin-top: 60px; text-align: center">
<button type="submit" class="layui-btn" lay-submit="" lay-filter="car-info">立即提交</button>
<button type="button" class="layui-btn layui-btn-danger" onclick="location.reload();">重置</button>
<button type="button" class="layui-btn layui-btn-danger" onclick="window.parent.layer.closeAll();">关闭</button>
</div>
</div>
</div>
<!--Global Javascript -->
<script src="/static/plugins//layui/layui.all.js"></script>
<script src="/static/plugins/jquery/jquery.min.js"></script>
<script src="/static/js/default.js"></script>
<script>
layui.laydate.render({
elem: '#register_date'
});
layui.form.on('submit(car-info)', function(data){
$.post('<?php echo url("index/edit"); ?>',data.field,function(ret){
layer.msg(ret['msg'],function(){
if(ret['code'] == 1){
window.parent.layer.closeAll();
window.parent.layui.table.reload('carInfo');
}
delete ret;
});
});
return false;
});
</script>
</body>
</html>

10
think

@ -0,0 +1,10 @@
#!/usr/bin/env php
<?php
namespace think;
// 命令行入口文件
// 加载基础文件
require __DIR__ . '/vendor/autoload.php';
// 应用初始化
(new App())->console->run();

@ -0,0 +1 @@
如果不使用模板,可以删除该目录

@ -0,0 +1 @@
git pull
Loading…
Cancel
Save