' . $art['name'] . '
'; + echo '' . $art['descs'] . '
'; + echo 'commit 4f3da37e060c40cfe7c0e5c609f2f5612ade5f54
Author: LiuZhengYu <2777920394@qq.com>
Date: Wed Apr 15 17:28:46 2026 +0800
批量添加
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ad26d09
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,31 @@
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.out
+*.so
+*.dylib
+*.pem
+*.log
+*.glb
+*.zip
+*.rar
+*.pdf
+*.docx
+*.xls
+*.doc
+*.gltf
+*.mp3
+*.mp4
+
+# Dependency directories (remove the comment below to include it)
+资料/*
+web/ud/docs/*
+web/ud/2025/*
+web/ud/2026/*
+web/ud/2027/*
+web/ud/2028/*
+**/unpackage/
+**/tmp/
+web.ini
+gitup.bat
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..9fbb181
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,18 @@
+{
+ // 使用 IntelliSense 了解相关属性。
+ // 悬停以查看现有属性的描述。
+ // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "ciyon main",
+ "type": "go",
+ "request": "launch",
+ "mode": "auto",
+ "program": "${workspaceRoot}",
+ "env": {},
+ "args": [],
+ "showLog": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..327df4c
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,4 @@
+{
+ "editor.unicodeHighlight.includeComments": false,
+ "editor.unicodeHighlight.includeStrings": false
+}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 0000000..54bb9d5
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,18 @@
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "label": "刷新CDN缓存",
+ "type": "shell",
+ "command": "node ../../nodejs/refreshcdn/refreshcdn.js ${workspaceFolder}",
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ },
+ "presentation": {
+ "reveal": "always"
+ },
+ "problemMatcher": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..17cb286
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,117 @@
+GNU GENERAL PUBLIC LICENSE
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
+
+ one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author
+
+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c0f916a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,172 @@
+# Ciyon - 众产全栈开发框架
+## 技术特点
+### AI辅助决策
+ 基于Function Call和JSON的AI能力,实现了定期AI决策及渐进式主动决策执行能力。
+
+ 利用置信度缓解AI幻觉难题,基于量化函数可实现专用AI能力。
+
+### Web3D地球
+ 基于Cesium与ThreeJS,实现了三维场景可视化配置和开发JS独立组件。
+
+ 支持多种地图源、地形图、GLB模型、光照、无人机建模等。
+
+### 原生重构组件
+ 内生发展,尽量不引用第三方库,拆解掌握原理后重写。
+
+ PC端组件20+,移动端组件60+,不断扩展中。
+
+### PHP+Golang
+ PHP在项目原型验证阶段快速开发上线。
+
+ Golang作为服务器集群降成本的高并发优化。
+
+### 免编译模式
+ 尽量用免编译模式开发,降低老旧代码维护难度。
+
+ 是未来演进的重要研究基础。
+
+### 代码生成器
+ 支持基于数据表的通用功能的代码生成能力。
+
+ 数据表注解定义,自动生成代码,再利用AI补全微调。
+
+ 遵循一定的开发规范,能产生90%高质量直接运行代码。
+
+
+## 软件架构
+### 总控端原生JS
+ 使用原生JS实现一系列的常用函数封装。
+
+ 包括websocket、bigscreen、openai、sse、i18n等。
+
+ 结合Web3D的数据大屏驾驶舱示例代码实现。
+
+### 总控端PHP
+ 原生实现独立开发框架,输入安全校验、唯一访问入口。
+
+ 拆解吸收多种大型框架源码。本框架结构简单,可读性强。
+
+### 总控端Golang
+ 原生实现独立开发框架,未实现函数自动转至PHP执行。
+
+ 支持mock、连接池、自更新等。
+
+### 移动端Vue3
+ 在Vue3基础上极简封装各类常用组件。
+
+ 统一封装常见函数,页面全面可自定义,多语言。
+
+ 提供路由工具,一键生成路由代码。
+
+### Web站原生JS库
+ 让Web呈现扁平的价值传达,减少酷炫效果对阅读的干扰,整站SEO可完整解析。
+
+### Web站缓存机制
+ 自定义的动态页面缓存模式,结合各类CDN回源策略减轻对源服务器请求。
+
+
+## 软件工程
+### 项目可行性验证阶段
+ 用原生JS+PHP+微信小程序开发。
+
+ 在数周内完成项目快速开发。
+
+ 低成本投入市场验证迭代。
+
+### 项目快速发展阶段
+ Web服务器集群规模或数据库服务器连接数承压后,
+
+ 用Golang重写高并发请求的函数接口,逐步替代。
+
+### 项目稳定运营阶段
+ Golang将业务侧数据全部重写,完全替换PHP低效代码。
+
+ 根据业务特点拆分,扩展成多地多中心异构拓扑。
+
+
+## 未来演进
+### 全量区块链
+ 创新的实现区块链底层架构,将上传的文件图片视频资源、数据库资源全部完整上链。
+
+ 非简单的hash上链。
+
+### 后端智能合约化
+ 后端研发基于区块链JS智能合约,
+
+ 实现统一的前端JS访问入口,实现区块链级事务。
+
+### 大前端上链
+ 从区块链上下载前端代码包,加载到用户端(PC/手机/XR眼镜等),任何交互操作均直接请求区块链智能合约。
+
+### 代码可审计
+ 区块链基于共识算法开放协议,天然可审计。
+
+ 前端代码及后端智能合约不允许混淆和编译。
+
+ 用户端可随时调阅源码分析。
+
+
+# 在线演示
+
+https://ciyon.ciy.cn/
+https://ciyon.ciy.cn/admin/
+
+# Windows开发环境部署
+[详见教程](https://ciyon.ciy.cn/docs/#100)
+
+部署软件: Nginx、PHP、MariaDB、Golang
+建议安装: Git、python3、node.js
+开发IDE: VSCode(Cursor/Claude Code/Antigravity)、UniAPP、微信开发者工具
+开发工具: Navicat、WinSCP5、Google Chrome、S3 Browser、Apifox
+效率工具: XMind、WPS Office、Everything、ToDesk
+网络工具: SocketTool、MQTT-Explorer
+
+# Linux生产环境部署
+[详见教程](https://ciyon.ciy.cn/docs/#102)
+操作系统: Debian
+运维工具: Navicat、WinSCP5+、S3 Browser
+
+# 重要更新记录
+
+## 2026.03.01
+- 升级: 增加总控MCP和用户MCP通用接口
+
+## 2026.02.02
+- 升级: 路由重构,支持软路由,需结合Nginx配置
+
+## 2025.12.01
+- 里程碑: 众产事业平台上线
+
+## 2025.09.06
+- 文档: 编写移动端 Demo代码
+
+## 2025.08.25
+- 文档: docs文档整理
+
+## 2025.06.12
+- 文档: Ciyon文档上线,文档整理
+
+## 2025.05.16
+- 新增: Ciyon官网上线、Git内部公开发布
+
+## 2025.04.06
+- 文档: 编写PC Demo代码
+
+## 2025.02.20
+- 升级: 移动端Vue3框架所有组件完成去依赖
+
+## 2024.12.26
+- 新增: AI辅助决策。支持多轮AI任务
+
+## 2024.10.05
+- 新增: Web3D地编器及ciyearth.js组件库
+
+## 2024.08.30
+- 新增: Golang语言开发模式
+
+## 2024.05.21
+- 升级: 移动端Vue3/Uniapp兼容框架(原Vue2框架废弃)
+
+## 2024.03.12
+- 里程碑: 基于CIYPHP重写开发SaaS框架
+
diff --git a/aiskill/ciyon-PC前端.md b/aiskill/ciyon-PC前端.md
new file mode 100644
index 0000000..791cc83
--- /dev/null
+++ b/aiskill/ciyon-PC前端.md
@@ -0,0 +1,933 @@
+# Ciyon PC前端开发指南
+
+## 框架概述
+
+Ciyon是一个轻量级、高性能的PC前端开发框架,采用原生JavaScript开发,不依赖第三方库(如Vue、React、jQuery),专注于企业级后台管理系统和SaaS应用的快速开发。
+
+### 核心特点
+
+- **零依赖**: 纯原生JavaScript,无第三方库依赖
+- **组件化**: 提供丰富的表单组件和业务组件
+- **高性能**: 优化的DOM操作和事件处理
+- **响应式**: 支持多端适配(PC、平板、手机)
+- **国际化**: 内置多语言支持
+- **主题系统**: CSS变量实现主题切换
+
+---
+
+## 框架架构
+
+### 核心库文件
+
+```
+web/jscss/
+├── ciy.js # 基础工具库和DOM操作
+├── ciycmp.js # 表单组件库
+├── ciycmp2.js # 扩展组件库
+├── ciytable.js # 表格和列表组件
+├── ciybigscreen.js # 数据大屏组件
+├── ciy_websocket.js # WebSocket通信
+├── style.css # 核心样式
+└── theme.js # 暗黑模式
+```
+
+### 设计模式
+
+#### DOM封装模式
+
+框架使用 `$5()` 函数替代jQuery,提供统一的DOM操作接口:
+
+```javascript
+// 选择元素
+var dom = $5('.class-name');
+
+// 链式调用
+dom.css({color: 'red'}).addClass('active').show();
+
+// 事件绑定
+dom.on('click', function(e) {
+ console.log('clicked');
+});
+```
+
+#### 组件化模式
+
+使用自定义标签和 `ciycmp()` 函数初始化组件:
+
+```html
+
+
+
+ ?',
+```
+
+#### CATM - 树形字典(级联)
+```
+COMMENT '组织结构,CATM,树形字典code|分隔符'
+```
+- 用途:树形结构字典的级联选择
+- 参数:树形字典表名和可选分隔符(默认为 ` - `)
+- 示例:
+```sql
+`prodcata` int(11) NOT NULL COMMENT '组织结构,CATM,zc_depart',
+`areacode` int(11) NOT NULL COMMENT '所在地区,CATM,ciy_arearpc',
+`areacode` int(11) NOT NULL COMMENT '所在地区,CATM,ciy_arearpc|?',
+```
+
+#### TBIN - 位运算字典(多选)
+```
+COMMENT '认证情况,TBIN,字典code|分隔符'
+```
+- 用途:通过位运算存储的多选值(最多16个选项)
+- 参数:字典code和可选分隔符
+- 示例:
+```sql
+`renzheng` int(11) NOT NULL DEFAULT 0 COMMENT '认证,TBIN,certs',
+```
+
+#### TINT - 整型字典
+```
+COMMENT '发送人,TINT,10:用户.20:平台.30:AI客服'
+```
+- 用途:直接定义的整型字典选项
+- 参数:`值:名称` 格式的选项列表
+- 示例:
+```sql
+`sendtype` int(11) NOT NULL COMMENT '发送人,TINT,10:用户.20:平台.30:AI客服',
+```
+
+---
+
+### 关联类组件
+
+#### DB - 表关联(单选)
+```
+COMMENT '|版块|,DB,关联表名'
+```
+- 用途:关联其他表的下拉选择
+- 参数:关联表名
+- 示例:
+```sql
+`sectionid` int(11) NOT NULL COMMENT '|版块|,DB,ap_art_section',
+```
+
+---
+
+### 日期时间类组件
+
+#### DATE - 日期时间
+```
+COMMENT '创建时间,DATE'
+COMMENT '有效期至,DATE,Y-m-d'
+```
+- 用途:日期时间显示和选择
+- 参数:
+ - 无参数:显示 `Y-m-d H:i`
+ - `Y-m-d`:仅显示日期(年-月-日)
+- 示例:
+```sql
+`addtimes` bigint(20) NOT NULL COMMENT '创建时间,DATE',
+`accounttimes` bigint(20) NOT NULL COMMENT '有效期至,DATE,Y-m-d',
+```
+
+#### TIME - 时间点
+```
+COMMENT '营业时间,TIME'
+```
+- 用途:一天内的时间点选择(HH:MM格式)
+- 示例:
+```sql
+`dayclock` int(11) NOT NULL COMMENT '营业时间,TIME',
+```
+
+---
+
+### 金额数值类组件
+
+#### CNY - 金额(元)
+```
+COMMENT '充值金额|,CNY'
+```
+- 用途:人民币金额显示(单位:元)
+- 自动格式化:`1000000` → `10,000.00元`
+- 实际存储:分为最小单元
+- 示例:
+```sql
+`iemoney` int(11) NOT NULL COMMENT '金额|,CNY',
+`cashmoney` int(10) NOT NULL COMMENT '提现金额|,CNY',
+```
+
+#### MCNY - 金额(万元)
+```
+COMMENT '金额|,WCNY,2'
+```
+- 用途:人民币金额显示(单位:万元)
+- 参数:小数位数(默认3位)
+- 自动格式化:`100000000` → `100.000万`
+- 实际存储:分(0.01元)为最小单元
+- 示例:
+```sql
+`bankmoney` int(11) NOT NULL COMMENT '贷款金额|,WCNY,2',
+```
+
+#### MCNY - 金额单位(毫)
+```
+COMMENT '金额|,WCNY'
+```
+- 用途:人民币金额显示(单位:元)
+- 参数:小数位数,默认保留4位小数
+- 自动格式化:`10000` → `1.00元`
+- 实际存储:毫元为最小单元,10000毫分=100分=1元
+- 示例:
+```sql
+`qian` int(11) NOT NULL COMMENT '提成金额|,MCNY',
+```
+
+
+#### BET - 科学计数法(带小数)
+```
+COMMENT '热功|,BET,焦耳,1000,3'
+```
+- 用途:带小数的数值显示
+- 参数:单位,倍率,小数位数
+- 示例:
+```sql
+`price` int(11) NOT NULL COMMENT '热功|,BET,焦耳,1000,3',
+```
+
+---
+
+### 物理单位类组件
+
+#### WGT - 重量
+```
+COMMENT '重量|,WGT,2'
+```
+- 用途:重量单位显示
+- 参数:小数位数
+- 自动转换:根据数值自动选择单位
+- 实际存储:克为最小单元,1000克=1公斤
+- 示例:
+```sql
+`ton` int(11) NOT NULL COMMENT '吨位|,WGT',
+`weightg` int(11) NOT NULL COMMENT '体重|,WGT',
+```
+
+#### LGH - 长度
+```
+COMMENT '长度|,LGH,厘米.米.公里,2'
+```
+- 用途:长度单位显示
+- 参数:单位列表,小数位数
+- 实际存储:毫米为最小单元
+- 示例:
+```sql
+`metre` int(11) NOT NULL COMMENT '长度|,LGH',
+`height` int(11) NOT NULL COMMENT '身高|,LGH',
+```
+
+#### METRE - 米制单位
+```
+COMMENT '长度|,METRE,米|1000|公里'
+```
+- 用途:米制单位显示(固定倍率)
+- 参数:单位1|倍率|单位2
+- 实际存储:米为最小单元
+- 示例:
+```sql
+`metre` int(11) NOT NULL COMMENT '直线距离|,METRE',
+```
+
+#### TC - 温度
+```
+COMMENT '温度|,TC'
+```
+- 用途:温度显示(摄氏度)
+- 实际存储:1/1000摄氏度为最小单元
+- 示例:
+```sql
+`eartmpr` int(11) NOT NULL COMMENT '耳温|,TC',
+```
+
+#### SEC - 时长(秒)
+```
+COMMENT '执行用时|,SEC'
+```
+- 用途:以秒为单位的时长显示
+- 自动格式化:根据数值显示为 `xx秒`、`xx分钟`、`xx小时`
+- 示例:
+```sql
+`runsec` int(11) NOT NULL COMMENT '执行用时|,SEC',
+```
+
+#### CYC - 周期
+```
+COMMENT '执行周期|,CYC'
+```
+- 用途:周期显示
+- 自动格式化:根据数值显示为 `xx天`、`xx月`
+- 示例:
+```sql
+`npcyc` int(11) NOT NULL COMMENT '执行周期|,CYC',
+```
+
+#### PCT - 百分比
+```
+COMMENT '百分比|,PCT'
+```
+- 用途:百分比显示
+- 自动格式化:`50` → `50.00%`
+- 示例:
+```sql
+`pct` int(11) NOT NULL COMMENT '百分比|,PCT',
+```
+
+#### INT - 可带单位的整数
+```
+COMMENT '积分|,INT,分'
+COMMENT '活动期数,INT,第?期'
+```
+- 用途:带单位的整数显示
+- 参数:单位名(可用 `?` 占位数值)
+- 示例:
+```sql
+`mypnt` int(11) NOT NULL COMMENT '积分|,INT,分',
+`acttm` int(11) NOT NULL COMMENT '活动期数,INT,第?期',
+```
+
+---
+
+### 布尔类组件
+
+#### BOOL - 布尔开关
+```
+COMMENT '|是否使用|,BOOL'
+```
+- 用途:布尔值的开关显示
+- 参数:真值.假值(默认为 `✔.✘`)
+- 存储:真值为1,假值为2。其他值无效
+- 示例:
+```sql
+`isuse` int(11) NOT NULL COMMENT '|是否使用|,BOOL,✔.✘',
+`isopen` int(11) NOT NULL COMMENT '|是否开启|,BOOL,开启.关闭',
+```
+
+---
+
+### 文件附件类组件
+
+#### IMG1 - 单图上传
+```
+COMMENT '头像,IMG1'
+COMMENT '身份证人像面,IMG1'
+```
+- 用途:单张图片上传
+- 前端组件:`?',
+ `renzheng` int(11) NOT NULL COMMENT '认证情况,TBIN,re.nz.he.ng|?',
+ `ppint` int(11) NOT NULL COMMENT '|临时字典|,TINT,1:aaa.3:bbbb.5:cccc',
+ `npcyc` int(11) NOT NULL COMMENT '|执行周期|,CYC',
+ `runsec` int(11) NOT NULL COMMENT '执行用时|,SEC',
+ `acttm` int(11) NOT NULL COMMENT '活动期数|,INT,第?期',
+ `imgs` varchar(800) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动花絮,IMG,?50',
+ `ton` bigint(20) NOT NULL COMMENT '吨位|,TON',
+ `price` bigint(20) NOT NULL COMMENT '单价|,CNY',
+ `lat` int(11) NOT NULL COMMENT ',纬度',
+ `lng` int(11) NOT NULL COMMENT '|位置|,LOC,lat',
+ `pct` int(11) NOT NULL COMMENT '百分比|,PCT',
+ `url` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '链接,URL,跳转',
+ `weightg` bigint(20) NOT NULL COMMENT '体重|,KG,1,KG|1000|吨',
+ `eartmpr` int(11) NOT NULL COMMENT '耳温|,TC,3',
+ `qian` bigint(20) NOT NULL COMMENT '中式钱|,LNY',
+ `meishi` bigint(20) NOT NULL COMMENT '美式钱|,SNY',
+ `weight` bigint(20) NOT NULL COMMENT '重量|,WGT,G.*KG.TON,1',
+ `height` bigint(20) NOT NULL COMMENT '长度|,LGH',
+ `skt` bigint(20) NOT NULL COMMENT '科学数|,BET,SKT,1000,1',
+ `idcard` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '身份证号,MSK,******#*',
+ `addtimes` bigint(20) NOT NULL COMMENT '添加时间,DATE',
+ `content` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT ',介绍,BR',
+ `md` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT ',富文本,MD',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 78 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '复杂功能表' ROW_FORMAT = Dynamic;
+
+```
+
+---
+
+## 前端组件对应表
+
+| 列注释组件 | 前端HTML组件 | 说明 |
+|-----------|------------|------|
+| CATA | `xxx
+' . $art['descs'] . '
'; + echo '?',
+ `addr` varchar(180) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '详细地址',
+ `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '收件人',
+ `phone` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '联系电话',
+ `uptimes` bigint(20) NOT NULL COMMENT '更新时间,DATE',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 70 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '收货地址表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of ap_usr_shipaddr
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for ap_usr_suggest
+-- ----------------------------
+DROP TABLE IF EXISTS `ap_usr_suggest`;
+CREATE TABLE `ap_usr_suggest` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `vuser` bigint(20) NOT NULL COMMENT '所属用户,DB,ap_user',
+ `contract` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '联系方式',
+ `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '建议内容,BR',
+ `imgs` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '图片,IMG',
+ `addtimes` bigint(20) NOT NULL COMMENT '提交时间,DATE',
+ `replyuser` int(11) NOT NULL DEFAULT 0 COMMENT '答复人,CATA,adminuser',
+ `replytimes` bigint(20) NOT NULL DEFAULT 0 COMMENT '答复时间,DATE',
+ `replymsg` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '答复内容,BR',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '意见建议表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of ap_usr_suggest
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for ciy_bankcode
+-- ----------------------------
+DROP TABLE IF EXISTS `ciy_bankcode`;
+CREATE TABLE `ciy_bankcode` (
+ `id` bigint(20) NOT NULL COMMENT '联行号',
+ `bkcode` int(11) NOT NULL COMMENT '前三位银行码',
+ `name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '银行名称',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '中国联行号' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of ciy_bankcode
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for demo_normal
+-- ----------------------------
+DROP TABLE IF EXISTS `demo_normal`;
+CREATE TABLE `demo_normal` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID,ENID',
+ `auditstatus` int(11) NOT NULL COMMENT '|审核状态|,CATA,auditstatus',
+ `audituser` int(11) NOT NULL DEFAULT 0 COMMENT '审核人,CATU,adminuser',
+ `audittimes` bigint(20) NOT NULL COMMENT '审核时间,DATE',
+ `auditmsg` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '审核理由',
+ `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '默认标题',
+ `menuid` int(11) NOT NULL COMMENT '所属菜单,DB,zc_menu',
+ `filesize` int(11) NOT NULL COMMENT '文件大小|,FSIZE',
+ `metre` int(11) NOT NULL COMMENT '长度|,METRE',
+ `bankmoney` bigint(20) NOT NULL COMMENT '贷款金额|,WCNY',
+ `setdate` bigint(20) NOT NULL COMMENT '设置日期,DATE,Y-m-d',
+ `settimes` bigint(20) NOT NULL COMMENT '设置时间,DATE',
+ `dayclock` int(11) NOT NULL COMMENT '|营业时间|,TIME,H:i:s',
+ `downurl` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '|文档|,IMG,t',
+ `avar` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '头像,IMG1',
+ `isuse` int(11) NOT NULL COMMENT '|是否使用|,BOOL',
+ `isopen` int(11) NOT NULL COMMENT '|是否开启|,BOOL,开启.关闭',
+ `unit` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '库存单位,UNIT',
+ `sigstatus` int(11) NOT NULL COMMENT '|单选状态|,CATA,auditstatus',
+ `mauditstatus` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '多选状态,CATS,auditstatus|~',
+ `prodcata` int(11) NOT NULL COMMENT '组织结构,CATM,zc_depart',
+ `areacode` int(11) NOT NULL COMMENT '所在地区,CATM,ciy_arearpc|?',
+ `renzheng` int(11) NOT NULL COMMENT '认证情况,TBIN,re.nz.he.ng|?',
+ `ppint` int(11) NOT NULL COMMENT '|临时字典|,TINT,1:aaa.3:bbbb.5:cccc',
+ `npcyc` int(11) NOT NULL COMMENT '|执行周期|,CYC',
+ `runsec` int(11) NOT NULL COMMENT '执行用时|,SEC',
+ `acttm` int(11) NOT NULL COMMENT '活动期数|,INT,第?期',
+ `imgs` varchar(800) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动花絮,IMG,?50',
+ `ton` bigint(20) NOT NULL COMMENT '吨位|,TON',
+ `price` bigint(20) NOT NULL COMMENT '单价|,CNY',
+ `lat` int(11) NOT NULL COMMENT ',纬度',
+ `lng` int(11) NOT NULL COMMENT '|位置|,LOC,lat',
+ `pct` int(11) NOT NULL COMMENT '百分比|,PCT',
+ `url` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '链接,URL,跳转',
+ `weightg` bigint(20) NOT NULL COMMENT '体重|,KG,1,KG|1000|吨',
+ `eartmpr` int(11) NOT NULL COMMENT '耳温|,TC,3',
+ `qian` bigint(20) NOT NULL COMMENT '中式钱|,LNY',
+ `meishi` bigint(20) NOT NULL COMMENT '美式钱|,SNY',
+ `weight` bigint(20) NOT NULL COMMENT '重量|,WGT,G.*KG.TON,1',
+ `height` bigint(20) NOT NULL COMMENT '长度|,LGH',
+ `skt` bigint(20) NOT NULL COMMENT '科学数|,BET,SKT,1000,1',
+ `idcard` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '身份证号,MSK,******#*',
+ `addtimes` bigint(20) NOT NULL COMMENT '添加时间,DATE',
+ `content` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT ',介绍,BR',
+ `md` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT ',富文本,MD',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 78 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '复杂功能表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of demo_normal
+-- ----------------------------
+INSERT INTO `demo_normal` VALUES (11, 100, 10, 1746396705, '', '区块同步', 0, 0, 0, 0, 0, 0, 0, '', '', 2, 2, '', 0, '', 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 0, 0, 0, '', 1746396698, '', '[MD]');
+
+-- ----------------------------
+-- Table structure for doc_help
+-- ----------------------------
+DROP TABLE IF EXISTS `doc_help`;
+CREATE TABLE `doc_help` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `upid` int(11) NOT NULL COMMENT ',上级',
+ `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题',
+ `csort` int(11) NOT NULL DEFAULT 1 COMMENT '排序',
+ `isuse` int(11) NOT NULL DEFAULT 0 COMMENT '|公开|,BOOL',
+ `uptimes` bigint(20) NOT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 155 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '菜单表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of doc_help
+-- ----------------------------
+INSERT INTO `doc_help` VALUES (1, 0, '首页', 10, 1, 1751753699);
+INSERT INTO `doc_help` VALUES (10, 0, '快速了解', 10, 1, 1757412998);
+
+-- ----------------------------
+-- Table structure for www_content
+-- ----------------------------
+DROP TABLE IF EXISTS `www_content`;
+CREATE TABLE `www_content` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `cateid` int(11) NOT NULL COMMENT '所属栏目,DB,www_list_cate',
+ `name` varchar(180) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容主题',
+ `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT ',浓缩内容,BR',
+ `qutime` int(11) NOT NULL COMMENT '引用次数|',
+ `addtimes` bigint(20) NOT NULL COMMENT '添加时间,DATE',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 385 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '浓缩知识' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of www_content
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for www_customer
+-- ----------------------------
+DROP TABLE IF EXISTS `www_customer`;
+CREATE TABLE `www_customer` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `fromurl` varchar(180) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '来源页面',
+ `mobile` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '手机号',
+ `demandinfo` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '需求信息,BR',
+ `addtimes` bigint(20) NOT NULL COMMENT '提交时间,DATE',
+ `contacttimes` bigint(20) NOT NULL COMMENT '接待时间,DATE',
+ `memo` varchar(180) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '接待备注,BR',
+ `contactadmin` int(11) NOT NULL COMMENT '接待人,CATA,adminuser',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 385 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户线索' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of www_customer
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for www_keyword
+-- ----------------------------
+DROP TABLE IF EXISTS `www_keyword`;
+CREATE TABLE `www_keyword` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `cateid` int(11) NOT NULL COMMENT '所属栏目,DB,www_list_cate',
+ `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '关键词',
+ `usetime` int(11) NOT NULL COMMENT '使用次数|',
+ `addtimes` bigint(20) NOT NULL COMMENT '添加时间,DATE',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 385 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '关键词库' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of www_keyword
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for www_list_art
+-- ----------------------------
+DROP TABLE IF EXISTS `www_list_art`;
+CREATE TABLE `www_list_art` (
+ `id` int(11) NOT NULL COMMENT '|ID|',
+ `cateid` int(11) NOT NULL COMMENT '所属栏目,DB,www_list_cate',
+ `clickcnt` int(11) NOT NULL COMMENT '点击量|',
+ `icon` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '缩略图,IMG',
+ `name` varchar(180) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主标题',
+ `seotitle` varchar(180) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'SEO标题',
+ `keyw` varchar(180) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '关键词',
+ `author` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '作者',
+ `descs` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT ',摘要,BR',
+ `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT ',内容,MD',
+ `csort` int(11) NOT NULL COMMENT '|排序|',
+ `uptimes` bigint(20) NOT NULL COMMENT '更新时间,DATE',
+ `vadmin` int(11) NOT NULL COMMENT '操作人,CATA,adminuser',
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '已发文章' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of www_list_art
+-- ----------------------------
+INSERT INTO `www_list_art` VALUES (434, 2, 1001, '', '三星级农贸市场收费软件', '', '三星级农贸市场,三星级农贸市场收费软件,农贸市场', '', '很多人都知道,智慧农贸批发当下势头舒展,而软件作为农贸批发市场一般经营必不或缺的少部分,有着举足轻重的现象。市场方能通过网络上买卖称重数据,与网络上支出信息数据两', '\n很多人都知道,智慧农贸批发当下势头舒展,而软件作为农贸批发市场一般经营必不或缺的少部分,有着举足轻重的现象。市场方能通过网络上买卖称重数据,与网络上支出信息数据两者比较,构成解析,为市场上运作决策做应当统计及保证;为经营户提供了多样化、多平台、多渠道的计量手段,有效果减少了客户换零钱、找零钱、跑机械等困扰。同如今消费群众提供了1个安心、安全、快捷的买东西场所。\n
\n\n智慧农贸改造高星市场上精品化。在电脑部件、管理服务等角度提档更新,用心制作一批拥有示范引导效用的四星级及上面所说设计图市场。业态持续发展多方位。改进农贸市场谋划配置、琢磨以邻里重点方式为主新建或改建水产批发市场。进展网络上配送服务,采用互联网上下单、市场上发货、第三方配送的经营方式。\n
\n\n智能化果蔬批发选择媒体发布系统的好的地方:1、起到的作用资讯公示的结果,方便客户晓得市场内包含商户、菜价、优惠这个项目、检查内容等数据。 2、内容统一整理至云端,操作市场上运营方登入平台后台查询网上经营现状,既有利于农批市场对外招商引导流量,对内传达提高行业里服务质量,争创星级水产批发市场。\n
\n\n智能水产批发转型提升星级化。对乡村无星级网上及城区一星级及下面的农贸批发市场实行分批星级化改造,大幅提升三星级及以上水产批发市场在全市农批市场中的占比。对存在安全影响、规模小、功能差,不符合网上名称登记说明的市场,照章实施退出制度。\n
\n\n
\n
\n 随着计算机互联网通信能力、二维码读取、无绳射频识别能力(RFID)、远红外识别器、全球明确软件等等资讯传输设备的发展,物联网技巧从不可触摸通向现世,融合人们消费,宽泛使用在各产业,畜牧业也走进IoT聚焦时代。在促成农牧畜牧规模化、集成化、公开化、智能化、行业化、市场化、智能的进程中,不光一定要放牧康复技艺与工业化放牧的系统情况,也应该需要批量计算机信息使用软件研发。\n
\n\n 于IoT技艺的引导下,普通的“后院养殖”刚好逐渐消亡。随便专一的专业养殖场,或者传统养殖个体经营户,都会先便捷便利的坚持智能化的养殖操作执行。物联网技艺甚或最好于一样的养殖范围中,制作着不同的的放牧管理模式,到最后提升牧场的产能与价值,成为一个超级给力的“饲养高手”。\n
\n\n 奇博科学智能农牧管理系统在统计各类放牧全程的最宝贵经历的基础上做到网络与畜禽身份各类甄别电子耳标技艺相结合,遵守政府农业发展“整合资源、系统集成”的指导方针,重点是依据农牧业放牧标准化、人性化和质量安全体系建设说明,因此实现农牧业的品类、繁殖发育、饲料、豢养、检疫、组件、生长发育环境等创造生产、交易流程。凭据畜牧商品的生长的时候,个性化的付出饲料,达到细致饲养,降低成本。达到节省时间、增产增收的目标。\n
', 1, 0, 0); +INSERT INTO `www_list_art` VALUES (436, 2, 891, '', '纳服绩效系统软件', '', '纳服绩效系统软件,纳服绩效,', '', '18大以来,税务总局深层次履行施行政府涉及“严谨KPI维护”的品质,依靠国家对于“推进政府绩效总管”的部署,从前几年用税务KPI维护,从之前的版本到当下的新版本,连续订正、', '\n 18大以来,税务总局深层次履行施行政府涉及“严谨KPI维护”的品质,依靠国家对于“推进政府绩效总管”的部署,从前几年用税务KPI维护,从之前的版本到当下的新版本,连续订正、不畏荆棘成正途,促使标准规范越来越改善、考评实行更加严实、操作体制越发确定、综合作用更明显。航天金税三期上线走进了其中之一新的信息化时代。\n
\n\n 办税大厅是税务部门的服务,税务服务人员的显示则会代表了税务部门的名誉。办税员要养成优良的做事嗜好,每天上班前周全安排,每一笔业务认真查对,天天完工后认真清点,快速统计剖析,增加对细节的知名度,改错操作执行过失,为之后的作事积聚阅历。需要有稍强的生意技巧能力。纳税服务众多是杂事,小事,但做的有效果这些个琐细的、详细的、乏味的事件要较强的单子技巧能力,可以在第一个时候觉得详细上要调整的地方并且给出正确的的领会。\n
\n\n 增强结论按照,对税务单位负责人进行订单调整、提拔、升级的时候,应以考核结论为关键依据,可缩小人为缘由与不确定根源。税务单位平时考察结论与季度奖励领取相关。级别区别,依照KPI数据来源设定KPI等级规则,就如这样就可以对考核效果坚持分等,例如优、良、差等 。这么多的税收机关一直有自己对等级划分的规范,在目标绩效管控模块中就可以活跃定义。上海奇博科技航天金税三期办税服务服务大厅绩效考察维护工具是有这考察结果采用的功能\n
', 1, 0, 0); +INSERT INTO `www_list_art` VALUES (437, 2, 1539, '', '税务绩效管理方案', '', '税务绩效管理方案,税务绩效管理,', '', '曾经政府举行专题会议,指引要快点建设按照增强增值税管理替重要目标的“金税工程”。大会赞同用人民银行清理中心网络建设交叉审视工具,同期标出防伪税控平台需先试点,后采', '\n 曾经政府举行专题会议,指引要快点建设按照增强增值税管理替重要目标的“金税工程”。大会赞同用人民银行清理中心网络建设交叉审视工具,同期标出防伪税控平台需先试点,后采取。为团体实行此项工程项目,国家建立了国家税控工具搭建协调总管小组,下属“金税项目”做事部门,详细负责机构、调和平台建设办事。为航天金税三期上线指明了角度\n
\n\n 华夏税务项目部门仰仗厉害的内容软件,达到对考核数据的自动收集、的时候掌控和业绩评价,使我国国家税收总局必定追查绩效指标的进行进度,保证各个部门和各个干部都了解自身办事的短板和追赶的目标,彰显了绩效管理持续校正的根本要义。强化能力支撑,没有停止的提升绩效管理工作质效。强化组织保障,业绩维护博取税务骨干广博帮助。机构保障是税务公司部门KPI维护不可或缺的组成部分。用在中国我国税收总局和各个省份税收部门设置KPI管理需求岗位,重复的提高业绩管控的专业化水准。\n
\n\n 加强结论凭据,对税务机关负责人实行订单调整、选拔、晋级的时间,应该用考核结果替重要依据,可减少人为因素与不确切根源。税务机关平常考察结论与按季度分成发送挂钩。级数划分,遵照绩效数据来源要求绩效级别规则,如此便可以了对考察得分坚持分等,比如优、良、差等 。这些税务机关一直有自身对级数划分的准则,在目的业绩管理设备终端中绝对可以灵活设置。上海奇博科技航天金税三期税收服务服务大厅业绩考核维护工具便是具有这考核结果采取的功能\n
', 1, 0, 0); +INSERT INTO `www_list_art` VALUES (438, 2, 2039, '', '畜牧业智能养殖计步器', '', '畜牧业智能养殖计步器,畜牧业智能养殖,', '', '近年来,在中央对畜禽标准化规模畜牧等协助体制的展开下,我国畜牧业刚好身在由一般养殖向当今畜牧变革的重要年代。智能化放牧总管,就可以实现畜牧智能化,设计不同的的养殖', '
\n 近年来,在中央对畜禽标准化规模畜牧等协助体制的展开下,我国畜牧业刚好身在由一般养殖向当今畜牧变革的重要年代。智能化放牧总管,就可以实现畜牧智能化,设计不同的的养殖管理方式,提高养殖场的产量和价值,让养殖户快速已经是一个超级过得去的“养殖权威”。\n
\n\n 农牧业是全体农牧业生产中规模化水准最厉害,能力、设备与成本消耗相比而言聚集的范围之一。在畜牧养殖领域管控生活中,智能放牧总管方案的应用就能实现畜牧场地信息化、智慧远程管理,充分发挥物联网技术在部件养殖生产中的结果,能确保养殖场地内环境适宜放牧畜禽生长发育,实现精细化的维护,为养殖牛羊的深了、好的、高效、自然、安全创造条件,帮客户提高效率、降低成本、提高获取。普遍的放牧方式相较于农民来说不只是有浪费时间,还不要保证羊群的舒服状况是活动情况,智能放牧绝对可以去掉这个难题。\n
\n\n 奇博科技智能农牧管理系统其重点技术受到几个方面:一则是智能化穿设备的集成度;再者是对数据处理的AI算法。好的智能化家畜管理系统是要在一些这个运动牲口的此刻达成最准确的彩票预测。让AI跟畜牧养殖学更好用的连结,应该更新十分的的信息数据相关性,进而更进执行,进步准确率。集成智能化无绳射频传感RFID、无线通讯、智能控制系统和下载监控系统等专业技艺,对放牧空气、生长发育状态等实行全方面监控管控,实行认真归纳。\n
', 1, 0, 0); +INSERT INTO `www_list_art` VALUES (439, 2, 1229, '', '大型蔬菜批发市场管理系统', '', '大型蔬菜批发市场,大型蔬菜批发市场管理系统', '', '城市化进展提升极速,各类大楼拔地而起,科技发展更是蒸蒸日上。而水产批发市场却好像被忽视般,与“高大上”的城区不相符合,必定是落后,甚至于脏乱的。自然,现在各监控部', '\n城市化进展提升极速,各类大楼拔地而起,科技发展更是蒸蒸日上。而水产批发市场却好像被忽视般,与“高大上”的城区不相符合,必定是落后,甚至于脏乱的。自然,现在各监控部门已经注意到这一点,在不同省份农贸市场监控部门参观了改造革新的设计图智能蔬菜批发市场后,也都就意味着智能化水产批发以后已往N多年的转型趋向和焦点新闻。\n
\n\n智能化蔬菜批发应该需要用到食品安全追溯工具,普遍模块寻常包容:使用安心水产批发市场食品安全追溯系统,就能够溯源农批市场的客户信息、供求资讯、供应内容、菜品资讯以及检验资讯,让农贸市场感受保证更放心、更安心,让我国看管更快捷方便。顾客最好盘查到买菜品从批发、流通、再到网上的供应商源头信息或者供给日期等内容,源头溯源盘查。\n
\n\n智慧水产批发选择媒体发布工具的好的地方:1、获得的效果信息公示的影响,操作购买者了解市场内涵概企业、菜价、优惠活动、检验信息等信息数据。 2、讯息统一聚集至云端,便利网上运营方登入系统后台看一下市场运作状况,既有利于农贸市场对外招商流量导入,对内推销提升网上服务质量,争创星级农贸市场。\n
\n\n智能水产批发改革看管技术智慧化。加速推进水产批发市场智慧化改造,运用智能配件设备,展开蔬菜批发市场智能化化维护,因此实现智能付账、购买溯源、计量总管、报价监测等智能化总管和技术模式,为消费者提供便利化智能化化服务。 四周整顿有序化。农贸批发市场界线500米内,原则上不可以成立“临时疏导点”。水产批发市场地域200米内,不提倡设置与市场内运作水产、肉食类、蔬菜、豆制品、熟食等同种用品的运作部门。\n
\n\n
\n
| # | '; + foreach ($heads as $arr) { + $html .= '' . $arr['name'] . ' | '; + } + $html .= '' . $lineidx . ' | ';
+ $bempty = true;
+ $unqs = array();
+ $csql = new \ciy\sql('ap_art_post');
+ foreach ($heads as $arr) {
+ $name = $arr['name'];
+ $errmsg = ''; //数据有误,显示红色说明
+ $showdat = ''; //显示在表格中的数据
+ if ($arr['idx'] > -1)
+ $showdat = trim($datas[$rowidx][$arr['idx']]);
+ if ($showdat == '--')
+ $showdat = '';
+ $value = $showdat; //在表单中的数据(转换后)
+ $ext = ''; //扩展表单
+ if ($name == '行码') {
+ if (empty($showdat)) {
+ $value = 0;
+ $showdat = '新增';
+ } else {
+ $id = deid($showdat);
+ if ($id == 0)
+ $errmsg = $name . '解析错误';
+ else {
+ $csqlchk = new \ciy\sql('ap_art_post');
+ $csqlchk->where('id', $id)->column('id');
+ $chkid = toint($db->get1($csqlchk));
+ if ($chkid != $id)
+ $errmsg = $name . '在数据库中不存在';
+ $value = $id;
+ }
+ }
+ } else if ($name == '版块') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ } else {
+ $showdat = str_replace(',', '', $showdat);
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint($showdat);
+ }
+ } else if ($name == '文章状态') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $value = dcode($code_artstatus, $showdat);
+ if ($value == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ }
+ } else if ($name == '排序位') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ } else {
+ $value = dcode($code_artsort, $showdat);
+ if ($value == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ }
+ } else if ($name == '文章标题') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ } else {
+ }
+ } else if ($name == '来源') {
+ if (empty($showdat)) {
+ $value = '';
+ } else {
+ }
+ } else if ($name == '作者') {
+ if (empty($showdat)) {
+ $value = '';
+ } else {
+ }
+ } else if ($name == '精读数') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', $showdat);
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint($showdat);
+ }
+ } else if ($name == '阅读数') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', $showdat);
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint($showdat);
+ }
+ } else if ($name == '摘要') {
+ if (empty($showdat)) {
+ $value = '';
+ } else {
+ }
+ } else if ($name == '撰写人') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $value = dcode($code_inputuser, $showdat);
+ if ($value == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ }
+ } else if ($name == '发布时间') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $value = tostamp($showdat);
+ if ($value === 0) {
+ $errmsg = $name . '时间格式错误';
+ } else {
+ $showdat = date('Y-m-d H:i', $value);
+ }
+ }
+ }
+ if (!empty($showdat))
+ $bempty = false;
+ if (empty($errmsg))
+ $hrhtml .= '' . $showdat . '' . $ext . ' | ';
+ else
+ $hrhtml .= '' . $showdat . ' | ';
+ }
+ if ($bempty)
+ continue;
+ if (count($unqs) > 0) {
+ $unq = implode('|', $unqs);
+ if (in_array($unq, $uniques))
+ $firsthtml = '重复 | ';
+ else {
+ $uniques[] = $unq;
+ $csql->column('id');
+ $chkid = toint($db->get1($csql));
+ if ($chkid > 0 && (($id > 0 && $chkid != $id) || $id == 0))
+ $firsthtml = '重复 | ';
+ }
+ }
+ $html .= '
|---|---|
共' . $cnt . '条数据';
+ return succjson(array('html' => $html, 'count' => $cnt));
+ }
+
+ public static function json_importxls_data() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p i'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $total = $post->getint('total');
+ try {
+ $db->begin();
+ for ($i = 1; $i <= $total; $i++) {
+ $id = $post->getint('id_' . $i);
+ $updata = array();
+ $updata['sectionid'] = $post->get('sectionid_' . $i);
+ $updata['artstatus'] = $post->get('artstatus_' . $i);
+ $updata['artsort'] = $post->get('artsort_' . $i);
+ $updata['name'] = $post->get('name_' . $i);
+ $updata['source'] = $post->get('source_' . $i);
+ $updata['author'] = $post->get('author_' . $i);
+ $updata['studycnt'] = $post->get('studycnt_' . $i);
+ $updata['readcnt'] = $post->get('readcnt_' . $i);
+ $updata['descs'] = $post->get('descs_' . $i);
+ $updata['inputuser'] = $post->get('inputuser_' . $i);
+ $updata['pubtimes'] = $post->get('pubtimes_' . $i);
+ $csql = new \ciy\sql('ap_art_post');
+ if ($id == 0) {
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增导入失败:' . $db->error);
+ } else {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新导入失败:' . $db->error);
+ }
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ return succjson();
+ }
+}
diff --git a/web/admin/ap/art_section.html b/web/admin/ap/art_section.html
new file mode 100644
index 0000000..cf90565
--- /dev/null
+++ b/web/admin/ap/art_section.html
@@ -0,0 +1,155 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/art_section.php b/web/admin/ap/art_section.php
new file mode 100644
index 0000000..3a49d8d
--- /dev/null
+++ b/web/admin/ap/art_section.php
@@ -0,0 +1,187 @@
+get('query');
+ $csql = new \ciy\sql('ap_art_section');
+ $csql->where('ngroup like', objstr($query, 'ngroup'));
+ $csql->where('name like', objstr($query, 'name'));
+ $csql->where('artcnt like', objstr($query, 'artcnt'));
+ $csql->where('adminuser', objstr($query, 'adminuser'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_art_section');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'ngroup', 'name' => '分组名', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'name', 'name' => '版块名称', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'artcnt', 'name' => '文章数', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'select', 'form' => 'adminuser', 'name' => '责任人', 'all' => '全部', 'select' => 'adminuser');
+ $ret['searchinput'] = $input;
+ }
+ return succjson($ret);
+ }
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $ngroup = $post->get('ngroup');
+ $name = $post->get('name');
+ if (empty($name))
+ return errjson('请填写版块名称');
+ $datarow = null;
+ if ($id > 0) {
+ $csql = new \ciy\sql('ap_art_section');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ }
+ try {
+ $db->begin();
+ $updata = array();
+ $updata['ngroup'] = $ngroup;
+ $updata['name'] = $name;
+ $updata['adminuser'] = $rsuser['id'];
+ $updata['addtimes'] = tostamp();
+ $csql = new \ciy\sql('ap_art_section');
+ if ($id > 0) {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ } else {
+ $updata['addtimes'] = tostamp();
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增失败:' . $db->error);
+ $id = $db->insert_id();
+ }
+ $updata['id'] = $id;
+ savelogdb($db, $rsuser['id'], 'ap_art_section', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_art_section');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_art_section');
+ savelogdb($db, $rsuser['id'], 'ap_art_section', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'ngroup', 'name' => '分组名');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'name', 'name' => '版块名称');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'auditcnt', 'name' => '待审数');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'artcnt', 'name' => '文章数');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'adminuser', 'name' => '责任人');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'addtimes', 'name' => '创建时间');
+ $code_adminuser = getcatas($db, 'adminuser');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'adminuser')
+ $val = ccode($code_adminuser, $val);
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/art_vent.html b/web/admin/ap/art_vent.html
new file mode 100644
index 0000000..159d838
--- /dev/null
+++ b/web/admin/ap/art_vent.html
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/art_vent.php b/web/admin/ap/art_vent.php
new file mode 100644
index 0000000..fa9ad90
--- /dev/null
+++ b/web/admin/ap/art_vent.php
@@ -0,0 +1,198 @@
+get('query');
+ $csql = new \ciy\sql('ap_art_vent');
+ $liid = objint($query, 'liid');
+ if ($liid == 1)
+ $csql->where('audituser=0');
+ if ($liid == 2)
+ $csql->where('audituser>0');
+ $csql->where('sectionid', get('_sectionid'));
+ $val = objstr($query, 'artid');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_art_post');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('artid', $trow['id']);
+ $query['artid'] = $trow['name'];
+ } else {
+ $csql->where('artid=0');
+ }
+ }
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->where('content like', objstr($query, 'content'));
+ $csql->wheredaterange('pubtimes', objstr($query, 'pubtimes'));
+ $csql->where('audituser', objstr($query, 'audituser'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if ($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_art_vent');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'artid', 'name' => '文章', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'content', 'name' => '内容', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'pubtimes', 'name' => '反馈时间');
+ $input[] = array('type' => 'select', 'form' => 'audituser', 'name' => '审核人', 'all' => '全部', 'select' => 'adminuser');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_art_section'] = getrelation($db, $rows, 'ap_art_section', 'sectionid');
+ $ret['ap_art_post'] = getrelation($db, $rows, 'ap_art_post', 'artid');
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_art_vent');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_art_vent');
+ savelogdb($db, $rsuser['id'], 'ap_art_vent', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+ public static function json_read() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $updata = array();
+ $updata['audituser'] = $rsuser['id'];
+ $csql = new \ciy\sql('ap_art_vent');
+ $csql->where('id in', $ids);
+ if ($db->update($csql, $updata) === false)
+ return errjson($db->error);
+ $ret['data'] = $updata;
+ $ret['ids'] = explode(',', $ids);
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'sectionid', 'name' => '版块');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'artid', 'name' => '版块');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'content', 'name' => '内容');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'pubtimes', 'name' => '反馈时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'audituser', 'name' => '审核人');
+ $code_sectionid = getrelation($db, $rows, 'ap_art_section', 'sectionid', 'id,name');
+ $code_artid = getrelation($db, $rows, 'ap_art_post', 'artid', 'id,name');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $code_audituser = getcatas($db, 'adminuser');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'sectionid')
+ $val = ccode($code_sectionid, $val);
+ if ($field == 'artid')
+ $val = ccode($code_artid, $val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'pubtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'audituser')
+ $val = ccode($code_audituser, $val);
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/banner.html b/web/admin/ap/banner.html
new file mode 100644
index 0000000..fa51291
--- /dev/null
+++ b/web/admin/ap/banner.html
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/banner.php b/web/admin/ap/banner.php
new file mode 100644
index 0000000..8b3777d
--- /dev/null
+++ b/web/admin/ap/banner.php
@@ -0,0 +1,129 @@
+get('query');
+ $csql = new \ciy\sql('ap_banner');
+ $csql->where('groupcode like', objstr($query, 'groupcode'));
+ $csql->where('url like', objstr($query, 'url'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_banner');
+ foreach ($field as $fr => $v) {
+ if ($post->is('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'groupcode', 'name' => '组别代码', 'prop' => ' style="width:6em;"' );
+ $input[] = array('type' => 'input', 'form' => 'url', 'name' => '链接', 'prop' => ' style="width:8em;"' );
+ $ret['searchinput'] = $input;
+ }
+ return succjson($ret);
+ }
+
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $groupcode = $post->get('groupcode');
+ $img = $post->get('img');
+ $url = $post->get('url');
+ if (empty($groupcode))
+ return errjson('请填写组别代码');
+ if (empty($img))
+ return errjson('请填写轮播图');
+ $datarow = null;
+ if ($id > 0) {
+ $csql = new \ciy\sql('ap_banner');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ }
+ try {
+ $db->begin();
+ $updata = array();
+ $updata['groupcode'] = $groupcode;
+ $updata['img'] = $img;
+ $updata['url'] = $url;
+ $csql = new \ciy\sql('ap_banner');
+ if ($id > 0) {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ } else {
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增失败:' . $db->error);
+ $id = $db->insert_id();
+ }
+ $updata['id'] = $id;
+ savelogdb($db, $rsuser['id'], 'ap_banner', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_banner');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_banner');
+ savelogdb($db, $rsuser['id'], 'ap_banner', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+}
\ No newline at end of file
diff --git a/web/admin/ap/cash_ie.html b/web/admin/ap/cash_ie.html
new file mode 100644
index 0000000..9e59e05
--- /dev/null
+++ b/web/admin/ap/cash_ie.html
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/cash_ie.php b/web/admin/ap/cash_ie.php
new file mode 100644
index 0000000..2ac9a43
--- /dev/null
+++ b/web/admin/ap/cash_ie.php
@@ -0,0 +1,186 @@
+get('query');
+ $csql = new \ciy\sql('ap_cash_ie');
+ $liid = objint($query, 'liid');
+ if ($liid > 0)
+ $csql->where('cashietype', $liid);
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->wherenumrange('iemoney', objstr($query, 'iemoney_1'), objstr($query, 'iemoney_2'), 100);
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->where('name like', objstr($query, 'name'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_cash_ie');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'num', 'form' => 'iemoney', 'name' => '金额', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '发生时间');
+ $input[] = array('type' => 'input', 'form' => 'name', 'name' => '摘要', 'prop' => ' style="width:8em;"');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+
+ public static function json_getdata() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $act = $post->get('act');
+ if ($id > 0) {
+ $csql = new \ciy\sql('ap_cash_ie');
+ $csql->where('id', $id);
+ $row = $db->getone($csql);
+ if (!is_array($row))
+ return errjson('数据不存在');
+ if ($act == 'view' || $act == 'review') {
+ $csql = (new \ciy\sql('ap_user'))->column('id,name');
+ $csql->where('id', $row['vuser']);
+ $ret['ap_user'] = $db->get($csql);
+ }
+ } else {
+ $row = array();
+ }
+ $ret['data'] = $row;
+ if ($act == 'edit') {
+ $csql = (new \ciy\sql('ap_user'))->column('id,name');
+ $ret['ap_user'] = $db->get($csql);
+ }
+ return succjson($ret);
+ }
+
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_cash_ie');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_cash_ie');
+ savelogdb($db, $rsuser['id'], 'ap_cash_ie', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'cashietype', 'name' => '收支分类');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'iemoney', 'name' => '金额');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '发生时间');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'name', 'name' => '摘要');
+ $code_cashietype = getcatas($db, 'cashietype');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'cashietype')
+ $val = ccode($code_cashietype, $val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'iemoney')
+ $val = number_format($val / 100, 2);
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/cash_in.html b/web/admin/ap/cash_in.html
new file mode 100644
index 0000000..22989be
--- /dev/null
+++ b/web/admin/ap/cash_in.html
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/cash_in.php b/web/admin/ap/cash_in.php
new file mode 100644
index 0000000..59eefcd
--- /dev/null
+++ b/web/admin/ap/cash_in.php
@@ -0,0 +1,188 @@
+get('query');
+ $csql = new \ciy\sql('ap_cash_in');
+ $liid = objint($query, 'liid');
+ if ($liid == 1)
+ $csql->where('paytimes=0');
+ if ($liid == 2)
+ $csql->where('paytimes>0');
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->wherenumrange('cashmoney', objstr($query, 'cashmoney_1'), objstr($query, 'cashmoney_2'), 100);
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->where('name like', objstr($query, 'name'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_cash_in');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'num', 'form' => 'cashmoney', 'name' => '金额', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '发生时间');
+ $input[] = array('type' => 'input', 'form' => 'name', 'name' => '摘要', 'prop' => ' style="width:8em;"');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+
+ public static function json_getdata() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $act = $post->get('act');
+ if ($id > 0) {
+ $csql = new \ciy\sql('ap_cash_in');
+ $csql->where('id', $id);
+ $row = $db->getone($csql);
+ if (!is_array($row))
+ return errjson('数据不存在');
+ if ($act == 'view' || $act == 'review') {
+ $csql = (new \ciy\sql('ap_user'))->column('id,name');
+ $csql->where('id', $row['vuser']);
+ $ret['ap_user'] = $db->get($csql);
+ }
+ } else {
+ $row = array();
+ }
+ $ret['data'] = $row;
+ if ($act == 'edit') {
+ $csql = (new \ciy\sql('ap_user'))->column('id,name');
+ $ret['ap_user'] = $db->get($csql);
+ }
+ return succjson($ret);
+ }
+
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_cash_in');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_cash_in');
+ savelogdb($db, $rsuser['id'], 'ap_cash_in', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'cashintype', 'name' => '收入分类');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'cashmoney', 'name' => '金额');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '发生时间');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'name', 'name' => '摘要');
+ $code_cashintype = getcatas($db, 'cashintype');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'cashintype')
+ $val = ccode($code_cashintype, $val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'cashmoney')
+ $val = number_format($val / 100, 2);
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/cash_out_apply.html b/web/admin/ap/cash_out_apply.html
new file mode 100644
index 0000000..95053b0
--- /dev/null
+++ b/web/admin/ap/cash_out_apply.html
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/cash_out_apply.php b/web/admin/ap/cash_out_apply.php
new file mode 100644
index 0000000..6869b58
--- /dev/null
+++ b/web/admin/ap/cash_out_apply.php
@@ -0,0 +1,225 @@
+get('query');
+ $csql = new \ciy\sql('ap_cash_out');
+ $liid = objint($query, 'liid');
+ if ($liid > 0)
+ $csql->where('cashstatus', $liid);
+ else
+ $csql->where('cashstatus=10');
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->where('cashtype', objstr($query, 'cashtype'));
+ $csql->wherenumrange('cashmoney', objstr($query, 'cashmoney_1'), objstr($query, 'cashmoney_2'), 100);
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->where('cashno like', objstr($query, 'cashno'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if ($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_cash_out');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'select', 'form' => 'cashtype', 'name' => '提现方式', 'all' => '全部', 'select' => '独立纳税.个人微信');
+ $input[] = array('type' => 'num', 'form' => 'cashmoney', 'name' => '金额', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '申请时间');
+ $input[] = array('type' => 'input', 'form' => 'cashno', 'name' => '支付编号', 'prop' => ' style="width:8em;"');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+ public static function json_audit() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $act = $post->getint('act');
+ $auditmsg = $post->get('auditmsg');
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ if ($act == 2) {
+ if (empty($auditmsg))
+ return errjson('请填写拒绝原因');
+ }
+ $csql = new \ciy\sql('ap_cash_out');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $ids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ if ($row['cashstatus'] != 10)
+ continue;
+ if ($act == 2) { //退余额
+ \web\cwebcomon::usercashoe($db, 11, $row['vuser'], $row['cashmoney'], '提现审核拒绝');
+ }
+ $id = $row['id'];
+ $updata = array();
+ if ($act == 1) {
+ if ($row['cashtype'] == 1)
+ $updata['cashstatus'] = 50;
+ else
+ $updata['cashstatus'] = 20;
+ } else {
+ $updata['cashstatus'] = 90;
+ $updata['auditmsg'] = $auditmsg;
+ }
+ $csql = new \ciy\sql('ap_cash_out');
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ $updata['id'] = $id;
+ $ids[] = $id;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ $ret['ids'] = $ids;
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_cash_out');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ if ($row['cashstatus'] < 90)
+ continue;
+ if ($row['addtimes'] > time() - 86400 * 30)
+ continue;
+ $delid = $row['id'];
+ delme($db, $delid, 'ap_cash_out');
+ savelogdb($db, $rsuser['id'], 'ap_cash_out', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'cashstatus', 'name' => '提现状态');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'cashtype', 'name' => '提现方式');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'cashmoney', 'name' => '金额');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '申请时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'cashtimes', 'name' => '支付时间');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'cashno', 'name' => '支付编号');
+ $code_cashstatus = getcatas($db, 'cashstatus');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $code_cashtype = $db->getdbcodes('ap_cash_out', 'cashtype');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'cashstatus')
+ $val = ccode($code_cashstatus, $val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'cashtype')
+ $val = ($val == 1 ? $code_cashtype[0]['name'] : @$code_cashtype[1]['name']);
+ if ($field == 'cashmoney')
+ $val = number_format($val / 100, 2);
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'cashtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/cash_out_inv.html b/web/admin/ap/cash_out_inv.html
new file mode 100644
index 0000000..1458328
--- /dev/null
+++ b/web/admin/ap/cash_out_inv.html
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/cash_out_inv.php b/web/admin/ap/cash_out_inv.php
new file mode 100644
index 0000000..b104c3f
--- /dev/null
+++ b/web/admin/ap/cash_out_inv.php
@@ -0,0 +1,227 @@
+get('query');
+ $csql = new \ciy\sql('ap_cash_out');
+ $liid = objint($query, 'liid');
+ if ($liid > 0)
+ $csql->where('cashstatus', $liid);
+ else
+ $csql->where('cashstatus=30');
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->where('cashtype', objstr($query, 'cashtype'));
+ $csql->wherenumrange('cashmoney', objstr($query, 'cashmoney_1'), objstr($query, 'cashmoney_2'), 100);
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->where('cashno like', objstr($query, 'cashno'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if ($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_cash_out');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $field['bankaccount']['c'] = '';
+ $field['bankname']['c'] = '';
+ $field['bankno']['c'] = '';
+ $field['bankcode']['c'] = '';
+ $field['cashno']['c'] = '';
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'select', 'form' => 'cashtype', 'name' => '提现方式', 'all' => '全部', 'select' => '独立纳税.个人微信');
+ $input[] = array('type' => 'num', 'form' => 'cashmoney', 'name' => '金额', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '申请时间');
+ $input[] = array('type' => 'input', 'form' => 'cashno', 'name' => '支付编号', 'prop' => ' style="width:8em;"');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+ public static function json_audit() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $act = $post->getint('act');
+ $auditmsg = $post->get('auditmsg');
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ if ($act == 2) {
+ if (empty($auditmsg))
+ return errjson('请填写拒绝原因');
+ }
+ $csql = new \ciy\sql('ap_cash_out');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $ids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ if ($row['cashstatus'] != 30)
+ continue;
+ if ($act == 2) { //退余额
+ \web\cwebcomon::usercashoe($db, 11, $row['vuser'], $row['cashmoney'], '提现发票拒绝');
+ }
+ $id = $row['id'];
+ $updata = array();
+ if ($act == 1) {
+ $updata['cashstatus'] = 50;
+ } else {
+ $updata['cashstatus'] = 90;
+ $updata['auditmsg'] = $auditmsg;
+ }
+ $csql = new \ciy\sql('ap_cash_out');
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ $updata['id'] = $id;
+ $ids[] = $id;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ $ret['ids'] = $ids;
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_cash_out');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ if ($row['cashstatus'] < 90)
+ continue;
+ if ($row['addtimes'] > time() - 86400 * 30)
+ continue;
+ $delid = $row['id'];
+ delme($db, $delid, 'ap_cash_out');
+ savelogdb($db, $rsuser['id'], 'ap_cash_out', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'cashstatus', 'name' => '提现状态');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'cashtype', 'name' => '提现方式');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'cashmoney', 'name' => '金额');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '申请时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'cashtimes', 'name' => '支付时间');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'cashno', 'name' => '支付编号');
+ $code_cashstatus = getcatas($db, 'cashstatus');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $code_cashtype = $db->getdbcodes('ap_cash_out', 'cashtype');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'cashstatus')
+ $val = ccode($code_cashstatus, $val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'cashtype')
+ $val = ($val == 1 ? $code_cashtype[0]['name'] : @$code_cashtype[1]['name']);
+ if ($field == 'cashmoney')
+ $val = number_format($val / 100, 2);
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'cashtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/cash_out_transfer.html b/web/admin/ap/cash_out_transfer.html
new file mode 100644
index 0000000..8002cce
--- /dev/null
+++ b/web/admin/ap/cash_out_transfer.html
@@ -0,0 +1,214 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/cash_out_transfer.php b/web/admin/ap/cash_out_transfer.php
new file mode 100644
index 0000000..2a8c14e
--- /dev/null
+++ b/web/admin/ap/cash_out_transfer.php
@@ -0,0 +1,302 @@
+get('query');
+ $csql = new \ciy\sql('ap_cash_out');
+ $liid = objint($query, 'liid');
+ if ($liid > 0)
+ $csql->where('cashstatus', $liid);
+ else
+ $csql->where('cashstatus=50');
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->where('cashtype', objstr($query, 'cashtype'));
+ $csql->wherenumrange('cashmoney', objstr($query, 'cashmoney_1'), objstr($query, 'cashmoney_2'), 100);
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->where('cashno like', objstr($query, 'cashno'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if ($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_cash_out');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $field['invfile']['c'] = '';
+ $field['invcode']['c'] = '';
+ $field['cashmoney']['c'] = '打款金额|,CNY';
+ $field['taxmoney']['c'] = '';
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'select', 'form' => 'cashtype', 'name' => '提现方式', 'all' => '全部', 'select' => '银行.微信');
+ $input[] = array('type' => 'num', 'form' => 'cashmoney', 'name' => '金额', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '申请时间');
+ $input[] = array('type' => 'input', 'form' => 'cashno', 'name' => '支付编号', 'prop' => ' style="width:8em;"');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+ public static function json_audit() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $auditstatus = $post->getint('auditstatus');
+ $auditmsg = $post->get('auditmsg');
+ $cashno = $post->get('cashno');
+ $id = $post->getint('id');
+ if ($auditstatus == 90) {
+ if (empty($auditmsg))
+ return errjson('请填写拒绝原因');
+ } else {
+ if (empty($cashno))
+ return errjson('请填写支付流水号');
+ }
+ $csql = new \ciy\sql('ap_cash_out');
+ $csql->where('id', $id);
+ $row = $db->getone($csql);
+ if (!is_array($row))
+ return errjson('数据不存在');
+ if ($row['cashstatus'] != 50)
+ return errjson('数据状态不是待支付');
+ $ids = array();
+ try {
+ $db->begin();
+ if ($auditstatus == 90) { //退余额
+ $updata = array();
+ \web\cwebcomon::usercashoe($db, 11, $row['vuser'], $row['cashmoney'], '提现支付拒绝');
+ }
+ $id = $row['id'];
+ $updata = array();
+ if ($auditstatus == 90) {
+ $updata['cashstatus'] = 90;
+ $updata['auditmsg'] = $auditmsg;
+ } else {
+ $updata['cashstatus'] = 100;
+ $updata['cashtimes'] = tostamp();
+ $updata['cashno'] = $cashno;
+ }
+ $csql = new \ciy\sql('ap_cash_out');
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ $updata['id'] = $id;
+ $ids[] = $id;
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ $ret['ids'] = $ids;
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_cash_out');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ if ($row['cashstatus'] < 90)
+ continue;
+ if ($row['addtimes'] > time() - 86400 * 30)
+ continue;
+ $delid = $row['id'];
+ delme($db, $delid, 'ap_cash_out');
+ savelogdb($db, $rsuser['id'], 'ap_cash_out', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'cashmoney', 'name' => '打款金额');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankaccount', 'name' => '账户名称');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankno', 'name' => '银行卡号');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankname', 'name' => '开户银行');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankcode', 'name' => '联行号');
+ $code_cashstatus = getcatas($db, 'cashstatus');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $code_cashtype = $db->getdbcodes('ap_cash_out', 'cashtype');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'cashstatus')
+ $val = ccode($code_cashstatus, $val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'cashtype')
+ $val = ($val == 1 ? $code_cashtype[0]['name'] : @$code_cashtype[1]['name']);
+ if ($field == 'cashmoney') {
+ $val = $row[$field];
+ if ($row['taxmoney'] > 0)
+ $val -= $row['taxmoney'];
+ $val = number_format($val / 100, 2);
+ }
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'cashtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+ public static function json_exporttaxxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $month = $post->getint('month');
+ $monthend = strtotime("+1 month", $month);
+ $csql = new \ciy\sql('ap_cash_out');
+ $csql->where('cashstatus', 100);
+ $csql->where('taxmoney>=0');
+ $csql->where('cashtimes>=', $month);
+ $csql->where('cashtimes<', $monthend);
+ $csql->order('vuser,cashtimes');
+ $rows = $db->get($csql);
+ //姓名与账户名称不符,且未银行卡的,风控提示
+
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'name', 'name' => '姓名');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'idid', 'name' => '身份证号');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'cashmoney', 'name' => '涉税金额');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'taxmoney', 'name' => '个税金额');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankno', 'name' => '银行卡号');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankname', 'name' => '开户银行');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '申请时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'cashtimes', 'name' => '支付时间');
+ $code_vuser = getrelation($db, $rows, 'ap_usr_ext', 'vuser', 'id,truename,idid');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'name')
+ $val = ccode($code_vuser, $row['vuser'], 'id', 'truename');
+ if ($field == 'idid')
+ $val = ccode($code_vuser, $row['vuser'], 'id', 'idid');
+ if ($field == 'cashmoney')
+ $val = number_format($val / 100, 2);
+ if ($field == 'taxmoney')
+ $val = number_format($val / 100, 2);
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'cashtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = '个税数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/invoicedetail.html b/web/admin/ap/invoicedetail.html
new file mode 100644
index 0000000..a8a3d0f
--- /dev/null
+++ b/web/admin/ap/invoicedetail.html
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/invoicedetail.php b/web/admin/ap/invoicedetail.php
new file mode 100644
index 0000000..dd11cef
--- /dev/null
+++ b/web/admin/ap/invoicedetail.php
@@ -0,0 +1,197 @@
+get('query', array());
+ $csql = new \ciy\sql('ap_invoicedetail');
+ $csql->where('name like', objstr($query, 'name'));
+ $csql->wheredaterange('uptimes', objstr($query, 'uptimes'));
+ $val = objstr($query, 'adminuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('zc_cata');
+ $csqlt->where('cbid in (select id from zc_cata where cbid=0 and codeid=\'adminuser\')');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('adminuser', $trow['codeid']);
+ $query['adminuser'] = $trow['name'];
+ } else {
+ $csql->where('adminuser=0');
+ }
+ }
+ $csql->where('memo like', objstr($query, 'memo'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post, $rsuser);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_invoicedetail');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'name', 'name' => '名称', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'uptimes', 'name' => '更新时间');
+ $input[] = array('type' => 'input', 'form' => 'adminuser', 'name' => '维护人', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'memo', 'name' => '备注信息', 'prop' => ' style="width:8em;"');
+ $ret['searchinput'] = $input;
+ }
+ return succjson($ret);
+ }
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $name = $post->get('name');
+ $adminuser = $post->getint('adminuser');
+ $memo = $post->get('memo');
+ if (empty($name))
+ return errjson('请填写名称');
+ $datarow = null;
+ if ($id > 0) {
+ $csql = new \ciy\sql('ap_invoicedetail');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ }
+ try {
+ $db->begin();
+ $updata = array();
+ $updata['name'] = $name;
+ $updata['uptimes'] = tostamp();
+ $updata['adminuser'] = $adminuser;
+ $updata['memo'] = $memo;
+ $csql = new \ciy\sql('ap_invoicedetail'); //auto
+ if ($id > 0) {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ } else {
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增失败:' . $db->error);
+ $id = $db->insert_id();
+ }
+ $updata['id'] = $id;
+ //savelogdb($db, $rsuser['id'], 'ap_invoicedetail', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_invoicedetail');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_invoicedetail');
+ savelogdb($db, $rsuser['id'], 'ap_invoicedetail', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post, $rsuser);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'name', 'name' => '名称');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'uptimes', 'name' => '更新时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'adminuser', 'name' => '维护人');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'memo', 'name' => '备注信息');
+ $code_adminuser = getcatas($db, 'adminuser');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'uptimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'adminuser')
+ $val = ccode($code_adminuser, $val);
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = '发票类型数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/invoicetitle.html b/web/admin/ap/invoicetitle.html
new file mode 100644
index 0000000..44d1949
--- /dev/null
+++ b/web/admin/ap/invoicetitle.html
@@ -0,0 +1,176 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/invoicetitle.php b/web/admin/ap/invoicetitle.php
new file mode 100644
index 0000000..f704407
--- /dev/null
+++ b/web/admin/ap/invoicetitle.php
@@ -0,0 +1,201 @@
+get('query');
+ $csql = new \ciy\sql('ap_invoicetitle');
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->where('name like', objstr($query, 'name'));
+ $csql->where('taxnumber like', objstr($query, 'taxnumber'));
+ $csql->where('bankname like', objstr($query, 'bankname'));
+ $csql->wheredaterange('uptimes', objstr($query, 'uptimes'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_invoicetitle');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'name', 'name' => '名称', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'taxnumber', 'name' => '税号', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'bankname', 'name' => '银行名称', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'uptimes', 'name' => '更新时间');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $name = $post->get('name');
+ $taxnumber = $post->get('taxnumber');
+ $addr = $post->get('addr');
+ $phone = $post->get('phone');
+ $bankname = $post->get('bankname');
+ $bankaccount = $post->get('bankaccount');
+ if (empty($name))
+ return errjson('请填写名称');
+ $csql = new \ciy\sql('ap_invoicetitle');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ try {
+ $db->begin();
+ $updata = array();
+ $updata['name'] = $name;
+ $updata['taxnumber'] = $taxnumber;
+ $updata['addr'] = $addr;
+ $updata['phone'] = $phone;
+ $updata['bankname'] = $bankname;
+ $updata['bankaccount'] = $bankaccount;
+ $updata['uptimes'] = tostamp();
+ $csql = new \ciy\sql('ap_invoicetitle');
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ $updata['id'] = $id;
+ savelogdb($db, $rsuser['id'], 'ap_invoicetitle', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ $ret['ap_user'] = getrelation($db, [$updata], 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_invoicetitle');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_invoicetitle');
+ savelogdb($db, $rsuser['id'], 'ap_invoicetitle', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'name', 'name' => '名称');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'taxnumber', 'name' => '税号');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'addr', 'name' => '单位地址');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'phone', 'name' => '电话号码');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankname', 'name' => '银行名称');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankaccount', 'name' => '银行账号');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'uptimes', 'name' => '更新时间');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'uptimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/invoicing.html b/web/admin/ap/invoicing.html
new file mode 100644
index 0000000..ca850e2
--- /dev/null
+++ b/web/admin/ap/invoicing.html
@@ -0,0 +1,204 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/invoicing.php b/web/admin/ap/invoicing.php
new file mode 100644
index 0000000..449bf88
--- /dev/null
+++ b/web/admin/ap/invoicing.php
@@ -0,0 +1,378 @@
+get('query', array());
+ $csql = new \ciy\sql('ap_invoicing');
+ $liid = objint($query, 'liid');
+ if ($liid > 0)
+ $csql->where('auditstatus', $liid);
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $val = objstr($query, 'invoicedetailid');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_invoicedetail');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('invoicedetailid', $trow['id']);
+ $query['invoicedetailid'] = $trow['name'];
+ } else {
+ $csql->where('invoicedetailid=0');
+ }
+ }
+ $csql->wherenumrange('invoicemoney', objstr($query, 'invoicemoney_1'), objstr($query, 'invoicemoney_2'), 100);
+ $csql->where('invcode like', objstr($query, 'invcode'));
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->where('name like', objstr($query, 'name'));
+ $csql->where('taxnumber', objstr($query, 'taxnumber'));
+ $csql->where('auditmsg like', objstr($query, 'auditmsg'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post, $rsuser);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if ($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_invoicing');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'invoicedetailid', 'name' => '所属明细', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'num', 'form' => 'invoicemoney', 'name' => '开票金额', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'input', 'form' => 'invcode', 'name' => '发票号码', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '申请时间');
+ $input[] = array('type' => 'input', 'form' => 'name', 'name' => '名称', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'taxnumber', 'name' => '税号', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'auditmsg', 'name' => '拒开原因', 'prop' => ' style="width:8em;"');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ $ret['ap_invoicedetail'] = getrelation($db, $rows, 'ap_invoicedetail', 'invoicedetailid');
+ return succjson($ret);
+ }
+
+
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_invoicing');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ if ($row['auditstatus'] < 90)
+ continue;
+ if ($row['addtimes'] > tostamp() - 86400 * 14)
+ continue;
+ //已开票超过14天,或已拒开超过14天
+ $delid = $row['id'];
+ delme($db, $delid, 'ap_invoicing');
+ savelogdb($db, $rsuser['id'], 'ap_invoicing', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ //$db->trace($post->get('_pf'), $rsuser);
+ $id = $post->getint('id');
+ $name = $post->get('name');
+ $content = $post->get('content', '', 'html');
+ $addtimes = $post->getint('addtimes');
+ $csql = new \ciy\sql('dao_bbstopic');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ try {
+ $db->begin();
+ $updata = array();
+ $updata['name'] = $name;
+ $updata['content'] = $content;
+ $updata['addtimes'] = $addtimes;
+ $csql = new \ciy\sql('dao_bbstopic'); //update
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ $updata['id'] = $id;
+ //savelogdb($db, $rsuser['id'], 'dao_dmissionnewreply', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+
+ public static function json_pass() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('dao_bbstopic');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ if ($row['replynum'] > -1)
+ continue;
+ $updata = array();
+ $updata['replynum'] = 0;
+ $csql = new \ciy\sql('dao_bbstopic');
+ $csql->where('id', $row['id']);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('审核失败:' . $db->error);
+ $vids[] = $row['id'];
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_audit() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p a'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->getint('ids');
+ $auditstatus = $post->getint('auditstatus');
+ $auditmsg = $post->get('auditmsg');
+ if ($auditstatus == 90 && empty($auditmsg))
+ return errjson('请填写驳回原因');
+ if ($auditstatus == 100) {
+ $invcode = $post->get('invcode');
+ $invfile = $post->get('invfile');
+ if (empty($invfile))
+ return errjson('请上传发票');
+ }
+ $csql = new \ciy\sql('ap_invoicing');
+ $csql->where('id', $ids);
+ $mrow = $db->getone($csql);
+ if (!is_array($mrow))
+ return errjson('数据不存在');
+ $ids = array();
+ try {
+ $db->begin();
+ $updata = array();
+ if ($auditstatus == 100) {
+ $updata['invcode'] = $invcode;
+ $updata['invfile'] = $invfile;
+ } else {
+ //归还金额
+ $updata2 = array();
+ $updata2['myinvmoney'] = array('myinvmoney+' . $mrow['invoicemoney']);
+ $csql = new \ciy\sql('ap_user');
+ $csql->where('id', $mrow['vuser']);
+ if ($db->update($csql, $updata2) === false)
+ throw new \Exception('更新账户失败:' . $db->error);
+ }
+ $updata['auditstatus'] = $auditstatus;
+ $updata['audittimes'] = tostamp();
+ $updata['audituser'] = $rsuser['id'];
+ $updata['auditmsg'] = $auditmsg;
+ $csql = new \ciy\sql('ap_invoicing');
+ $csql->where('id', $mrow['id']);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('审核失败:' . $db->error);
+ $updata['id'] = $mrow['id'];
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+
+ public static function json_reback() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p a'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $csql = new \ciy\sql('ap_invoicing');
+ $csql->where('id', $id);
+ $mrow = $db->getone($csql);
+ if (!is_array($mrow))
+ return errjson('数据不存在');
+ if ($mrow['auditstatus'] != 100)
+ return errjson('该发票未开票,无法退回');
+ $ids = array();
+ try {
+ $db->begin();
+ $updata2 = array();
+ $updata2['myinvmoney'] = array('myinvmoney+' . $mrow['invoicemoney']);
+ $csql = new \ciy\sql('ap_user');
+ $csql->where('id', $mrow['vuser']);
+ if ($db->update($csql, $updata2) === false)
+ throw new \Exception('更新账户失败:' . $db->error);
+ $updata = array();
+ $updata['auditstatus'] = 95;
+ $updata['audittimes'] = tostamp();
+ $updata['audituser'] = $rsuser['id'];
+ $csql = new \ciy\sql('ap_invoicing');
+ $csql->where('id', $mrow['id']);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('审核失败:' . $db->error);
+ $updata['id'] = $mrow['id'];
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post, $rsuser);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'auditstatus', 'name' => '审核状态');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'invoicetitleid', 'name' => '所属抬头');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'invoicedetailid', 'name' => '所属明细');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'invoicemoney', 'name' => '开票金额');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'invfile', 'name' => '发票');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'invcode', 'name' => '发票号码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '申请时间');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'name', 'name' => '名称');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'taxnumber', 'name' => '税号');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'addr', 'name' => '单位地址');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'phone', 'name' => '电话号码');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankname', 'name' => '银行名称');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'bankaccount', 'name' => '银行账号');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'audittimes', 'name' => '操作时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'audituser', 'name' => '操作人');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'auditmsg', 'name' => '拒开原因');
+ $code_auditstatus = getcatas($db, 'auditstatus');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $code_invoicetitleid = getrelation($db, $rows, 'ap_invoicetitle', 'invoicetitleid', 'id,name');
+ $code_invoicedetailid = getrelation($db, $rows, 'ap_invoicedetail', 'invoicedetailid', 'id,name');
+ $code_audituser = getcatas($db, 'adminuser');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'auditstatus')
+ $val = ccode($code_auditstatus, $val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'invoicetitleid')
+ $val = ccode($code_invoicetitleid, $val);
+ if ($field == 'invoicedetailid')
+ $val = ccode($code_invoicedetailid, $val);
+ if ($field == 'invoicemoney')
+ $val = number_format($val / 100, 2);
+ if ($field == 'addtimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'audittimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'audituser')
+ $val = ccode($code_audituser, $val);
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = '发票开票数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/logdb.html b/web/admin/ap/logdb.html
new file mode 100644
index 0000000..4d5a24f
--- /dev/null
+++ b/web/admin/ap/logdb.html
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/logdb.php b/web/admin/ap/logdb.php
new file mode 100644
index 0000000..bba3706
--- /dev/null
+++ b/web/admin/ap/logdb.php
@@ -0,0 +1,163 @@
+get('query');
+ $csql = new \ciy\sql('ap_log');
+ $liid = objint($query, 'liid');
+ if ($liid == 1)
+ $csql->where('readuser=0');
+ if ($liid == 2)
+ $csql->where('readuser>0');
+ $val = objstr($query, 'loguser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('loguser', $trow['id']);
+ $query['loguser'] = $trow['name'];
+ } else {
+ $csql->where('loguser=0');
+ }
+ }
+ $csql->where('readuser', objstr($query, 'readuser'));
+ $csql->where('types', objstr($query, 'types'));
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->where('logs like', objstr($query, 'logs'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+ public static function json_init() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_log');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array(
+ 'type' => 'input',
+ 'form' => 'loguser',
+ 'name' => '操作人',
+ 'prop' => ' style="width:6em;"',
+ );
+ $input[] = array(
+ 'type' => 'select',
+ 'form' => 'readuser',
+ 'name' => '审阅人',
+ 'prop' => ' style="min-width:6em;"',
+ 'select' => 'adminuser',
+ 'all' => '全部'
+ );
+ $input[] = array(
+ 'type' => 'input',
+ 'form' => 'types',
+ 'name' => 'LOG分类',
+ 'prop' => ' style="width:8em;"'
+ );
+ $input[] = array(
+ 'type' => 'daterange',
+ 'form' => 'addtimes',
+ 'name' => '发生日期'
+ );
+ $input[] = array(
+ 'type' => 'input',
+ 'form' => 'logs',
+ 'name' => '详情',
+ 'prop' => ' style="width:8em;"'
+ );
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'loguser');
+ return succjson($ret);
+ }
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+
+ if (nopower($db, $rsuser['id'], 'p10260d'))
+ return errjson('您未被授权操作');
+
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_log');
+
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ delme($db, $delid, 'ap_log');
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_multiread() {
+ global $db;
+ $rsuser = verifyfast();
+
+ if (nopower($db, $rsuser['id'], 'p10260s'))
+ return errjson('您未被授权操作');
+
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_log');
+
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $rowid = $row['id'];
+ $updata = array();
+ $updata['readuser'] = $rsuser['id'];
+ $csql = new \ciy\sql('ap_log');
+ $csql->where('id', $rowid);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ $vids[] = $rowid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+}
diff --git a/web/admin/ap/luser.html b/web/admin/ap/luser.html
new file mode 100644
index 0000000..b458711
--- /dev/null
+++ b/web/admin/ap/luser.html
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/luser.php b/web/admin/ap/luser.php
new file mode 100644
index 0000000..bd8096a
--- /dev/null
+++ b/web/admin/ap/luser.php
@@ -0,0 +1,105 @@
+get('query');
+ $csql = new \ciy\sql('ap_lug');
+ $liid = objint($query, 'liid');
+ if ($liid > 0)
+ $csql->where('isinout', $liid);
+ $val = objstr($query, 'loguser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('loguser', $trow['id']);
+ $query['loguser'] = $trow['name'];
+ } else {
+ $csql->where('loguser=0');
+ }
+ }
+ $csql->where('model like', objstr($query, 'model'));
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+ public static function json_init() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_lug');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array(
+ 'type' => 'input',
+ 'form' => 'loguser',
+ 'name' => '操作人',
+ 'prop' => ' style="width:6em;"',
+ );
+ $input[] = array(
+ 'type' => 'daterange',
+ 'form' => 'addtimes',
+ 'name' => '发生日期'
+ );
+ $input[] = array(
+ 'type' => 'input',
+ 'form' => 'model',
+ 'name' => '设备指纹',
+ );
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'loguser');
+ return succjson($ret);
+ }
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+
+ if (nopower($db, $rsuser['id'], 'p10261d'))
+ return errjson('您未被授权操作');
+
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_lug');
+
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ delme($db, $delid, 'ap_lug');
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+}
diff --git a/web/admin/ap/paper.go b/web/admin/ap/paper.go
new file mode 100644
index 0000000..04db44f
--- /dev/null
+++ b/web/admin/ap/paper.go
@@ -0,0 +1,198 @@
+package ap
+
+import (
+ "fmt"
+ "net/http"
+
+ "ciyon/web/admin"
+ c "ciyon/zciyon"
+)
+
+func paper_setwhere(post *c.CiyPost) (map[string]any, *c.CiySQL) {
+ query := post.Getobj("query")
+ csql := c.NewCiySQL("ap_paper")
+ csql.Where("name like", c.Getstr(query, "name"))
+ csql.Where_numrange("readcnt", c.Getstr(query, "readcnt_1"), c.Getstr(query, "readcnt_2"), 1)
+ csql.Where("inputuser", c.Getstr(query, "inputuser"))
+ csql.Where_daterange("uptimes", c.Getstr(query, "uptimes"))
+ order := c.Getstr(query, "order", "id desc")
+ csql.Order(order)
+ query["order"] = order
+ return query, csql
+}
+func Paper_init(w http.ResponseWriter, r *http.Request) bool {
+ post := c.NewCiyPost(w, r)
+ _, userid := admin.Verifyfast(r, c.CiyDB, post)
+ if userid == 0 {
+ return false
+ }
+ where, csql := paper_setwhere(post)
+ pageno := post.Getint("pageno", 1)
+ pagecount := post.Getint("pagecount", 10)
+ csql.Limit(pageno, pagecount)
+ csql.Column("!content")
+ rows, mainrowcount, err := c.CiyDB.Get(csql, post.Getint("count"))
+ if err != nil {
+ return c.ErrJSON(w, "读取错误", err)
+ }
+ ret := map[string]any{}
+ ret["where"] = where
+ ret["pageno"] = pageno
+ ret["pagecount"] = pagecount
+ ret["count"] = mainrowcount
+ ret["list"] = rows
+ if post.Getbool("field") {
+ field, fshow := c.CiyDB.GetField(csql)
+ c.FieldAdd(&field, &fshow, 0, "_btn", "操作")
+ field["name"]["thwidth"] = "30em"
+ field["readcnt"]["order"] = "r"
+ ret["fshow"] = fshow
+ ret["field"] = field
+ }
+ if post.Getbool("once") {
+ once := map[string]any{}
+ input := make([]map[string]any, 0)
+ input = append(input, map[string]any{
+ "form": "name",
+ "type": "input",
+ "name": "名称",
+ "prop": ` style="width:8em;"`,
+ })
+ input = append(input, map[string]any{
+ "form": "readcnt",
+ "type": "num",
+ "name": "阅读数",
+ "prop": ` style="width:4em;"`,
+ })
+ input = append(input, map[string]any{
+ "form": "inputuser",
+ "type": "select",
+ "name": "撰写人",
+ "select": "adminuser",
+ "all": "全部",
+ })
+ input = append(input, map[string]any{
+ "form": "uptimes",
+ "type": "daterange",
+ "name": "更新时间",
+ })
+ once["input"] = input
+ ret["once"] = once
+ }
+ return c.SuccJSON(w, r, ret)
+}
+func Paper_update(w http.ResponseWriter, r *http.Request) bool {
+ post := c.NewCiyPost(w, r)
+ _, userid := admin.Verifyfast(r, c.CiyDB, post)
+ if userid == 0 {
+ return false
+ }
+ if admin.Nopower(c.CiyDB, userid, "p10201u") {
+ return c.ErrJSON(w, "您未被授权操作")
+ }
+ id := post.Getint("id")
+ name := post.Get("name")
+ title := post.Get("title")
+ if name == "" {
+ return c.ErrJSON(w, "请填写文档标题")
+ }
+ content := post.Get("content")
+ if content == "[MD]" {
+ return c.ErrJSON(w, "请填写内容")
+ }
+ var err error
+ var datarow map[string]any
+ if id > 0 {
+ csql := c.NewCiySQL("ap_paper")
+ csql.Where("id", id)
+ datarow, err = c.CiyDB.Getone(csql)
+ if datarow == nil {
+ return c.ErrJSON(w, "数据不存在", err)
+ }
+ }
+ err = c.CiyDB.Tran(func() error {
+ var csql *c.CiySQL
+ csql = c.NewCiySQL("ap_paper")
+ csql.Where("name", name)
+ csql.Column("id")
+ chkid := c.Toint(c.CiyDB.Get1(csql))
+ if chkid > 0 && ((id > 0 && chkid != id) || id == 0) {
+ return fmt.Errorf("数据已存在")
+ }
+ updata := map[string]any{}
+ updata["name"] = name
+ updata["title"] = title
+ updata["inputuser"] = userid
+ updata["uptimes"] = c.Tostamp()
+ updata["content"] = content
+ csql = c.NewCiySQL("ap_paper")
+ if id > 0 {
+ csql.Where("id", id)
+ _, err = c.CiyDB.Update(csql, updata)
+ } else {
+ id, err = c.CiyDB.Insert(csql, updata)
+ updata["newid"] = id
+ }
+ if err != nil {
+ return fmt.Errorf("更新失败:%v", err)
+ }
+ admin.SaveLogDB(c.CiyDB, "ap_paper", datarow, updata)
+ return nil
+ })
+ if err != nil {
+ return c.ErrJSON(w, "事务"+err.Error())
+ }
+ return c.SuccJSON(w, r)
+}
+func Paper_getdata(w http.ResponseWriter, r *http.Request) bool {
+ post := c.NewCiyPost(w, r)
+ _, userid := admin.Verifyfast(r, c.CiyDB, post)
+ if userid == 0 {
+ return false
+ }
+ id := post.Getint("id")
+ data := post.Getbool("data")
+ ret := map[string]any{}
+ if data {
+ csql := c.NewCiySQL("ap_paper")
+ csql.Where("id", id)
+ var err error
+ ret["data"], err = c.CiyDB.Getone(csql)
+ if err != nil {
+ return c.ErrJSON(w, "读取失败:"+err.Error())
+ }
+ }
+ return c.SuccJSON(w, r, ret)
+}
+func Paper_del(w http.ResponseWriter, r *http.Request) bool {
+ post := c.NewCiyPost(w, r)
+ _, userid := admin.Verifyfast(r, c.CiyDB, post)
+ if userid == 0 {
+ return false
+ }
+ if admin.Nopower(c.CiyDB, userid, "p10201d") {
+ return c.ErrJSON(w, "您未被授权操作")
+ }
+ ids := post.Get("ids")
+ if ids == "" {
+ return c.ErrJSON(w, "请选择至少一条")
+ }
+ csql := c.NewCiySQL("ap_paper")
+ csql.Where("id in", ids)
+ rows, _, err := c.CiyDB.Get(csql)
+ if err != nil {
+ return c.ErrJSON(w, "读取数据错误", err)
+ }
+ err = c.CiyDB.Tran(func() error {
+ for _, row := range rows {
+ rowid := c.Toint(row["id"])
+ c.Delme(c.CiyDB, rowid, "ap_paper")
+ admin.SaveLogDB(c.CiyDB, "ap_paper", row, nil)
+ }
+ return nil
+ })
+ if err != nil {
+ return c.ErrJSON(w, "事务"+err.Error())
+ }
+ return c.SuccJSON(w, r)
+}
diff --git a/web/admin/ap/paper.html b/web/admin/ap/paper.html
new file mode 100644
index 0000000..154f92c
--- /dev/null
+++ b/web/admin/ap/paper.html
@@ -0,0 +1,186 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/paper.php b/web/admin/ap/paper.php
new file mode 100644
index 0000000..5bd8776
--- /dev/null
+++ b/web/admin/ap/paper.php
@@ -0,0 +1,184 @@
+get('query');
+ $csql = new \ciy\sql('ap_paper');
+ $csql->where('name like', objstr($query, 'name'));
+ $csql->wherenumrange('readcnt', objstr($query, 'readcnt_1'), objstr($query, 'readcnt_2'), 1);
+ $csql->where('inputuser', objstr($query, 'inputuser'));
+ $csql->wheredaterange('uptimes', objstr($query, 'uptimes'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+ public static function json_init() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $csql->column('!content', $db->getraw('show full fields from ap_paper'));
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_paper');
+ foreach ($field as $fr => $v) {
+ if ($post->is('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $field['name']['thwidth'] = '15em';
+ $field['title']['thwidth'] = '15em';
+ $field['readcnt']['order'] = 'r';
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array(
+ 'type' => 'input',
+ 'form' => 'name',
+ 'name' => '名称',
+ 'prop' => ' style="width:8em;"'
+ );
+ $input[] = array(
+ 'type' => 'num',
+ 'form' => 'readcnt',
+ 'name' => '阅读数',
+ 'prop' => ' style="width:4em;"'
+ );
+ $input[] = array(
+ 'type' => 'select',
+ 'form' => 'inputuser',
+ 'name' => '撰写人',
+ 'select' => 'adminuser',
+ 'all' => '全部'
+ );
+ $input[] = array(
+ 'type' => 'daterange',
+ 'form' => 'uptimes',
+ 'name' => '更新时间'
+ );
+ $ret['searchinput'] = $input;
+ }
+ return succjson($ret);
+ }
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+
+ if (nopower($db, $rsuser['id'], 'p10201u'))
+ return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $name = $post->get('name');
+ $title = $post->get('title');
+ if (empty($name))
+ return errjson('请填写文档标题');
+ $content = $post->get('content', '', 'html');
+ if ($content == '[MD]')
+ return errjson('请填写内容');
+ $datarow = null;
+ if ($id > 0) {
+ $csql = new \ciy\sql('ap_paper');
+
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ }
+ try {
+ $db->begin();
+ $csql = new \ciy\sql('ap_paper');
+ $csql->where('name', $name);
+ $csql->column('id');
+ $chkid = toint($db->get1($csql));
+ if ($chkid > 0 && (($id > 0 && $chkid != $id) || $id == 0))
+ throw new \Exception('CIYIGN数据已存在');
+
+ $updata = array();
+ $updata['name'] = $name;
+ $updata['title'] = $title;
+ $updata['inputuser'] = $rsuser['id'];
+ $updata['uptimes'] = tostamp();
+ $updata['content'] = $content;
+ $csql = new \ciy\sql('ap_paper');
+ if ($id > 0) {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ } else {
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增失败:' . $db->error);
+ $id = $db->insert_id();
+ }
+ $updata['id'] = $id;
+ savelogdb($db, $rsuser['id'], 'ap_paper', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+ public static function json_getdata() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $data = $post->getbool('data');
+ if ($data) {
+ $csql = new \ciy\sql('ap_paper');
+ $csql->where('id', $id);
+ $ret['data'] = $db->getone($csql);
+ }
+ return succjson($ret);
+ }
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+
+ if (nopower($db, $rsuser['id'], 'p10201d'))
+ return errjson('您未被授权操作');
+
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_paper');
+
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //tran_delcheck($db, $delid, $row['name'], 'xxid', 'tablexx', '存在xxx,不能删除');
+ //delall($db, $delid, 'tablexx', 'xxid', 'xxx删除失败');
+ delme($db, $delid, 'ap_paper');
+ savelogdb($db, $rsuser['id'], 'ap_paper', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+}
diff --git a/web/admin/ap/pnt_bundle.html b/web/admin/ap/pnt_bundle.html
new file mode 100644
index 0000000..037bdcf
--- /dev/null
+++ b/web/admin/ap/pnt_bundle.html
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/pnt_bundle.php b/web/admin/ap/pnt_bundle.php
new file mode 100644
index 0000000..1a3f87d
--- /dev/null
+++ b/web/admin/ap/pnt_bundle.php
@@ -0,0 +1,336 @@
+get('query');
+ $csql = new \ciy\sql('ap_pnt_bundle');
+ $csql->wherenumrange('buypnt', objstr($query, 'buypnt_1'), objstr($query, 'buypnt_2'), 1);
+ $csql->wherenumrange('buymoney', objstr($query, 'buymoney_1'), objstr($query, 'buymoney_2'), 100);
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_pnt_bundle');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'num', 'form' => 'buypnt', 'name' => '金币', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'num', 'form' => 'buymoney', 'name' => '金额', 'prop' => ' style="width:4em;"');
+ $ret['searchinput'] = $input;
+ }
+ return succjson($ret);
+ }
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $buypnt = $post->getint('buypnt');
+ $buymoney = $post->getint('buymoney');
+ if ($buypnt == 0)
+ return errjson('请填写金币');
+ if ($buymoney == 0)
+ return errjson('请填写金额');
+ $datarow = null;
+ if ($id > 0) {
+ $csql = new \ciy\sql('ap_pnt_bundle');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ }
+ try {
+ $db->begin();
+ $updata = array();
+ $updata['buypnt'] = $buypnt;
+ $updata['buymoney'] = $buymoney;
+ $csql = new \ciy\sql('ap_pnt_bundle');
+ if ($id > 0) {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ } else {
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增失败:' . $db->error);
+ $id = $db->insert_id();
+ }
+ $updata['id'] = $id;
+ savelogdb($db, $rsuser['id'], 'ap_pnt_bundle', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_pnt_bundle');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_pnt_bundle');
+ savelogdb($db, $rsuser['id'], 'ap_pnt_bundle', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'buypnt', 'name' => '金币');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'buymoney', 'name' => '金额');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'buymoney')
+ $val = number_format($val / 100, 2);
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+
+ public static function json_importxls_in() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p i'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $file = PATH_WEB . '/ud' . $post->get('file');
+ if (!file_exists($file))
+ return errjson('文件不存在');
+ require_once PATH_ROOT . '../libs/phpoffice/autoload.php';
+ $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file);
+ $sheet = $spreadsheet->getActiveSheet();
+ $datas = $sheet->toArray('', true, true, false);
+ $datacnt = count($datas);
+ if ($datacnt < 2)
+ return errjson('数据为空');
+ $html = '';
+ $headsn = array();
+ $headsn[] = '行码.id';
+ $headsn[] = '金币.buypnt';
+ $headsn[] = '金额.buymoney';
+ $xlsidx = 1;
+ if (empty($datas[0][count($headsn) - 1]))
+ $xlsidx = 2;
+ $heads = array();
+ foreach ($headsn as $_head) {
+ $hd = explode('.', $_head);
+ if (count($hd) < 2)
+ continue;
+ $heads[] = array(
+ 'idx' => array_search($hd[0], $datas[$xlsidx - 1]), 'fld' => $hd[1], 'name' => $hd[0]
+ );
+ }
+ $html .= '| # | '; + foreach ($heads as $arr) { + $html .= '' . $arr['name'] . ' | '; + } + $html .= '' . $lineidx . ' | ';
+ $bempty = true;
+ $unqs = array();
+ $csql = new \ciy\sql('ap_pnt_bundle');
+ foreach ($heads as $arr) {
+ $name = $arr['name'];
+ $errmsg = ''; //数据有误,显示红色说明
+ $showdat = ''; //显示在表格中的数据
+ if ($arr['idx'] > -1)
+ $showdat = trim($datas[$rowidx][$arr['idx']]);
+ if ($showdat == '--')
+ $showdat = '';
+ $value = $showdat; //在表单中的数据(转换后)
+ $ext = ''; //扩展表单
+ if ($name == '行码') {
+ if (empty($showdat)) {
+ $value = 0;
+ $showdat = '新增';
+ } else {
+ $id = deid($showdat);
+ if ($id == 0)
+ $errmsg = $name . '解析错误';
+ else {
+ $csqlchk = new \ciy\sql('ap_pnt_bundle');
+ $csqlchk->where('id', $id)->column('id');
+ $chkid = toint($db->get1($csqlchk));
+ if ($chkid != $id)
+ $errmsg = $name . '在数据库中不存在';
+ $value = $id;
+ }
+ }
+ } else if ($name == '金币') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ } else {
+ $showdat = str_replace(',', '', $showdat);
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint($showdat);
+ }
+ } else if ($name == '金额') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ } else {
+ $showdat = str_replace(',', '', $showdat);
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 100);
+ }
+ }
+ if (!empty($showdat))
+ $bempty = false;
+ if (empty($errmsg))
+ $hrhtml .= '' . $showdat . '' . $ext . ' | ';
+ else
+ $hrhtml .= '' . $showdat . ' | ';
+ }
+ if ($bempty)
+ continue;
+ if (count($unqs) > 0) {
+ $unq = implode('|', $unqs);
+ if (in_array($unq, $uniques))
+ $firsthtml = '重复 | ';
+ else {
+ $uniques[] = $unq;
+ $csql->column('id');
+ $chkid = toint($db->get1($csql));
+ if ($chkid > 0 && (($id > 0 && $chkid != $id) || $id == 0))
+ $firsthtml = '重复 | ';
+ }
+ }
+ $html .= '
|---|---|
共' . $cnt . '条数据';
+ return succjson(array('html' => $html, 'count' => $cnt));
+ }
+
+ public static function json_importxls_data() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p i'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $total = $post->getint('total');
+ try {
+ $db->begin();
+ for ($i = 1; $i <= $total; $i++) {
+ $id = $post->getint('id_' . $i);
+ $updata = array();
+ $updata['buypnt'] = $post->get('buypnt_' . $i);
+ $updata['buymoney'] = $post->get('buymoney_' . $i);
+ $csql = new \ciy\sql('ap_pnt_bundle');
+ if ($id == 0) {
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增导入失败:' . $db->error);
+ } else {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新导入失败:' . $db->error);
+ }
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ return succjson();
+ }
+}
diff --git a/web/admin/ap/pnt_buy.html b/web/admin/ap/pnt_buy.html
new file mode 100644
index 0000000..76a24a2
--- /dev/null
+++ b/web/admin/ap/pnt_buy.html
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/pnt_buy.php b/web/admin/ap/pnt_buy.php
new file mode 100644
index 0000000..f08396e
--- /dev/null
+++ b/web/admin/ap/pnt_buy.php
@@ -0,0 +1,187 @@
+get('query');
+ $csql = new \ciy\sql('ap_pnt_buy');
+ $liid = objint($query, 'liid');
+ if ($liid == 1)
+ $csql->where('paytimes=0');
+ if ($liid == 2)
+ $csql->where('paytimes>0');
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->wherenumrange('pnt', objstr($query, 'pnt_1'), objstr($query, 'pnt_2'), 1);
+ $csql->wherenumrange('buypntmoney', objstr($query, 'buypntmoney_1'), objstr($query, 'buypntmoney_2'), 100);
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_pnt_buy');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'num', 'form' => 'pnt', 'name' => '金币', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'num', 'form' => 'buypntmoney', 'name' => '金额', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '提交时间');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+
+ public static function json_getdata() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $act = $post->get('act');
+ if ($id > 0) {
+ $csql = new \ciy\sql('ap_pnt_buy');
+ $csql->where('id', $id);
+ $row = $db->getone($csql);
+ if (!is_array($row))
+ return errjson('数据不存在');
+ if ($act == 'view' || $act == 'review') {
+ $csql = (new \ciy\sql('ap_user'))->column('id,name');
+ $csql->where('id', $row['vuser']);
+ $ret['ap_user'] = $db->get($csql);
+ }
+ } else {
+ $row = array();
+ }
+ $ret['data'] = $row;
+ if ($act == 'edit') {
+ $csql = (new \ciy\sql('ap_user'))->column('id,name');
+ $ret['ap_user'] = $db->get($csql);
+ }
+ return succjson($ret);
+ }
+
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_pnt_buy');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_pnt_buy');
+ savelogdb($db, $rsuser['id'], 'ap_pnt_buy', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'pnt', 'name' => '金币');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'buypntmoney', 'name' => '金额');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '提交时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'paytimes', 'name' => '支付时间');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'buypntmoney')
+ $val = number_format($val / 100, 2);
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'paytimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/pnt_record.html b/web/admin/ap/pnt_record.html
new file mode 100644
index 0000000..3309cc8
--- /dev/null
+++ b/web/admin/ap/pnt_record.html
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/pnt_record.php b/web/admin/ap/pnt_record.php
new file mode 100644
index 0000000..ce4a426
--- /dev/null
+++ b/web/admin/ap/pnt_record.php
@@ -0,0 +1,154 @@
+get('query');
+ $csql = new \ciy\sql('ap_pnt_record');
+ $liid = objint($query, 'liid');
+ if ($liid == 1)
+ $csql->where('pnt>0');
+ if ($liid == 2)
+ $csql->where('pnt<0');
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->wherenumrange('pnt', objstr($query, 'pnt_1'), objstr($query, 'pnt_2'), 1);
+ $csql->where('name like', objstr($query, 'name'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_pnt_record');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '发生时间');
+ $input[] = array('type' => 'num', 'form' => 'pnt', 'name' => '积分', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'input', 'form' => 'name', 'name' => '摘要', 'prop' => ' style="width:8em;"');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_pnt_record');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_pnt_record');
+ savelogdb($db, $rsuser['id'], 'ap_pnt_record', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '发生时间');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'pnt', 'name' => '积分');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'fromid', 'name' => 'fromid');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'name', 'name' => '摘要');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/pnt_track.html b/web/admin/ap/pnt_track.html
new file mode 100644
index 0000000..6547279
--- /dev/null
+++ b/web/admin/ap/pnt_track.html
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/pnt_track.php b/web/admin/ap/pnt_track.php
new file mode 100644
index 0000000..a985036
--- /dev/null
+++ b/web/admin/ap/pnt_track.php
@@ -0,0 +1,183 @@
+get('query');
+ $csql = new \ciy\sql('ap_pnt_track');
+ $csql->where('name like', objstr($query, 'name'));
+ $csql->wherenumrange('point', objstr($query, 'point_1'), objstr($query, 'point_2'), 1000);
+ $csql->wherenumrange('limh24', objstr($query, 'limh24_1'), objstr($query, 'limh24_2'), 1000);
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_pnt_track');
+ foreach ($field as $fr => $v) {
+ if ($post->is('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'name', 'name' => '埋点名称', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'num', 'form' => 'point', 'name' => '可获金币', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'num', 'form' => 'limh24', 'name' => '24小时上限', 'prop' => ' style="width:4em;"');
+ $ret['searchinput'] = $input;
+ }
+ return succjson($ret);
+ }
+
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $name = $post->get('name');
+ $point = $post->getint('point');
+ $limh24 = $post->getint('limh24');
+ if (empty($name))
+ return errjson('请填写埋点名称');
+ $datarow = null;
+ if ($id > 0) {
+ $csql = new \ciy\sql('ap_pnt_track');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ }
+ try {
+ $db->begin();
+ $updata = array();
+ $updata['name'] = $name;
+ $updata['point'] = $point;
+ $updata['limh24'] = $limh24;
+ $updata['adminuser'] = $rsuser['id'];
+ $updata['uptimes'] = tostamp();
+ $csql = new \ciy\sql('ap_pnt_track');
+ if ($id > 0) {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ } else {
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增失败:' . $db->error);
+ $id = $db->insert_id();
+ }
+ $updata['id'] = $id;
+ savelogdb($db, $rsuser['id'], 'ap_pnt_track', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_pnt_track');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_pnt_track');
+ savelogdb($db, $rsuser['id'], 'ap_pnt_track', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'name', 'name' => '埋点名称');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'point', 'name' => '可获金币');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'limh24', 'name' => '24小时上限');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'adminuser', 'name' => '操作人');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'uptimes', 'name' => '更新时间');
+ $code_adminuser = getcatas($db, 'adminuser');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'adminuser')
+ $val = ccode($code_adminuser, $val);
+ if ($field == 'uptimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/review_text.html b/web/admin/ap/review_text.html
new file mode 100644
index 0000000..278e250
--- /dev/null
+++ b/web/admin/ap/review_text.html
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/review_text.php b/web/admin/ap/review_text.php
new file mode 100644
index 0000000..491bab2
--- /dev/null
+++ b/web/admin/ap/review_text.php
@@ -0,0 +1,264 @@
+get('query', array());
+ $csql = new \ciy\sql('ap_review_text');
+ $liid = objint($query, 'liid');
+ if ($liid > 0)
+ $csql->where('reviewstatus', $liid);
+ $csql->where('tabname like', objstr($query, 'tabname'));
+ $csql->where('content like', objstr($query, 'content'));
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $val = objstr($query, 'reviewadmin');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('zc_cata');
+ $csqlt->where('cbid in (select id from zc_cata where cbid=0 and codeid=\'reviewadmin\')');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('reviewadmin', $trow['codeid']);
+ $query['reviewadmin'] = $trow['name'];
+ } else {
+ $csql->where('reviewadmin=0');
+ }
+ }
+ $csql->wheredaterange('reviewtimes', objstr($query, 'reviewtimes'));
+ $csql->where('reviewmsg like', objstr($query, 'reviewmsg'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post, $rsuser);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $mrows = $db->get($csql, $mainrowcount);
+ if ($mrows === false)
+ return errjson($db->error);
+ $ret['searchwhere'] = $where;
+ $ret['pageno'] = $pageno;
+ $ret['pagecount'] = $pagecount;
+ $ret['count'] = $mainrowcount;
+ $ret['list'] = $mrows;
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_review_text');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'tabname', 'name' => '数据表名', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'content', 'name' => '内容', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '产生时间');
+ $input[] = array('type' => 'input', 'form' => 'reviewadmin', 'name' => '审核人', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'reviewtimes', 'name' => '审核时间');
+ $input[] = array('type' => 'input', 'form' => 'reviewmsg', 'name' => '审核说明', 'prop' => ' style="width:8em;"');
+ $ret['searchinput'] = $input;
+ }
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ //$db->trace($post->get('_pf'), $rsuser);
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_review_text');
+ $csql->where('id in', $ids);
+ $mrows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($mrows as $mrow) {
+ $delid = $mrow['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_review_text');
+ savelogdb($db, $rsuser['id'], 'ap_review_text', $mrow, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_resolve() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p m'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ //$db->trace($post->get('_pf'), $rsuser);
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_review_text');
+ $csql->where('id in', $ids);
+ $mrows = $db->get($csql);
+ $ids = array();
+ try {
+ $db->begin();
+ foreach ($mrows as $mrow) {
+ if (!empty($mrow['resolvefunc'])) {
+ //调用处理器
+ }
+ $updata = array();
+ $updata['reviewstatus'] = 100;
+ $updata['reviewtimes'] = tostamp();
+ $updata['reviewadmin'] = $rsuser['id'];
+ $csql = new \ciy\sql('ap_review_text');
+ $csql->where('id', $mrow['id']);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('批量操作失败:' . $db->error);
+ $ids[] = $mrow['id'];
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ $ret['ids'] = $ids;
+ return succjson($ret);
+ }
+
+ public static function json_reject() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p m'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ //$db->trace($post->get('_pf'), $rsuser);
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_review_text');
+ $csql->where('id in', $ids);
+ $mrows = $db->get($csql);
+ $ids = array();
+ try {
+ $db->begin();
+ foreach ($mrows as $mrow) {
+ if (!empty($mrow['rejectfunc'])) {
+ if ($mrow['rejectfunc'] == 'DELETE') {
+ delme($db, $mrow['tabid'], $mrow['tabname']);
+ } else {
+ //调用处理器
+ }
+ }
+ $updata = array();
+ $updata['reviewstatus'] = 90;
+ $updata['reviewtimes'] = tostamp();
+ $updata['reviewadmin'] = $rsuser['id'];
+ $csql = new \ciy\sql('ap_review_text');
+ $csql->where('id', $mrow['id']);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('批量操作失败:' . $db->error);
+ $ids[] = $mrow['id'];
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ $ret['ids'] = $ids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post, $rsuser);
+ $mrows = $db->get($csql);
+ if (count($mrows) > 10000)
+ return errjson('将导出' . count($mrows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'reviewstatus', 'name' => '合规状态');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'tabname', 'name' => '数据表名');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '产生时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'reviewadmin', 'name' => '审核人');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'reviewtimes', 'name' => '审核时间');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'reviewmsg', 'name' => '审核说明');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'dblchkadmin', 'name' => '复审人');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'dblchktimes', 'name' => '复审时间');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'dblchkmsg', 'name' => '复审说明');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'resolvefunc', 'name' => '合规处理器');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'rejectfunc', 'name' => '拒审处理器');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'tabid', 'name' => '数据索引');
+ $code_reviewstatus = getcatas($db, 'reviewstatus');
+ $code_reviewadmin = getcatas($db, 'adminuser');
+ $code_dblchkadmin = getcatas($db, 'adminuser');
+ $datas = array();
+ foreach ($mrows as $mrow) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($mrow[$field]) ? $mrow[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'reviewstatus')
+ $val = ccode($code_reviewstatus, $val);
+ if ($field == 'addtimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'reviewadmin')
+ $val = ccode($code_reviewadmin, $val);
+ if ($field == 'reviewtimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'dblchkadmin')
+ $val = ccode($code_dblchkadmin, $val);
+ if ($field == 'dblchktimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = '后审数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/transfer.html b/web/admin/ap/transfer.html
new file mode 100644
index 0000000..948691b
--- /dev/null
+++ b/web/admin/ap/transfer.html
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/transfer.php b/web/admin/ap/transfer.php
new file mode 100644
index 0000000..d7e9eaf
--- /dev/null
+++ b/web/admin/ap/transfer.php
@@ -0,0 +1,155 @@
+get('query');
+ $csql = new \ciy\sql('ap_transfer');
+ $liid = objint($query, 'liid');
+ if ($liid > 0)
+ $csql->where('orderstatus', $liid);
+ $val = objstr($query, 'id');
+ if (!empty($val) && $val[0] == 'P')
+ $csql->where('id', substr($val, 1));
+ $csql->wherenumrange('amount', objstr($query, 'amount_1'), objstr($query, 'amount_2'), 100);
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->where('thirdno like', objstr($query, 'thirdno'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if ($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_transfer');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'id', 'name' => '流水号', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'num', 'form' => 'amount', 'name' => '金额', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '创建时间');
+ $input[] = array('type' => 'input', 'form' => 'thirdno', 'name' => '三方单号', 'prop' => ' style="width:8em;"');
+ $ret['searchinput'] = $input;
+ }
+ return succjson($ret);
+ }
+
+ public static function json_checksign() {
+ global $db;
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $csql = new \ciy\sql('ap_transfer');
+ $csql->where('id', $id);
+ $orderrow = $db->getone($csql);
+ if (!is_array($orderrow))
+ return errjson('数据不存在');
+ $csql = new \ciy\sql('ap_api');
+ $csql->where('id', $orderrow['apiid']);
+ $apirow = $db->getone($csql);
+ if (!is_array($apirow))
+ return errjson('API不存在');
+ $signs = array();
+ $waitsignstr = 'amount=' . $orderrow['amount'] . ',addtimes=' . $orderrow['addtimes'];
+ $signs[] = array('hash' => hash('sha256', $waitsignstr), 'sign' => $orderrow['signature']);
+ $retsign = self::verifysign_api($apirow['pubkey'], $signs);
+ if (is_string($retsign))
+ return errjson($retsign);
+ return succjson();
+ }
+ static function verifysign_api($signKey, $signs) {
+ if (strpos($signKey, '-----BEGIN RSA PUBLIC KEY-----') === false && strpos($signKey, '-----BEGIN PUBLIC KEY-----') === false)
+ $signKey = "-----BEGIN PUBLIC KEY-----\n" . wordwrap($signKey, 64, "\n") . "\n-----END PUBLIC KEY-----";
+
+ foreach ($signs as $sign) {
+ $signbin = hex2bin($sign['sign']);
+ if ($signbin === false)
+ return errjson('签名格式错误');
+ $hashbin = hex2bin($sign['hash']);
+ $result = openssl_verify($hashbin, $signbin, $signKey, OPENSSL_ALGO_SHA256);
+ if ($result === 0)
+ return '数字证书验签失败';
+ else if ($result !== 1)
+ return '数字证书验签错误:' . openssl_error_string();
+ return true;
+ }
+ }
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'orderstatus', 'name' => '状态');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'amount', 'name' => '金额');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '创建时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'uptimes', 'name' => '完成时间');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'thirdno', 'name' => '订单号');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'apiuser', 'name' => 'APIID');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'signature', 'name' => '签名');
+ $code_orderstatus = getcatas($db, 'orderstatus');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'orderstatus')
+ $val = ccode($code_orderstatus, $val);
+ if ($field == 'amount')
+ $val = number_format($val / 100, 2);
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'uptimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = '转账单数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/user.html b/web/admin/ap/user.html
new file mode 100644
index 0000000..942e3bb
--- /dev/null
+++ b/web/admin/ap/user.html
@@ -0,0 +1,269 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/user.php b/web/admin/ap/user.php
new file mode 100644
index 0000000..6451f64
--- /dev/null
+++ b/web/admin/ap/user.php
@@ -0,0 +1,237 @@
+get('query');
+ $csql = new \ciy\sql('ap_user');
+ $liid = objint($query, 'liid');
+ if ($liid > 0)
+ $csql->where('stpstatus', $liid);
+ $val = objstr($query, 'id');
+ if (!empty($val)) {
+ $id = deid($val);
+ if ($id > 0)
+ $csql->where('id', $id);
+ }
+ $val = objstr($query, 'certs');
+ if (!empty($val))
+ $csql->where('certs like', ',' . $val . ',');
+ $csql->where('name like', objstr($query, 'name'));
+ $csql->where('mobile like', objstr($query, 'mobile'));
+ $csql->wherenumrange('mycashmoney', objstr($query, 'mycashmoney_1'), objstr($query, 'mycashmoney_2'), 10000);
+ $csql->wherenumrange('mypnt', objstr($query, 'mypnt_1'), objstr($query, 'mypnt_2'), 1000);
+ $csql->wheredaterange('logintimes', objstr($query, 'logintimes'));
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->where('memo like', objstr($query, 'memo'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_user');
+ foreach ($field as $fr => $v) {
+ if ($post->is('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'id', 'name' => '会员编号', 'prop' => ' style="width:6em;"');
+ $input[] = array('type' => 'select', 'form' => 'certs', 'name' => '认证', 'select' => 'certs', 'all' => '全部');
+ $input[] = array('type' => 'input', 'form' => 'name', 'name' => '用户昵称', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'mobile', 'name' => '手机号', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'num', 'form' => 'mycashmoney', 'name' => '提现余额', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'num', 'form' => 'mypnt', 'name' => '金币', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'logintimes', 'name' => '登录时间');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '注册日期');
+ $input[] = array('type' => 'input', 'form' => 'memo', 'name' => '备注', 'prop' => ' style="width:8em;"');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'upid');
+ return succjson($ret);
+ }
+
+ public static function json_getdata() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $act = $post->get('act');
+ if ($id > 0) {
+ $csql = new \ciy\sql('ap_user');
+ $csql->where('id', $id);
+ $row = $db->getone($csql);
+ if (!is_array($row))
+ return errjson('数据不存在');
+ if ($act == 'view' || $act == 'review') {
+ $csql = (new \ciy\sql('ap_user'))->column('id,name');
+ $csql->where('id', $row['upid']);
+ $ret['ap_user'] = $db->get($csql);
+ }
+ } else {
+ $row = array();
+ }
+ $ret['data'] = $row;
+ if ($act == 'edit') {
+ $csql = (new \ciy\sql('ap_user'))->column('id,name');
+ $ret['ap_user'] = $db->get($csql);
+ }
+ return succjson($ret);
+ }
+
+ public static function json_update() {
+ global $db;
+ global $_token;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $icon = $post->get('icon');
+ $name = $post->get('name');
+ $mobile = $post->get('mobile');
+ $stpstatus = $post->getint('stpstatus');
+ $repass = $post->get('repass');
+ $memo = $post->get('memo');
+ if (empty($name))
+ return errjson('请填写用户昵称');
+ $csql = new \ciy\sql('ap_user');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ try {
+ $db->begin();
+ $updata = array();
+ $updata['icon'] = $icon;
+ $updata['name'] = $name;
+ $updata['mobile'] = $mobile;
+ $updata['stpstatus'] = $stpstatus;
+ if(!empty($repass))
+ $updata['password'] = md5($repass . $_token['salt']);
+ $updata['addtimes'] = tostamp();
+ $updata['memo'] = $memo;
+ $csql = new \ciy\sql('ap_user');
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ $updata['id'] = $id;
+ savelogdb($db, $rsuser['id'], 'ap_user', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ if ($post->get('_pf') == 'PC')
+ return succjson();
+ $csql = new \ciy\sql('ap_user');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ $ret['data'] = $datarow;
+ return succjson($ret);
+ }
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'icon', 'name' => '头像');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'name', 'name' => '用户昵称');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'mobile', 'name' => '手机号');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'stpstatus', 'name' => '账号状态');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'myinvmoney', 'name' => '待开票金额');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'mycashmoney', 'name' => '用户余额');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'mybondmoney', 'name' => '保证金');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'mypnt', 'name' => '金币');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'certs', 'name' => '认证范围');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'logintimes', 'name' => '登录时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '注册日期');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'upid', 'name' => '分享人');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'password', 'name' => '密码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'trytime', 'name' => '密码重试次数');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'memo', 'name' => '备注');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'power', 'name' => '权限表');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'wxunionid', 'name' => '微信UnionID');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'wxminaid', 'name' => '小程序OpenID');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'wxminakey', 'name' => '小程序Key');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'sid', 'name' => '授权码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'exptimes', 'name' => '到期时间');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'ip', 'name' => '登录IP');
+ $code_stpstatus = getcatas($db, 'stpstatus');
+ $code_certs = getcatas($db, 'certs');
+ $code_upid = getrelation($db, $rows, 'ap_user', 'upid', 'id,name');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'stpstatus')
+ $val = ccode($code_stpstatus, $val);
+ if ($field == 'myinvmoney')
+ $val = number_format($val / 100, 2);
+ if ($field == 'mycashmoney')
+ $val = number_format($val / 100, 2);
+ if ($field == 'mybondmoney')
+ $val = number_format($val / 100, 2);
+ if ($field == 'certs')
+ $val = implode(',', scode($code_certs, $val));
+ if ($field == 'logintimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d', $val));
+ if ($field == 'upid')
+ $val = ccode($code_upid, $val);
+ if ($field == 'exptimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/user_service.html b/web/admin/ap/user_service.html
new file mode 100644
index 0000000..275a791
--- /dev/null
+++ b/web/admin/ap/user_service.html
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ | # | '; + foreach ($heads as $arr) { + $html .= '' . $arr['name'] . ' | '; + } + $html .= '' . $lineidx . ' | ';
+ $bempty = true;
+ $unqs = array();
+ $csql = new \ciy\sql('ap_usr_buy_bundle');
+ foreach ($heads as $arr) {
+ $name = $arr['name'];
+ $errmsg = ''; //数据有误,显示红色说明
+ $showdat = ''; //显示在表格中的数据
+ if ($arr['idx'] > -1)
+ $showdat = trim($datas[$rowidx][$arr['idx']]);
+ if ($showdat == '--')
+ $showdat = '';
+ $value = $showdat; //在表单中的数据(转换后)
+ $ext = ''; //扩展表单
+ if ($name == '行码') {
+ if (empty($showdat)) {
+ $value = 0;
+ $showdat = '新增';
+ } else {
+ $id = deid($showdat);
+ if ($id == 0)
+ $errmsg = $name . '解析错误';
+ else {
+ $csqlchk = new \ciy\sql('ap_usr_buy_bundle');
+ $csqlchk->where('id', $id)->column('id');
+ $chkid = toint($db->get1($csqlchk));
+ if ($chkid != $id)
+ $errmsg = $name . '在数据库中不存在';
+ $value = $id;
+ }
+ }
+ } else if ($name == '套餐说明') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ } else {
+ }
+ } else if ($name == '对应等级') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ } else {
+ $value = dcode($code_userlevel, $showdat);
+ if ($value == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ }
+ } else if ($name == '天数') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ } else {
+ $showdat = str_replace(',', '', $showdat);
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint($showdat);
+ }
+ } else if ($name == '金额') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ } else {
+ $showdat = str_replace(',', '', $showdat);
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 100);
+ }
+ }
+ if (!empty($showdat))
+ $bempty = false;
+ if (empty($errmsg))
+ $hrhtml .= '' . $showdat . '' . $ext . ' | ';
+ else
+ $hrhtml .= '' . $showdat . ' | ';
+ }
+ if ($bempty)
+ continue;
+ if (count($unqs) > 0) {
+ $unq = implode('|', $unqs);
+ if (in_array($unq, $uniques))
+ $firsthtml = '重复 | ';
+ else {
+ $uniques[] = $unq;
+ $csql->column('id');
+ $chkid = toint($db->get1($csql));
+ if ($chkid > 0 && (($id > 0 && $chkid != $id) || $id == 0))
+ $firsthtml = '重复 | ';
+ }
+ }
+ $html .= '
|---|---|
共' . $cnt . '条数据';
+ return succjson(array('html' => $html, 'count' => $cnt));
+ }
+
+ public static function json_importxls_data() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p i'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $total = $post->getint('total');
+ try {
+ $db->begin();
+ for ($i = 1; $i <= $total; $i++) {
+ $id = $post->getint('id_' . $i);
+ $updata = array();
+ $updata['name'] = $post->get('name_' . $i);
+ $updata['userlevel'] = $post->get('userlevel_' . $i);
+ $updata['days'] = $post->get('days_' . $i);
+ $updata['usermoney'] = $post->get('usermoney_' . $i);
+ $csql = new \ciy\sql('ap_usr_buy_bundle');
+ if ($id == 0) {
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增导入失败:' . $db->error);
+ } else {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新导入失败:' . $db->error);
+ }
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ return succjson();
+ }
+}
diff --git a/web/admin/ap/usr_buy_user.html b/web/admin/ap/usr_buy_user.html
new file mode 100644
index 0000000..26f3659
--- /dev/null
+++ b/web/admin/ap/usr_buy_user.html
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/usr_buy_user.php b/web/admin/ap/usr_buy_user.php
new file mode 100644
index 0000000..f854921
--- /dev/null
+++ b/web/admin/ap/usr_buy_user.php
@@ -0,0 +1,216 @@
+get('query');
+ $csql = new \ciy\sql('ap_usr_buy_user');
+ $liid = objint($query, 'liid');
+ if ($liid == 1)
+ $csql->where('paytimes=0');
+ if ($liid == 2)
+ $csql->where('paytimes>0');
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $val = objstr($query, 'bundleid');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_usr_buy_bundle');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('bundleid', $trow['id']);
+ $query['bundleid'] = $trow['name'];
+ } else {
+ $csql->where('bundleid=0');
+ }
+ }
+ $csql->where('userlevel', objstr($query, 'userlevel'));
+ $csql->wherenumrange('days', objstr($query, 'days_1'), objstr($query, 'days_2'), 1);
+ $csql->wherenumrange('buydaymoney', objstr($query, 'buydaymoney_1'), objstr($query, 'buydaymoney_2'), 100);
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_usr_buy_user');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'bundleid', 'name' => '所属套餐', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'select', 'form' => 'userlevel', 'name' => '对应等级', 'all' => '全部', 'select' => 'userlevel');
+ $input[] = array('type' => 'num', 'form' => 'days', 'name' => '会员天数', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'num', 'form' => 'buydaymoney', 'name' => '金额', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '提交时间');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ $ret['ap_usr_buy_bundle'] = getrelation($db, $rows, 'ap_usr_buy_bundle', 'bundleid');
+ return succjson($ret);
+ }
+
+ public static function json_getdata() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $act = $post->get('act');
+ if ($id > 0) {
+ $csql = new \ciy\sql('ap_usr_buy_user');
+ $csql->where('id', $id);
+ $row = $db->getone($csql);
+ if (!is_array($row))
+ return errjson('数据不存在');
+ if ($act == 'view' || $act == 'review') {
+ $csql = (new \ciy\sql('ap_user'))->column('id,name');
+ $csql->where('id', $row['vuser']);
+ $ret['ap_user'] = $db->get($csql);
+ $csql = (new \ciy\sql('ap_usr_buy_bundle'))->column('id,name');
+ $csql->where('id', $row['bundleid']);
+ $ret['ap_usr_buy_bundle'] = $db->get($csql);
+ }
+ } else {
+ $row = array();
+ }
+ $ret['data'] = $row;
+ if ($act == 'edit') {
+ $csql = (new \ciy\sql('ap_user'))->column('id,name');
+ $ret['ap_user'] = $db->get($csql);
+ $csql = (new \ciy\sql('ap_usr_buy_bundle'))->column('id,name');
+ $ret['ap_usr_buy_bundle'] = $db->get($csql);
+ }
+ return succjson($ret);
+ }
+
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_usr_buy_user');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_usr_buy_user');
+ savelogdb($db, $rsuser['id'], 'ap_usr_buy_user', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'bundleid', 'name' => '所属套餐');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'userlevel', 'name' => '对应等级');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'days', 'name' => '会员天数');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'buydaymoney', 'name' => '金额');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '提交时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'paytimes', 'name' => '支付时间');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $code_bundleid = getrelation($db, $rows, 'ap_usr_buy_bundle', 'bundleid', 'id,name');
+ $code_userlevel = getcatas($db, 'userlevel');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'bundleid')
+ $val = ccode($code_bundleid, $val);
+ if ($field == 'userlevel')
+ $val = ccode($code_userlevel, $val);
+ if ($field == 'buydaymoney')
+ $val = number_format($val / 100, 2);
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'paytimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/usr_capcode.html b/web/admin/ap/usr_capcode.html
new file mode 100644
index 0000000..aa8df71
--- /dev/null
+++ b/web/admin/ap/usr_capcode.html
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/usr_capcode.php b/web/admin/ap/usr_capcode.php
new file mode 100644
index 0000000..3161be9
--- /dev/null
+++ b/web/admin/ap/usr_capcode.php
@@ -0,0 +1,125 @@
+get('query');
+ $csql = new \ciy\sql('ap_usr_capcode');
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->where('account like', objstr($query, 'account'));
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_usr_capcode');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'account', 'name' => '账号', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '生成时间');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+
+ public static function json_getdata() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $act = $post->get('act');
+ if ($id > 0) {
+ $csql = new \ciy\sql('ap_usr_capcode');
+ $csql->where('id', $id);
+ $row = $db->getone($csql);
+ if (!is_array($row))
+ return errjson('数据不存在');
+ if ($act == 'view' || $act == 'review') {
+ $csql = (new \ciy\sql('ap_user'))->column('id,name');
+ $csql->where('id', $row['vuser']);
+ $ret['ap_user'] = $db->get($csql);
+ }
+ } else {
+ $row = array();
+ }
+ $ret['data'] = $row;
+ if ($act == 'edit') {
+ $csql = (new \ciy\sql('ap_user'))->column('id,name');
+ $ret['ap_user'] = $db->get($csql);
+ }
+ return succjson($ret);
+ }
+
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_usr_capcode');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_usr_capcode');
+ savelogdb($db, $rsuser['id'], 'ap_usr_capcode', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+}
diff --git a/web/admin/ap/usr_problem.html b/web/admin/ap/usr_problem.html
new file mode 100644
index 0000000..6a7f613
--- /dev/null
+++ b/web/admin/ap/usr_problem.html
@@ -0,0 +1,152 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/usr_problem.php b/web/admin/ap/usr_problem.php
new file mode 100644
index 0000000..a672923
--- /dev/null
+++ b/web/admin/ap/usr_problem.php
@@ -0,0 +1,230 @@
+get('query');
+ $csql = new \ciy\sql('ap_usr_problem');
+ $liid = objint($query, 'liid');
+ if ($liid == 2)
+ $csql->where('closetimes=0')->where('replytimes>0');
+ else if ($liid == 3)
+ $csql->where('closetimes>0');
+ else if ($liid == 1)
+ $csql->where('closetimes=0')->where('replytimes=0');
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->where('contract like', objstr($query, 'contract'));
+ $csql->where('content like', objstr($query, 'content'));
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if ($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_usr_problem');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'contract', 'name' => '联系方式', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'content', 'name' => '工单提问', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '提交时间');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+
+ public static function json_getdata() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $act = $post->get('act');
+ if ($id > 0) {
+ $csql = new \ciy\sql('ap_usr_problem');
+ $csql->where('id', $id);
+ $row = $db->getone($csql);
+ if (!is_array($row))
+ return errjson('数据不存在');
+ if ($act == 'view' || $act == 'review') {
+ $csql = (new \ciy\sql('ap_user'))->column('id,name');
+ $csql->where('id', $row['vuser']);
+ $ret['ap_user'] = $db->get($csql);
+ }
+ } else {
+ $row = array();
+ }
+ $ret['data'] = $row;
+ if ($act == 'edit') {
+ $csql = (new \ciy\sql('ap_user'))->column('id,name');
+ $ret['ap_user'] = $db->get($csql);
+ }
+ return succjson($ret);
+ }
+
+ public static function json_getchat() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $csql = new \ciy\sql('ap_usr_problechat');
+ $csql->where('problemid', $id);
+ $csql->order('id');
+ $rows = $db->get($csql);
+ $ret['chats'] = $rows;
+ return succjson($ret);
+ }
+ public static function json_repchat() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $content = trim($post->get('content'));
+ if (empty($content))
+ return errjson('请输入内容');
+ $updata = array();
+ $updata['sendtype'] = 2;
+ $updata['problemid'] = $id;
+ $updata['content'] = $content;
+ $updata['addtimes'] = time();
+ $csql = new \ciy\sql('ap_usr_problechat');
+ if ($db->insert($csql, $updata) === false)
+ return errjson('更新失败:' . $db->error);
+ $updata = array();
+ $updata['replytimes'] = time();
+ $csql = new \ciy\sql('ap_usr_problem');
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ return errjson('更新失败:' . $db->error);
+ $updata['id'] = $id;
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_usr_problem');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ delall($db, $delid, 'ap_usr_problechat', 'problemid', '交流');
+ delme($db, $delid, 'ap_usr_problem');
+ savelogdb($db, $rsuser['id'], 'ap_usr_problem', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'contract', 'name' => '联系方式');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'content', 'name' => '工单提问');
+ $fields[] = array('style' => 'l', 'width' => 300, 'field' => 'imgs', 'name' => '图片');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '提交时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'replytimes', 'name' => '回复时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'closetimes', 'name' => '关闭时间');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'replytimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'closetimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/usr_real_apply.html b/web/admin/ap/usr_real_apply.html
new file mode 100644
index 0000000..9066a64
--- /dev/null
+++ b/web/admin/ap/usr_real_apply.html
@@ -0,0 +1,175 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/usr_real_apply.php b/web/admin/ap/usr_real_apply.php
new file mode 100644
index 0000000..bdd8356
--- /dev/null
+++ b/web/admin/ap/usr_real_apply.php
@@ -0,0 +1,190 @@
+get('query', array());
+ $csql = new \ciy\sql('ap_usr_real_apply');
+ $liid = objint($query, 'liid');
+ if ($liid > 0)
+ $csql->where('auditstatus', $liid);
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->where('name like', objstr($query, 'name'));
+ $csql->where('idid like', objstr($query, 'idid'));
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->where('audituser', objstr($query, 'audituser'));
+ $csql->wheredaterange('audittimes', objstr($query, 'audittimes'));
+ $csql->where('auditmsg like', objstr($query, 'auditmsg'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post, $rsuser);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $mrows = $db->get($csql, $mainrowcount);
+ if ($mrows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $mrows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_usr_real_apply');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'name', 'name' => '真实姓名', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'idid', 'name' => '身份证号', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '申请时间');
+ $input[] = array('type' => 'select', 'form' => 'audituser', 'name' => '审核员', 'all' => '全部', 'select' => 'adminuser');
+ $input[] = array('type' => 'daterange', 'form' => 'audittimes', 'name' => '审核时间');
+ $input[] = array('type' => 'input', 'form' => 'auditmsg', 'name' => '驳回原因', 'prop' => ' style="width:8em;"');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $mrows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+
+ public static function json_audit() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p a'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $auditstatus = $post->getint('auditstatus');
+ $auditmsg = $post->get('auditmsg');
+ if ($auditstatus == 90 && empty($auditmsg))
+ return errjson('请填写驳回原因');
+ $csql = new \ciy\sql('ap_usr_real_apply');
+ $csql->where('id in', $ids);
+ $mrows = $db->get($csql);
+ $ids = array();
+ try {
+ $db->begin();
+ foreach ($mrows as $mrow) {
+ if ($auditstatus == 100) {
+ $updata = array();
+ $updata['truename'] = $mrow['name'];
+ $updata['idid'] = $mrow['idid'];
+ $csql = new \ciy\sql('ap_usr_ext');
+ $csql->where('id', $mrow['vuser']);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('用户更新失败:' . $db->error);
+ }
+ $updata = array();
+ $updata['auditstatus'] = $auditstatus;
+ $updata['audituser'] = $rsuser['id'];
+ $updata['audittimes'] = tostamp();
+ $updata['auditmsg'] = $auditmsg;
+ $csql = new \ciy\sql('ap_usr_real_apply');
+ $csql->where('id', $mrow['id']);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('审核失败:' . $db->error);
+ $ids[] = $mrow['id'];
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ $ret['ids'] = $ids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post, $rsuser);
+ $mrows = $db->get($csql);
+ if (count($mrows) > 10000)
+ return errjson('将导出' . count($mrows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'auditstatus', 'name' => '审核状态');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'name', 'name' => '真实姓名');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'idid', 'name' => '身份证号');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'idcard1', 'name' => '身份证人像面');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'idcard2', 'name' => '身份证国徽面');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '申请时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'audituser', 'name' => '审核员');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'audittimes', 'name' => '审核时间');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'auditmsg', 'name' => '驳回原因');
+ $code_auditstatus = getcatas($db, 'auditstatus');
+ $code_vuser = getrelation($db, $mrows, 'ap_user', 'vuser', 'id,name');
+ $code_audituser = getcatas($db, 'adminuser');
+ $datas = array();
+ foreach ($mrows as $mrow) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($mrow[$field]) ? $mrow[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'auditstatus')
+ $val = ccode($code_auditstatus, $val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'addtimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'audituser')
+ $val = ccode($code_audituser, $val);
+ if ($field == 'audittimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = '实名认证申请数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/usr_sendmail.html b/web/admin/ap/usr_sendmail.html
new file mode 100644
index 0000000..b69572c
--- /dev/null
+++ b/web/admin/ap/usr_sendmail.html
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/usr_sendmail.php b/web/admin/ap/usr_sendmail.php
new file mode 100644
index 0000000..4d9da43
--- /dev/null
+++ b/web/admin/ap/usr_sendmail.php
@@ -0,0 +1,207 @@
+get('query', array());
+ $csql = new \ciy\sql('ap_usr_sendmail');
+ $liid = objint($query, 'liid');
+ if ($liid == 1)
+ $csql->where('');
+ if ($liid == 2)
+ $csql->where('');
+ if ($liid == 3)
+ $csql->where('');
+ if ($liid == 4)
+ $csql->where('');
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->where('email like', objstr($query, 'email'));
+ $csql->where('chan like', objstr($query, 'chan'));
+ $csql->where('name like', objstr($query, 'name'));
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->wheredaterange('sendtimes', objstr($query, 'sendtimes'));
+ $csql->wheredaterange('donetimes', objstr($query, 'donetimes'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post, $rsuser);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $mrows = $db->get($csql, $mainrowcount);
+ if ($mrows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $mrows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_usr_sendmail');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'email', 'name' => '邮件地址', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'chan', 'name' => '通道号', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'name', 'name' => '标题', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '添加时间');
+ $input[] = array('type' => 'daterange', 'form' => 'sendtimes', 'name' => '发送时间');
+ $input[] = array('type' => 'daterange', 'form' => 'donetimes', 'name' => '完成时间');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $mrows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ //$db->trace($post->get('_pf'), $rsuser);
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_usr_sendmail');
+ $csql->where('id in', $ids);
+ $mrows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($mrows as $mrow) {
+ $delid = $mrow['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_usr_sendmail');
+ savelogdb($db, $rsuser['id'], 'ap_usr_sendmail', $mrows, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_multi_status() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p m'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $status = $post->getint('status');
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_usr_sendmail');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $ids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $updata = array();
+ $updata['status'] = $status;
+ $csql = new \ciy\sql('ap_usr_sendmail');
+ $csql->where('id', $row['id']);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('批量操作失败:' . $db->error);
+ $ids[] = $row['id'];
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ $ret['ids'] = $ids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post, $rsuser);
+ $mrows = $db->get($csql);
+ if (count($mrows) > 10000)
+ return errjson('将导出' . count($mrows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'email', 'name' => '邮件地址');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'chan', 'name' => '通道号');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'name', 'name' => '标题');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '添加时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'sendtimes', 'name' => '发送时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'donetimes', 'name' => '完成时间');
+ $code_vuser = getrelation($db, $mrows, 'ap_user', 'vuser', 'id,name');
+ $datas = array();
+ foreach ($mrows as $mrow) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($mrow[$field]) ? $mrow[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'addtimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'sendtimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'donetimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = '发送邮件数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/usr_sendsms.html b/web/admin/ap/usr_sendsms.html
new file mode 100644
index 0000000..b69572c
--- /dev/null
+++ b/web/admin/ap/usr_sendsms.html
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/usr_sendsms.php b/web/admin/ap/usr_sendsms.php
new file mode 100644
index 0000000..e8997b3
--- /dev/null
+++ b/web/admin/ap/usr_sendsms.php
@@ -0,0 +1,203 @@
+get('query', array());
+ $csql = new \ciy\sql('ap_usr_sendsms');
+ $liid = objint($query, 'liid');
+ if ($liid == 1)
+ $csql->where('');
+ if ($liid == 2)
+ $csql->where('');
+ if ($liid == 3)
+ $csql->where('');
+ if ($liid == 4)
+ $csql->where('');
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->where('mobile like', objstr($query, 'mobile'));
+ $csql->where('chan like', objstr($query, 'chan'));
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->wheredaterange('sendtimes', objstr($query, 'sendtimes'));
+ $csql->wheredaterange('donetimes', objstr($query, 'donetimes'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post, $rsuser);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_usr_sendsms');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'mobile', 'name' => '手机号', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'chan', 'name' => '通道号', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '添加时间');
+ $input[] = array('type' => 'daterange', 'form' => 'sendtimes', 'name' => '发送时间');
+ $input[] = array('type' => 'daterange', 'form' => 'donetimes', 'name' => '完成时间');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_usr_sendsms');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_usr_sendsms');
+ savelogdb($db, $rsuser['id'], 'ap_usr_sendsms', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_multi_status() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p m'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $status = $post->getint('status');
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_usr_sendsms');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $ids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $updata = array();
+ $updata['status'] = $status;
+ $csql = new \ciy\sql('ap_usr_sendsms');
+ $csql->where('id', $row['id']);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('批量操作失败:' . $db->error);
+ $ids[] = $row['id'];
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ $ret['ids'] = $ids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post, $rsuser);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'mobile', 'name' => '手机号');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'chan', 'name' => '通道号');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '添加时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'sendtimes', 'name' => '发送时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'donetimes', 'name' => '完成时间');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'addtimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'sendtimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'donetimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = '发送短信数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/usr_shipaddr.html b/web/admin/ap/usr_shipaddr.html
new file mode 100644
index 0000000..c4c903c
--- /dev/null
+++ b/web/admin/ap/usr_shipaddr.html
@@ -0,0 +1,164 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/usr_shipaddr.php b/web/admin/ap/usr_shipaddr.php
new file mode 100644
index 0000000..0a36395
--- /dev/null
+++ b/web/admin/ap/usr_shipaddr.php
@@ -0,0 +1,196 @@
+get('query');
+ $csql = new \ciy\sql('ap_usr_shipaddr');
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->where('name like', objstr($query, 'name'));
+ $csql->where('phone like', objstr($query, 'phone'));
+ $csql->wheredaterange('uptimes', objstr($query, 'uptimes'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_usr_shipaddr');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'name', 'name' => '收件人', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'phone', 'name' => '联系电话', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'uptimes', 'name' => '更新时间');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $areacode = $post->getint('areacode');
+ $addr = $post->get('addr');
+ $name = $post->get('name');
+ $phone = $post->get('phone');
+ if (empty($name))
+ return errjson('请填写收件人');
+ $csql = new \ciy\sql('ap_usr_shipaddr');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ try {
+ $db->begin();
+ $updata = array();
+ $updata['areacode'] = $areacode;
+ $updata['addr'] = $addr;
+ $updata['name'] = $name;
+ $updata['phone'] = $phone;
+ $updata['uptimes'] = tostamp();
+ $csql = new \ciy\sql('ap_usr_shipaddr');
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ $updata['id'] = $id;
+ savelogdb($db, $rsuser['id'], 'ap_usr_shipaddr', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ $ret['ap_user'] = getrelation($db, [$updata], 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_usr_shipaddr');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_usr_shipaddr');
+ savelogdb($db, $rsuser['id'], 'ap_usr_shipaddr', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'areacode', 'name' => '所在地区');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'addr', 'name' => '详细地址');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'name', 'name' => '收件人');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'phone', 'name' => '联系电话');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'uptimes', 'name' => '更新时间');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $code_areacode = $db->get((new \ciy\sql('ciy_arearpc'))->column('id,name,upid'));
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'areacode')
+ $val = implode('-', mcode($code_areacode, $val));
+ if ($field == 'uptimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/ap/usr_suggest.html b/web/admin/ap/usr_suggest.html
new file mode 100644
index 0000000..7c6c109
--- /dev/null
+++ b/web/admin/ap/usr_suggest.html
@@ -0,0 +1,194 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/ap/usr_suggest.php b/web/admin/ap/usr_suggest.php
new file mode 100644
index 0000000..3d8b6da
--- /dev/null
+++ b/web/admin/ap/usr_suggest.php
@@ -0,0 +1,200 @@
+get('query');
+ $csql = new \ciy\sql('ap_usr_suggest');
+ $liid = objint($query, 'liid');
+ if ($liid == 1)
+ $csql->where('replytimes=0');
+ if ($liid == 2)
+ $csql->where('replytimes>0');
+ $val = objstr($query, 'vuser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('ap_user');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('vuser', $trow['id']);
+ $query['vuser'] = $trow['name'];
+ } else {
+ $csql->where('vuser=0');
+ }
+ }
+ $csql->where('contract like', objstr($query, 'contract'));
+ $csql->where('content like', objstr($query, 'content'));
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->where('replyuser', objstr($query, 'replyuser'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if ($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_usr_suggest');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'vuser', 'name' => '所属用户', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'contract', 'name' => '联系方式', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'content', 'name' => '建议内容', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '提交时间');
+ $input[] = array('type' => 'select', 'form' => 'replyuser', 'name' => '答复人', 'all' => '全部', 'select' => 'adminuser');
+ $ret['searchinput'] = $input;
+ }
+ $ret['ap_user'] = getrelation($db, $rows, 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $replymsg = $post->get('replymsg');
+ $csql = new \ciy\sql('ap_usr_suggest');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ try {
+ $db->begin();
+ $updata = array();
+ $updata['replyuser'] = $rsuser['id'];
+ $updata['replytimes'] = tostamp();
+ $updata['replymsg'] = $replymsg;
+ $csql = new \ciy\sql('ap_usr_suggest');
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ $updata['id'] = $id;
+ savelogdb($db, $rsuser['id'], 'ap_usr_suggest', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ $ret['ap_user'] = getrelation($db, [$updata], 'ap_user', 'vuser');
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_usr_suggest');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_usr_suggest');
+ savelogdb($db, $rsuser['id'], 'ap_usr_suggest', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'vuser', 'name' => '所属用户');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'contract', 'name' => '联系方式');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'content', 'name' => '建议内容');
+ $fields[] = array('style' => 'l', 'width' => 300, 'field' => 'imgs', 'name' => '图片');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '提交时间');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'replyuser', 'name' => '答复人');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'replytimes', 'name' => '答复时间');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'replymsg', 'name' => '答复内容');
+ $code_vuser = getrelation($db, $rows, 'ap_user', 'vuser', 'id,name');
+ $code_replyuser = getcatas($db, 'adminuser');
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'vuser')
+ $val = ccode($code_vuser, $val);
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'replyuser')
+ $val = ccode($code_replyuser, $val);
+ if ($field == 'replytimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = 'Demo数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+}
diff --git a/web/admin/autotask/base.go b/web/admin/autotask/base.go
new file mode 100644
index 0000000..b8fadde
--- /dev/null
+++ b/web/admin/autotask/base.go
@@ -0,0 +1,227 @@
+package autotask
+
+import (
+ c "ciyon/zciyon"
+ "fmt"
+ "net/http"
+ "os"
+ "path/filepath"
+ "regexp"
+ "strings"
+ "time"
+)
+
+func funcindex() map[string]func(map[string]any) string {
+ return map[string]func(map[string]any) string{
+ "web\\admin\\autotask\\base::dayclean": dayclean,
+ "web\\admin\\autotask\\base::srvstats": srvstats,
+ }
+}
+func srvstats(systemrow map[string]any) string {
+ defer func() {
+ if r := recover(); r != nil {
+ fmt.Println("srvstats panic:", r)
+ c.Log.Error("AUTO", "srvstats panic:"+r.(string))
+ }
+ }()
+ func_succ := c.CiyVars.Func_succ
+ func_fail := c.CiyVars.Func_fail
+ func_commit := c.CiyVars.Func_commit
+ func_rollback := c.CiyVars.Func_rollback
+ func_runms := 0
+ if func_succ+func_fail > 0 {
+ func_runms = c.CiyVars.Func_runms / (func_commit + func_rollback + 1)
+ }
+ c.CiyVars.Func_succ = 0
+ c.CiyVars.Func_fail = 0
+ c.CiyVars.Func_commit = 0
+ c.CiyVars.Func_rollback = 0
+ c.CiyVars.Func_runms = 0
+ disk := c.Ciy_sys_getdisk("/")
+ disk2 := c.Ciy_sys_getdisk("/data")
+ disk_sysfree := disk["free"]
+ disk_datafree := disk2["free"]
+ starttime := c.Timems()
+ fpath := c.CiyWebDir + "/ud/_" + c.Tostr(c.Tostamp()) + ".bin"
+ fsize := 1024 * 1024 // 1MB
+ fcontent := make([]byte, fsize)
+ for i := 0; i < fsize; i++ {
+ fcontent[i] = byte(i%70 + 30)
+ }
+ f, err := os.Create(fpath)
+ if err != nil {
+ c.Log.Error("FILE", "创建临时文件失败"+fpath+":"+err.Error())
+ } else {
+ f.Write(fcontent)
+ f.Close()
+ rcontent, err := os.ReadFile(fpath)
+ if err != nil {
+ c.Log.Error("FILE", "读取临时文件失败")
+ } else {
+ for i := 0; i < fsize; i++ {
+ if fcontent[i] != rcontent[i] {
+ c.Log.Error("FILE", "写入临时文件校验失败")
+ break
+ }
+ }
+ os.Remove(fpath)
+ }
+ }
+ disk_ioms := c.Timems() - starttime
+
+ output := c.RunCmd("ps", "aux", "-A")
+ cmddb := []string{"mysql", "mysqld"}
+ cmdweb := []string{"nginx", "php", "WorkerMan", "mosquitto", "gitea", "/zgo"}
+ cpu := map[string]float64{"db": 0, "web": 0, "oth": 0}
+ mem := map[string]float64{"db": 0, "web": 0, "oth": 0}
+
+ for _, line := range output {
+ if strings.Contains(line, "COMMAND") {
+ continue
+ }
+ _nextspace(&line)
+ _nextspace(&line)
+ cpup := c.Tofloat(_nextspace(&line))
+ memp := c.Tofloat(_nextspace(&line))
+ _nextspace(&line) // 虚拟内存
+ _nextspace(&line) // 物理内存 包括共享内存
+ _nextspace(&line)
+ _nextspace(&line)
+ _nextspace(&line)
+ _nextspace(&line)
+ if _arrin(line, cmddb) {
+ cpu["db"] += cpup
+ mem["db"] += memp
+ } else if _arrin(line, cmdweb) {
+ cpu["web"] += cpup
+ mem["web"] += memp
+ } else {
+ cpu["oth"] += cpup
+ mem["oth"] += memp
+ }
+ }
+
+ output = c.RunCmd("free", "-m")
+ mem_free := 0
+ matches := regexp.MustCompile(`Mem:\s+(\d+)`).FindStringSubmatch(output[1])
+ if len(matches) > 1 {
+ mem_free = c.Toint(c.Tofloat(matches[1]) * (100 - cpu["db"] - cpu["web"] - cpu["oth"]) * 1024 * 1024 / 100)
+ }
+
+ output = c.RunCmd("sh", "-c", "netstat -an | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'")
+ net_tcp := 0
+ for _, line := range output {
+ ls := strings.Split(line, " ")
+ if ls[0] == "LISTEN" {
+ continue
+ }
+ if len(ls) < 2 {
+ continue
+ }
+ net_tcp += c.Toint(ls[1])
+ }
+ starttime = c.Timems()
+ resp, err := http.Get("https://www.baidu.com")
+ if err == nil {
+ resp.Body.Close()
+ }
+ net_ioms := c.Timems() - starttime
+
+ dbrows, err := c.CiyDB.Getraw("show global status")
+ if err != nil {
+ c.Log.Error("FILE", "执行show global status失败")
+ }
+ dbstat := map[string]float64{}
+ for _, row := range dbrows {
+ name := c.Tostr(row["Variable_name"])
+ val := c.Tofloat(row["Value"])
+ dbstat[name] = val
+ }
+ db_keyhit := dbstat["Handler_read_key"] / (dbstat["Com_select"] + 1) * 100
+ db_dbhit := dbstat["Innodb_buffer_pool_reads"] / (dbstat["Innodb_buffer_pool_read_requests"] + 1) * 100
+ db_tmptable := dbstat["Created_tmp_disk_tables"] / (dbstat["Created_tmp_tables"] + 1) * 100
+
+ updata := map[string]any{}
+ updata["func_succ"] = func_succ
+ updata["func_fail"] = func_fail
+ updata["func_commit"] = func_commit
+ updata["func_rollback"] = func_rollback
+ updata["func_runms"] = func_runms
+ updata["disk_sysfree"] = disk_sysfree
+ updata["disk_datafree"] = disk_datafree
+ updata["disk_ioms"] = disk_ioms
+ updata["cpu_free"] = 100 - cpu["db"] - cpu["web"] - cpu["oth"]
+ updata["cpu_db"] = cpu["db"]
+ updata["cpu_web"] = cpu["web"]
+ updata["cpu_oth"] = cpu["oth"]
+ updata["mem_free"] = mem_free
+ updata["mem_db"] = mem["db"]
+ updata["mem_web"] = mem["web"]
+ updata["mem_oth"] = mem["oth"]
+ updata["net_tcp"] = net_tcp
+ updata["net_ioms"] = net_ioms
+ updata["db_query"] = dbstat["Questions"]
+ updata["db_commit"] = dbstat["Com_commit"]
+ updata["db_rollback"] = dbstat["Com_rollback"]
+ updata["db_keyhit"] = db_keyhit
+ updata["db_dbhit"] = db_dbhit
+ updata["db_tmptable"] = db_tmptable
+ updata["db_lock"] = dbstat["Innodb_row_lock_current_waits"]
+ updata["addtimes"] = c.Tostamp()
+ csql := c.NewCiySQL("zc_stats")
+ c.CiyDB.Insert(csql, updata)
+
+ retmsg := "succ: " + c.Tostr(func_succ)
+ if func_rollback > 0 {
+ retmsg += ", rollback: " + c.Tostr(func_rollback)
+ }
+ return retmsg
+}
+func dayclean(systemrow map[string]any) string {
+ maxAge := 3 * 24 * time.Hour
+ cnt := 0
+ errcnt := 0
+ filepath.Walk(c.CiyWebDir+"/ud/tmp", func(path string, info os.FileInfo, err error) error {
+ if err != nil {
+ _tasklog(systemrow, "出现错误:"+err.Error())
+ return err
+ }
+ if info.IsDir() {
+ return nil
+ }
+ if time.Since(info.ModTime()) > maxAge {
+ err := os.Remove(path)
+ cnt++
+ if err != nil {
+ errcnt++
+ fmt.Printf("failed to delete file: %s\n", err)
+ }
+ }
+ return nil
+ })
+ retmsg := "clean: " + c.Tostr(cnt)
+ if errcnt > 0 {
+ retmsg += ", err: " + c.Tostr(errcnt)
+ }
+ return retmsg
+}
+
+func _nextspace(line *string) string {
+ ind := strings.Index(*line, " ")
+ if ind == -1 {
+ *line = ""
+ return *line
+ }
+ va := (*line)[:ind]
+ *line = (*line)[ind:]
+ *line = strings.TrimSpace(*line)
+ return va
+}
+func _arrin(cmd string, arr []string) bool {
+ for _, v := range arr {
+ if strings.Contains(cmd, v) {
+ return true
+ }
+ }
+ return false
+}
diff --git a/web/admin/autotask/base.php b/web/admin/autotask/base.php
new file mode 100644
index 0000000..35b4984
--- /dev/null
+++ b/web/admin/autotask/base.php
@@ -0,0 +1,231 @@
+where('addtimes<', time() - 86400 * 90));
+ $msg .= self::_base_deldb($db, (new \ciy\sql('zc_autotsk_log'))->where('addtimes<', time() - 86400 * 90));
+ $msg .= self::_base_deldb($db, (new \ciy\sql('zc_funcslow'))->where('addtimes<', time() - 86400 * 60));
+ $msg .= self::_base_deldb($db, (new \ciy\sql('zc_stats'))->where('addtimes<', time() - 86400 * 60));
+ $msg .= self::_base_deldb($db, (new \ciy\sql('zc_log'))->where('addtimes<', time() - 86400 * 100));
+ $msg .= self::_base_deldb($db, (new \ciy\sql('zc_online'))->where('exptimes<', time() - 86400 * 7));
+
+ $cnt = 0;
+ $msg .= self::_base_delfile(PATH_WEB . 'ud/tmp', 86400 * 3, $cnt);
+ $cnt = 0;
+ $msg .= self::_base_delfile(PATH_WEB . 'ud/rep', 86400 * 1, $cnt);
+ return $msg;
+ }
+ static function _base_deldb($db, $csql) {
+ $execute = $db->delete($csql);
+ if ($execute === false)
+ return 'clean ' . $csql->table . ': ' . $db->error . '| 任务名称 | " + c.Tostr(taskrow["name"]) + " |
| 入口函数 | " + c.Tostr(taskrow["runfunc"]) + " |
| 执行参数 | " + c.Tostr(taskrow["runparam"]) + " |
| 执行时长 | " + c.Tostr(tskrunrow["runsec"]) + "s |
| 任务简报 | " + c.Tostr(tskrunrow["msg"]) + " |
| 时间 | 数据 |
| " + c.Todate(c.Toint(row["addtimes"])) + " | " + c.Tostr(row["msg"]) + " |
| 任务名称 | ' . $taskrow['name'] . ' |
| 入口函数 | ' . $taskrow['runfunc'] . ' |
| 执行参数 | ' . $taskrow['runparam'] . ' |
| 执行时长 | ' . $tskrunrow['runsec'] . 's |
| 任务简报 | ' . $tskrunrow['msg'] . ' |
| 时间 | 数据 |
| ' . date('Y-m-d H:i:s', $row['addtimes']) . ' | ' . $row['msg'] . ' |
+
+ -- 贷款金额 (万元) |
+ -- 待还金额 (万元) |
+ -- 贷款单位 (家) |
+
+
+
+
+
+
+
+
+ | + | 贷款 (万元) | +合同 (份) | +单位 (家) | +
| 300万以内 | +
+ --
+
+ |
+
+ --
+
+ |
+
+ --
+
+ |
+
| 300-800万 | +
+ --
+
+ |
+
+ --
+
+ |
+
+ --
+
+ |
+
| 800万以上 | +
+ --
+
+ |
+
+ --
+
+ |
+
+ --
+
+ |
+
+
+
+
+
+ ' + thos.ce.viewer.flags.speedbet + '';
+ htmltip += ' ';
+ $5('.cecontrolpanel').html(htmltip);
+ } else {
+ $5('.cecontrolpanel').html('');
+ }
+ }
+ };
+ }
+ this.distory = function (data) {
+ if (thos.ce)
+ thos.ce.destroy();
+ thos.ce = null;
+ }
+
+
+ var thos = this;
+ this.ce = null;
+ this.resize();
+ opdata.container.append(`
+
+ `);
+}
\ No newline at end of file
diff --git a/web/admin/demo/bs/b64/farm1_c1.js b/web/admin/demo/bs/b64/farm1_c1.js
new file mode 100644
index 0000000..3eadbaf
--- /dev/null
+++ b/web/admin/demo/bs/b64/farm1_c1.js
@@ -0,0 +1,26 @@
+
+function ciy_chart_farm1_c1(opdata) {
+ this.func = ['farm_c1'];
+ this.lastdata = {};
+ this.resize = function () {
+ }
+ this.setdata = function (funame, data) {
+ if (!data)
+ return;
+ this.lastdata[funame] = data;
+ $5('[data-bank]', opdata.container).text(data.farm.name);
+ }
+ this.distory = function () {
+ }
+
+
+ opdata.container.append(`
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | # | '; + foreach ($heads as $arr) { + $html .= '' . $arr['name'] . ' | '; + } + $html .= '' . $lineidx . ' | ';
+ $bempty = true;
+ $unqs = array();
+ $csql = new \ciy\sql('zc_admin');
+ foreach ($heads as $arr) {
+ $name = $arr['name'];
+ $errmsg = ''; //数据有误,显示红色说明
+ $showdat = ''; //显示在表格中的数据
+ if ($arr['idx'] > -1)
+ $showdat = trim($datas[$rowidx][$arr['idx']]);
+ if ($showdat == '--')
+ $showdat = '';
+ $value = $showdat; //在表单中的数据(转换后)
+ $ext = ''; //扩展表单
+ if ($name == '行码') {
+ if (empty($showdat)) {
+ $value = 0;
+ $showdat = '新增';
+ } else {
+ $id = deid($showdat);
+ if ($id == 0)
+ $errmsg = $name . '解析错误';
+ else {
+ $csqlchk = new \ciy\sql('zc_admin');
+ $csqlchk->where('id', $id)->column('id');
+ $chkid = toint($db->get1($csqlchk));
+ if ($chkid != $id)
+ $errmsg = $name . '在数据库中不存在';
+ $value = $id;
+ }
+ }
+ } else if ($name == '姓名') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ }
+ } else if ($name == '手机号') {
+ $csql->where('mobile', $showdat);
+ $unqs[] = $showdat;
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ }
+ } else if ($name == '性别') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ } else {
+ $value = dcode($code_sex, $showdat);
+ if ($value == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ }
+ } else if ($name == '所属组织') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $dats = explode('-', $showdat);
+ $value = dcode($code_departid, $dats[count($dats) - 1]);
+ if ($value == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ }
+ }
+ if (!empty($showdat))
+ $bempty = false;
+
+ if (empty($errmsg))
+ $hrhtml .= '' . $showdat . '' . $ext . ' | ';
+ else
+ $hrhtml .= '' . $showdat . ' | ';
+ }
+ if ($bempty)
+ continue;
+
+ if (count($unqs) > 0) {
+ $unq = implode('|', $unqs);
+ if (in_array($unq, $uniques))
+ $firsthtml = '重复 | ';
+ else {
+ $uniques[] = $unq;
+ $csql->column('id');
+ $chkid = toint($db->get1($csql));
+ if ($chkid > 0 && (($id > 0 && $chkid != $id) || $id == 0))
+ $firsthtml = '重复 | ';
+ }
+ }
+ $html .= '
|---|---|
共' . $cnt . '条数据';
+ return succjson(array('html' => $html, 'count' => $cnt));
+ }
+ public static function json_importxls_data() {
+ global $db;
+ $rsuser = verifyfast();
+ if (nopower($db, $rsuser['id'], 'p500a'))
+ return errjson('您未被授权操作新增');
+ $post = new \ciy\post();
+ $total = $post->getint('total');
+ try {
+ $db->begin();
+ for ($i = 1; $i <= $total; $i++) {
+ $id = $post->getint('id_' . $i);
+ $name = $post->get('name_' . $i);
+ $mobile = $post->get('mobile_' . $i);
+ $sex = $post->get('sex_' . $i);
+ $departid = $post->get('departid_' . $i);
+ $csql = new \ciy\sql('zc_admin');
+ $csql->where('mobile', $mobile);
+ $csql->column('id');
+ $chkid = toint($db->get1($csql));
+ if ($chkid > 0 && (($id > 0 && $chkid != $id) || $id == 0))
+ throw new \Exception('CIYIGN发现数据有重复');
+
+ $updata = array();
+ $updata['name'] = $name;
+ $updata['mobile'] = $mobile;
+ $updata['stpstatus'] = 10;
+ $updata['sex'] = $sex;
+ $updata['departid'] = $departid;
+ $updata['addtimes'] = tostamp();
+ $csql = new \ciy\sql('zc_admin');
+ if ($id == 0) {
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增失败:' . $db->error);
+ } else {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ }
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $db->execute('update zc_online set usrchg=2');
+ return succjson();
+ }
+}
diff --git a/web/admin/demo/dyn/callapi.html b/web/admin/demo/dyn/callapi.html
new file mode 100644
index 0000000..e56f2b8
--- /dev/null
+++ b/web/admin/demo/dyn/callapi.html
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 获取token+
业务调用+
识别号+
登录用户+
ECC签名+
ECC验签+
PIN码+
重置PIN码+
读写标记+
初始化+
生成RSA密钥对+
RSA签名+
RSA验签+
钱包登录+
钱包签名+
钱包验签+
css优先级+
hr横线+ + +
行内效果+
code效果
+ kbd效果
+ 下划线
+
+ 24栅格+
pre代码块+
#include bits/stdc.h
+int main() {
+ return 0;
+}
+
+ 图标+ 首尾
按钮+ + + + + +
span效果+ span + def + dag + imp succ + warn + man + span + cata_dag + cata_imp + cata_warn + cata_man + +
fieldset+ + + + +
特定css+
+ciy-tree-spread +table +search +ciy-list l0/l1/l2/l3 rt rb lb rbg +gridline end +ciy-form text v inline label.imp label.auto char[2-9] inline-minwidth +form-bottom +input.tran select.tran textarea.tran +ciy-badge ciy-badge-dot +ciy-tabcard +ciy-caption mk center title right sub +fieldset/legend box tips ++ +
原子css+
+txt-sm/smm/smmm txt-lg/lgg/lggg txt-left/center/right/just +txt-wb 加粗 txt-wl 细线 txt-un 下划线 +txt[1-9] bg[1-9] px[1-4] py[1-4] r[1-5] +cursor-p/d txt-nowrap txt-over +flex flex-center flex-top +flex1 flexnone +hide noselect tran5 +sta abs fix rel sti r0 l0 t0 b0 r1 l1 t1 b1 ++ + + \ No newline at end of file diff --git a/web/admin/demo/front/demo_cssn.html b/web/admin/demo/front/demo_cssn.html new file mode 100644 index 0000000..7ffb36f --- /dev/null +++ b/web/admin/demo/front/demo_cssn.html @@ -0,0 +1,50 @@ + + + +
dom方法+ dom单个元素,无null。doms多个元素,无[]。
clas链+
attr方法+ get,支持stirng和json + 有属性 + 属性没有值 + 无属性 +
css方法+ get css + 定义style,获取bgcolor + 未定义style,获取bgcolor +
val方法+ val 设置/获取value,支持ciycmp对象setvalue/getvalue
html/text方法+ outhtml/html 设置/获取html。text 设置/获取文本。 +
p1
+p2
+p3
+ html覆盖内部 + outhtml覆盖自身 + text覆盖 +html方法+ outhtml/html 设置/获取html。prepend/append 子元素。before/after 兄弟元素 +
p1
+p2
+p3
+ prepend内部插入 + append内部添加 + before上插入 + after下添加 + html覆盖内部 + outhtml覆盖自身 +prev/next方法+ 获取n个 +
n1
+n2
+n3
+n4
+n5
+n6
+n7
+无上下dom
+on/one/off方法+
rect方法+
aniin/aniout动画方法+ + + + +
getGamepads 0-3+
pulse-loader+ + + +
ring-loader+ + +
bounce-loader+
neon-loader+
fluid-loader+ + +
minimal-loader+
所有函数+
+ ciyfn.ajax ajax请求
+ ciyfn.callfunc 后台json_xx交互,
+ funcname:
+ 函数名,func
+ 本级目录下其他页函数,gocxx.func
+ 指定页函数,path1/path2/gocxx.func
+ post: object数据
+ succfn: 请求成功回调
+ opn:
+ header: 请求头object
+ method: 请求方式,get/post/put/delete
+ timeout: 超时时间,默认10秒
+ showload: 是否显示顶部加载条,默认true
+ fail: 请求失败回调,默认ciyfn.alert提示
+ complete: 请求完成回调
+ ciyfn.callfastfunc 后台json_xx单行交互,防重复,调用callfunc
+ dom: 防重复dom
+ confirmmsg: 提示文字,有则alert,无则直接请求
+ func: 调用callfunc的funcname
+ postparam: 调用callfunc的post
+ succfunc: 字符串reload刷新本页,或成功回调函数
+ failfunc: 失败回调函数
+ ciyfn.tojson json解析,无论是否能序列化,均返回object。
+ ciyfn.jsontostr json转字符串。
+
+ ciyfn.calljsondata 加载json数据
+ ciyfn.loadjs 加载js库。
+ objname: 根据window下是否存在某函数,存在则不用重复加载。
+ jsurl: js库地址
+ callback: 准备好回调函数
+ ciyfn.throttle 防止频繁调用。
+ dom: 给该dom加上loading class,在callfunc done后移除。
+ sec: 多少秒,默认ciy_vars.dupsec
+
+ ciyfn.getdictdata 获取字典数据。array/localstroage.cata_xx/window.ciy_xx/id.name,id2.name2
+ ciyfn.filterdictdata 过滤字典数据。
+ data: 字典数据
+ opn: {}
+ all: 顶部添加{id:'', name:all}
+ first: 顶部添加...first
+ limit: a~b 只包含[a,b]。a,b,c 包含a,b,c
+ filter: field=value 只包含field=value的数据。
+ rename: 10=新名称 将id=10的name改为新名称。
+
+ ciyfn.ccode 字典id转name
+ ciyfn.multicode 多级字典id转数组
+ ciyfn.scode 多选字典,逗号分隔id转数组
+
+
+ ciyfn.getform 获取某元素被包含的form数据。默认body/form。自定义tagname。
+ ciyfn.makeuploadpath 生成标准上传路径,支持saasid。[sn/n/]Y/md/xxx
+ ciyfn.arr_treemap 带upid的数组,转带child的树形结构
+ ciyfn.urlparam 将url参数转为object对象。
+ ciyfn.sendsignal 向其他窗口发送信号,支持跨域。
+ manage_refresh 刷新当前页
+ manage_ifropen 打开新卡片页
+ restorage 刷新storage
+
+ tostr 转化成字符串
+ toint 转化成整数
+ tofloat 转化成浮点数
+ tostamp 输入Date/字符串时间,返回时间戳。不输入,返回当前时间戳。
+ isarray 判断是否为[]
+ isobj 判断是否为{}
+ ciyfn.isemptyobj 判断是否为空{}
+ ciyfn.getstorage 获取storage数据
+ ciyfn.setstorage 设置storage数据
+ ciyfn.removestorage 删除storage数据
+ ciyfn.savedict 保存字典数据。
+
+
+
+ ciyclass.managepage 管理页面基类
+ ciyfn.inmobile 判断是否在移动端
+
+ ciyfn.totimepoint 将数字转成 HH:ii[:ss]
+ ciyfn.totimespan 输入时间/时间戳,返回n[天/小时/月..]前/后
+ ciyfn.totimesec 输入秒数,返回n[天/小时/月..]前/后、刚刚
+ ciyfn.todatetime 格式化时间,输入时间戳/字符串/Date/-1,返回Y-m-d H:i
+ ciyfn.objclone 对象深拷贝
+ ciyfn.isfloat0 浮点数是否接近0
+ ciyfn.topad0 数字左侧补0
+
+ ciyfn.copyboard 复制到剪贴板
+ ciyfn.file_ext 获取文件后缀名,大写
+ ciyfn.isimg 判断是否为图片文件
+
+ ciyfn.getstrparam
+
+ ciyfn.file_uploads 上传文件到本地或云存储
+ ciyfn.nopower 无权限判断
+ ciyclass.sse 服务器SSE事件类
+
+ ciyfn.lang 多语言转文字
+ ciyfn.setlang 设置语言
+ ciyfn.domlang 将dom中.lang转文字
+ ciyfn.file_stor 获取文件存储url
+
+ ciyfn.alert 弹出alert。
+ ciyfn.toast 信息提示。
+ ciyfn.showend 右下角提示,数秒隐藏。
+ ciyclass.mask 默认页面初始化。 .show(clickfn,css) / .hide()
+ ciyfn.popmenu 弹出菜单
+ menu: array:[{ title:'',act,name,url},...]
+ menu: Element 完全自定义菜单
+ ciyfn.showmap 打开地图,显示位置。
+ ciyfn.dropmenu 下拉菜单
+ ciyclass.tabcard 选显卡类
+ ciyfn.lazyimg 图片懒加载
+
+ 对话框+
自定尺寸对话框+
多按钮对话框+
带输入对话框+
iframe对话框+
iframe对话框回调+
自定义对话框+
左右对齐对话框+
其他对话框+
按钮样式+
自定尺寸按钮+
图标按钮+
span标签+
下拉按钮+
叠加提示效果+
tabcard类+
tabcard类用于创建带有选项卡的卡片,可以切换不同内容,并提供右侧按钮。
+使用方法:
+支持2个样式类,分别是simple、form
+支持full类,将空间高度占满
+支持right元素,用于放置右侧按钮
+tabcontent与li数量相等,自动切换对应tabcontent
+无tabcontent则用户自行实现
+JS调用ciyclass.tabcard()方法初始化
+ data-display: 元素属性,显示模式。可选值block、inline-block、flex、inline-flex、grid、inline-grid信息提示效果+
顶部静默加载效果+ +
| # | \n" + for _, arr := range heads { + html += "" + arr["name"] + " | \n" + } + html += "" + lineidx + " | "
+ bempty := true
+ unqs := make([]string, 0)
+ csql := c.NewCiySQL("demo_normal")
+ for _, arr := range heads {
+ name := arr["name"]
+ errmsg := "" //数据有误,显示红色说明
+ showdat := "" //显示在表格中的数据
+ if c.Toint(arr["idx"]) > -1 {
+ showdat = strings.TrimSpace(datas[0][rowidx][c.Toint(arr["idx"])])
+ }
+ if showdat == "--" {
+ showdat = ""
+ }
+ var value any
+ value = showdat //在表单中的数据(转换后)
+ ext := "" //扩展表单
+ if name == "行码" {
+ if showdat == "" {
+ value = 0
+ showdat = "新增"
+ } else {
+ id = c.DeID(showdat)
+ if id == 0 {
+ errmsg = name + "解析错误"
+ } else {
+ csqlchk := c.NewCiySQL("demo_normal")
+ csqlchk.Where("id", id).Column("id")
+ chkid := c.Toint(c.CiyDB.Get1(csqlchk))
+ if chkid != id {
+ errmsg = name + "在数据库中不存在"
+ }
+ value = id
+ }
+ }
+ } else if name == "审核状态" {
+ if showdat == "" {
+ value = 0
+ } else {
+ value = c.Dcode(code_auditstatus, c.Tostr(showdat))
+ if value == -1 {
+ errmsg = name + "文字与系统数据不匹配"
+ }
+ }
+ } else if name == "审核人" {
+ if showdat == "" {
+ value = 0
+ } else {
+ value = c.Dcode(code_userid, showdat)
+ if value == -1 {
+ errmsg = name + "文字与系统数据不匹配"
+ }
+ }
+ } else if name == "审核时间" {
+ if showdat == "" {
+ value = 0
+ } else {
+ value = c.Tostamp(c.Tostr(showdat))
+ if value == 0 {
+ errmsg = name + "时间格式错误"
+ } else {
+ showdat = c.Todate(c.Toint(value), "Y-m-d H:i:s")
+ }
+ }
+ } else if name == "默认标题" {
+ if showdat == "" {
+ errmsg = name + "为必填项"
+ } else {
+ csql.Where("name", showdat)
+ unqs = append(unqs, showdat)
+ }
+ } else if name == "所属菜单" {
+ if showdat == "" {
+ value = 0
+ } else {
+ value = c.Dcode(code_menuid, showdat)
+ if value == -1 {
+ errmsg = name + "文字与系统数据不匹配"
+ }
+ }
+ } else if name == "文件大小" {
+ if showdat == "" {
+ value = 0
+ } else {
+ idat, err := strconv.Atoi(showdat)
+ if err != nil {
+ errmsg = name + "不是数字"
+ } else {
+ value = idat
+ }
+ }
+ } else if name == "长度" {
+ if showdat == "" {
+ value = 0
+ } else {
+ idat, err := strconv.ParseFloat(showdat, 64)
+ if err != nil {
+ errmsg = name + "不是数字"
+ } else {
+ value = c.Toint(idat * 1000)
+ showdat += "米"
+ }
+ }
+ } else if name == "贷款金额" {
+ if showdat == "" {
+ value = 0
+ } else {
+ idat, err := strconv.ParseFloat(showdat, 64)
+ if err != nil {
+ errmsg = name + "不是数字"
+ } else {
+ value = c.Toint(idat * 1000000)
+ showdat += "万元"
+ }
+ }
+ } else if name == "设置日期" {
+ if showdat == "" {
+ value = 0
+ } else {
+ value = c.Tostamp(c.Tostr(showdat))
+ if value == 0 {
+ errmsg = name + "时间格式错误"
+ } else {
+ showdat = c.Todate(c.Toint(value), "Y-m-d")
+ }
+ }
+ } else if name == "设置时间" {
+ if showdat == "" {
+ value = 0
+ } else {
+ value = c.Tostamp(c.Tostr(showdat))
+ if value == 0 {
+ errmsg = name + "时间格式错误"
+ } else {
+ showdat = c.Todate(c.Toint(value), "Y-m-d H:i:s")
+ }
+ }
+ } else if name == "是否使用" {
+ if showdat == "" {
+ value = 0
+ } else {
+ if showdat == code_isuse[0]["name"] {
+ value = 1
+ showdat = c.Tostr(code_isuse[0]["name"])
+ } else {
+ value = 2
+ showdat = c.Tostr(code_isuse[1]["name"])
+ }
+ }
+ } else if name == "是否开启" {
+ if showdat == "" {
+ value = 0
+ } else {
+ if showdat == code_isopen[0]["name"] {
+ value = 1
+ showdat = c.Tostr(code_isuse[0]["name"])
+ } else {
+ value = 2
+ showdat = c.Tostr(code_isuse[1]["name"])
+ }
+ }
+ } else if name == "库存单位" {
+ //显示 1箱=5盒,1盒=10袋 存储 袋|10|盒|5|箱
+ if showdat == "" {
+ } else {
+ us := strings.Split(showdat, ",")
+ if len(us) == 2 {
+ tmp := us[0]
+ us[0] = us[1]
+ us[1] = tmp
+ }
+ us[0] = us[0][1:]
+ re := regexp.MustCompile(`(.*?)(\d+)(.*)`)
+ matches := re.FindStringSubmatch(us[0])
+ if len(matches) >= 4 {
+ unitx := matches[1]
+ value = matches[3] + "|" + matches[2] + "|" + matches[1]
+ if len(us) == 2 {
+ us[1] = us[1][1:]
+ matches = re.FindStringSubmatch(us[1])
+ if len(matches) >= 4 {
+ if unitx != matches[3] {
+ errmsg = name + "中间单位不匹配"
+ } else {
+ value = c.Tostr(value) + "|" + matches[2] + "|" + matches[1]
+ }
+ } else {
+ errmsg = name + "第二段格式错误"
+ }
+ }
+ } else {
+ errmsg = name + "第一段格式错误"
+ }
+ }
+ } else if name == "多选状态" {
+ if showdat == "" {
+ } else {
+ tdats := strings.Split(showdat, ",")
+ vals := make([]string, 0)
+ for _, da := range tdats {
+ tval := c.Dcode(code_mauditstatus, da)
+ if tval == -1 {
+ errmsg = name + "文字与系统数据不匹配"
+ }
+ vals = append(vals, c.Tostr(tval))
+ }
+ value = strings.Join(vals, ",")
+ }
+ } else if name == "商品分类" {
+ if showdat == "" {
+ value = 0
+ } else {
+ dats := strings.Split(showdat, "-")
+ value = c.Dcode(code_prodcata, dats[len(dats)-1])
+ if value == -1 {
+ errmsg = name + "文字与系统数据不匹配"
+ }
+ }
+ } else if name == "所在地区" {
+ if showdat == "" {
+ value = 0
+ } else {
+ dats := strings.Split(showdat, "-")
+ value = c.Dcode(code_areacode, dats[len(dats)-1])
+ if value == -1 {
+ errmsg = name + "文字与系统数据不匹配"
+ }
+ }
+ } else if name == "认证情况" {
+ if showdat == "" {
+ value = 0
+ } else {
+ dats := strings.Split(showdat, ",")
+ tdat := 0
+ for _, da := range dats {
+ bti := c.Dcode(code_renzheng, da)
+ if bti == -1 {
+ errmsg = name + "文字与系统数据不匹配"
+ }
+ tdat += (1 << (bti - 1))
+ }
+ value = tdat
+ }
+ } else if name == "执行周期" {
+ if showdat == "" {
+ value = 0
+ } else {
+ last := showdat[len(showdat)-3:]
+ dd := c.Toint(showdat[:len(showdat)-3])
+ if dd == 0 {
+ errmsg = name + "周期数字错误"
+ } else if last == "天" {
+ value = dd * 86400
+ } else if last == "月" {
+ value = -dd
+ } else if last == "秒" {
+ value = dd
+ } else {
+ errmsg = name + "周期单位错误"
+ }
+ }
+ } else if name == "执行用时" {
+ if showdat == "" {
+ value = 0
+ } else {
+ idat, err := strconv.Atoi(showdat)
+ if err != nil {
+ errmsg = name + "不是数字"
+ } else {
+ value = idat
+ }
+ }
+ } else if name == "活动期数" {
+ if showdat == "" {
+ value = 0
+ } else {
+ idat, err := strconv.Atoi(showdat)
+ if err != nil {
+ errmsg = name + "不是数字"
+ } else {
+ value = idat
+ }
+ }
+ } else if name == "吨位" {
+ if showdat == "" {
+ value = 0
+ } else {
+ idat, err := strconv.ParseFloat(showdat, 64)
+ if err != nil {
+ errmsg = name + "不是数字"
+ } else {
+ value = c.Toint(idat * 1000000)
+ showdat += "吨"
+ }
+ }
+ } else if name == "单价" {
+ if showdat == "" {
+ value = 0
+ } else {
+ idat, err := strconv.ParseFloat(showdat, 64)
+ if err != nil {
+ errmsg = name + "不是数字"
+ } else {
+ value = c.Toint(idat * 100)
+ showdat += "元"
+ }
+ }
+ } else if name == "纬度" {
+ if showdat == "" {
+ value = 0
+ } else {
+ idat, err := strconv.ParseFloat(showdat, 64)
+ if err != nil {
+ errmsg = name + "不是数字"
+ } else {
+ value = idat
+ }
+ }
+ } else if name == "位置" {
+ if showdat == "" {
+ value = 0
+ } else {
+ idat, err := strconv.ParseFloat(showdat, 64)
+ if err != nil {
+ errmsg = name + "不是数字"
+ } else {
+ value = idat
+ }
+ }
+ } else if name == "监管数量" {
+ if showdat == "" {
+ value = 0
+ } else {
+ idat, err := strconv.ParseFloat(showdat, 64)
+ if err != nil {
+ errmsg = name + "不是数字"
+ } else {
+ value = idat
+ }
+ }
+ } else if name == "链接" {
+ } else if name == "身份证号" {
+ } else if name == "体重" {
+ if showdat == "" {
+ value = 0
+ } else {
+ idat, err := strconv.ParseFloat(showdat, 64)
+ if err != nil {
+ errmsg = name + "不是数字"
+ } else {
+ value = c.Toint(idat * 1000)
+ showdat += "KG"
+ }
+ }
+ } else if name == "耳温" {
+ if showdat == "" {
+ value = 0
+ } else {
+ idat, err := strconv.ParseFloat(showdat, 64)
+ if err != nil {
+ errmsg = name + "不是数字"
+ } else {
+ value = c.Toint(idat * 1000)
+ showdat += "℃"
+ }
+ }
+ } else if name == "介绍" {
+ }
+ if showdat != "" {
+ bempty = false
+ }
+ if errmsg == "" {
+ hrhtml += "" + showdat + "" + ext + " | "
+ } else {
+ hrhtml += "" + showdat + " | "
+ }
+ }
+ if bempty {
+ continue
+ }
+
+ if len(unqs) > 0 {
+ unq := strings.Join(unqs, "|")
+ if _, ok := uniques[unq]; ok {
+ firsthtml = "重复 | "
+ } else {
+ uniques[unq] = true
+ csql.Column("id")
+ chkid := c.Toint(c.CiyDB.Get1(csql))
+ if chkid > 0 && ((id > 0 && chkid != id) || id == 0) {
+ firsthtml = "重复 | "
+ }
+ }
+ }
+ html += "
|---|---|
共" + c.Tostr(cnt) + "条数据\n"
+ return c.SuccJSON(w, r, map[string]any{
+ "html": html,
+ "count": cnt,
+ })
+}
+func Normal_importxls_data(w http.ResponseWriter, r *http.Request) bool {
+ post := c.NewCiyPost(w, r)
+ _, userid := admin.Verifyfast(r, c.CiyDB, post)
+ if userid == 0 {
+ return false
+ }
+ total := post.Getint("total")
+ err := c.CiyDB.Tran(func() error {
+ for i := 1; i <= total; i++ {
+ istr := c.Tostr(i)
+ id := post.Getint("id_" + istr)
+ auditstatus := post.Get("auditstatus_" + istr)
+ audituser := post.Get("audituser_" + istr)
+ audittimes := post.Get("audittimes_" + istr)
+ name := post.Get("name_" + istr)
+ menuid := post.Get("menuid_" + istr)
+ filesize := post.Get("filesize_" + istr)
+ metre := post.Get("metre_" + istr)
+ bankmoney := post.Get("bankmoney_" + istr)
+ setdate := post.Get("setdate_" + istr)
+ settimes := post.Get("settimes_" + istr)
+ isuse := post.Get("isuse_" + istr)
+ isopen := post.Get("isopen_" + istr)
+ unit := post.Get("unit_" + istr)
+ mauditstatus := post.Get("mauditstatus_" + istr)
+ prodcata := post.Get("prodcata_" + istr)
+ areacode := post.Get("areacode_" + istr)
+ renzheng := post.Get("renzheng_" + istr)
+ npcyc := post.Get("npcyc_" + istr)
+ runsec := post.Get("runsec_" + istr)
+ acttm := post.Get("acttm_" + istr)
+ ton := post.Get("ton_" + istr)
+ price := post.Get("price_" + istr)
+ lat := post.Get("lat_" + istr)
+ lng := post.Get("lng_" + istr)
+ url := post.Get("url_" + istr)
+ idcard := post.Get("idcard_" + istr)
+ weightg := post.Get("weightg_" + istr)
+ eartmpr := post.Get("eartmpr_" + istr)
+ content := post.Get("content_" + istr)
+ csql := c.NewCiySQL("demo_normal")
+ csql.Where("name", name)
+ csql.Column("id")
+ chkid := c.Toint(c.CiyDB.Get1(csql))
+ if chkid > 0 && ((id > 0 && chkid != id) || id == 0) {
+ return fmt.Errorf("发现数据有重复")
+ }
+ updata := map[string]any{}
+ updata["auditstatus"] = auditstatus
+ updata["audituser"] = audituser
+ updata["audittimes"] = audittimes
+ updata["name"] = name
+ updata["menuid"] = menuid
+ updata["filesize"] = filesize
+ updata["metre"] = metre
+ updata["bankmoney"] = bankmoney
+ updata["setdate"] = setdate
+ updata["settimes"] = settimes
+ updata["isuse"] = isuse
+ updata["isopen"] = isopen
+ updata["unit"] = unit
+ updata["mauditstatus"] = mauditstatus
+ updata["prodcata"] = prodcata
+ updata["areacode"] = areacode
+ updata["renzheng"] = renzheng
+ updata["npcyc"] = npcyc
+ updata["runsec"] = runsec
+ updata["acttm"] = acttm
+ updata["ton"] = ton
+ updata["price"] = price
+ updata["lat"] = lat
+ updata["lng"] = lng
+ updata["url"] = url
+ updata["idcard"] = idcard
+ updata["weightg"] = weightg
+ updata["eartmpr"] = eartmpr
+ updata["content"] = content
+ updata["addtimes"] = c.Tostamp()
+ csql = c.NewCiySQL("demo_normal")
+ var err error
+ if id == 0 {
+ _, err = c.CiyDB.Insert(csql, updata)
+ } else {
+ csql.Where("id", id)
+ _, err = c.CiyDB.Update(csql, updata)
+ }
+ if err != nil {
+ return fmt.Errorf("导入失败:%v", err)
+ }
+ }
+ return nil
+ })
+ if err != nil {
+ return c.ErrJSON(w, err.Error())
+ }
+ return c.SuccJSON(w, r)
+}
diff --git a/web/admin/demo/normal.html b/web/admin/demo/normal.html
new file mode 100644
index 0000000..919918f
--- /dev/null
+++ b/web/admin/demo/normal.html
@@ -0,0 +1,947 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/demo/normal.php b/web/admin/demo/normal.php
new file mode 100644
index 0000000..733ff18
--- /dev/null
+++ b/web/admin/demo/normal.php
@@ -0,0 +1,1080 @@
+get('query', array());
+ $csql = new \ciy\sql('demo_normal');
+ $liid = objint($query, 'liid');
+ if ($liid > 0)
+ $csql->where('auditstatus', $liid);
+ $val = objstr($query, 'audituser');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('zc_cata');
+ $csqlt->where('cbid in (select id from zc_cata where cbid=0 and codeid=\'audituser\')');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('audituser', $trow['codeid']);
+ $query['audituser'] = $trow['name'];
+ } else {
+ $csql->where('audituser=0');
+ }
+ }
+ $csql->wheredaterange('audittimes', objstr($query, 'audittimes'));
+ $csql->where('auditmsg like', objstr($query, 'auditmsg'));
+ $csql->where('name like', objstr($query, 'name'));
+ $val = objstr($query, 'menuid');
+ if (!empty($val)) {
+ $csqlt = new \ciy\sql('zc_menu');
+ $csqlt->where('name like', $val);
+ $trow = $db->getone($csqlt);
+ if (is_array($trow)) {
+ $csql->where('menuid', $trow['id']);
+ $query['menuid'] = $trow['name'];
+ } else {
+ $csql->where('menuid=0');
+ }
+ }
+ $csql->where('isopen', objstr($query, 'isopen'));
+ $csql->where('mauditstatus like', ',' . objstr($query, 'mauditstatus') . ',');
+ $csql->wherenumrange('ton', objstr($query, 'ton_1'), objstr($query, 'ton_2'), 1000000);
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post, $rsuser);
+ $csql->column('!content,md', $db->getraw('show full fields from demo_normal'));
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $mrows = $db->get($csql, $mainrowcount);
+ if ($mrows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $mrows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'demo_normal');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'audituser', 'name' => '审核人', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'audittimes', 'name' => '审核时间');
+ $input[] = array('type' => 'input', 'form' => 'auditmsg', 'name' => '审核理由', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'name', 'name' => '默认标题', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'menuid', 'name' => '所属菜单', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'select', 'form' => 'isopen', 'name' => '是否开启', 'all' => '全部', 'select' => '开启.关闭');
+ $input[] = array('type' => 'select', 'form' => 'mauditstatus', 'name' => '多选状态', 'all' => '全部', 'select' => 'auditstatus');
+ $input[] = array('type' => 'num', 'form' => 'ton', 'name' => '吨位', 'prop' => ' style="width:4em;"');
+ $ret['searchinput'] = $input;
+ $csql = (new \ciy\sql('zc_depart'))->column('id,name,upid');
+ $ret['zc_depart'] = $db->get($csql);
+ }
+ $ret['zc_menu'] = getrelation($db, $mrows, 'zc_menu', 'menuid');
+ return succjson($ret);
+ }
+
+ public static function json_getdata() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $act = $post->get('act');
+ $mrow = array();
+ if ($id > 0) {
+ $csql = new \ciy\sql('demo_normal');
+ $csql->where('id', $id);
+ $mrow = $db->getone($csql);
+ if (!is_array($mrow))
+ return errjson('数据不存在');
+ if ($act == 'view' || $act == 'review') {
+ $csql = (new \ciy\sql('zc_menu'))->column('id,name');
+ $csql->where('id', $mrow['menuid']);
+ $ret['zc_menu'] = $db->get($csql);
+ }
+ }
+ $ret['data'] = $mrow;
+ if ($act == 'edit') {
+ $csql = (new \ciy\sql('zc_menu'))->column('id,name');
+ $ret['zc_menu'] = $db->get($csql);
+ }
+ return succjson($ret);
+ }
+
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ //$db->trace($post->get('_pf'), $rsuser);
+ $id = $post->getint('id');
+ $name = $post->get('name');
+ $menuid = $post->getint('menuid');
+ $filesize = $post->getint('filesize');
+ $metre = $post->getint('metre');
+ $bankmoney = $post->getint('bankmoney');
+ $setdate = $post->getint('setdate');
+ $settimes = $post->getint('settimes');
+ $dayclock = $post->getint('dayclock');
+ $downurl = $post->get('downurl');
+ $avar = $post->get('avar');
+ $isuse = $post->getint('isuse');
+ $isopen = $post->getint('isopen');
+ $unit = $post->get('unit');
+ $sigstatus = $post->getint('sigstatus');
+ $mauditstatus = $post->get('mauditstatus');
+ $prodcata = $post->getint('prodcata');
+ $areacode = $post->getint('areacode');
+ $renzheng = $post->getint('renzheng');
+ $ppint = $post->getint('ppint');
+ $npcyc = $post->getint('npcyc');
+ $runsec = $post->getint('runsec');
+ $acttm = $post->getint('acttm');
+ $imgs = $post->get('imgs');
+ $ton = $post->getint('ton');
+ $price = $post->getint('price');
+ $lat = $post->getint('lat');
+ $lng = $post->getint('lng');
+ $pct = $post->getint('pct');
+ $url = $post->get('url');
+ $weightg = $post->getint('weightg');
+ $eartmpr = $post->getint('eartmpr');
+ $qian = $post->getint('qian');
+ $meishi = $post->getint('meishi');
+ $weight = $post->getint('weight');
+ $height = $post->getint('height');
+ $skt = $post->getint('skt');
+ $idcard = $post->get('idcard');
+ $content = $post->get('content');
+ $md = $post->get('md');
+ if (empty($name))
+ return errjson('请填写默认标题');
+ $datarow = null;
+ if ($id > 0) {
+ $csql = new \ciy\sql('demo_normal');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ }
+ try {
+ $db->begin();
+ $updata = array();
+ $updata['name'] = $name;
+ $updata['menuid'] = $menuid;
+ $updata['filesize'] = $filesize;
+ $updata['metre'] = $metre;
+ $updata['bankmoney'] = $bankmoney;
+ $updata['setdate'] = $setdate;
+ $updata['settimes'] = $settimes;
+ $updata['dayclock'] = $dayclock;
+ $updata['downurl'] = $downurl;
+ $updata['avar'] = $avar;
+ $updata['isuse'] = $isuse;
+ $updata['isopen'] = $isopen;
+ $updata['unit'] = $unit;
+ $updata['sigstatus'] = $sigstatus;
+ $updata['mauditstatus'] = $mauditstatus;
+ $updata['prodcata'] = $prodcata;
+ $updata['areacode'] = $areacode;
+ $updata['renzheng'] = $renzheng;
+ $updata['ppint'] = $ppint;
+ $updata['npcyc'] = $npcyc;
+ $updata['runsec'] = $runsec;
+ $updata['acttm'] = $acttm;
+ $updata['imgs'] = $imgs;
+ $updata['ton'] = $ton;
+ $updata['price'] = $price;
+ $updata['lat'] = $lat;
+ $updata['lng'] = $lng;
+ $updata['pct'] = $pct;
+ $updata['url'] = $url;
+ $updata['weightg'] = $weightg;
+ $updata['eartmpr'] = $eartmpr;
+ $updata['qian'] = $qian;
+ $updata['meishi'] = $meishi;
+ $updata['weight'] = $weight;
+ $updata['height'] = $height;
+ $updata['skt'] = $skt;
+ $updata['idcard'] = $idcard;
+ $updata['content'] = $content;
+ $updata['md'] = $md;
+ $csql = new \ciy\sql('demo_normal'); //auto
+ if ($id > 0) {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ } else {
+ $updata['auditstatus'] = 0;
+ $updata['audituser'] = 0;
+ $updata['audittimes'] = 0;
+ $updata['auditmsg'] = '';
+ $updata['addtimes'] = tostamp();
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增失败:' . $db->error);
+ $id = $db->insert_id();
+ }
+ $updata['id'] = $id;
+ //savelogdb($db, $rsuser['id'], 'demo_normal', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ $ret['zc_menu'] = getrelation($db, [$updata], 'zc_menu', 'menuid');
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ //$db->trace($post->get('_pf'), $rsuser);
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('demo_normal');
+ $csql->where('id in', $ids);
+ $mrows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($mrows as $mrow) {
+ $delid = $mrow['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'demo_normal');
+ savelogdb($db, $rsuser['id'], 'demo_normal', $mrow, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_audit() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p a'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ //$db->trace($post->get('_pf'), $rsuser);
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $auditstatus = $post->getint('auditstatus');
+ $auditmsg = $post->get('auditmsg');
+ if ($auditstatus == 90 && empty($auditmsg))
+ return errjson('请填写驳回原因');
+ $csql = new \ciy\sql('demo_normal');
+ $csql->where('id in', $ids);
+ $mrows = $db->get($csql);
+ $ids = array();
+ try {
+ $db->begin();
+ foreach ($mrows as $mrow) {
+ if ($auditstatus == 100) {
+ }
+ $updata = array();
+ $updata['auditstatus'] = $auditstatus;
+ $updata['audituser'] = $rsuser['id'];
+ $updata['audittimes'] = tostamp();
+ $updata['auditmsg'] = $auditmsg;
+ $csql = new \ciy\sql('demo_normal');
+ $csql->where('id', $mrow['id']);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('审核失败:' . $db->error);
+ $ids[] = $mrow['id'];
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ $ret['ids'] = $ids;
+ return succjson($ret);
+ }
+
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p e'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post, $rsuser);
+ $mrows = $db->get($csql);
+ if (count($mrows) > 10000)
+ return errjson('将导出' . count($mrows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('style' => 'l', 'width' => 60, 'field' => 'id', 'name' => '行码');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'auditstatus', 'name' => '审核状态');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'audituser', 'name' => '审核人');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'audittimes', 'name' => '审核时间');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'auditmsg', 'name' => '审核理由');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'name', 'name' => '默认标题');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'menuid', 'name' => '所属菜单');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'filesize', 'name' => '文件大小');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'metre', 'name' => '长度');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'bankmoney', 'name' => '贷款金额');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'setdate', 'name' => '设置日期');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'settimes', 'name' => '设置时间');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'dayclock', 'name' => '营业时间');
+ $fields[] = array('style' => 'c', 'width' => 300, 'field' => 'downurl', 'name' => '文档');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'avar', 'name' => '头像');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'isuse', 'name' => '是否使用');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'isopen', 'name' => '是否开启');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'unit', 'name' => '库存单位');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'sigstatus', 'name' => '单选状态');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'mauditstatus', 'name' => '多选状态');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'prodcata', 'name' => '组织结构');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'areacode', 'name' => '所在地区');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'renzheng', 'name' => '认证情况');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'ppint', 'name' => '临时字典');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'npcyc', 'name' => '执行周期');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'runsec', 'name' => '执行用时');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'acttm', 'name' => '活动期数');
+ $fields[] = array('style' => 'l', 'width' => 300, 'field' => 'imgs', 'name' => '活动花絮');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'ton', 'name' => '吨位');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'price', 'name' => '单价');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'lat', 'name' => '纬度');
+ $fields[] = array('style' => 'c', 'width' => 100, 'field' => 'lng', 'name' => '位置');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'pct', 'name' => '百分比');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'url', 'name' => '链接');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'weightg', 'name' => '体重');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'eartmpr', 'name' => '耳温');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'qian', 'name' => '中式钱');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'meishi', 'name' => '美式钱');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'weight', 'name' => '重量');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'height', 'name' => '长度');
+ $fields[] = array('style' => 'r', 'width' => 100, 'field' => 'skt', 'name' => '科学数');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'idcard', 'name' => '身份证号');
+ $fields[] = array('style' => 'l', 'width' => 100, 'field' => 'addtimes', 'name' => '添加时间');
+ $fields[] = array('style' => 'l', 'width' => 150, 'field' => 'content', 'name' => '介绍');
+ $code_auditstatus = getcatas($db, 'auditstatus');
+ $code_audituser = getcatas($db, 'adminuser');
+ $code_menuid = getrelation($db, $mrows, 'zc_menu', 'menuid', 'id,name');
+ $code_isuse = $db->getdbcodes('demo_normal', 'isuse');
+ $code_isopen = $db->getdbcodes('demo_normal', 'isopen');
+ $code_sigstatus = getcatas($db, 'auditstatus');
+ $code_mauditstatus = getcatas($db, 'auditstatus');
+ $code_prodcata = $db->get((new \ciy\sql('zc_depart'))->column('id,name,upid'));
+ $code_areacode = $db->get((new \ciy\sql('ciy_arearpc'))->column('id,name,upid'));
+ $code_renzheng = $db->getdbcodes('demo_normal', 'renzheng');
+ $code_ppint = $db->getdbcodes('demo_normal', 'ppint');
+ $datas = array();
+ foreach ($mrows as $mrow) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($mrow[$field]) ? $mrow[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'auditstatus')
+ $val = ccode($code_auditstatus, $val);
+ if ($field == 'audituser')
+ $val = ccode($code_audituser, $val);
+ if ($field == 'audittimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'menuid')
+ $val = ccode($code_menuid, $val);
+ if ($field == 'filesize')
+ $val = number_format($val / 1024, 2) . 'KB';
+ if ($field == 'metre')
+ $val = number_format($val / 1000, 2) . '米';
+ if ($field == 'bankmoney')
+ $val = number_format($val / 1000000, 3) . '万元';
+ if ($field == 'setdate')
+ $val = ($val <= 0 ? '--' : date('Y-m-d', $val));
+ if ($field == 'settimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'dayclock')
+ $val = ($val <= 0 ? '--' : totimepoint($val));
+ if ($field == 'isuse')
+ $val = ($val == 1 ? $code_isuse[0]['name'] : @$code_isuse[1]['name']);
+ if ($field == 'isopen')
+ $val = ($val == 1 ? $code_isopen[0]['name'] : @$code_isopen[1]['name']);
+ if ($field == 'unit')
+ $val = ($val == '' ? '--' : implode(',', tounit($val)));
+ if ($field == 'sigstatus')
+ $val = ccode($code_sigstatus, $val);
+ if ($field == 'mauditstatus')
+ $val = implode(',', scode($code_mauditstatus, $val));
+ if ($field == 'prodcata')
+ $val = implode('-', mcode($code_prodcata, $val));
+ if ($field == 'areacode')
+ $val = implode('-', mcode($code_areacode, $val));
+ if ($field == 'renzheng')
+ $val = implode(',', bcode($code_renzheng, $val));
+ if ($field == 'ppint')
+ $val = ccode($code_ppint, $val);
+ if ($field == 'npcyc')
+ $val = ($val == 0 ? '--' : tocyc($val));
+ if ($field == 'runsec')
+ $val .= '秒';
+ if ($field == 'ton')
+ $val = number_format($val / 1000000, 3) . '吨';
+ if ($field == 'price')
+ $val = number_format($val / 100, 2);
+ if ($field == 'pct')
+ $val = number_format($val / 100, 2) . '%';
+ if ($field == 'weightg')
+ $val = number_format($val / 1000, 3) . 'KG';
+ if ($field == 'eartmpr')
+ $val = number_format($val / 1000, 1) . '℃';
+ if ($field == 'qian')
+ $val = number_format($val / 100, 2) . '元';
+ if ($field == 'weight')
+ $val = number_format($val / 1000, 3) . 'KG';
+ if ($field == 'height')
+ $val = number_format($val / 1000, 3) . '米';
+ if ($field == 'skt')
+ $val = number_format($val / 1000, 3) . 'SKT';
+ if ($field == 'addtimes')
+ $val = ($val <= 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+ $param['toptitle'] = '复杂功能数据报表';
+ $str = \ciy\excel::general_excel_xml($param);
+ $filename = '';
+ if (empty($filename))
+ $filename = date('Y-m-d_H-i-s') . rand(1000, 9999);
+ $filename .= '.xls';
+ file_put_contents(PATH_WEB . 'ud/tmp/' . $filename, $str);
+ return succjson(array('url' => '/ud/tmp/' . $filename));
+ }
+
+ public static function json_importxls_in() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p i'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $file = PATH_WEB . '/ud' . $post->get('file');
+ if (!file_exists($file))
+ return errjson('文件不存在');
+ require_once PATH_ROOT . '../libs/phpoffice/autoload.php';
+ $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file);
+ $sheet = $spreadsheet->getActiveSheet();
+ $datas = $sheet->toArray('', true, true, false);
+ $datacnt = count($datas);
+ if ($datacnt < 2)
+ return errjson('数据为空');
+ $html = '';
+ $headsn = array();
+ $headsn[] = '行码.id';
+ $headsn[] = '默认标题.name';
+ $headsn[] = '所属菜单.menuid';
+ $headsn[] = '文件大小.filesize';
+ $headsn[] = '长度.metre';
+ $headsn[] = '贷款金额.bankmoney';
+ $headsn[] = '设置日期.setdate';
+ $headsn[] = '设置时间.settimes';
+ $headsn[] = '营业时间.dayclock';
+ $headsn[] = '是否使用.isuse';
+ $headsn[] = '是否开启.isopen';
+ $headsn[] = '库存单位.unit';
+ $headsn[] = '单选状态.sigstatus';
+ $headsn[] = '多选状态.mauditstatus';
+ $headsn[] = '组织结构.prodcata';
+ $headsn[] = '所在地区.areacode';
+ $headsn[] = '认证情况.renzheng';
+ $headsn[] = '临时字典.ppint';
+ $headsn[] = '执行周期.npcyc';
+ $headsn[] = '执行用时.runsec';
+ $headsn[] = '活动期数.acttm';
+ $headsn[] = '吨位.ton';
+ $headsn[] = '单价.price';
+ $headsn[] = '位置.lng';
+ $headsn[] = '百分比.pct';
+ $headsn[] = '链接.url';
+ $headsn[] = '体重.weightg';
+ $headsn[] = '耳温.eartmpr';
+ $headsn[] = '中式钱.qian';
+ $headsn[] = '美式钱.meishi';
+ $headsn[] = '重量.weight';
+ $headsn[] = '长度.height';
+ $headsn[] = '科学数.skt';
+ $headsn[] = '身份证号.idcard';
+ $headsn[] = '介绍.content';
+ $xlsidx = 1;
+ if (empty($datas[0][count($headsn) - 1]))
+ $xlsidx = 2;
+ $heads = array();
+ foreach ($headsn as $_head) {
+ $hd = explode('.', $_head);
+ if (count($hd) < 2)
+ continue;
+ $heads[] = array(
+ 'idx' => array_search($hd[0], $datas[$xlsidx - 1]), 'fld' => $hd[1], 'name' => $hd[0]
+ );
+ }
+ $code_menuid = $db->get((new \ciy\sql('zc_menu'))->column('id,name'));
+ $code_isuse = $db->getdbcodes('demo_normal', 'isuse');
+ $code_isopen = $db->getdbcodes('demo_normal', 'isopen');
+ $code_sigstatus = getcatas($db, 'auditstatus');
+ $code_mauditstatus = getcatas($db, 'auditstatus');
+ $code_prodcata = $db->get((new \ciy\sql('zc_depart'))->column('id,name,upid'));
+ $code_areacode = $db->get((new \ciy\sql('ciy_arearpc'))->column('id,name,upid'));
+ $code_renzheng = $db->getdbcodes('demo_normal', 'renzheng');
+ $code_ppint = $db->getdbcodes('demo_normal', 'ppint');
+ $html .= '| # | '; + foreach ($heads as $arr) { + $html .= '' . $arr['name'] . ' | '; + } + $html .= '' . $lineidx . ' | ';
+ $bempty = true;
+ $unqs = array();
+ $csql = new \ciy\sql('demo_normal');
+ foreach ($heads as $arr) {
+ $name = $arr['name'];
+ $errmsg = ''; //数据有误,显示红色说明
+ $showdat = ''; //显示在表格中的数据
+ if ($arr['idx'] > -1)
+ $showdat = trim($datas[$rowidx][$arr['idx']]);
+ if ($showdat == '--')
+ $showdat = '';
+ $value = $showdat; //在表单中的数据(转换后)
+ $ext = ''; //扩展表单
+ if ($name == '行码') {
+ if (empty($showdat)) {
+ $value = 0;
+ $showdat = '新增';
+ } else {
+ $id = deid($showdat);
+ if ($id == 0)
+ $errmsg = $name . '解析错误';
+ else {
+ $csqlchk = new \ciy\sql('demo_normal');
+ $csqlchk->where('id', $id)->column('id');
+ $chkid = toint($db->get1($csqlchk));
+ if ($chkid != $id)
+ $errmsg = $name . '在数据库中不存在';
+ $value = $id;
+ }
+ }
+ } else if ($name == '默认标题') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ } else {
+ }
+ } else if ($name == '所属菜单') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $value = dcode($code_menuid, $showdat);
+ if ($value == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ }
+ } else if ($name == '文件大小') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', str_replace('KB', '', $showdat));
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 1024);
+ $showdat .= 'KB';
+ }
+ } else if ($name == '长度') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', str_replace('米', '', $showdat));
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 1000);
+ $showdat .= '米';
+ }
+ } else if ($name == '贷款金额') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', str_replace('万元', '', $showdat));
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 1000000);
+ $showdat .= '万元';
+ }
+ } else if ($name == '设置日期') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $value = tostamp($showdat);
+ if ($value === 0) {
+ $errmsg = $name . '时间格式错误';
+ } else {
+ $showdat = date('Y-m-d', $value);
+ }
+ }
+ } else if ($name == '设置时间') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $value = tostamp($showdat);
+ if ($value === 0) {
+ $errmsg = $name . '时间格式错误';
+ } else {
+ $showdat = date('Y-m-d H:i', $value);
+ }
+ }
+ } else if ($name == '营业时间') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $tps = explode(':', $showdat);
+ $value = 0;
+ if (count($tps) == 2)
+ $value = $tps[0] * 3600 + $tps[1] * 60;
+ else if (count($tps) == 3)
+ $value = $tps[0] * 3600 + $tps[1] * 60 + $tps[2];
+ if ($value === 0) {
+ $errmsg = $name . '时间格式错误';
+ } else {
+ $showdat = totimepoint($value, true);
+ }
+ }
+ } else if ($name == '是否使用') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ if ($showdat == $code_isuse[0]['name']) {
+ $value = 1;
+ $showdat = $code_isuse[0]['name'];
+ } else {
+ $value = 2;
+ $showdat = $code_isuse[1]['name'];
+ }
+ }
+ } else if ($name == '是否开启') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ if ($showdat == $code_isopen[0]['name']) {
+ $value = 1;
+ $showdat = $code_isopen[0]['name'];
+ } else {
+ $value = 2;
+ $showdat = $code_isopen[1]['name'];
+ }
+ }
+ } else if ($name == '库存单位') {
+ if (empty($showdat)) {
+ $value = '';
+ } else {
+ $us = explode(',', $showdat);
+ $us = array_reverse($us);
+ if (preg_match('/1(.*?)(\d+)(.*)/', $us[0], $matches)) {
+ $unitx = $matches[1];
+ $value = $matches[3] . '|' . $matches[2] . '|' . $matches[1];
+ if (isset($us[1])) {
+ if (preg_match('/1(.*?)(\d+)(.*)/', $us[1], $matches)) {
+ if ($unitx != $matches[3]) {
+ $errmsg = $name . '中间单位不匹配';
+ } else {
+ $value .= '|' . $matches[2] . '|' . $matches[1];
+ }
+ } else {
+ $errmsg = $name . '第二段格式错误';
+ }
+ }
+ } else {
+ if (preg_match('/\d/', $us[0]) > 0)
+ $errmsg = $name . '第一段不能包含数字';
+ else
+ $value = $us[0];
+ }
+ }
+ } else if ($name == '单选状态') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $value = dcode($code_sigstatus, $showdat);
+ if ($value == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ }
+ } else if ($name == '多选状态') {
+ if (empty($showdat)) {
+ $value = '';
+ } else {
+ $tdats = explode(',', $showdat);
+ $vals = array();
+ foreach ($tdats as $da) {
+ $tval = dcode($code_mauditstatus, $da);
+ if ($tval == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ $vals[] = $tval;
+ }
+ $value = implode(',', $vals);
+ }
+ } else if ($name == '组织结构') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $dats = explode('-', $showdat);
+ $value = dcode($code_prodcata, $dats[count($dats) - 1]);
+ if ($value == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ }
+ } else if ($name == '所在地区') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $dats = explode('-', $showdat);
+ $value = dcode($code_areacode, $dats[count($dats) - 1]);
+ if ($value == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ }
+ } else if ($name == '认证情况') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $dats = explode(',', $showdat);
+ $tdat = 0;
+ foreach ($dats as $da) {
+ $bti = dcode($code_renzheng, $da);
+ if ($bti < 1) {
+ $errmsg = $name . '文字与系统数据不匹配';
+ } else {
+ $tdat += (1 << ($bti - 1));
+ }
+ }
+ $value = $tdat;
+ }
+ } else if ($name == '临时字典') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $value = dcode($code_ppint, $showdat);
+ if ($value == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ }
+ } else if ($name == '执行周期') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $last = substr($showdat, -3);
+ $dd = toint(substr($showdat, 0, -3));
+ if ($dd == 0) {
+ $errmsg = $name . '周期数字错误';
+ } else if ($last == '天') {
+ $value = $dd * 86400;
+ } else if ($last == '月') {
+ $value = -$dd;
+ } else if ($last == '秒') {
+ $value = $dd;
+ } else {
+ $errmsg = $name . '周期单位错误';
+ }
+ }
+ } else if ($name == '执行用时') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', str_replace('秒', '', $showdat));
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint($showdat);
+ $showdat .= '秒';
+ }
+ } else if ($name == '活动期数') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', $showdat);
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint($showdat);
+ }
+ } else if ($name == '吨位') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', str_replace('吨', '', $showdat));
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 1000000);
+ $showdat .= '吨';
+ }
+ } else if ($name == '单价') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', $showdat);
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 100);
+ }
+ } else if ($name == '位置') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', $showdat);
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint($showdat);
+ }
+ } else if ($name == '百分比') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', str_replace('%', '', $showdat));
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 100);
+ $showdat .= '%';
+ }
+ } else if ($name == '链接') {
+ if (empty($showdat)) {
+ $value = '';
+ } else {
+ }
+ } else if ($name == '体重') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', str_replace('KG', '', $showdat));
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 1000);
+ $showdat .= 'KG';
+ }
+ } else if ($name == '耳温') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', str_replace('℃', '', $showdat));
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 1000);
+ $showdat .= '℃';
+ }
+ } else if ($name == '中式钱') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', str_replace('元', '', $showdat));
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 100);
+ $showdat .= '元';
+ }
+ } else if ($name == '美式钱') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', str_replace('¤', '', $showdat));
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 100);
+ $showdat .= '¤';
+ }
+ } else if ($name == '重量') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', str_replace('KG', '', $showdat));
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 1000);
+ $showdat .= 'KG';
+ }
+ } else if ($name == '长度') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', str_replace('米', '', $showdat));
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 1000);
+ $showdat .= '米';
+ }
+ } else if ($name == '科学数') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $showdat = str_replace(',', '', str_replace('SKT', '', $showdat));
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 1000);
+ $showdat .= 'SKT';
+ }
+ } else if ($name == '身份证号') {
+ if (empty($showdat)) {
+ $value = '';
+ } else {
+ }
+ } else if ($name == '介绍') {
+ if (empty($showdat)) {
+ $value = '';
+ } else {
+ }
+ }
+ if (!empty($showdat))
+ $bempty = false;
+ if (empty($errmsg))
+ $hrhtml .= '' . $showdat . '' . $ext . ' | ';
+ else
+ $hrhtml .= '' . $showdat . ' | ';
+ }
+ if ($bempty)
+ continue;
+ if (count($unqs) > 0) {
+ $unq = implode('|', $unqs);
+ if (in_array($unq, $uniques))
+ $firsthtml = '重复 | ';
+ else {
+ $uniques[] = $unq;
+ $csql->column('id');
+ $chkid = toint($db->get1($csql));
+ if ($chkid > 0 && (($id > 0 && $chkid != $id) || $id == 0))
+ $firsthtml = '重复 | ';
+ }
+ }
+ $html .= '
|---|---|
共' . $cnt . '条数据';
+ return succjson(array('html' => $html, 'count' => $cnt));
+ }
+
+ public static function json_importxls_data() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p i'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ //$db->trace($post->get('_pf'), $rsuser);
+ $total = $post->getint('total');
+ try {
+ $db->begin();
+ for ($i = 1; $i <= $total; $i++) {
+ $id = $post->getint('id_' . $i);
+ $updata = array();
+ $updata['name'] = $post->get('name_' . $i);
+ $updata['menuid'] = $post->get('menuid_' . $i);
+ $updata['filesize'] = $post->get('filesize_' . $i);
+ $updata['metre'] = $post->get('metre_' . $i);
+ $updata['bankmoney'] = $post->get('bankmoney_' . $i);
+ $updata['setdate'] = $post->get('setdate_' . $i);
+ $updata['settimes'] = $post->get('settimes_' . $i);
+ $updata['dayclock'] = $post->get('dayclock_' . $i);
+ $updata['isuse'] = $post->get('isuse_' . $i);
+ $updata['isopen'] = $post->get('isopen_' . $i);
+ $updata['unit'] = $post->get('unit_' . $i);
+ $updata['sigstatus'] = $post->get('sigstatus_' . $i);
+ $updata['mauditstatus'] = $post->get('mauditstatus_' . $i);
+ $updata['prodcata'] = $post->get('prodcata_' . $i);
+ $updata['areacode'] = $post->get('areacode_' . $i);
+ $updata['renzheng'] = $post->get('renzheng_' . $i);
+ $updata['ppint'] = $post->get('ppint_' . $i);
+ $updata['npcyc'] = $post->get('npcyc_' . $i);
+ $updata['runsec'] = $post->get('runsec_' . $i);
+ $updata['acttm'] = $post->get('acttm_' . $i);
+ $updata['ton'] = $post->get('ton_' . $i);
+ $updata['price'] = $post->get('price_' . $i);
+ $updata['lng'] = $post->get('lng_' . $i);
+ $updata['pct'] = $post->get('pct_' . $i);
+ $updata['url'] = $post->get('url_' . $i);
+ $updata['weightg'] = $post->get('weightg_' . $i);
+ $updata['eartmpr'] = $post->get('eartmpr_' . $i);
+ $updata['qian'] = $post->get('qian_' . $i);
+ $updata['meishi'] = $post->get('meishi_' . $i);
+ $updata['weight'] = $post->get('weight_' . $i);
+ $updata['height'] = $post->get('height_' . $i);
+ $updata['skt'] = $post->get('skt_' . $i);
+ $updata['idcard'] = $post->get('idcard_' . $i);
+ $updata['content'] = $post->get('content_' . $i);
+ $csql = new \ciy\sql('demo_normal');
+ if ($id == 0) {
+ $updata['auditstatus'] = 2;
+ $updata['addtimes'] = tostamp();
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增导入失败:' . $db->error);
+ } else {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新导入失败:' . $db->error);
+ }
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ return succjson();
+ }
+}
diff --git a/web/admin/demo/safeop.html b/web/admin/demo/safeop.html
new file mode 100644
index 0000000..50e3c5e
--- /dev/null
+++ b/web/admin/demo/safeop.html
@@ -0,0 +1,414 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/demo/safeop.php b/web/admin/demo/safeop.php
new file mode 100644
index 0000000..c6ed349
--- /dev/null
+++ b/web/admin/demo/safeop.php
@@ -0,0 +1,582 @@
+get('query');
+ $csql = new \ciy\sql('ap_transfer');
+ $liid = objint($query, 'liid');
+ if ($liid > 0)
+ $csql->where('accounttype', $liid);
+ $val = objstr($query, 'id');
+ if (!empty($val) && $val[0] == 'P')
+ $csql->where('id', substr($val, 1));
+ $csql->wherenumrange('amount', objstr($query, 'amount_1'), objstr($query, 'amount_2'), 100);
+ $csql->where('tranaccount like', objstr($query, 'tranaccount'));
+ $csql->where('tranname like', objstr($query, 'tranname'));
+ $csql->where('tranidid like', objstr($query, 'tranidid'));
+ $csql->where('memo like', objstr($query, 'memo'));
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $csql->where('apiuser', objstr($query, 'apiuser'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $csql->where('orderstatus', 10);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if ($rows === false)
+ return errjson($db->error);
+ $ret = array('where' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'ap_transfer');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ if ($fr == 'merchantid')
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $field['orderstatus']['c'] = '';
+ $field['fee']['c'] = '';
+ $field['wano']['c'] = '';
+ $field['uptimes']['c'] = '';
+ $field['orderno']['c'] = '';
+ $field['pubkeyid']['c'] = '';
+ $field['signtimes']['c'] = '';
+ $field['tranreceipt']['c'] = '';
+ $field['errmsg']['c'] = '';
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = array();
+ $input = array();
+ $input[] = array('type' => 'input', 'form' => 'id', 'name' => '流水号', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'num', 'form' => 'amount', 'name' => '金额', 'prop' => ' style="width:4em;"');
+ $input[] = array('type' => 'input', 'form' => 'tranaccount', 'name' => '账号', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'tranname', 'name' => '姓名', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'tranidid', 'name' => '身份证号', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'input', 'form' => 'memo', 'name' => '备注', 'prop' => ' style="width:8em;"');
+ $input[] = array('type' => 'daterange', 'form' => 'addtimes', 'name' => '创建时间');
+ $input[] = array('type' => 'select', 'form' => 'apiuser', 'name' => '操作人', 'all' => '全部', 'select' => 'meruser');
+ $ret['once']['input'] = $input;
+ $csql = new \ciy\sql('hf_merchantbase');
+ $csql->where('id', $rsuser['s_b']);
+ $ret['once']['merchant'] = $db->getone($csql);
+ $csql = new \ciy\sql('hf_merchantpubkey');
+ $csql->where('merchantid', $rsuser['s_b']);
+ $ret['once']['hf_merchantpubkey'] = $db->get($csql);
+ // if($ret['once']['merchant']['safecase'] > 10){
+ // $csql = new \ciy\sql('hf_merchantuser');
+ // $csql->where('id', $ret['once']['merchant']['s_b']);
+ // $ret['once']['merchant'] = $db->getone($csql);
+
+ // }
+ }
+ return succjson($ret);
+ }
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $csql = new \ciy\sql('hf_merchantbase');
+ $csql->where('id', $rsuser['s_b']);
+ $merchantrow = $db->getone($csql);
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $data = array();
+ $data['accounttype'] = $post->getint('accounttype');
+ $data['amount'] = $post->getint('amount');
+ $data['tranaccount'] = $post->get('tranaccount');
+ $data['tranname'] = $post->get('tranname');
+ $data['tranidid'] = $post->get('tranidid');
+ $data['memo'] = $post->get('memo');
+ $retchk = check_transtr($data['amount'], $data['accounttype'], $data['tranaccount'], $data['tranname'], $data['tranidid'], $data['memo'], $merchantrow['safecase']);
+ if (is_string($retchk))
+ return errjson($retchk);
+ if ($id > 0) {
+ $csql = new \ciy\sql('ap_transfer');
+ $csql->where('merchantid', $rsuser['s_b']);
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ }
+ try {
+ $db->begin();
+ $updata = self::updatedata($db, $rsuser, $id, $data, $merchantrow);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+ public static function json_multiedit() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $csql = new \ciy\sql('hf_merchantbase');
+ $csql->where('id', $rsuser['s_b']);
+ $merchantrow = $db->getone($csql);
+ $post = new \ciy\post();
+ $count = $post->getint('count');
+ $datas = array();
+ for ($i = 0; $i < $count; $i++) {
+ if ($post->get('accounttype_' . $i) == '')
+ continue;
+ $data = array();
+ $data['accounttype'] = $post->getint('accounttype_' . $i);
+ $data['accounttype'] = ($data['accounttype'] == 1 ? 20 : 10);
+ $data['amount'] = $post->getint('amount_' . $i);
+ $data['tranaccount'] = $post->get('tranaccount_' . $i);
+ $data['tranname'] = $post->get('tranname_' . $i);
+ $data['tranidid'] = $post->get('tranidid_' . $i);
+ $data['memo'] = $post->get('memo_' . $i);
+ $retchk = check_transtr($data['amount'], $data['accounttype'], $data['tranaccount'], $data['tranname'], $data['tranidid'], $data['memo'], $merchantrow['safecase']);
+ if (is_string($retchk))
+ return errjson('第' . ($i + 1) . '行,' . $retchk);
+ $datas[] = $data;
+ }
+ try {
+ $db->begin();
+ foreach ($datas as $data) {
+ self::updatedata($db, $rsuser, 0, $data, $merchantrow);
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ return succjson();
+ }
+ static function updatedata($db, $rsuser, $id, $data, $merchantrow) {
+ $updata = array();
+ $updata['amount'] = $data['amount'];
+ $updata['accounttype'] = $data['accounttype'];
+ $updata['tranaccount'] = $data['tranaccount'];
+ $updata['tranname'] = $data['tranname'];
+ $updata['tranidid'] = $data['tranidid'];
+ $updata['memo'] = $data['memo'];
+ $updata['apiuser'] = $rsuser['id'];
+ $csql = new \ciy\sql('ap_transfer');
+ if ($id > 0) {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ } else {
+ $updata['providerid'] = $rsuser['s_a'];
+ $updata['merchantid'] = $rsuser['s_b'];
+ $updata['thirdno'] = '';
+ $updata['orderstatus'] = 10;
+ $updata['iswa'] = $merchantrow['bwa'];
+ $updata['wano'] = '';
+ $updata['addtimes'] = tostamp();
+ $updata['signtimes'] = 0;
+ $updata['uptimes'] = 0;
+ $updata['orderno'] = '';
+ $updata['payfundno'] = '';
+ $updata['signature'] = '';
+ $updata['pubkeyid'] = 0;
+ $updata['fee'] = 0;
+ $updata['tranreceipt'] = 10;
+ $updata['errmsg'] = '';
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增失败:' . $db->error);
+ $id = $db->insert_id();
+ }
+ $updata['id'] = $id;
+ return $updata;
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('ap_transfer');
+ $csql->where('merchantid', $rsuser['s_b']);
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ if ($row['orderstatus'] != 10)
+ continue;
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'ap_transfer');
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+
+ public static function json_getdopay() {
+ global $db;
+ $rsuser = verifyfast();
+ $csql = new \ciy\sql('hf_merchantbase');
+ $csql->where('id', $rsuser['s_b']);
+ $merchantrow = $db->getone($csql);
+ $csql = new \ciy\sql('ap_transfer');
+ $csql->where('merchantid', $rsuser['s_b']);
+ $csql->where('orderstatus', 10);
+ $orderrows = $db->get($csql);
+ $ret['datas'] = array();
+ $money = 0;
+ foreach ($orderrows as $orderrow) {
+ $money += $orderrow['amount'];
+ $ret['datas'][] = array(
+ 'id' => $orderrow['id'],
+ 'hash' => hash('sha256', signorder($orderrow))
+ );
+ }
+ $ret['total'] = count($orderrows);
+ $ret['money'] = $money;
+ $ret['safecase'] = $merchantrow['safecase'];
+ if ($ret['safecase'] > 0) {
+ $csql = new \ciy\sql('hf_merchantuser');
+ $csql->where('id', $rsuser['id']);
+ $userrow = $db->getone($csql);
+ if ($userrow['pubkeyid'] > 0) {
+ $csql = new \ciy\sql('hf_merchantpubkey');
+ $csql->where('id', $userrow['pubkeyid']);
+ $csql->where('safecase', $merchantrow['safecase']);
+ $pubkeyrow = $db->getone($csql);
+ $ret['pubkey'] = $pubkeyrow['pubkey'];
+ }
+ }
+ return succjson($ret);
+ }
+ public static function json_dopay() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $csql = new \ciy\sql('hf_merchantuser');
+ $csql->where('id', $rsuser['id']);
+ $userrow = $db->getone($csql);
+ if (empty($userrow['password']))
+ return errjson('请先设置初始登录密码');
+ $csql = new \ciy\sql('hf_merchantalipaycharge');
+ $csql->where('merchantid', $userrow['merchantid']);
+ $csql->where('addtimes<', time() - 60);
+ $csql->where('orderstatus<100');
+ if (toint($db->get1($csql)) > 0)//检查商户余额,结合本次下单金额与手续费欠费金额,是否低于,低于提示。
+ return errjson('有未结算的手续费,请稍后下单,请稍后下单或检查账户余额');
+ $csql = new \ciy\sql('hf_merchantbase');
+ $csql->where('id', $userrow['merchantid']);
+ $merchantrow = $db->getone($csql);
+ if (!is_array($merchantrow))
+ return errjson('商户不存在');
+ $tp = date('H') * 3600 + date('i') * 60 + date('s') + 1;
+ if ($merchantrow['stpt'] < $merchantrow['endpt']) {
+ if ($tp < $merchantrow['stpt'] || $tp > $merchantrow['endpt'])
+ return errjson('当前时间不在服务时间范围内');
+ } else {
+ if ($tp < $merchantrow['stpt'] && $tp > $merchantrow['endpt'])
+ return errjson('当前时间不在服务时间范围内');
+ }
+ if ($merchantrow['saasstatus'] != 10)
+ return errjson('商户已被暂停服务');
+ $csql = new \ciy\sql('hf_providerbase');
+ $csql->where('id', $merchantrow['providerid']);
+ $providerrow = $db->getone($csql);
+ if (!is_array($providerrow))
+ return errjson('服务商不存在');
+ if ($providerrow['providerstatus'] != 10)
+ return errjson('转账服务暂停,请联系服务商!');
+ if ($providerrow['depositmoney'] <= 0)
+ return errjson('转账服务暂停,请联系服务商');
+ $signs = $post->get('sign');
+ if ($merchantrow['safecase'] == 10) {
+ if (empty($userrow['password2']))
+ return errjson('请先在右上角下拉菜单中,设置安全密码');
+ $authtime = $post->getint('auth');
+ if (abs($authtime / 1000 - tostamp()) > 300) {
+ return errjson('您的本地时间与服务器时间相差超过5分钟,请调整本机时间。| # | '; + foreach ($heads as $arr) { + $html .= '' . $arr['name'] . ' | '; + } + $html .= '' . $lineidx . ' | ';
+ $bempty = true;
+ $unqs = array();
+ $csql = new \ciy\sql('ap_transfer');
+ $data = array();
+ foreach ($heads as $arr) {
+ $name = $arr['name'];
+ $errmsg = ''; //数据有误,显示红色说明
+ $showdat = ''; //显示在表格中的数据
+ if ($arr['idx'] > -1)
+ $showdat = trim($datas[$rowidx][$arr['idx']]);
+ if ($showdat == '--')
+ $showdat = '';
+ $value = $showdat; //在表单中的数据(转换后)
+ $ext = ''; //扩展表单
+ if ($name == '行码') {
+ if (empty($showdat)) {
+ $value = 0;
+ $showdat = '新增';
+ } else {
+ $id = deid($showdat);
+ if ($id == 0)
+ $errmsg = $name . '解析错误';
+ else {
+ $csqlchk = new \ciy\sql('ap_transfer');
+ $csqlchk->where('id', $id);
+ $chkrow = $db->getone($csqlchk);
+ if (!is_array($chkrow))
+ $errmsg = $name . '在数据库中不存在';
+ if ($chkrow['orderstatus'] != 10)
+ $errmsg = $name . '状态错误';
+ $value = $id;
+ }
+ }
+ } else if ($name == '账号类型') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ } else {
+ $value = dcode($code_accounttype, $showdat);
+ $data['accounttype'] = $data;
+ if ($value == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ }
+ } else if ($name == '金额') {
+ $showdat = str_replace(',', '', $showdat);
+ if (!is_numeric($showdat))
+ $errmsg = $name . '不是数字';
+ else
+ $value = toint((float)$showdat * 100);
+ $data['amount'] = $value;
+ if ($value < 0.1)
+ $errmsg = $name . '不能小于0.1元';
+ } else if ($name == '账号') {
+ if (empty($showdat)) {
+ $errmsg = $name . '必填';
+ }
+ $data['tranaccount'] = $showdat;
+ } else if ($name == '姓名') {
+ if (empty($showdat)) {
+ $errmsg = $name . '必填';
+ }
+ $data['tranname'] = $showdat;
+ } else if ($name == '身份证号') {
+ if (empty($showdat)) {
+ $value = '';
+ }
+ $data['tranidid'] = $showdat;
+ } else if ($name == '备注') {
+ if (empty($showdat)) {
+ $value = '';
+ }
+ $data['memo'] = $showdat;
+ }
+ if (!empty($showdat))
+ $bempty = false;
+
+ if (empty($errmsg))
+ $hrhtml .= '' . $showdat . '' . $ext . ' | ';
+ else
+ $hrhtml .= '' . $showdat . ' | ';
+ }
+ if ($bempty)
+ continue;
+
+ $retchk = check_transtr($data['amount'], $data['accounttype'], $data['tranaccount'], $data['tranname'], $data['tranidid'], $data['memo'], $merchantrow['safecase']);
+ if (is_string($retchk))
+ $firsthtml = '重复 | ';
+ else if (count($unqs) > 0) {
+ $unq = implode('|', $unqs);
+ if (in_array($unq, $uniques))
+ $firsthtml = '重复 | ';
+ else {
+ $uniques[] = $unq;
+ $csql->column('id');
+ $chkid = toint($db->get1($csql));
+ if ($chkid > 0 && (($id > 0 && $chkid != $id) || $id == 0))
+ $firsthtml = '重复 | ';
+ }
+ }
+ $html .= '
|---|---|
共' . $cnt . '条数据';
+ return succjson(array('html' => $html, 'count' => $cnt));
+ }
+
+ public static function json_importxls_data() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p i'))
+ // return errjson('您未被授权操作');
+ $csql = new \ciy\sql('hf_merchantbase');
+ $csql->where('id', $rsuser['s_b']);
+ $merchantrow = $db->getone($csql);
+ $post = new \ciy\post();
+ $total = $post->getint('total');
+ try {
+ $db->begin();
+ for ($i = 1; $i <= $total; $i++) {
+ $id = $post->getint('id_' . $i);
+ $data = array();
+ $data['accounttype'] = $post->get('accounttype_' . $i);
+ $data['amount'] = $post->get('amount_' . $i);
+ $data['tranaccount'] = $post->get('tranaccount_' . $i);
+ $data['tranname'] = $post->get('tranname_' . $i);
+ $data['tranidid'] = $post->get('tranidid_' . $i);
+ $data['memo'] = $post->get('memo_' . $i);
+ self::updatedata($db, $rsuser, $id, $data, $merchantrow);
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ return succjson();
+ }
+}
diff --git a/web/admin/demo/setpage.html b/web/admin/demo/setpage.html
new file mode 100644
index 0000000..82ac724
--- /dev/null
+++ b/web/admin/demo/setpage.html
@@ -0,0 +1,243 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ ' + table.data[id].name + ''";
+ $menubtn .= "\n });";
+ $menubtn .= "\n }";
+ }else{
+ if(empty($extkey))
+ $extkey = $str;
+ $menubtn .= "\n if (btn == '{$extkey}') {";
+ $menubtn .= "\n ciyfn.callfastfunc(dom, '是否{$str}?', '{$extkey}', { ids: id }, function (json) { table.updateline(json) });";
+ $menubtn .= "\n }";
+ }
+ $extcls = '';
+ }
+ $editbtn .= "\n html += `{$str}`;";
+ } else {
+ $bmenubtn = true;
+ $subs = explode('|', $str); //操作|成果|方法|-|修改|删除
+ $editbtn .= "\n html += `{$subs[0]}";
+ $editbtn .= "\n ";
+ $editbtn .= "\n `;";
+ }
+ }
+ $pcaddtit = '';
+ if ($hasadd)
+ $pcaddtit = "id == 0 ? '新建' : ";
+ $codex .= "\n
+
+
+
+data;
+ return $codex;
+}
diff --git a/web/admin/develop/code_pc_php.php b/web/admin/develop/code_pc_php.php
new file mode 100644
index 0000000..1e1b41d
--- /dev/null
+++ b/web/admin/develop/code_pc_php.php
@@ -0,0 +1,1380 @@
+get('table', '', 'all');
+ $subpath = $post->get('subpath', '', 'all');
+ $verifyfunc = $post->get('verifyfunc', '', 'all');
+ $codetable = $post->get('codetable', '', 'all');
+ $saasfield = $post->get('saasfield', '', 'all');
+ $saasusr = $post->get('saasusr', '', 'all');
+ $titname = $post->get('_bcod_titname', '', 'all');
+ $liiddict = str_replace(',', ',', $post->get('_bcod_liiddict', '', 'all'));
+ $selectorder = $post->get('_bcod_select_order', '', 'all');
+ $btntop_newline = $post->get('_bcod_btntop_newline', '', 'all');
+ $btnlist_line = $post->get('_bcod_btnlist_line', '', 'all');
+ $btntop_multibtn = $post->get('_bcod_btntop_multibtn', '', 'all');
+ $savepc = $post->get('_bcod_savepc', '', 'all');
+ $flds = calfld($post);
+
+ $hasview = strpos($btnlist_line, '查看') !== false;
+ $hasadd = strpos($btntop_newline, '添加') !== false; //有添加能力
+ $hasexcelin = strpos($btntop_newline, '导入') !== false;
+ $hasexcelout = strpos($btntop_newline, '导出') !== false;
+ $hasreview = strpos($btnlist_line, '审核') !== false;
+ $hasaudit = strpos($btntop_multibtn, '审核通过') !== false;
+ $chk_audit = false; //审核
+ $chk_matter = false; //流程
+ $chk_getupdate = false; //编辑,查看时,先请求getdata
+ $chk_deltimes = false; //删除时,加删除标记
+ $chk_multistatus = false; //批量列更新
+ $hasedit = strpos($btnlist_line, '修改') !== false;
+ if (!$hasedit)
+ $hasedit = $hasadd;
+ $hasdel = strpos($btnlist_line, '删除') !== false;
+ if ($hasdel === false)
+ $hasdel = strpos($btntop_multibtn, '删除') !== false;
+
+ if ($btntop_multibtn) {
+ $btns = explode(',', $btntop_multibtn);
+ foreach ($btns as $btn) {
+ if ($btn != '批量删除' && $btn != '审核通过' && $btn != '驳回')
+ $chk_multistatus = true;
+ if ($btn[0] == 'A')
+ $chk_multistatus = true;
+ }
+ }
+ $nocolumn = array();
+ foreach ($flds as $fld) {
+ if ($fld['col'] == 'auditstatus')
+ $chk_audit = true; //auditstatus/audituser/audittimes/auditmsg: 加审核按钮
+ if ($fld['col'] == 'matterstatus')
+ $chk_matter = true; //matterstatus/matternextuser/mattertimes: 加流程功能,是否可编辑/删除
+ if ($fld['col'] == 'deltimes')
+ $chk_deltimes = true;
+ if ($fld['set']['listload'] == 'rel') {
+ if (!$fld['set']['noup'])
+ $chk_getupdate = true;
+ }
+ if ($fld['set']['nocmn'] == 'no') {
+ $chk_getupdate = true;
+ $nocolumn[] = $fld['col'];
+ }
+ //list($dicttype, $dictname) = splitdict($fld['data']);
+ }
+
+ $savepc = str_replace('/', '\\', $savepc);
+ $savepc = substr($savepc, strpos($savepc, 'web\\'));
+ $namespace = substr($savepc, 0, strrpos($savepc, '\\'));
+ $classname = substr($savepc, strrpos($savepc, '\\') + 1);
+
+ $codex = "get('query', array());";
+ $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
+ if (!empty($liiddict)) {
+ $codex .= "\n \$liid = objint(\$query, 'liid');";
+ if (strpos($liiddict, ',') === false) {
+ $codex .= "\n if (\$liid > 0)";
+ $codex .= "\n \$csql->where('{$liiddict}', \$liid);";
+ } else {
+ $lidicts = explode(',', $liiddict);
+ for ($i = 0; $i < count($lidicts); $i++) {
+ if ($i == 0)
+ continue;
+ $codex .= "\n if (\$liid == {$i})";
+ $codex .= "\n \$csql->where('');";
+ }
+ }
+ }
+
+ foreach ($flds as $fld) {
+ $col = $fld['col'];
+ if (!$fld['bqry']) {
+ if ($fld['breq']) {
+ $codex .= "\n \$csql->where('{$col}', get('_{$col}'));";
+ }
+ continue;
+ }
+ $cate = $fld['cate'];
+ if ($cate == 'DB' || $cate == 'CATU' || $cate == 'CATS' || $cate == 'CATM') {
+ $dbquery = isset($fld['set']['dbquery']) ? $fld['set']['dbquery'] : '';
+ if ($dbquery == 'select' || $dbquery == 'window') {
+ if ($cate == 'CATS')
+ $codex .= "\n \$csql->where('{$col} like', ',' . objstr(\$query, '{$col}') . ',');";
+ else
+ $codex .= "\n \$csql->where('{$col}', objstr(\$query, '{$col}'));";
+ } else {
+ $datas = explode('|', $fld['data']);
+ $codex .= "\n \$val = objstr(\$query, '{$col}');";
+ $codex .= "\n if (!empty(\$val)) {";
+ list($dicttype, $dictname) = splitdict($fld['data']);
+ if ($dicttype == 'dictcata') {
+ $codex .= "\n \$csqlt = new \ciy\sql('{$codetable}');";
+ $codex .= "\n \$csqlt->where('cbid in (select id from {$codetable} where cbid=0 and codeid=\'{$col}\')');";
+ $codex .= "\n \$csqlt->where('name like', \$val);";
+ $codex .= "\n \$trow = \$db->getone(\$csqlt);";
+ $codex .= "\n if (is_array(\$trow)) {";
+ $codex .= "\n \$csql->where('{$col}', \$trow['codeid']);";
+ } else {
+ $codex .= "\n \$csqlt = new \ciy\sql('{$datas[0]}');";
+ $codex .= "\n \$csqlt->where('name like', \$val);";
+ $codex .= "\n \$trow = \$db->getone(\$csqlt);";
+ $codex .= "\n if (is_array(\$trow)) {";
+ if ($cate == 'CATS')
+ $codex .= "\n \$csql->where('{$col} like', ',' . \$trow['id'] . ',');";
+ else
+ $codex .= "\n \$csql->where('{$col}', \$trow['id']);";
+ }
+ $codex .= "\n \$query['{$col}'] = \$trow['name'];";
+ $codex .= "\n } else {";
+ $codex .= "\n \$csql->where('{$col}=0');";
+ $codex .= "\n }";
+ $codex .= "\n }";
+ if ($fld['breq']) {
+ $codex .= "\n else";
+ $codex .= "\n \$csql->where('{$col}', get('_{$col}'));";
+ }
+ }
+ } else if ($cate == 'TBIN') {
+ $codex .= "\n \$val = objint(\$query, '{$col}');";
+ $codex .= "\n if (\$val > 0) {";
+ $codex .= "\n \$val = 1 << (\$val - 1);";
+ $codex .= "\n \$csql->where('{$col}&' . \$val . '=' . \$val);";
+ $codex .= "\n }";
+ } else if (
+ $cate == 'METRE' || $cate == 'FSIZE' || $cate == 'WCNY' || $cate == 'MCNY' || $cate == 'SEC' || $cate == 'TON' || $cate == 'BET'
+ || $cate == 'PCT' || $cate == 'CNY' || $cate == 'NUM' || $cate == 'KG' || $cate == 'TC' || $cate == 'INT'
+ || $cate == 'LNY' || $cate == 'SNY' || $cate == 'WGT' || $cate == 'LGH'
+ ) {
+ $bet = 1000;
+ if ($cate == 'FSIZE')
+ $bet = 1024;
+ else if ($cate == 'WCNY' || $cate == 'TON')
+ $bet = 1000000;
+ else if ($cate == 'MCNY')
+ $bet = 10000;
+ else if ($cate == 'SEC' || $cate == 'NUM' || $cate == 'INT')
+ $bet = 1;
+ else if ($cate == 'PCT' || $cate == 'CNY' || $cate == 'LNY' || $cate == 'SNY')
+ $bet = 100;
+ else if ($cate == 'BET') {
+ $bet = flddata($fld['data'], 1, 100);
+ }
+ $codex .= "\n \$csql->wherenumrange('{$col}', objstr(\$query, '{$col}_1'), objstr(\$query, '{$col}_2'), {$bet});";
+ } else if ($cate == 'DATE') {
+ $datequery = isset($fld['set']['datequery']) ? $fld['set']['datequery'] : '';
+ if ($datequery == 'month' || $datequery == 'day')
+ $codex .= "\n \$csql->wheredaterange('{$col}', objstr(\$query, '{$col}'), '{$datequery}');";
+ else
+ $codex .= "\n \$csql->wheredaterange('{$col}', objstr(\$query, '{$col}'));";
+ } else if ($cate == 'CATA' || $cate == 'BOOL' || $cate == 'TINT') {
+ $codex .= "\n \$csql->where('{$col}', objstr(\$query, '{$col}'));";
+ } else {
+ $codex .= "\n \$csql->where('{$col} like', objstr(\$query, '{$col}'));";
+ }
+ }
+ $codex .= "\n \$order = objstr(\$query, 'order', 'id desc');";
+ $codex .= "\n \$csql->order(\$order);";
+ $codex .= "\n \$query['order'] = \$order;";
+ $codex .= "\n return [\$query, \$csql];";
+ $codex .= "\n }";
+
+ $codex .= "\n";
+ $codex .= "\n public static function json_list() {";
+ $codex .= "\n global \$db;";
+ if ($verifyfunc)
+ $codex .= "\n \$rsuser = {$verifyfunc}();";
+ $codex .= "\n \$post = new \ciy\post();";
+ $codex .= "\n list(\$where, \$csql) = self::setwhere(\$db, \$post, \$rsuser);";
+ if ($saasfield) {
+ if (!empty($saasusr))
+ $codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
+ }
+ if (count($nocolumn) > 0) {
+ $codex .= "\n \$csql->column('!" . implode(',', $nocolumn) . "', \$db->getraw('show full fields from {$tabname}'));";
+ }
+ $codex .= "\n \$pageno = \$post->getint('pageno', 1);";
+ $codex .= "\n \$pagecount = \$post->getint('pagecount', 10);";
+ $codex .= "\n \$csql->limit(\$pageno, \$pagecount);";
+ $codex .= "\n \$mainrowcount = \$post->getint('count');";
+ $codex .= "\n \$mrows = \$db->get(\$csql, \$mainrowcount);";
+ $codex .= "\n if (\$mrows === false)";
+ $codex .= "\n return errjson(\$db->error);";
+ $codex .= "\n \$ret['searchwhere'] = \$where;";
+ $codex .= "\n \$ret['pageno'] = \$pageno;";
+ $codex .= "\n \$ret['pagecount'] = \$pagecount;";
+ $codex .= "\n \$ret['count'] = \$mainrowcount;";
+ $codex .= "\n \$ret['list'] = \$mrows;";
+ $codex .= "\n if (\$post->getbool('field')) {";
+ $codex .= "\n \$field = array();";
+ $codex .= "\n \$fshow = \$db->getfield(\$field, '{$tabname}');";
+ $codex .= "\n foreach (\$field as \$fr => \$v) {";
+ $codex .= "\n if (get('_' . \$fr))";
+ $codex .= "\n \$field[\$fr]['c'] = ',' . \$field[\$fr]['c'];";
+ if ($saasfield) {
+ $codex .= "\n if (\$fr == '{$saasfield}')";
+ $codex .= "\n \$field[\$fr]['c'] = ',' . \$field[\$fr]['c'];";
+ }
+ $codex .= "\n }";
+ if ($btnlist_line)
+ $codex .= "\n \$fshow = fieldadd(\$fshow, \$field, 0, '_btn', '操作');";
+ foreach ($flds as $fld) {
+ if ($fld['bsrt'])
+ $codex .= "\n \$field['{$fld['col']}']['order'] = 'r';";
+ }
+ $codex .= "\n \$ret['field'] = \$field;";
+ $codex .= "\n \$ret['fshow'] = \$fshow;";
+ $codex .= "\n }";
+ $codex .= "\n if (\$post->getbool('once')) {";
+ $codex .= "\n \$ret['once'] = true;";
+ $codex .= "\n \$input = array();";
+ foreach ($flds as $fld) {
+ if (!$fld['bqry'])
+ continue;
+ //$input[] = array('type' => 'switch', 'form' => 'locc', 'name' => '搜附近', 'value' => '附近,全部', 'def' => 2, 'tip' => '水电费' );
+ $cate = $fld['cate'];
+ $col = $fld['col'];
+ if ($cate == 'DB' || $cate == 'CATU' || $cate == 'CATS' || $cate == 'CATM') {
+ $dbquery = isset($fld['set']['dbquery']) ? $fld['set']['dbquery'] : '';
+ $pspec = '';
+ if ($fld['breq']) {
+ $codex .= "\n if (!get('_{$col}'))";
+ $pspec = ' ';
+ }
+ if ($dbquery == 'window') {
+ //暂未实现
+ } else if ($dbquery == 'select') {
+ $datas = explode('|', $fld['data']);
+ $codex .= "\n{$pspec} \$input[] = array('type' => 'select', 'form' => '{$col}', 'name' => '{$fld['name']}', 'all' => '全部', 'select' => '{$datas[0]}');";
+ } else {
+ $codex .= "\n{$pspec} \$input[] = array('type' => 'input', 'form' => '{$col}', 'name' => '{$fld['name']}', 'prop' => ' style=\"width:8em;\"');";
+ }
+ } else if ($cate == 'CATA' || $cate == 'BOOL') {
+ $cabquery = isset($fld['set']['cabquery']) ? $fld['set']['cabquery'] : '';
+ $datas = explode('|', $fld['data']);
+ if ($cate == 'CATA')
+ $select = explode('|', $fld['data'])[0];
+ else {
+ $exts = explode('.', $fld['data']);
+ if (count($exts) == 1)
+ $exts[1] = '';
+ $exts[0] = empty($exts[0]) ? '✔' : $exts[0];
+ $exts[1] = empty($exts[1]) ? '✘' : $exts[1];
+ $select = "{$exts[0]}.{$exts[1]}";
+ }
+ if ($cabquery == 'radio')
+ $codex .= "\n \$input[] = array('type' => 'radio', 'form' => '{$col}', 'name' => '{$fld['name']}', 'all' => '全部', 'select' => '{$select}');";
+ else
+ $codex .= "\n \$input[] = array('type' => 'select', 'form' => '{$col}', 'name' => '{$fld['name']}', 'all' => '全部', 'select' => '{$select}');";
+ } else if ($cate == 'TBIN' || $cate == 'TINT') {
+ $datas = explode('|', $fld['data']);
+ $codex .= "\n \$input[] = array('type' => 'select', 'form' => '{$col}', 'name' => '{$fld['name']}', 'all' => '全部', 'select' => '{$datas[0]}');";
+ } else if ($cate == 'DATE') {
+ $datequery = isset($fld['set']['datequery']) ? $fld['set']['datequery'] : '';
+ if ($datequery == 'month' || $datequery == 'day')
+ $codex .= "\n \$input[] = array('type' => '{$datequery}', 'form' => '{$col}', 'name' => '{$fld['name']}');";
+ else
+ $codex .= "\n \$input[] = array('type' => 'daterange', 'form' => '{$col}', 'name' => '{$fld['name']}');";
+ } else if (
+ $cate == 'METRE' || $cate == 'FSIZE' || $cate == 'WCNY' || $cate == 'MCNY' || $cate == 'SEC' || $cate == 'TON'
+ || $cate == 'PCT' || $cate == 'CNY' || $cate == 'NUM' || $cate == 'KG' || $cate == 'TC' || $cate == 'INT'
+ || $cate == 'BET' || $cate == 'LNY' || $cate == 'SNY' || $cate == 'WGT' || $cate == 'LGH'
+ ) {
+ $codex .= "\n \$input[] = array('type' => 'num', 'form' => '{$col}', 'name' => '{$fld['name']}', 'prop' => ' style=\"width:4em;\"');";
+ } else {
+ $codex .= "\n \$input[] = array('type' => 'input', 'form' => '{$col}', 'name' => '{$fld['name']}', 'prop' => ' style=\"width:8em;\"');";
+ }
+ }
+ if ($selectorder) {
+ $sos = explode(',', $selectorder);
+ $codex .= "\n \$vals = array();";
+ foreach ($sos as $so) {
+ $soarr = explode(':', $so);
+ if (count($soarr) != 2)
+ continue;
+ $codex .= "\n \$vals[] = array('id' => '{$soarr[0]}', 'name' => '{$soarr[1]}');";
+ }
+ $codex .= "\n \$input[] = array('type' => 'select', 'form' => 'order', 'name' => '排序', 'select' => \$vals);";
+ }
+ $codex .= "\n \$ret['searchinput'] = \$input;";
+
+ foreach ($flds as $fld) {
+ $cate = $fld['cate'];
+ if ($cate == 'DB' || $cate == 'CATU' || $cate == 'CATS' || $cate == 'CATM') {
+ if (empty($fld['set']['listload'])) {
+ list($dicttype, $dictname) = splitdict($fld['data']);
+ if ($dicttype == 'dictdb') {
+ $ext = '';
+ if ($cate == 'CATM')
+ $ext = ',upid';
+ $codex .= "\n \$csql = (new \ciy\sql('{$dictname}'))->column('id,name{$ext}');";
+ $codex .= "\n \$ret['{$dictname}'] = \$db->get(\$csql);";
+ }
+ }
+ }
+ }
+ $codex .= "\n }";
+ $rels = array();
+ foreach ($flds as $fld) {
+ if (!$fld['show'])
+ continue;
+ if ($saasfield == $fld['col'])
+ continue;
+ $cate = $fld['cate'];
+ if ($cate == 'DB' || $cate == 'CATU' || $cate == 'CATS' || $cate == 'CATM') {
+ if (isset($fld['set']['listload']) && $fld['set']['listload'] == 'rel') {
+ list($dicttype, $dictname) = splitdict($fld['data']);
+ if ($dicttype == 'dictdb') {
+ if (isset($rels[$dictname]))
+ $rels[$dictname][] = $fld['col'];
+ else
+ $rels[$dictname] = array($fld['col']);
+ }
+ }
+ }
+ }
+ foreach ($rels as $dictname => $cols) {
+ $colsn = implode(',', $cols);
+ $codex .= "\n \$ret['{$dictname}'] = getrelation(\$db, \$mrows, '{$dictname}', '{$colsn}');";
+ }
+ $codex .= "\n return succjson(\$ret);";
+ $codex .= "\n }";
+
+ if ($chk_getupdate && ($hasedit || $hasview || $hasreview)) {
+ $codex .= "\n";
+ $codex .= "\n public static function json_getdata() {";
+ $codex .= "\n global \$db;";
+ if ($verifyfunc)
+ $codex .= "\n \$rsuser = {$verifyfunc}();";
+ $codex .= "\n \$post = new \ciy\post();";
+ $codex .= "\n \$id = \$post->getint('id');";
+ $codex .= "\n \$act = \$post->get('act');";
+ $codex .= "\n \$mrow = array();";
+ $codex .= "\n if (\$id > 0) {";
+ $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
+ if ($saasfield) {
+ if (!empty($saasusr))
+ $codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
+ }
+ $codex .= "\n \$csql->where('id', \$id);";
+ $codex .= "\n \$mrow = \$db->getone(\$csql);";
+ $codex .= "\n if (!is_array(\$mrow))";
+ $codex .= "\n return errjson('数据不存在');";
+ $codex .= "\n if (\$act == 'view' || \$act == 'review') {";
+ foreach ($flds as $fld) {
+ $cate = $fld['cate'];
+ if ($cate == 'DB' || $cate == 'CATU' || $cate == 'CATS' || $cate == 'CATM') {
+ if (!$fld['show'] && empty($fld['set']['noup']) && isset($fld['set']['listload']) && $fld['set']['listload'] == 'rel') {
+ list($dicttype, $dictname) = splitdict($fld['data']);
+ if ($dicttype == 'dictdb') {
+ $codex .= "\n \$csql = (new \ciy\sql('{$dictname}'))->column('id,name');";
+ $codex .= "\n \$csql->where('id', \$mrow['{$fld['col']}']);";
+ $codex .= "\n \$ret['{$dictname}'] = \$db->get(\$csql);";
+ }
+ }
+ }
+ }
+ $codex .= "\n }";
+ $codex .= "\n }";
+ $codex .= "\n \$ret['data'] = \$mrow;";
+ $codex .= "\n if (\$act == 'edit') {";
+ foreach ($flds as $fld) {
+ $cate = $fld['cate'];
+ if ($cate == 'DB' || $cate == 'CATU' || $cate == 'CATS' || $cate == 'CATM') {
+ if (empty($fld['set']['noup']) && @$fld['set']['dbedit'] != 'text' && @$fld['set']['listload'] == 'rel') {
+ list($dicttype, $dictname) = splitdict($fld['data']);
+ if ($dicttype == 'dictdb') {
+ $codex .= "\n \$csql = (new \ciy\sql('{$dictname}'))->column('id,name');";
+ $codex .= "\n \$ret['{$dictname}'] = \$db->get(\$csql);";
+ }
+ }
+ }
+ }
+ $codex .= "\n }";
+ $codex .= "\n return succjson(\$ret);";
+ $codex .= "\n }";
+ $codex .= "\n";
+ }
+ if ($hasedit) {
+ $codex .= "\n public static function json_update() {";
+ $codex .= "\n global \$db;";
+ if ($verifyfunc) {
+ $codex .= "\n \$rsuser = {$verifyfunc}();";
+ $codex .= "\n //if (nopower(\$db, \$rsuser['id'], 'p u'))";
+ $codex .= "\n // return errjson('您未被授权操作');";
+ }
+ $codex .= "\n \$post = new \ciy\post();";
+ $codex .= "\n //\$db->trace(\$post->get('_pf'), \$rsuser);";
+ foreach ($flds as $fld) {
+ $col = $fld['col'];
+ // if ($col == $saasfield || $col == 'addtimes' || $col == 'ip' || $col == 'uptimes')
+ // continue;
+ // if ($col == 'auditstatus' || $col == 'audittimes' || $col == 'audituser' || $col == 'auditmsg')
+ // continue;
+ // if ($col == 'matterstatus' || $col == 'matternextuser' || $col == 'mattertimes')
+ // continue;
+ if ($col != 'id' && !empty($fld['set']['noup']) && $fld['set']['noup'] != 'fow')
+ continue;
+ $type = $fld['type'];
+ if ($type == 'bigint' || $type == 'int')
+ $typefc = 'getint';
+ else if ($type == 'double' || $type == 'float')
+ $typefc = 'getfloat';
+ else
+ $typefc = 'get';
+ if ($fld['cate'] == 'FILEMD')
+ $codex .= "\n \${$col}_text = \$post->get('{$col}');";
+ else
+ $codex .= "\n \${$col} = \$post->{$typefc}('{$col}');";
+ }
+ foreach ($flds as $fld) {
+ if (!$fld['bimp'])
+ continue;
+ if (!empty($fld['set']['noup']))
+ continue;
+ $col = $fld['col'];
+ $cate = $fld['cate'];
+ $name = $fld['name'];
+ $type = $fld['type'];
+ if ($cate == 'MD')
+ $codex .= "\n if (\${$col} == '[MD]')";
+ else if ($cate == 'FILEMD')
+ $codex .= "\n if (\${$col}_text == '[MD]')";
+ else if ($type == 'bigint' || $type == 'int' || $type == 'double' || $type == 'float')
+ $codex .= "\n if (\${$col} == 0)";
+ else
+ $codex .= "\n if (empty(\${$col}))";
+ $codex .= "\n return errjson('请填写{$name}');";
+ }
+ if ($hasadd) {
+ $codex .= "\n \$datarow = null;";
+ $codex .= "\n if (\$id > 0) {";
+ $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
+ if ($saasfield) {
+ if (!empty($saasusr))
+ $codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
+ }
+ $codex .= "\n \$csql->where('id', \$id);";
+ $codex .= "\n \$datarow = \$db->getone(\$csql);";
+ $codex .= "\n if (!is_array(\$datarow))";
+ $codex .= "\n return errjson('数据不存在');";
+ $codex .= "\n }";
+ } else {
+ $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
+ if ($saasfield) {
+ if (!empty($saasusr))
+ $codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
+ }
+ $codex .= "\n \$csql->where('id', \$id);";
+ $codex .= "\n \$datarow = \$db->getone(\$csql);";
+ $codex .= "\n if (!is_array(\$datarow))";
+ $codex .= "\n return errjson('数据不存在');";
+ }
+ foreach ($flds as $fld) {
+ $col = $fld['col'];
+ if ($fld['cate'] == 'FILEMD'){
+ $codex .= "\n \${$col} = (isset(\$datarow['{$col}']) ? \$datarow['{$col}'] + 1 : 1);";
+ }
+ }
+ $codex .= "\n try {";
+ $codex .= "\n \$db->begin();";
+ $dups = array();
+ foreach ($flds as $fld) {
+ if (!$fld['bdup'])
+ continue;
+ $dups[] = $fld['col'];
+ }
+ if (count($dups) > 0) {
+ $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
+ if ($saasfield) {
+ if (!empty($saasusr))
+ $codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
+ }
+ foreach ($dups as $dup) {
+ $codex .= "\n \$csql->where('{$dup}', \${$dup});";
+ }
+ $codex .= "\n \$csql->column('id');";
+ $codex .= "\n \$chkid = toint(\$db->get1(\$csql));";
+ $codex .= "\n if (\$chkid > 0 && ((\$id > 0 && \$chkid != \$id) || \$id == 0))";
+ $codex .= "\n throw new \Exception('CIYIGN数据已存在');";
+ }
+ $codex .= "\n \$updata = array();";
+ foreach ($flds as $fld) {
+ $col = $fld['col'];
+ if ($col == 'id' || $col == 'addtimes')
+ continue;
+ // if ($col == 'auditstatus' || $col == 'audittimes' || $col == 'audituser' || $col == 'auditmsg')
+ // continue;
+ // if ($col == 'matterstatus' || $col == 'matternextuser' || $col == 'mattertimes')
+ // continue;
+ // if ($col == 'uptimes')
+ // $codex .= "\n \$updata['{$col}'] = tostamp();";
+ // else if ($col == 'ip')
+ // $codex .= "\n \$updata['{$col}'] = getip();";
+ if (!empty($fld['set']['noup'])) {
+ if ($fld['set']['noup'] == 'now')
+ $codex .= "\n \$updata['{$col}'] = tostamp();";
+ else if ($fld['set']['noup'] == 'me')
+ $codex .= "\n \$updata['{$col}'] = \$rsuser['id'];";
+ else if ($fld['set']['noup'] == 'fow')
+ $codex .= "\n \$updata['{$col}'] = \${$col};";
+ else if ($fld['set']['noup'] == 'ip')
+ $codex .= "\n \$updata['{$col}'] = getip();";
+ } else
+ $codex .= "\n \$updata['{$col}'] = \${$col};";
+ }
+ $codex .= "\n \$csql = new \ciy\sql('{$tabname}'); //auto";
+ if ($hasadd) {
+ $codex .= "\n if (\$id > 0) {";
+ $codex .= "\n \$csql->where('id', \$id);";
+ $codex .= "\n if (\$db->update(\$csql, \$updata) === false)";
+ $codex .= "\n throw new \Exception('更新失败:' . \$db->error);";
+ $codex .= "\n } else {";
+ foreach ($flds as $fld) {
+ $col = $fld['col'];
+ if ($col == 'id') {
+ } else if ($fld['set']['noup'] == 'no') {
+ if ($fld['type'] == 'int' || $fld['type'] == 'bigint')
+ $codex .= "\n \$updata['{$col}'] = 0;";
+ else
+ $codex .= "\n \$updata['{$col}'] = '';";
+ } else if ($saasfield) {
+ if (!empty($saasusr))
+ $codex .= "\n \$updata['{$col}'] = \$rsuser['{$saasusr}'];";
+ } else if ($col == 'addtimes')
+ $codex .= "\n \$updata['{$col}'] = tostamp();";
+ else if ($col == 'auditstatus')
+ $codex .= "\n \$updata['{$col}'] = 20;";
+ else if ($col == 'matterstatus')
+ $codex .= "\n \$updata['{$col}'] = 2;";
+ }
+ $codex .= "\n if (\$db->insert(\$csql, \$updata) === false)";
+ $codex .= "\n throw new \Exception('新增失败:' . \$db->error);";
+ $codex .= "\n \$id = \$db->insert_id();";
+ $codex .= "\n }";
+ $codex .= "\n \$updata['id'] = \$id;";
+ } else {
+ $codex .= "\n \$csql->where('id', \$id);";
+ $codex .= "\n if (\$db->update(\$csql, \$updata) === false)";
+ $codex .= "\n throw new \Exception('更新失败:' . \$db->error);";
+ $codex .= "\n \$updata['id'] = \$id;";
+ }
+ $codex .= "\n //savelogdb(\$db, \$rsuser['id'], '{$tabname}', \$datarow, \$updata);";
+ $codex .= "\n \$db->commit();";
+ $codex .= "\n } catch (\Exception \$ex) {";
+ $codex .= "\n \$db->rollback();";
+ $codex .= "\n savelogfile('err_db', \$ex->getMessage());";
+ $codex .= "\n return errjson(\$ex->getMessage());";
+ $codex .= "\n }";
+ $codex .= "\n \$ret['data'] = \$updata;";
+ $rels = array();
+ foreach ($flds as $fld) {
+ if ($saasfield == $fld['col'])
+ continue;
+ $cate = $fld['cate'];
+ if ($cate == 'DB' || $cate == 'CATU' || $cate == 'CATS' || $cate == 'CATM') {
+ if (isset($fld['set']['listload']) && $fld['set']['listload'] == 'rel') {
+ list($dicttype, $dictname) = splitdict($fld['data']);
+ if ($dicttype == 'dictdb') {
+ if (isset($rels[$dictname]))
+ $rels[$dictname][] = $fld['col'];
+ else
+ $rels[$dictname] = array($fld['col']);
+ }
+ }
+ }
+ }
+ foreach ($rels as $dictname => $cols) {
+ $colsn = implode(',', $cols);
+ $codex .= "\n \$ret['{$dictname}'] = getrelation(\$db, [\$updata], '{$dictname}', '{$colsn}');";
+ }
+ foreach ($flds as $fld) {
+ $col = $fld['col'];
+ if ($fld['cate'] == 'FILEMD'){
+ $codex .= "\n if (storsave('/md/{$fld['set']['savepath']}/' . \$id . '_' . \${$col} . '.txt', \${$col}_text) === false)";
+ $codex .= "\n return errjson('写入失败');";
+ }
+ }
+ $codex .= "\n return succjson(\$ret);";
+ // $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
+ // $codex .= "\n \$csql->where('id', \$id);";
+ // $codex .= "\n \$datarow = \$db->getone(\$csql);";
+ // $codex .= "\n \$ret['data'] = \$datarow;";
+ // $codex .= "\n return succjson(\$ret);";
+ $codex .= "\n }";
+ }
+ if ($hasdel) {
+ $codex .= "\n";
+ $codex .= "\n public static function json_del() {";
+ $codex .= "\n global \$db;";
+ if ($verifyfunc) {
+ $codex .= "\n \$rsuser = {$verifyfunc}();";
+ $codex .= "\n //if (nopower(\$db, \$rsuser['id'], 'p d'))";
+ $codex .= "\n // return errjson('您未被授权操作');";
+ }
+ $codex .= "\n \$post = new \ciy\post();";
+ $codex .= "\n //\$db->trace(\$post->get('_pf'), \$rsuser);";
+ $codex .= "\n \$ids = \$post->get('ids');";
+ $codex .= "\n if (empty(\$ids))";
+ $codex .= "\n return errjson('请选择至少一条');";
+ $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
+ if ($saasfield) {
+ if (!empty($saasusr))
+ $codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
+ }
+ $codex .= "\n \$csql->where('id in', \$ids);";
+ $codex .= "\n \$mrows = \$db->get(\$csql);";
+ $codex .= "\n \$vids = array();";
+ $codex .= "\n try {";
+ $codex .= "\n \$db->begin();";
+ $codex .= "\n foreach (\$mrows as \$mrow) {";
+ $codex .= "\n \$delid = \$mrow['id'];";
+ $codex .= "\n //delcheck(\$db, \$delid, 'tablexx', 'xxid', '管理员');";
+ if ($chk_deltimes) {
+ $codex .= "\n //deltimeall(\$db, \$delid, 'tablexx', 'xxid', '运动员');";
+ $codex .= "\n deltimeme(\$db, \$delid, '{$tabname}');";
+ } else {
+ $codex .= "\n //delall(\$db, \$delid, 'tablexx', 'xxid', '运动员'); //deltimeall";
+ $codex .= "\n delme(\$db, \$delid, '{$tabname}');";
+ }
+ $codex .= "\n savelogdb(\$db, \$rsuser['id'], '{$tabname}', \$mrow, null);";
+ $codex .= "\n \$vids[] = \$delid;";
+ $codex .= "\n }";
+ $codex .= "\n \$db->commit();";
+ $codex .= "\n } catch (\Exception \$ex) {";
+ $codex .= "\n \$db->rollback();";
+ $codex .= "\n savelogfile('err_db', \$ex->getMessage());";
+ $codex .= "\n return errjson(\$ex->getMessage());";
+ $codex .= "\n }";
+ $codex .= "\n \$ret['ids'] = \$vids;";
+ $codex .= "\n return succjson(\$ret);";
+ $codex .= "\n }";
+ }
+
+ if ($hasreview || $hasaudit) {
+ $codex .= "\n";
+ $codex .= "\n public static function json_audit() {";
+ $codex .= "\n global \$db;";
+ if ($verifyfunc) {
+ $codex .= "\n \$rsuser = {$verifyfunc}();";
+ $codex .= "\n //if (nopower(\$db, \$rsuser['id'], 'p a'))";
+ $codex .= "\n // return errjson('您未被授权操作');";
+ }
+ $codex .= "\n \$post = new \ciy\post();";
+ $codex .= "\n //\$db->trace(\$post->get('_pf'), \$rsuser);";
+ $codex .= "\n \$ids = \$post->get('ids');";
+ $codex .= "\n if (empty(\$ids))";
+ $codex .= "\n return errjson('请选择至少一条');";
+ $codex .= "\n \$auditstatus = \$post->getint('auditstatus');";
+ foreach ($flds as $fld) {
+ if ($fld['col'] == 'auditmsg') {
+ $codex .= "\n \$auditmsg = \$post->get('auditmsg');";
+ $codex .= "\n if (\$auditstatus == 90 && empty(\$auditmsg))";
+ $codex .= "\n return errjson('请填写驳回原因');";
+ }
+ }
+ $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
+ if ($saasfield) {
+ if (!empty($saasusr))
+ $codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
+ }
+ $codex .= "\n \$csql->where('id in', \$ids);";
+ $codex .= "\n \$mrows = \$db->get(\$csql);";
+ $codex .= "\n \$ids = array();";
+ $codex .= "\n try {";
+ $codex .= "\n \$db->begin();";
+ $codex .= "\n foreach (\$mrows as \$mrow) {";
+ $codex .= "\n if (\$auditstatus == 100) {";
+ $codex .= "\n }";
+ $codex .= "\n \$updata = array();";
+ foreach ($flds as $fld) {
+ $col = $fld['col'];
+ if ($col == 'audituser')
+ $codex .= "\n \$updata['{$col}'] = \$rsuser['id'];";
+ if ($col == 'audittimes')
+ $codex .= "\n \$updata['{$col}'] = tostamp();";
+ if ($col == 'auditstatus')
+ $codex .= "\n \$updata['{$col}'] = \$auditstatus;";
+ if ($col == 'auditmsg')
+ $codex .= "\n \$updata['{$col}'] = \$auditmsg;";
+ }
+ $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
+ $codex .= "\n \$csql->where('id', \$mrow['id']);";
+ $codex .= "\n if (\$db->update(\$csql, \$updata) === false)";
+ $codex .= "\n throw new \Exception('审核失败:' . \$db->error);";
+ $codex .= "\n \$ids[] = \$mrow['id'];";
+ $codex .= "\n }";
+ $codex .= "\n \$db->commit();";
+ $codex .= "\n } catch (\Exception \$ex) {";
+ $codex .= "\n \$db->rollback();";
+ $codex .= "\n savelogfile('err_db', \$ex->getMessage());";
+ $codex .= "\n return errjson(\$ex->getMessage());";
+ $codex .= "\n }";
+ $codex .= "\n \$ret['data'] = \$updata;";
+ $codex .= "\n \$ret['ids'] = \$ids;";
+ $codex .= "\n return succjson(\$ret);";
+ $codex .= "\n }";
+ }
+
+ if ($chk_multistatus) {
+ $codex .= "\n";
+ $codex .= "\n public static function json_multi_status() {";
+ $codex .= "\n global \$db;";
+ if ($verifyfunc) {
+ $codex .= "\n \$rsuser = {$verifyfunc}();";
+ $codex .= "\n //if (nopower(\$db, \$rsuser['id'], 'p m'))";
+ $codex .= "\n // return errjson('您未被授权操作');";
+ }
+ $codex .= "\n \$post = new \ciy\post();";
+ $codex .= "\n //\$db->trace(\$post->get('_pf'), \$rsuser);";
+ $codex .= "\n \$status = \$post->getint('status');";
+ $codex .= "\n \$ids = \$post->get('ids');";
+ $codex .= "\n if (empty(\$ids))";
+ $codex .= "\n return errjson('请选择至少一条');";
+ $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
+ if ($saasfield) {
+ if (!empty($saasusr))
+ $codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
+ }
+ $codex .= "\n \$csql->where('id in', \$ids);";
+ $codex .= "\n \$mrows = \$db->get(\$csql);";
+ $codex .= "\n \$ids = array();";
+ $codex .= "\n try {";
+ $codex .= "\n \$db->begin();";
+ $codex .= "\n foreach (\$mrows as \$mrow) {";
+ $codex .= "\n \$updata = array();";
+ $codex .= "\n \$updata['status'] = \$status;";
+ $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
+ $codex .= "\n \$csql->where('id', \$mrow['id']);";
+ $codex .= "\n if (\$db->update(\$csql, \$updata) === false)";
+ $codex .= "\n throw new \Exception('批量操作失败:' . \$db->error);";
+ $codex .= "\n \$ids[] = \$mrow['id'];";
+ $codex .= "\n }";
+ $codex .= "\n \$db->commit();";
+ $codex .= "\n } catch (\Exception \$ex) {";
+ $codex .= "\n \$db->rollback();";
+ $codex .= "\n savelogfile('err_db', \$ex->getMessage());";
+ $codex .= "\n return errjson(\$ex->getMessage());";
+ $codex .= "\n }";
+ $codex .= "\n \$ret['data'] = \$updata;";
+ $codex .= "\n \$ret['ids'] = \$ids;";
+ $codex .= "\n return succjson(\$ret);";
+ $codex .= "\n }";
+ }
+ if ($hasexcelout) {
+ $codex .= "\n";
+ $codex .= "\n public static function json_exportxls() {";
+ $codex .= "\n global \$db;";
+
+ $codex .= "\n \$rsuser = verifyfast();";
+ $codex .= "\n //if (nopower(\$db, \$rsuser['id'], 'p e'))";
+ $codex .= "\n // return errjson('您未被授权操作');";
+
+ $codex .= "\n \$post = new \\ciy\\post();";
+ $codex .= "\n list(\$where, \$csql) = self::setwhere(\$db, \$post, \$rsuser);";
+ $codex .= "\n \$mrows = \$db->get(\$csql);";
+ $codex .= "\n if (count(\$mrows) > 10000)";
+ $codex .= "\n return errjson('将导出' . count(\$mrows) . '条,不建议超过1万条,请筛选缩小范围');";
+ $codex .= "\n \$fields = array();";
+ foreach ($flds as $fld) {
+ if (!$fld['bout'])
+ continue;
+ if ($saasfield == $fld['col'])
+ continue;
+ $col = $fld['col'];
+ $name = $fld['name'];
+ $cate = $fld['cate'];
+ $type = $fld['type'];
+ $width = 100;
+ if ($col == 'id') {
+ $width = 60;
+ $name = '行码';
+ }
+ if ($type == 'varchar' || $cate == 'CATS' || $cate == 'CATM')
+ $width = 150;
+ if ($cate == 'IMG')
+ $width = 300;
+ $codex .= "\n \$fields[] = array('style' => '{$fld['align']}', 'width' => {$width}, 'field' => '{$col}', 'name' => '{$name}');";
+ }
+ foreach ($flds as $fld) {
+ if (!$fld['bout'])
+ continue;
+ if ($saasfield == $fld['col'])
+ continue;
+ $col = $fld['col'];
+ $cate = $fld['cate'];
+ if ($cate == 'BOOL') {
+ $codex .= "\n \$code_{$col} = \$db->getdbcodes('{$tabname}', '{$col}');";
+ } else if ($cate == 'TINT' || $cate == 'TBIN' || $cate == 'CATS' || $cate == 'CATM' || $cate == 'DB' || $cate == 'CATA' || $cate == 'CATU') {
+ $ext = '';
+ if ($cate == 'CATM')
+ $ext = ',upid';
+ list($dicttype, $dictname) = splitdict($fld['data']);
+ if ($dicttype == 'dictciy') {
+ $codex .= "\n \$code_{$col} = \$db->get((new \\ciy\\sql('{$dictname}'))->column('id,name{$ext}'));";
+ } else if ($dicttype == 'dictdb') {
+ if (isset($fld['set']['listload']) && $fld['set']['listload'] == 'rel')
+ $codex .= "\n \$code_{$col} = getrelation(\$db, \$mrows, '{$dictname}', '{$col}', 'id,name{$ext}');";
+ else
+ $codex .= "\n \$code_{$col} = \$db->get((new \\ciy\\sql('{$dictname}'))->column('id,name{$ext}'));";
+ } else if ($dicttype == 'dictcata') {
+ $codex .= "\n \$code_{$col} = getcatas(\$db, '{$dictname}');";
+ } else {
+ $codex .= "\n \$code_{$col} = \$db->getdbcodes('{$tabname}', '{$col}');";
+ }
+ }
+ }
+ $codex .= "\n \$datas = array();";
+ $codex .= "\n foreach (\$mrows as \$mrow) {";
+ $codex .= "\n \$dat = array();";
+ $codex .= "\n foreach (\$fields as \$field) {";
+ $codex .= "\n \$field = \$field['field'];";
+ $codex .= "\n \$val = isset(\$mrow[\$field]) ? \$mrow[\$field] : '';";
+
+ foreach ($flds as $fld) {
+ if ($fld['col'] != 'id' && !$fld['bout'])
+ continue;
+ if ($saasfield == $fld['col'])
+ continue;
+ $col = $fld['col'];
+ $cate = $fld['cate'];
+ $ext = '';
+ if ($col == 'id') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = enid(\$val);";
+ } else if ($cate == 'FSIZE') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = number_format(\$val / 1024, 2) . 'KB';";
+ } else if ($cate == 'METRE') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = number_format(\$val / 1000, 2) . '米';";
+ } else if ($cate == 'DATE') {
+ $codex .= "\n if (\$field == '{$col}')";
+ if (strpos('H', $fld['data']) !== false)
+ $codex .= "\n \$val = (\$val <= 0 ? '--' : date('Y-m-d H:i', \$val));";
+ else
+ $codex .= "\n \$val = (\$val <= 0 ? '--' : date('Y-m-d', \$val));";
+ } else if ($cate == 'TIME') {
+ $codex .= "\n if (\$field == '{$col}')";
+ if (strpos(':s', $fld['data']) !== false)
+ $ext = ', true';
+ $codex .= "\n \$val = (\$val <= 0 ? '--' : totimepoint(\$val{$ext}));";
+ } else if ($cate == 'WCNY') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = number_format(\$val / 1000000, 3) . '万元';";
+ } else if ($cate == 'MCNY') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = number_format(\$val / 10000, 4) . '元';";
+ } else if ($cate == 'BOOL') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = (\$val == 1 ? \$code_{$col}[0]['name'] : @\$code_{$col}[1]['name']);";
+ } else if ($cate == 'UNIT') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = (\$val == '' ? '--' : implode(',', tounit(\$val)));";
+ } else if ($cate == 'CATA' || $cate == 'TINT' || $cate == 'DB' || $cate == 'CATU') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = ccode(\$code_{$col}, \$val);";
+ } else if ($cate == 'TBIN') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = implode(',', bcode(\$code_{$col}, \$val));";
+ } else if ($cate == 'CATS') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = implode(',', scode(\$code_{$col}, \$val));";
+ } else if ($cate == 'CATM') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = implode('-', mcode(\$code_{$col}, \$val));";
+ } else if ($cate == 'CYC') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = (\$val == 0 ? '--' : tocyc(\$val));";
+ } else if ($cate == 'SEC') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val .= '秒';";
+ } else if ($cate == 'BET') {
+ $unit = flddata($fld['data'], 0, '');
+ $bet = flddata($fld['data'], 1, 100);
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = number_format(\$val / {$bet}, 3) . '{$unit}';";
+ } else if ($cate == 'LNY') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = number_format(\$val / 100, 2) . '元';";
+ } else if ($cate == 'LNY') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = number_format(\$val / 100, 2) . '¤';";
+ } else if ($cate == 'WGT') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = number_format(\$val / 1000, 3) . 'KG';";
+ } else if ($cate == 'LGH') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = number_format(\$val / 1000, 3) . '米';";
+ } else if ($cate == 'TON') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = number_format(\$val / 1000000, 3) . '吨';";
+ } else if ($cate == 'PCT') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = number_format(\$val / 100, 2) . '%';";
+ } else if ($cate == 'CNY') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = number_format(\$val / 100, 2);";
+ } else if ($cate == 'KG') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = number_format(\$val / 1000, 3) . 'KG';";
+ } else if ($cate == 'TC') {
+ $codex .= "\n if (\$field == '{$col}')";
+ $codex .= "\n \$val = number_format(\$val / 1000, 1) . '℃';";
+ } else {
+ }
+ }
+ $codex .= "\n \$dat[] = \$val;";
+ $codex .= "\n }";
+ $codex .= "\n \$datas[] = \$dat;";
+ $codex .= "\n }";
+
+ $codex .= "\n \$param = array();";
+ $codex .= "\n \$param['field'] = \$fields;";
+ $codex .= "\n \$param['data'] = \$datas;";
+
+ $codex .= "\n \$param['sheetname'] = '数据报表';";
+ $codex .= "\n \$param['titleheight'] = '25'; //列头高度";
+ $codex .= "\n \$param['landscape'] = true; //横向打印";
+ $codex .= "\n \$param['fixtopage'] = true; //打印整个工作表";
+
+ $codex .= "\n \$param['toptitle'] = '{$titname}数据报表';";
+ $codex .= "\n \$str = \\ciy\\excel::general_excel_xml(\$param);";
+ $codex .= "\n \$filename = '';";
+ $codex .= "\n if (empty(\$filename))";
+ $codex .= "\n \$filename = date('Y-m-d_H-i-s') . rand(1000, 9999);";
+ $codex .= "\n \$filename .= '.xls';";
+ $codex .= "\n file_put_contents(PATH_WEB . 'ud/tmp/' . \$filename, \$str);";
+ $codex .= "\n return succjson(array('url' => '/ud/tmp/' . \$filename));";
+ $codex .= "\n }";
+ }
+ if ($hasexcelin) {
+ $codex .= "\n";
+ $codex .= "\n public static function json_importxls_in() {";
+ $codex .= "\n global \$db;";
+ $codex .= "\n \$rsuser = verifyfast();";
+ $codex .= "\n //if (nopower(\$db, \$rsuser['id'], 'p i'))";
+ $codex .= "\n // return errjson('您未被授权操作');";
+
+ $codex .= "\n \$post = new \ciy\post();";
+ $codex .= "\n \$file = PATH_WEB . '/ud' . \$post->get('file');";
+ $codex .= "\n if (!file_exists(\$file))";
+ $codex .= "\n return errjson('文件不存在');";
+ $codex .= "\n require_once PATH_ROOT . '../libs/phpoffice/autoload.php';";
+ $codex .= "\n \$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load(\$file);";
+ $codex .= "\n \$sheet = \$spreadsheet->getActiveSheet();";
+ $codex .= "\n \$datas = \$sheet->toArray('', true, true, false);";
+ $codex .= "\n \$datacnt = count(\$datas);";
+ $codex .= "\n if (\$datacnt < 2)";
+ $codex .= "\n return errjson('数据为空');";
+ $codex .= "\n \$html = '';";
+ $codex .= "\n \$headsn = array();";
+
+ foreach ($flds as $fld) {
+ $col = $fld['col'];
+ if ($fld['cate'] == 'FILEMD')
+ continue;
+ if ($col == 'id') {
+ $codex .= "\n \$headsn[] = '行码.id';";
+ continue;
+ }
+ if (!$fld['bmin'])
+ continue;
+ $name = $fld['name'];
+ $codex .= "\n \$headsn[] = '{$name}.{$col}';";
+ }
+ $codex .= "\n \$xlsidx = 1;";
+ $codex .= "\n if (empty(\$datas[0][count(\$headsn) - 1]))";
+ $codex .= "\n \$xlsidx = 2;";
+ $codex .= "\n \$heads = array();";
+ $codex .= "\n foreach (\$headsn as \$_head) {";
+ $codex .= "\n \$hd = explode('.', \$_head);";
+ $codex .= "\n if (count(\$hd) < 2)";
+ $codex .= "\n continue;";
+ $codex .= "\n \$heads[] = array(";
+ $codex .= "\n 'idx' => array_search(\$hd[0], \$datas[\$xlsidx - 1]), 'fld' => \$hd[1], 'name' => \$hd[0]";
+ $codex .= "\n );";
+ $codex .= "\n }";
+
+ foreach ($flds as $fld) {
+ if (!$fld['bmin'])
+ continue;
+ $col = $fld['col'];
+ $cate = $fld['cate'];
+ if ($cate == 'BOOL') {
+ $codex .= "\n \$code_{$col} = \$db->getdbcodes('{$tabname}', '{$col}');";
+ } else if ($cate == 'TINT' || $cate == 'TBIN' || $cate == 'CATS' || $cate == 'CATM' || $cate == 'DB' || $cate == 'CATA' || $cate == 'CATU') {
+ $ext = '';
+ if ($cate == 'CATM')
+ $ext = ',upid';
+ list($dicttype, $dictname) = splitdict($fld['data']);
+ if ($dicttype == 'dictciy') {
+ $codex .= "\n \$code_{$col} = \$db->get((new \\ciy\\sql('{$dictname}'))->column('id,name{$ext}'));";
+ } else if ($dicttype == 'dictdb') {
+ $codex .= "\n \$code_{$col} = \$db->get((new \\ciy\\sql('{$dictname}'))->column('id,name{$ext}'));";
+ } else if ($dicttype == 'dictcata') {
+ $codex .= "\n \$code_{$col} = getcatas(\$db, '{$dictname}');";
+ } else {
+ $codex .= "\n \$code_{$col} = \$db->getdbcodes('{$tabname}', '{$col}');";
+ }
+ }
+ }
+ $codex .= "\n \$html .= '| # | ';"; + $codex .= "\n foreach (\$heads as \$arr) {"; + $codex .= "\n \$html .= '' . \$arr['name'] . ' | ';"; + $codex .= "\n }"; + $codex .= "\n \$html .= '' . \$lineidx . ' | ';";
+ $codex .= "\n \$bempty = true;";
+ $codex .= "\n \$unqs = array();";
+ $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
+ $codex .= "\n foreach (\$heads as \$arr) {";
+ $codex .= "\n \$name = \$arr['name'];";
+ $codex .= "\n \$errmsg = ''; //数据有误,显示红色说明";
+ $codex .= "\n \$showdat = ''; //显示在表格中的数据";
+ $codex .= "\n if (\$arr['idx'] > -1)";
+ $codex .= "\n \$showdat = trim(\$datas[\$rowidx][\$arr['idx']]);";
+ $codex .= "\n if (\$showdat == '--')";
+ $codex .= "\n \$showdat = '';";
+ $codex .= "\n \$value = \$showdat; //在表单中的数据(转换后)";
+ $codex .= "\n \$ext = ''; //扩展表单";
+ $codex .= "\n if (\$name == '行码') {";
+ $codex .= "\n if (empty(\$showdat)) {";
+ $codex .= "\n \$value = 0;";
+ $codex .= "\n \$showdat = '新增';";
+ $codex .= "\n } else {";
+ $codex .= "\n \$id = deid(\$showdat);";
+ $codex .= "\n if (\$id == 0)";
+ $codex .= "\n \$errmsg = \$name . '解析错误';";
+ $codex .= "\n else {";
+ $codex .= "\n \$csqlchk = new \ciy\sql('{$tabname}');";
+ $codex .= "\n \$csqlchk->where('id', \$id)->column('id');";
+ $codex .= "\n \$chkid = toint(\$db->get1(\$csqlchk));";
+ $codex .= "\n if (\$chkid != \$id)";
+ $codex .= "\n \$errmsg = \$name . '在数据库中不存在';";
+ $codex .= "\n \$value = \$id;";
+ $codex .= "\n }";
+ $codex .= "\n }";
+
+ foreach ($flds as $fld) {
+ if ($fld['col'] == 'id' || !$fld['bmin'])
+ continue;
+ $col = $fld['col'];
+ if($col == 'FILEMD')
+ continue;
+ $name = $fld['name'];
+ $cate = $fld['cate'];
+ $type = $fld['type'];
+ $ext = '';
+ $codex .= "\n } else if (\$name == '{$name}') {";
+ $codex .= "\n if (empty(\$showdat)) {";
+ if ($fld['bimp']) {
+ $codex .= "\n \$errmsg = \$name . '为必填项';";
+ } else {
+ if ($type == 'bigint' || $type == 'int' || $type == 'double' || $type == 'float')
+ $codex .= "\n \$value = 0;";
+ else
+ $codex .= "\n \$value = '';";
+ }
+ $codex .= "\n } else {";
+ if ($fld['bdup']) {
+ $codex .= "\n \$csql->where('{$col}', \$showdat);";
+ $codex .= "\n \$unqs[] = \$showdat;";
+ }
+
+ if ($cate == 'CATA' || $cate == 'TINT' || $cate == 'DB' || $cate == 'CATU') {
+ $codex .= "\n \$value = dcode(\$code_{$col}, \$showdat);";
+ $codex .= "\n if (\$value == -1)";
+ $codex .= "\n \$errmsg = \$name . '文字与系统数据不匹配';";
+ } else if ($cate == 'DATE') {
+ $codex .= "\n \$value = tostamp(\$showdat);";
+ $codex .= "\n if (\$value === 0) {";
+ $codex .= "\n \$errmsg = \$name . '时间格式错误';";
+ $codex .= "\n } else {";
+ if (strpos('H', $fld['data']) !== false)
+ $codex .= "\n \$showdat = date('Y-m-d H:i', \$value);";
+ else
+ $codex .= "\n \$showdat = date('Y-m-d', \$value);";
+ $codex .= "\n }";
+ } else if ($cate == 'TIME') {
+ $codex .= "\n \$tps = explode(':', \$showdat);";
+ $codex .= "\n \$value = 0;";
+ $codex .= "\n if (count(\$tps) == 2)";
+ $codex .= "\n \$value = \$tps[0] * 3600 + \$tps[1] * 60;";
+ $codex .= "\n else if (count(\$tps) == 3)";
+ $codex .= "\n \$value = \$tps[0] * 3600 + \$tps[1] * 60 + \$tps[2];";
+ $codex .= "\n if (\$value === 0) {";
+ $codex .= "\n \$errmsg = \$name . '时间格式错误';";
+ $codex .= "\n } else {";
+ $codex .= "\n \$showdat = totimepoint(\$value, true);";
+ $codex .= "\n }";
+ } else if ($cate == 'BOOL') {
+ $codex .= "\n if (\$showdat == \$code_{$col}[0]['name']) {";
+ $codex .= "\n \$value = 1;";
+ $codex .= "\n \$showdat = \$code_{$col}[0]['name'];";
+ $codex .= "\n } else {";
+ $codex .= "\n \$value = 2;";
+ $codex .= "\n \$showdat = \$code_{$col}[1]['name'];";
+ $codex .= "\n }";
+ } else if ($cate == 'UNIT') {
+ $codex .= "\n \$us = explode(',', \$showdat);";
+ $codex .= "\n \$us = array_reverse(\$us);";
+ $codex .= "\n if (preg_match('/1(.*?)(\d+)(.*)/', \$us[0], \$matches)) {";
+ $codex .= "\n \$unitx = \$matches[1];";
+ $codex .= "\n \$value = \$matches[3] . '|' . \$matches[2] . '|' . \$matches[1];";
+ $codex .= "\n if (isset(\$us[1])) {";
+ $codex .= "\n if (preg_match('/1(.*?)(\d+)(.*)/', \$us[1], \$matches)) {";
+ $codex .= "\n if (\$unitx != \$matches[3]) {";
+ $codex .= "\n \$errmsg = \$name . '中间单位不匹配';";
+ $codex .= "\n } else {";
+ $codex .= "\n \$value .= '|' . \$matches[2] . '|' . \$matches[1];";
+ $codex .= "\n }";
+ $codex .= "\n } else {";
+ $codex .= "\n \$errmsg = \$name . '第二段格式错误';";
+ $codex .= "\n }";
+ $codex .= "\n }";
+ $codex .= "\n } else {";
+ $codex .= "\n if (preg_match('/\d/', \$us[0]) > 0)";
+ $codex .= "\n \$errmsg = \$name . '第一段不能包含数字';";
+ $codex .= "\n else";
+ $codex .= "\n \$value = \$us[0];";
+ $codex .= "\n }";
+ } else if ($cate == 'TBIN') {
+ $codex .= "\n \$dats = explode(',', \$showdat);";
+ $codex .= "\n \$tdat = 0;";
+ $codex .= "\n foreach (\$dats as \$da) {";
+ $codex .= "\n \$bti = dcode(\$code_{$col}, \$da);";
+ $codex .= "\n if (\$bti < 1) {";
+ $codex .= "\n \$errmsg = \$name . '文字与系统数据不匹配';";
+ $codex .= "\n } else {";
+ $codex .= "\n \$tdat += (1 << (\$bti - 1));";
+ $codex .= "\n }";
+ $codex .= "\n }";
+ $codex .= "\n \$value = \$tdat;";
+ } else if ($cate == 'CATS') {
+ $codex .= "\n \$tdats = explode(',', \$showdat);";
+ $codex .= "\n \$vals = array();";
+ $codex .= "\n foreach (\$tdats as \$da) {";
+ $codex .= "\n \$tval = dcode(\$code_{$col}, \$da);";
+ $codex .= "\n if (\$tval == -1)";
+ $codex .= "\n \$errmsg = \$name . '文字与系统数据不匹配';";
+ $codex .= "\n \$vals[] = \$tval;";
+ $codex .= "\n }";
+ $codex .= "\n \$value = implode(',', \$vals);";
+ } else if ($cate == 'CATM') {
+ $codex .= "\n \$dats = explode('-', \$showdat);";
+ $codex .= "\n \$value = dcode(\$code_{$col}, \$dats[count(\$dats) - 1]);";
+ $codex .= "\n if (\$value == -1)";
+ $codex .= "\n \$errmsg = \$name . '文字与系统数据不匹配';";
+ } else if ($cate == 'CYC') {
+ $codex .= "\n \$last = substr(\$showdat, -3);";
+ $codex .= "\n \$dd = toint(substr(\$showdat, 0, -3));";
+ $codex .= "\n if (\$dd == 0) {";
+ $codex .= "\n \$errmsg = \$name . '周期数字错误';";
+ $codex .= "\n } else if (\$last == '天') {";
+ $codex .= "\n \$value = \$dd * 86400;";
+ $codex .= "\n } else if (\$last == '月') {";
+ $codex .= "\n \$value = -\$dd;";
+ $codex .= "\n } else if (\$last == '秒') {";
+ $codex .= "\n \$value = \$dd;";
+ $codex .= "\n } else {";
+ $codex .= "\n \$errmsg = \$name . '周期单位错误';";
+ $codex .= "\n }";
+ } else if ($type == 'double' || $type == 'float' || $type == 'int' || $type == 'bigint') {
+ $unit = '';
+ $bet = 1;
+ if ($cate == 'FSIZE') {
+ $unit = 'KB';
+ $bet = 1024;
+ } else if ($cate == 'METRE') {
+ $unit = '米';
+ $bet = 1000;
+ } else if ($cate == 'WCNY') {
+ $unit = '万元';
+ $bet = 1000000;
+ } else if ($cate == 'SEC') {
+ $unit = '秒';
+ } else if ($cate == 'BET') {
+ $unit = flddata($fld['data'], 0, '');
+ $bet = flddata($fld['data'], 1, 100);
+ } else if ($cate == 'LGH') {
+ $unit = '米';
+ $bet = 1000;
+ } else if ($cate == 'WGT') {
+ $unit = 'KG';
+ $bet = 1000;
+ } else if ($cate == 'LNY') {
+ $unit = '元';
+ $bet = 100;
+ } else if ($cate == 'SNY') {
+ $unit = '¤';
+ $bet = 100;
+ } else if ($cate == 'TON') {
+ $unit = '吨';
+ $bet = 1000000;
+ } else if ($cate == 'CNY') {
+ $bet = 100;
+ } else if ($cate == 'PCT') {
+ $unit = '%';
+ $bet = 100;
+ } else if ($cate == 'KG') {
+ $unit = 'KG';
+ $bet = 1000;
+ } else if ($cate == 'TC') {
+ $unit = '℃';
+ $bet = 1000;
+ }
+ if (empty($unit))
+ $codex .= "\n \$showdat = str_replace(',', '', \$showdat);";
+ else
+ $codex .= "\n \$showdat = str_replace(',', '', str_replace('{$unit}', '', \$showdat));";
+ $codex .= "\n if (!is_numeric(\$showdat))";
+ $codex .= "\n \$errmsg = \$name . '不是数字';";
+ $codex .= "\n else";
+ if ($bet > 1)
+ $codex .= "\n \$value = toint((float)\$showdat * {$bet});";
+ else if ($type == 'double' || $type == 'float')
+ $codex .= "\n \$value = (float)\$showdat;";
+ else
+ $codex .= "\n \$value = toint(\$showdat);";
+ if (!empty($unit))
+ $codex .= "\n \$showdat .= '{$unit}';";
+ }
+ $codex .= "\n }";
+ }
+ $codex .= "\n }";
+
+ $codex .= "\n if (!empty(\$showdat))";
+ $codex .= "\n \$bempty = false;";
+
+ $codex .= "\n if (empty(\$errmsg))";
+ $codex .= "\n \$hrhtml .= '' . \$showdat . '' . \$ext . ' | ';";
+ $codex .= "\n else";
+ $codex .= "\n \$hrhtml .= '' . \$showdat . ' | ';";
+ $codex .= "\n }";
+ $codex .= "\n if (\$bempty)";
+ $codex .= "\n continue;";
+
+ $codex .= "\n if (count(\$unqs) > 0) {";
+ $codex .= "\n \$unq = implode('|', \$unqs);";
+ $codex .= "\n if (in_array(\$unq, \$uniques))";
+ $codex .= "\n \$firsthtml = '重复 | ';";
+ $codex .= "\n else {";
+ $codex .= "\n \$uniques[] = \$unq;";
+ $codex .= "\n \$csql->column('id');";
+ $codex .= "\n \$chkid = toint(\$db->get1(\$csql));";
+ $codex .= "\n if (\$chkid > 0 && ((\$id > 0 && \$chkid != \$id) || \$id == 0))";
+ $codex .= "\n \$firsthtml = '重复 | ';";
+ $codex .= "\n }";
+ $codex .= "\n }";
+ $codex .= "\n \$html .= '
|---|---|
共' . \$cnt . '条数据';";
+ $codex .= "\n return succjson(array('html' => \$html, 'count' => \$cnt));";
+ $codex .= "\n }";
+ $codex .= "\n";
+ $codex .= "\n public static function json_importxls_data() {";
+ $codex .= "\n global \$db;";
+
+ $codex .= "\n \$rsuser = verifyfast();";
+ $codex .= "\n //if (nopower(\$db, \$rsuser['id'], 'p i'))";
+ $codex .= "\n // return errjson('您未被授权操作');";
+ $codex .= "\n \$post = new \ciy\post();";
+ $codex .= "\n //\$db->trace(\$post->get('_pf'), \$rsuser);";
+ $codex .= "\n \$total = \$post->getint('total');";
+ $codex .= "\n try {";
+ $codex .= "\n \$db->begin();";
+ $codex .= "\n for (\$i = 1; \$i <= \$total; \$i++) {";
+ $codex .= "\n \$id = \$post->getint('id_' . \$i);";
+ $dups = array();
+ foreach ($flds as $fld) {
+ if (!$fld['bdup'])
+ continue;
+ $col = $fld['col'];
+ $dups[] = $col;
+ $codex .= "\n \${$col} = \$post->get('{$col}_' . \$i);";
+ }
+ if (count($dups) > 0) {
+ $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
+ if ($saasfield) {
+ if (!empty($saasusr))
+ $codex .= "\n \$csql->where('{$saasfield}', \$rsuser['{$saasusr}']);";
+ }
+ foreach ($dups as $dup) {
+ $codex .= "\n \$csql->where('{$dup}', \${$dup});";
+ }
+ $codex .= "\n \$csql->column('id');";
+ $codex .= "\n \$chkid = toint(\$db->get1(\$csql));";
+ $codex .= "\n if (\$chkid > 0 && ((\$id > 0 && \$chkid != \$id) || \$id == 0))";
+ $codex .= "\n throw new \Exception('CIYIGN发现数据有重复');";
+ }
+ $codex .= "\n \$updata = array();";
+ foreach ($flds as $fld) {
+ if (!$fld['bmin'])
+ continue;
+ $col = $fld['col'];
+ if ($col == 'id')
+ continue;
+ if ($fld['cate'] == 'FILEMD')
+ continue;
+ $codex .= "\n \$updata['{$col}'] = \$post->get('{$col}_' . \$i);";
+ }
+ $codex .= "\n \$csql = new \ciy\sql('{$tabname}');";
+ $codex .= "\n if (\$id == 0) {";
+ foreach ($flds as $fld) {
+ $col = $fld['col'];
+ if ($col == $saasfield) {
+ if (!empty($saasusr))
+ $codex .= "\n \$updata['{$col}'] = \$rsuser['{$saasusr}'];";
+ }
+ if ($col == 'addtimes')
+ $codex .= "\n \$updata['{$col}'] = tostamp();";
+ if ($col == 'auditstatus')
+ $codex .= "\n \$updata['{$col}'] = 2;";
+ if ($col == 'matterstatus')
+ $codex .= "\n \$updata['{$col}'] = 2;";
+ }
+ $codex .= "\n if (\$db->insert(\$csql, \$updata) === false)";
+ $codex .= "\n throw new \Exception('新增导入失败:' . \$db->error);";
+ $codex .= "\n } else {";
+ $codex .= "\n \$csql->where('id', \$id);";
+ $codex .= "\n if (\$db->update(\$csql, \$updata) === false)";
+ $codex .= "\n throw new \Exception('更新导入失败:' . \$db->error);";
+ $codex .= "\n }";
+ $codex .= "\n }";
+ $codex .= "\n \$db->commit();";
+ $codex .= "\n } catch (\Exception \$ex) {";
+ $codex .= "\n \$db->rollback();";
+ $codex .= "\n savelogfile('err_db', \$ex->getMessage());";
+ $codex .= "\n return errjson(\$ex->getMessage());";
+ $codex .= "\n }";
+ $codex .= "\n return succjson();";
+ $codex .= "\n }";
+ }
+ $codex .= "\n}";
+ $codex .= "\n";
+ return $codex;
+}
diff --git a/web/admin/develop/code_saas.html b/web/admin/develop/code_saas.html
new file mode 100644
index 0000000..2eea4e7
--- /dev/null
+++ b/web/admin/develop/code_saas.html
@@ -0,0 +1,177 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/develop/code_saas.php b/web/admin/develop/code_saas.php
new file mode 100644
index 0000000..daa3824
--- /dev/null
+++ b/web/admin/develop/code_saas.php
@@ -0,0 +1,163 @@
+get('query');
+ $csql = new \ciy\sql('zc_dev_dbsaas');
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+
+ public static function json_list() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ if ($rows === false)
+ return errjson($db->error);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'zc_dev_dbsaas');
+ foreach ($field as $fr => $v) {
+ if (get('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ }
+ return succjson($ret);
+ }
+
+ public static function json_getdata() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $act = $post->get('act');
+ if ($id > 0) {
+ $csql = new \ciy\sql('zc_dev_dbsaas');
+ $csql->where('id', $id);
+ $row = $db->getone($csql);
+ if (!is_array($row))
+ return errjson('数据不存在');
+ } else {
+ $row = array();
+ }
+ $ret['data'] = $row;
+ if ($act == 'edit') {
+ $csql = new \ciy\sql('INFORMATION_SCHEMA.SCHEMATA');
+ $csql->column('SCHEMA_NAME as id,SCHEMA_NAME as name');
+ $sehrows = $db->get($csql);
+ $ret['schema'] = $sehrows;
+ }
+ return succjson($ret);
+ }
+
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p u'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $name = $post->get('name');
+ $schem = $post->get('schem');
+ $subpath = $post->get('subpath');
+ $verifyfunc = $post->get('verifyfunc');
+ $codetable = $post->get('codetable');
+ $saasfield = $post->get('saasfield');
+ $saasusr = $post->get('saasusr');
+ if (strpos($subpath, '\\') === false)
+ return errjson('相对路径需反斜杠\\');
+ if (dirmake(PATH_WEB . $subpath) === false)
+ return errjson('创建目录失败');
+ $datarow = null;
+ if ($id > 0) {
+ $csql = new \ciy\sql('zc_dev_dbsaas');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ }
+
+ try {
+ $db->begin();
+ $updata = array();
+ $updata['name'] = $name;
+ $updata['schem'] = $schem;
+ $updata['subpath'] = $subpath;
+ $updata['verifyfunc'] = $verifyfunc;
+ $updata['codetable'] = $codetable;
+ $updata['saasfield'] = $saasfield;
+ $updata['saasusr'] = $saasusr;
+ $csql = new \ciy\sql('zc_dev_dbsaas');
+ if ($id > 0) {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ } else {
+ $updata['id'] = 0;
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增失败:' . $db->error);
+ $id = $db->insert_id();
+ }
+ $updata['id'] = $id;
+ //savelogdb($db, $rsuser['id'], 'zc_dev_dbsaas', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ $ret['hf_providerbase'] = getrelation($db, [$updata], 'hf_providerbase', 'providerid');
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ //if (nopower($db, $rsuser['id'], 'p d'))
+ // return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('zc_dev_dbsaas');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ //delcheck($db, $delid, 'tablexx', 'xxid', '管理员');
+ //delall($db, $delid, 'tablexx', 'xxid', '运动员'); //deltimeall
+ delme($db, $delid, 'zc_dev_dbsaas');
+ savelogdb($db, $rsuser['id'], 'zc_dev_dbsaas', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+}
diff --git a/web/admin/develop/note.html b/web/admin/develop/note.html
new file mode 100644
index 0000000..0af5804
--- /dev/null
+++ b/web/admin/develop/note.html
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ | # | \n" + for _, arr := range heads { + html += "" + arr["name"] + " | \n" + } + html += "" + lineidx + " | "
+ bempty := true
+ for _, arr := range heads {
+ name := arr["name"]
+ errmsg := "" //数据有误,显示红色说明
+ showdat := "" //显示在表格中的数据
+ if c.Toint(arr["idx"]) > -1 {
+ showdat = strings.TrimSpace(datas[0][rowidx][c.Toint(arr["idx"])])
+ }
+ if showdat == "--" {
+ showdat = ""
+ }
+ var value any
+ value = showdat //在表单中的数据(转换后)
+ ext := "" //扩展表单
+ if name == "行码" {
+ if showdat == "" {
+ value = 0
+ showdat = "新增"
+ } else {
+ id = c.DeID(showdat)
+ if id == 0 {
+ errmsg = name + "解析错误"
+ } else {
+ csqlchk := c.NewCiySQL("zc_admin")
+ csqlchk.Where("id", id).Column("id")
+ chkid := c.Toint(c.CiyDB.Get1(csqlchk))
+ if chkid != id {
+ errmsg = name + "在数据库中不存在"
+ }
+ value = id
+ }
+ }
+ } else if name == "状态" {
+ if showdat == "" {
+ value = 0
+ } else {
+ value = c.Dcode(code_stpstatus, c.Tostr(showdat))
+ if value == -1 {
+ errmsg = name + "文字与系统数据不匹配"
+ }
+ }
+ } else if name == "性别" {
+ if showdat == "" {
+ value = 0
+ } else {
+ value = c.Dcode(code_sex, c.Tostr(showdat))
+ if value == -1 {
+ errmsg = name + "文字与系统数据不匹配"
+ }
+ }
+ } else if name == "姓名" {
+ if showdat == "" {
+ errmsg = name + "为必填项"
+ } else {
+ csqlchk := c.NewCiySQL("zc_admin")
+ csqlchk.Where("name", id).Column("id")
+ chkid := c.Toint(c.CiyDB.Get1(csqlchk))
+ if chkid > 0 && ((id > 0 && chkid != id) || id == 0) {
+ errmsg = name + "在数据库中出现重复"
+ }
+ if c.In_array(un_name, showdat) > -1 {
+ errmsg = name + "发现重复"
+ } else {
+ un_name = append(un_name, showdat)
+ }
+ }
+ } else if name == "手机号" {
+ if showdat == "" {
+ errmsg = name + "为必填项"
+ } else {
+ csqlchk := c.NewCiySQL("zc_admin")
+ csqlchk.Where("mobile", id).Column("id")
+ chkid := c.Toint(c.CiyDB.Get1(csqlchk))
+ if chkid > 0 && ((id > 0 && chkid != id) || id == 0) {
+ errmsg = name + "在数据库中出现重复"
+ }
+ if c.In_array(un_mobile, showdat) > -1 {
+ errmsg = name + "发现重复"
+ } else {
+ un_mobile = append(un_mobile, showdat)
+ }
+ }
+ } else if name == "所属组织" {
+ if showdat == "" {
+ value = 0
+ } else {
+ dats := strings.Split(showdat, "-")
+ value = c.Dcode(code_departid, dats[len(dats)-1])
+ if value == -1 {
+ errmsg = name + "文字与系统数据不匹配"
+ }
+ }
+ }
+ if showdat != "" {
+ bempty = false
+ }
+ if errmsg == "" {
+ hrhtml += "" + showdat + "" + ext + " | "
+ } else {
+ hrhtml += "" + showdat + " | "
+ }
+ }
+ if bempty {
+ continue
+ }
+
+ html += "
|---|---|
共" + c.Tostr(cnt) + "条数据\n"
+ return c.SuccJSON(w, r, map[string]any{
+ "html": html,
+ "count": cnt,
+ })
+}
+func Admin_importxls_data(w http.ResponseWriter, r *http.Request) bool {
+ post := c.NewCiyPost(w, r)
+ _, userid := admin.Verifyfast(r, c.CiyDB, post)
+ if userid == 0 {
+ return false
+ }
+ if admin.Nopower(c.CiyDB, userid, "p500a") {
+ return c.ErrJSON(w, "您未被授权操作新增")
+ }
+ total := post.Getint("total")
+ err := c.CiyDB.Tran(func() error {
+ for i := 1; i <= total; i++ {
+ istr := c.Tostr(i)
+ id := post.Getint("id_" + istr)
+ stpstatus := post.Getint("stpstatus_" + istr)
+ name := post.Get("name_" + istr)
+ mobile := post.Get("mobile_" + istr)
+ sex := post.Getint("sex_" + istr)
+ departid := post.Getint("departid_" + istr)
+ csql := c.NewCiySQL("zc_admin")
+ csql.Where("mobile", mobile)
+ csql.Column("id")
+ chkid := c.Toint(c.CiyDB.Get1(csql))
+ if chkid > 0 && ((id > 0 && chkid != id) || id == 0) {
+ return fmt.Errorf("发现手机号有重复")
+ }
+ updata := map[string]any{}
+ updata["name"] = name
+ updata["mobile"] = mobile
+ updata["stpstatus"] = stpstatus
+ updata["sex"] = sex
+ updata["departid"] = departid
+ csql = c.NewCiySQL("zc_admin")
+ var err error
+ if id == 0 {
+ updata["addtimes"] = c.Tostamp()
+ _, err = c.CiyDB.Insert(csql, updata)
+ } else {
+ csql.Where("id", id)
+ _, err = c.CiyDB.Update(csql, updata)
+ }
+ if err != nil {
+ return fmt.Errorf("导入失败:%v", err)
+ }
+ }
+ return nil
+ })
+ if err != nil {
+ return c.ErrJSON(w, "事务"+err.Error())
+ }
+ c.CiyDB.Execute("update zc_online set usrchg=2")
+ return c.SuccJSON(w, r)
+}
diff --git a/web/admin/rigger/admin.html b/web/admin/rigger/admin.html
new file mode 100644
index 0000000..b46d985
--- /dev/null
+++ b/web/admin/rigger/admin.html
@@ -0,0 +1,251 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/rigger/admin.php b/web/admin/rigger/admin.php
new file mode 100644
index 0000000..240cd1b
--- /dev/null
+++ b/web/admin/rigger/admin.php
@@ -0,0 +1,523 @@
+get('query');
+ $csql = new \ciy\sql('zc_admin');
+ $csql->where('departid', $post->get('departid'));
+ $liid = objint($query, 'liid');
+ if ($liid > 0)
+ $csql->where('stpstatus', $liid);
+ $csql->where('name like', objstr($query, 'name'));
+ $csql->where('mobile like', objstr($query, 'mobile'));
+ $csql->where('sex', objstr($query, 'sex'));
+ $csql->wheredaterange('logintimes', objstr($query, 'logintimes'));
+ $csql->wheredaterange('addtimes', objstr($query, 'addtimes'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+ public static function json_init() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'zc_admin');
+ foreach ($field as $fr => $v) {
+ if ($post->is('_' . $fr))
+ $field[$fr]['c'] = ',' . $field[$fr]['c'];
+ }
+ $fshow = fieldadd($fshow, $field, 0, '_btn', '操作');
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array(
+ 'type' => 'input',
+ 'form' => 'name',
+ 'name' => '姓名',
+ 'prop' => ' style="width:8em;"'
+ );
+ $input[] = array(
+ 'type' => 'input',
+ 'form' => 'mobile',
+ 'name' => '手机号',
+ 'prop' => ' style="width:8em;"'
+ );
+ $input[] = array(
+ 'type' => 'select',
+ 'form' => 'sex',
+ 'name' => '性别',
+ 'select' => 'sex',
+ 'all' => '全部'
+ );
+ $input[] = array(
+ 'type' => 'daterange',
+ 'form' => 'logintimes',
+ 'name' => '登录时间'
+ );
+ $input[] = array(
+ 'type' => 'daterange',
+ 'form' => 'addtimes',
+ 'name' => '注册时间'
+ );
+ $ret['searchinput'] = $input;
+ $csql = (new \ciy\sql('zc_depart'))->column('id,upid,name,isuse');
+ $ret['zc_depart'] = $db->get($csql);
+ $csql = new \ciy\sql('zc_role');
+ $csql->column('id,name');
+ $ret['zc_role'] = $db->get($csql);
+ }
+ return succjson($ret);
+ }
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $name = $post->get('name');
+ if (empty($name))
+ return errjson('请填写姓名');
+ $stpstatus = $post->getint('stpstatus');
+ if ($stpstatus <= 0)
+ return errjson('请填写状态');
+ $mobile = $post->get('mobile');
+ if (empty($mobile))
+ return errjson('请填写手机号');
+ $sex = $post->getint('sex');
+ if ($sex <= 0)
+ return errjson('请填写性别');
+ $departid = $post->getint('departid');
+ if ($departid == 0)
+ return errjson('请选择组织/部门');
+ $roleid = $post->getint('roleid');
+ $icon = $post->get('icon');
+ $datarow = null;
+ if ($id > 0) {
+ if (nopower($db, $rsuser['id'], 'p500u'))
+ return errjson('您未被授权操作修改');
+ $csql = new \ciy\sql('zc_admin');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ if ($datarow['roleid'] != $roleid) {
+ if (nopower($db, $rsuser['id'], 'p500r'))
+ return errjson('您没有赋予角色的权限');
+ } else
+ $roleid = 0;
+ } else {
+ if (nopower($db, $rsuser['id'], 'p500a'))
+ return errjson('您未被授权操作新增');
+ if (nopower($db, $rsuser['id'], 'p500r'))
+ $roleid = 0;
+ }
+ if ($roleid > 0) {
+ $csql = new \ciy\sql('zc_role');
+ $csql->where('id', $roleid);
+ $rolerow = $db->getone($csql);
+ if (!is_array($rolerow))
+ return errjson('角色不存在');
+ }
+ try {
+ $db->begin();
+ $csql = new \ciy\sql('zc_admin');
+ $csql->where('mobile', $mobile);
+ $csql->column('id');
+ $chkid = toint($db->get1($csql));
+ if ($chkid > 0 && (($id > 0 && $chkid != $id) || $id == 0))
+ throw new \Exception('CIYIGN数据已存在');
+
+ $updata = array();
+ $updata['icon'] = $icon;
+ $updata['name'] = $name;
+ $updata['stpstatus'] = $stpstatus;
+ $updata['mobile'] = $mobile;
+ $updata['sex'] = $sex;
+ $updata['departid'] = $departid;
+ $updata['roleid'] = $roleid;
+ if ($roleid > 0) {
+ $updata['power'] = $rolerow['power'];
+ }
+ $csql = new \ciy\sql('zc_admin');
+ if ($id > 0) {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ if ($stpstatus == 10) {
+ if ($roleid > 0 || $datarow['name'] != $name || $datarow['icon'] != $icon)
+ if ($db->execute('update zc_online set usrchg=2 where user=?', array($id)) === false)
+ throw new \Exception('更新online失败:' . $db->error);
+ } else {
+ if ($db->execute('delete from zc_online where user=?', array($id)) === false)
+ throw new \Exception('删除online失败:' . $db->error);
+ }
+ if ($datarow['name'] != $name)
+ $db->execute('update zc_online set usrchg=2');
+ } else {
+ $updata['addtimes'] = tostamp();
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增失败:' . $db->error);
+ $id = $db->insert_id();
+ if ($db->execute('update zc_online set usrchg=2') === false)
+ throw new \Exception('更新online失败:' . $db->error);
+ }
+ $updata['id'] = $id;
+ savelogdb($db, $rsuser['id'], 'zc_admin', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+ if (nopower($db, $rsuser['id'], 'p500d'))
+ return errjson('您未被授权操作');
+
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('zc_admin');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ if ($rsuser['id'] == $delid)
+ throw new \Exception('CIYIGN不能删除本人');
+ if ($row['id'] == 10)
+ throw new \Exception('CIYIGN不能删除超级管理员');
+ delme($db, $delid, 'zc_admin');
+ $db->execute('delte from zc_online where user=?', array($delid));
+ savelogdb($db, $rsuser['id'], 'zc_admin', $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $db->execute('update zc_online set usrchg=2');
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+ public static function json_repass() {
+ global $db;
+ $rsuser = verifyfast();
+ global $_token;
+ if (nopower($db, $rsuser['id'], 'p500p'))
+ return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $newpass = rand(100000, 999999);
+ try {
+ $db->begin();
+ $updata = array();
+ $updata['trytime'] = 0;
+ $updata['password'] = sha256($newpass . $_token['salt']);
+ $csql = new \ciy\sql('zc_admin');
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ if ($db->execute('delete from zc_online where user=?', array($id)) === false)
+ throw new \Exception('删除online失败:' . $db->error);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['msg'] = '重置后密码: ' . $newpass;
+ return succjson($ret);
+ }
+ public static function json_exportxls() {
+ global $db;
+ $rsuser = verifyfast();
+ if (nopower($db, $rsuser['id'], 'p500e'))
+ return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $csql = new \ciy\sql('zc_admin');
+
+ list($where, $csql) = self::setwhere($db, $post);
+ $rows = $db->get($csql);
+ if (count($rows) > 10000)
+ return errjson('将导出' . count($rows) . '条,不建议超过1万条,请筛选缩小范围');
+ $fields = array();
+ $fields[] = array('width' => 60, 'style' => 'c', 'field' => 'id', 'name' => '行码');
+ $fields[] = array('width' => 100, 'style' => 'l', 'field' => 'name', 'name' => '姓名');
+ $fields[] = array('width' => 60, 'style' => 'c', 'field' => 'stpstatus', 'name' => '状态');
+ $fields[] = array('width' => 100, 'style' => 'l', 'field' => 'mobile', 'name' => '手机号');
+ $fields[] = array('width' => 60, 'style' => 'c', 'field' => 'sex', 'name' => '性别');
+ $fields[] = array('width' => 100, 'style' => 'l', 'field' => 'departid', 'name' => '所属组织');
+ $fields[] = array('width' => 100, 'style' => 'l', 'field' => 'logintimes', 'name' => '活跃时间');
+ $fields[] = array('width' => 100, 'style' => 'l', 'field' => 'addtimes', 'name' => '注册时间');
+ $code_stpstatus = getcatas($db, 'stpstatus', 'zc_cata');
+ $code_sex = getcatas($db, 'sex', 'zc_cata');
+ $csql = (new \ciy\sql('zc_depart'))->column('id,upid,name');
+ $code_departid = $db->get($csql);
+ $datas = array();
+ foreach ($rows as $row) {
+ $dat = array();
+ foreach ($fields as $field) {
+ $field = $field['field'];
+ $val = isset($row[$field]) ? $row[$field] : '';
+ if ($field == 'id')
+ $val = enid($val);
+ if ($field == 'stpstatus')
+ $val = ccode($code_stpstatus, $val);
+ if ($field == 'sex')
+ $val = ccode($code_sex, $val);
+ if ($field == 'departid')
+ $val = implode('-', mcode($code_departid, $val));
+ if ($field == 'logintimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ if ($field == 'addtimes')
+ $val = ($val == 0 ? '--' : date('Y-m-d H:i', $val));
+ $dat[] = $val;
+ }
+ $datas[] = $dat;
+ }
+
+ $param = array();
+ $param['field'] = $fields;
+ $param['data'] = $datas;
+
+ $param['sheetname'] = '数据报表';
+ $param['titleheight'] = '25'; //列头高度
+ $param['landscape'] = true; //横向打印
+ $param['fixtopage'] = true; //打印整个工作表
+
+ $param['toptitle'] = '管理员数据报表';
+ // $param['total'] = array();
+ // $param['total'][] = array('name'=>'合计','merge'=>8,'style'=>'l');
+ // $param['total'][] = array('name'=>'=SUM(R[-'.count($datas).']C:R[-1]C)','style'=>'r');
+ // $param['total'][] = array('name'=>'=MAX(R[-'.count($datas).']C:R[-1]C)','style'=>'r');
+ // $param['total'][] = array('name'=>'','style'=>'l');
+ // $param['total'][] = array('name'=>'','style'=>'l');
+
+ //$param['rowstop'] = '| # | '; + foreach ($heads as $arr) { + $html .= '' . $arr['name'] . ' | '; + } + $html .= '' . $lineidx . ' | ';
+ $bempty = true;
+ $unqs = array();
+ $csql = new \ciy\sql('zc_admin');
+ foreach ($heads as $arr) {
+ $name = $arr['name'];
+ $errmsg = ''; //数据有误,显示红色说明
+ $showdat = ''; //显示在表格中的数据
+ if ($arr['idx'] > -1)
+ $showdat = trim($datas[$rowidx][$arr['idx']]);
+ if ($showdat == '--')
+ $showdat = '';
+ $value = $showdat; //在表单中的数据(转换后)
+ $ext = ''; //扩展表单
+ if ($name == '行码') {
+ if (empty($showdat)) {
+ $value = 0;
+ $showdat = '新增';
+ } else {
+ $id = deid($showdat);
+ if ($id == 0)
+ $errmsg = $name . '解析错误';
+ else {
+ $csqlchk = new \ciy\sql('zc_admin');
+ $csqlchk->where('id', $id)->column('id');
+ $chkid = toint($db->get1($csqlchk));
+ if ($chkid != $id)
+ $errmsg = $name . '在数据库中不存在';
+ $value = $id;
+ }
+ }
+ } else if ($name == '姓名') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ }
+ } else if ($name == '手机号') {
+ $csql->where('mobile', $showdat);
+ $unqs[] = $showdat;
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ }
+ } else if ($name == '性别') {
+ if (empty($showdat)) {
+ $errmsg = $name . '为必填项';
+ } else {
+ $value = dcode($code_sex, $showdat);
+ if ($value == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ }
+ } else if ($name == '所属组织') {
+ if (empty($showdat)) {
+ $value = 0;
+ } else {
+ $dats = explode('-', $showdat);
+ $value = dcode($code_departid, $dats[count($dats) - 1]);
+ if ($value == -1)
+ $errmsg = $name . '文字与系统数据不匹配';
+ }
+ }
+ if (!empty($showdat))
+ $bempty = false;
+
+ if (empty($errmsg))
+ $hrhtml .= '' . $showdat . '' . $ext . ' | ';
+ else
+ $hrhtml .= '' . $showdat . ' | ';
+ }
+ if ($bempty)
+ continue;
+
+ if (count($unqs) > 0) {
+ $unq = implode('|', $unqs);
+ if (in_array($unq, $uniques))
+ $firsthtml = '重复 | ';
+ else {
+ $uniques[] = $unq;
+ $csql->column('id');
+ $chkid = toint($db->get1($csql));
+ if ($chkid > 0 && (($id > 0 && $chkid != $id) || $id == 0))
+ $firsthtml = '重复 | ';
+ }
+ }
+ $html .= '
|---|---|
共' . $cnt . '条数据';
+ return succjson(array('html' => $html, 'count' => $cnt));
+ }
+ public static function json_importxls_data() {
+ global $db;
+ $rsuser = verifyfast();
+ if (nopower($db, $rsuser['id'], 'p500a'))
+ return errjson('您未被授权操作新增');
+ $post = new \ciy\post();
+ $total = $post->getint('total');
+ try {
+ $db->begin();
+ for ($i = 1; $i <= $total; $i++) {
+ $id = $post->getint('id_' . $i);
+ $name = $post->get('name_' . $i);
+ $mobile = $post->get('mobile_' . $i);
+ $sex = $post->get('sex_' . $i);
+ $departid = $post->get('departid_' . $i);
+ $csql = new \ciy\sql('zc_admin');
+ $csql->where('mobile', $mobile);
+ $csql->column('id');
+ $chkid = toint($db->get1($csql));
+ if ($chkid > 0 && (($id > 0 && $chkid != $id) || $id == 0))
+ throw new \Exception('CIYIGN发现数据有重复');
+
+ $updata = array();
+ $updata['name'] = $name;
+ $updata['mobile'] = $mobile;
+ $updata['stpstatus'] = 10;
+ $updata['sex'] = $sex;
+ $updata['departid'] = $departid;
+ $updata['addtimes'] = tostamp();
+ $csql = new \ciy\sql('zc_admin');
+ if ($id == 0) {
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('新增失败:' . $db->error);
+ } else {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ }
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $db->execute('update zc_online set usrchg=2');
+ return succjson();
+ }
+}
diff --git a/web/admin/rigger/autotask.go b/web/admin/rigger/autotask.go
new file mode 100644
index 0000000..e293c03
--- /dev/null
+++ b/web/admin/rigger/autotask.go
@@ -0,0 +1,226 @@
+package rigger
+
+import (
+ "fmt"
+ "net/http"
+
+ "ciyon/web/admin"
+ c "ciyon/zciyon"
+)
+
+func autotask_setwhere(post *c.CiyPost) (map[string]any, *c.CiySQL) {
+ query := post.Getobj("query")
+ csql := c.NewCiySQL("zc_autotask")
+ liid := c.Getint(query, "liid")
+ if liid > 0 {
+ csql.Where("autotaskstatus", liid)
+ }
+ csql.Where("types like", c.Getstr(query, "types"))
+ order := c.Getstr(query, "order", "id desc")
+ csql.Order(order)
+ query["order"] = order
+ return query, csql
+}
+func Autotask_init(w http.ResponseWriter, r *http.Request) bool {
+ post := c.NewCiyPost(w, r)
+ _, userid := admin.Verifyfast(r, c.CiyDB, post)
+ if userid == 0 {
+ return false
+ }
+ where, csql := autotask_setwhere(post)
+ pageno := post.Getint("pageno", 1)
+ pagecount := post.Getint("pagecount", 10)
+ csql.Limit(pageno, pagecount)
+ rows, mainrowcount, err := c.CiyDB.Get(csql, post.Getint("count"))
+ if err != nil {
+ return c.ErrJSON(w, "读取错误", err)
+ }
+ rows = append(rows, map[string]any{
+ "id": "",
+ "runcycle": 0,
+ "nexttimes": c.Tostamp(),
+ })
+ ret := map[string]any{}
+ ret["where"] = where
+ ret["pageno"] = pageno
+ ret["pagecount"] = pagecount
+ ret["count"] = mainrowcount
+ ret["list"] = rows
+ if post.Getbool("field") {
+ field, fshow := c.CiyDB.GetField(csql)
+ c.FieldAdd(&field, &fshow, -1, "_btn", "操作")
+ field["runparam"]["thwidth"] = "8em"
+ field["nexttimes"]["thwidth"] = "10em"
+ field["runcycle"]["thwidth"] = "9em"
+ field["autotaskstatus"]["thwidth"] = "6em"
+ ret["fshow"] = fshow
+ ret["field"] = field
+ }
+ if post.Getbool("once") {
+ once := map[string]any{}
+ input := make([]map[string]any, 0)
+ input = append(input, map[string]any{
+ "form": "name",
+ "type": "input",
+ "name": "任务名称",
+ "prop": ` style="width:8em;"`,
+ })
+ input = append(input, map[string]any{
+ "form": "runfunc",
+ "type": "input",
+ "name": "入口函数",
+ "prop": ` style="width:8em;"`,
+ })
+ once["input"] = input
+ ret["once"] = once
+ }
+ return c.SuccJSON(w, r, ret)
+}
+func Autotask_update(w http.ResponseWriter, r *http.Request) bool {
+ post := c.NewCiyPost(w, r)
+ _, userid := admin.Verifyfast(r, c.CiyDB, post)
+ if userid == 0 {
+ return false
+ }
+ if admin.Nopower(c.CiyDB, userid, "p602u") {
+ return c.ErrJSON(w, "您未被授权操作")
+ }
+ id := post.Getint("id")
+ name := post.Get("name")
+ if name == "" {
+ return c.ErrJSON(w, "请填写任务名称")
+ }
+ runfunc := post.Get("runfunc")
+ if runfunc == "" {
+ return c.ErrJSON(w, "请填写入口函数")
+ }
+ runparam := post.Get("runparam")
+ nexttimes := post.Getdate("nexttimes")
+ runcycle := post.Getint("runcycle")
+ if runcycle >= 0 && runcycle < 60 {
+ return c.ErrJSON(w, "请填写超过1分钟的执行周期")
+ }
+ var err error
+ var datarow map[string]any
+ if id > 0 {
+ csql := c.NewCiySQL("zc_autotask")
+ csql.Where("id", id)
+ datarow, err = c.CiyDB.Getone(csql)
+ if datarow == nil {
+ return c.ErrJSON(w, "数据不存在", err)
+ }
+ }
+ updata := map[string]any{}
+ err = c.CiyDB.Tran(func() error {
+ var csql *c.CiySQL
+ csql = c.NewCiySQL("zc_autotask")
+ csql.Where("name", name)
+ csql.Column("id")
+ chkid := c.Toint(c.CiyDB.Get1(csql))
+ if chkid > 0 && ((id > 0 && chkid != id) || id == 0) {
+ return fmt.Errorf("数据已存在")
+ }
+ updata["name"] = name
+ updata["runfunc"] = runfunc
+ updata["runparam"] = runparam
+ updata["nexttimes"] = nexttimes
+ updata["runcycle"] = runcycle
+ csql = c.NewCiySQL("zc_autotask")
+ if id > 0 {
+ csql.Where("id", id)
+ _, err = c.CiyDB.Update(csql, updata)
+ } else {
+ updata["autotaskstatus"] = 90
+ if nexttimes == 0 {
+ updata["nexttimes"] = c.Tostamp()
+ }
+ id, err = c.CiyDB.Insert(csql, updata)
+ }
+ updata["newid"] = id
+ if err != nil {
+ return fmt.Errorf("更新失败:%v", err)
+ }
+ admin.SaveLogDB(c.CiyDB, "zc_autotask", datarow, updata)
+ return nil
+ })
+ if err != nil {
+ return c.ErrJSON(w, "事务"+err.Error())
+ }
+ ret := map[string]any{}
+ ret["data"] = updata
+ return c.SuccJSON(w, r, ret)
+}
+func Autotask_del(w http.ResponseWriter, r *http.Request) bool {
+ post := c.NewCiyPost(w, r)
+ _, userid := admin.Verifyfast(r, c.CiyDB, post)
+ if userid == 0 {
+ return false
+ }
+ if admin.Nopower(c.CiyDB, userid, "p602d") {
+ return c.ErrJSON(w, "您未被授权操作")
+ }
+ ids := post.Get("ids")
+ if ids == "" {
+ return c.ErrJSON(w, "请选择至少一条")
+ }
+ csql := c.NewCiySQL("zc_autotask")
+ csql.Where("id in", ids)
+ rows, _, err := c.CiyDB.Get(csql)
+ if err != nil {
+ return c.ErrJSON(w, "读取数据错误", err)
+ }
+ vids := make([]int, 0)
+ err = c.CiyDB.Tran(func() error {
+ for _, row := range rows {
+ delid := c.Toint(row["id"])
+ c.Delme(c.CiyDB, delid, "zc_autotask")
+ admin.SaveLogDB(c.CiyDB, "zc_autotask", row, nil)
+ vids = append(vids, delid)
+ }
+ return nil
+ })
+ if err != nil {
+ return c.ErrJSON(w, "事务"+err.Error())
+ }
+ ret := map[string]any{}
+ ret["ids"] = vids
+ return c.SuccJSON(w, r, ret)
+}
+
+func Autotask_status(w http.ResponseWriter, r *http.Request) bool {
+ post := c.NewCiyPost(w, r)
+ _, userid := admin.Verifyfast(r, c.CiyDB, post)
+ if userid == 0 {
+ return false
+ }
+ if admin.Nopower(c.CiyDB, userid, "p602u") {
+ return c.ErrJSON(w, "您未被授权操作")
+ }
+ id := post.Getint("id")
+ status := post.Getint("status")
+ csql := c.NewCiySQL("zc_autotask")
+ csql.Where("id", id)
+ row, err := c.CiyDB.Getone(csql)
+ if err != nil {
+ return c.ErrJSON(w, "读取数据错误", err)
+ }
+ updata := map[string]any{}
+ err = c.CiyDB.Tran(func() error {
+ updata["autotaskstatus"] = status
+ csql = c.NewCiySQL("zc_autotask")
+ csql.Where("id", id)
+ _, err = c.CiyDB.Update(csql, updata)
+ if err != nil {
+ return fmt.Errorf("更新失败:%v", err)
+ }
+ admin.SaveLogDB(c.CiyDB, "zc_autotask", row, updata)
+ updata["id"] = id
+ return nil
+ })
+ if err != nil {
+ return c.ErrJSON(w, "事务"+err.Error())
+ }
+ ret := map[string]any{}
+ ret["data"] = updata
+ return c.SuccJSON(w, r, ret)
+}
diff --git a/web/admin/rigger/autotask.html b/web/admin/rigger/autotask.html
new file mode 100644
index 0000000..5c07f78
--- /dev/null
+++ b/web/admin/rigger/autotask.html
@@ -0,0 +1,194 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/admin/rigger/autotask.php b/web/admin/rigger/autotask.php
new file mode 100644
index 0000000..0543ca5
--- /dev/null
+++ b/web/admin/rigger/autotask.php
@@ -0,0 +1,193 @@
+get('query');
+ $csql = new \ciy\sql('zc_autotask');
+ $liid = objint($query, 'liid');
+ if ($liid > 0)
+ $csql->where('autotaskstatus', $liid);
+ $csql->where('name like', objstr($query, 'name'));
+ $csql->where('runfunc like', objstr($query, 'runfunc'));
+ $order = objstr($query, 'order', 'id desc');
+ $csql->order($order);
+ $query['order'] = $order;
+ return [$query, $csql];
+ }
+ public static function json_init() {
+ global $db;
+ $rsuser = verifyfast();
+ $post = new \ciy\post();
+ list($where, $csql) = self::setwhere($db, $post);
+ $pageno = $post->getint('pageno', 1);
+ $pagecount = $post->getint('pagecount', 10);
+ $csql->limit($pageno, $pagecount);
+ $mainrowcount = $post->getint('count');
+ $rows = $db->get($csql, $mainrowcount);
+ $rows[] = array('id' => '', 'runcycle' => 0, 'nexttimes' => tostamp());
+ $ret = array('searchwhere' => $where, 'pageno' => $pageno, 'pagecount' => $pagecount, 'count' => $mainrowcount, 'list' => $rows);
+ if ($post->getbool('field')) {
+ $field = array();
+ $fshow = $db->getfield($field, 'zc_autotask');
+ $fshow = fieldadd($fshow, $field, -1, '_btn', '操作');
+ $field['runparam']['thwidth'] = '8em';
+ $field['nexttimes']['thwidth'] = '10em';
+ $field['runcycle']['thwidth'] = '9em';
+ $field['autotaskstatus']['thwidth'] = '6em';
+ $ret['field'] = $field;
+ $ret['fshow'] = $fshow;
+ }
+ if ($post->getbool('once')) {
+ $ret['once'] = true;
+ $input = array();
+ $input[] = array(
+ 'type' => 'input',
+ 'form' => 'name',
+ 'name' => '任务名称',
+ 'prop' => ' style="width:8em;"'
+ );
+ $input[] = array(
+ 'type' => 'input',
+ 'form' => 'runfunc',
+ 'name' => '入口函数',
+ 'prop' => ' style="width:8em;"'
+ );
+ $ret['searchinput'] = $input;
+ }
+ return succjson($ret);
+ }
+
+ public static function json_update() {
+ global $db;
+ $rsuser = verifyfast();
+
+ if (nopower($db, $rsuser['id'], 'p602u'))
+ return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $name = $post->get('name');
+ if (empty($name))
+ return errjson('请填写任务名称');
+ $runfunc = $post->get('runfunc');
+ if (empty($runfunc))
+ return errjson('请填写入口函数');
+ $runparam = $post->get('runparam');
+ $nexttimes = $post->getdate('nexttimes');
+ $runcycle = $post->getint('runcycle');
+ if ($runcycle >= 0 && $runcycle < 60)
+ return errjson('请填写超过1分钟的执行周期');
+ $datarow = null;
+ if ($id > 0) {
+ $csql = new \ciy\sql('zc_autotask');
+ $csql->where('id', $id);
+ $datarow = $db->getone($csql);
+ if (!is_array($datarow))
+ return errjson('数据不存在');
+ }
+ try {
+ $db->begin();
+ $csql = new \ciy\sql('zc_autotask');
+ $csql->where('name', $name);
+ $csql->column('id');
+ $chkid = toint($db->get1($csql));
+ if ($chkid > 0 && (($id > 0 && $chkid != $id) || $id == 0))
+ throw new \Exception('CIYIGN数据已存在');
+
+ $updata = array();
+ $updata['name'] = $name;
+ $updata['runfunc'] = $runfunc;
+ $updata['runparam'] = $runparam;
+ $updata['nexttimes'] = $nexttimes;
+ $updata['runcycle'] = $runcycle;
+ $csql = new \ciy\sql('zc_autotask');
+ if ($id > 0) {
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ } else {
+ $updata['autotaskstatus'] = 90;
+ if ($nexttimes == 0)
+ $updata['nexttimes'] = tostamp();
+ if ($db->insert($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ $id = $db->insert_id();
+ }
+ $updata['id'] = $id;
+ savelogdb($db, $rsuser['id'], 'zc_autotask', $datarow, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+
+ public static function json_del() {
+ global $db;
+ $rsuser = verifyfast();
+
+ if (nopower($db, $rsuser['id'], 'p602d'))
+ return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $ids = $post->get('ids');
+ if (empty($ids))
+ return errjson('请选择至少一条');
+ $csql = new \ciy\sql('zc_autotask');
+ $csql->where('id in', $ids);
+ $rows = $db->get($csql);
+ $vids = array();
+ try {
+ $db->begin();
+ foreach ($rows as $row) {
+ $delid = $row['id'];
+ delme($db, $delid, 'zc_autotask');
+ savelogdb($db, $rsuser['id'], $delid, $row, null);
+ $vids[] = $delid;
+ }
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['ids'] = $vids;
+ return succjson($ret);
+ }
+ public static function json_status() {
+ global $db;
+ $rsuser = verifyfast();
+
+ if (nopower($db, $rsuser['id'], 'p602u'))
+ return errjson('您未被授权操作');
+ $post = new \ciy\post();
+ $id = $post->getint('id');
+ $status = $post->getint('status');
+ $csql = new \ciy\sql('zc_autotask');
+ $csql->where('id', $id);
+ $row = $db->getone($csql);
+ if (!is_array($row))
+ return errjson('数据不存在');
+ try {
+ $db->begin();
+ $updata = array();
+ $updata['autotaskstatus'] = $status;
+ $csql = new \ciy\sql('zc_autotask');
+ $csql->where('id', $id);
+ if ($db->update($csql, $updata) === false)
+ throw new \Exception('更新失败:' . $db->error);
+ $updata['id'] = $id;
+ savelogdb($db, $rsuser['id'], 'zc_autotask', $row, $updata);
+ $db->commit();
+ } catch (\Exception $ex) {
+ $db->rollback();
+ savelogfile('err_db', $ex->getMessage());
+ return errjson($ex->getMessage());
+ }
+ $ret['data'] = $updata;
+ return succjson($ret);
+ }
+}
diff --git a/web/admin/rigger/autotskrun.go b/web/admin/rigger/autotskrun.go
new file mode 100644
index 0000000..910ee65
--- /dev/null
+++ b/web/admin/rigger/autotskrun.go
@@ -0,0 +1,222 @@
+package rigger
+
+import (
+ "math/rand"
+ "net/http"
+
+ "ciyon/web/admin"
+ c "ciyon/zciyon"
+)
+
+func autotskrun_setwhere(post *c.CiyPost) (map[string]any, *c.CiySQL) {
+ query := post.Getobj("query")
+ csql := c.NewCiySQL("zc_autotsk_run")
+ csql.Where("autotaskid", c.Getstr(query, "_autotaskid"))
+ csql.Where_daterange("addtimes", c.Getstr(query, "addtimes"))
+ csql.Where_numrange("runsec", c.Getstr(query, "runsec_1"), c.Getstr(query, "runsec_2"), 1)
+ csql.Where_numrange("logcnt", c.Getstr(query, "logcnt_1"), c.Getstr(query, "logcnt_2"), 1)
+ csql.Where("msg like", c.Getstr(query, "msg"))
+ order := c.Getstr(query, "order", "id desc")
+ csql.Order(order)
+ query["order"] = order
+ return query, csql
+}
+func Autotskrun_init(w http.ResponseWriter, r *http.Request) bool {
+ post := c.NewCiyPost(w, r)
+ _, userid := admin.Verifyfast(r, c.CiyDB, post)
+ if userid == 0 {
+ return false
+ }
+ where, csql := autotskrun_setwhere(post)
+ pageno := post.Getint("pageno", 1)
+ pagecount := post.Getint("pagecount", 10)
+ csql.Limit(pageno, pagecount)
+ rows, mainrowcount, err := c.CiyDB.Get(csql, post.Getint("count"))
+ if err != nil {
+ return c.ErrJSON(w, "读取错误", err)
+ }
+ ret := map[string]any{}
+ ret["where"] = where
+ ret["pageno"] = pageno
+ ret["pagecount"] = pagecount
+ ret["count"] = mainrowcount
+ ret["list"] = rows
+ if post.Getbool("field") {
+ field, fshow := c.CiyDB.GetField(csql)
+ field["msg"]["thwidth"] = "20em"
+ ret["fshow"] = fshow
+ ret["field"] = field
+ }
+ if post.Getbool("once") {
+ once := map[string]any{}
+ input := make([]map[string]any, 0)
+ input = append(input, map[string]any{
+ "form": "addtimes",
+ "type": "daterange",
+ "name": "执行时间",
+ })
+ input = append(input, map[string]any{
+ "form": "runsec",
+ "type": "num",
+ "name": "时长",
+ "prop": ` style="width:4em;"`,
+ })
+ input = append(input, map[string]any{
+ "form": "logcnt",
+ "type": "num",
+ "name": "LOG统计",
+ "prop": ` style="width:4em;"`,
+ })
+ input = append(input, map[string]any{
+ "form": "msg",
+ "type": "input",
+ "name": "任务简报",
+ "prop": ` style="width:8em;"`,
+ })
+ once["input"] = input
+ csql = c.NewCiySQL("zc_autotask")
+ csql.Column("id,name")
+ ret["zc_autotask"], _, _ = c.CiyDB.Get(csql)
+ ret["once"] = once
+ }
+ return c.SuccJSON(w, r, ret)
+}
+func Autotskrun_del(w http.ResponseWriter, r *http.Request) bool {
+ post := c.NewCiyPost(w, r)
+ _, userid := admin.Verifyfast(r, c.CiyDB, post)
+ if userid == 0 {
+ return false
+ }
+ if admin.Nopower(c.CiyDB, userid, "p602l") {
+ return c.ErrJSON(w, "您未被授权操作")
+ }
+ ids := post.Get("ids")
+ if ids == "" {
+ return c.ErrJSON(w, "请选择至少一条")
+ }
+ csql := c.NewCiySQL("zc_autotsk_run")
+ csql.Where("id in", ids)
+ rows, _, err := c.CiyDB.Get(csql)
+ if err != nil {
+ return c.ErrJSON(w, "读取数据错误", err)
+ }
+ vids := make([]int, 0)
+ err = c.CiyDB.Tran(func() error {
+ for _, row := range rows {
+ delid := c.Toint(row["id"])
+ c.Delall(c.CiyDB, delid, "zc_autotsk_log", "runtaskid", "Log记录")
+ c.Delme(c.CiyDB, delid, "zc_autotsk_run")
+ admin.SaveLogDB(c.CiyDB, "zc_autotsk_run", row, nil)
+ vids = append(vids, delid)
+ }
+ return nil
+ })
+ if err != nil {
+ return c.ErrJSON(w, "事务"+err.Error())
+ }
+ ret := map[string]any{}
+ ret["ids"] = vids
+ return c.SuccJSON(w, r, ret)
+}
+
+func Autotskrun_exportxls(w http.ResponseWriter, r *http.Request) bool {
+ post := c.NewCiyPost(w, r)
+ _, userid := admin.Verifyfast(r, c.CiyDB, post)
+ if userid == 0 {
+ return false
+ }
+ if admin.Nopower(c.CiyDB, userid, "p602l") {
+ return c.ErrJSON(w, "您未被授权操作")
+ }
+ _, csql := autotskrun_setwhere(post)
+ rows, _, err := c.CiyDB.Get(csql)
+ if err != nil {
+ return c.ErrJSON(w, "读取错误", err)
+ }
+ if len(rows) > 10000 {
+ return c.ErrJSON(w, "将导出"+c.Tostr(len(rows))+"条,不建议超过1万条,请筛选缩小范围", err)
+ }
+ fields := []map[string]string{}
+ fields = append(fields, map[string]string{"style": "c", "width": "60", "field": "id", "name": "行码"})
+ fields = append(fields, map[string]string{"style": "l", "width": "100", "field": "autotaskid", "name": "所属任务"})
+ fields = append(fields, map[string]string{"style": "l", "width": "100", "field": "addtimes", "name": "执行时间"})
+ fields = append(fields, map[string]string{"style": "r", "width": "60", "field": "runsec", "name": "时长"})
+ fields = append(fields, map[string]string{"style": "r", "width": "60", "field": "logcnt", "name": "LOG统计"})
+ fields = append(fields, map[string]string{"style": "l", "width": "500", "field": "msg", "name": "任务简报"})
+
+ csql = c.NewCiySQL("zc_autotask")
+ csql.Column("id,name")
+ code_autotaskid, _, err2 := c.CiyDB.Get(csql)
+ if err2 != nil {
+ return c.ErrJSON(w, "读取zc_autotask错误", err2)
+ }
+
+ datas := [][]string{}
+ for _, row := range rows {
+ dat := make([]string, 0)
+ for _, f := range fields {
+ field := f["field"]
+ if val, ok := row[field]; ok {
+ var str string
+ if field == "id" {
+ str = c.EnID(c.Toint(val))
+ } else if field == "autotaskid" {
+ str = c.Ccode(code_autotaskid, c.Toint(val))
+ } else if field == "addtimes" {
+ t := c.Toint(val)
+ if t <= 0 {
+ str = "--"
+ } else {
+ str = c.Todate(t, "Y-m-d H:i")
+ }
+ } else {
+ str = c.Tostr(val)
+ }
+ dat = append(dat, str)
+ } else {
+ dat = append(dat, "")
+ }
+ }
+ datas = append(datas, dat)
+ }
+ param := map[string]any{}
+ param["sheetname"] = "数据报表"
+ param["titleheight"] = "25" //列头高度
+ param["landscape"] = true //横向打印
+ param["fixtopage"] = true //打印整个工作表
+ param["toptitle"] = "任务执行记录数据报表"
+ total := []map[string]any{} //单行统计数据
+ // total = append(total, map[string]any{"style": "l", "name": "合计", "merge": 5})
+ // total = append(total, map[string]any{"style": "r", "name": "=SUM(R[-" + c.Tostr(len(datas)) + "]C:R[-1]C)"})
+ // total = append(total, map[string]any{"style": "r", "name": "=MAX(R[-" + c.Tostr(len(datas)) + "]C:R[-1]C)"})
+ // param["rowstop"] = `| ' + convertcode(trs[i].trim()) + ' | '; + } + } else { + html += '
| ' + convertcode(trs[i].trim()) + ' | '; + } + } + html += '
# 一级标题#c 一级标题居中#r 一级标题右对齐## 二级标题 带[n、]编号### 三级标题 带[n.m、]编号#### 四级标题 带[n.n.k、]编号^c 正文居中^r 正文右对齐!imgurl 引用图片,imgurl为图片地址`强调` 反引号包裹,强调 效果**加粗** 双星号包裹,加粗 效果[链接文字](网址),如:[众产](https://ciy.cn/)。[!imgurl](https://ciy.cn/),图片链接。[链接文字](附件链接) 附件下载| '; + for (var ki in thos.sortfield) { + var key = thos.sortfield[ki]; + if (!thos.field[key].c) + continue; + var colname = thos.field[key].c; + var colhide = false; + if (colname[0] == '#') {//默认隐藏列设置 + colhide = true; + colname = colname.substring(1); + } + var colext = ''; + if (colname[0] == ',') {//列表不显示 + var ind = colname.indexOf(',', 1); + if (ind > 0) { + colext = colname.substring(ind + 1); + } + colname = ''; + } else { + var ind = colname.indexOf(','); + if (ind > 0) { + colext = colname.substring(ind + 1); + colname = colname.substring(0, ind); + } + } + var ind = colext.indexOf(' //'); + if (ind > 0) + colext = colext.substring(0, ind).trim(); + thos.field[key].ext = colext; + //var ind2 = colext.indexOf(','); + //thos.field[key].exdata = ind2 > -1 ? colext.substring(ind2 + 1) : ''; + //处理字段名称两侧竖线,代表数据对齐方式。|状态| + thos.field[key].align = 'left'; + if (colname.substring(colname.length - 1) == '|') { + if (colname.substring(0, 1) == '|') { + colname = colname.substring(1, colname.length - 1); + thos.field[key].align = 'center'; + } else { + colname = colname.substring(0, colname.length - 1); + thos.field[key].align = 'right'; + } + } + if (colname.substring(0, 1) == '|') + colname = colname.substring(1); + if (colname.length == 0) + continue; + html += ' | 0) + html += ' data-ext="' + colext + '"'; + if (colhide) + html += ' data-hide="1"'; + html += ' data-align="' + thos.field[key].align + '">'; + if (typeof (opn.thfield) == 'function') { + var fieldbk = opn.thfield(colname, key, thos.field[key], json); + if (fieldbk) + html += fieldbk; + else + html += ciyfn.lang(colname); + } else + html += ciyfn.lang(colname); + if (opn.help && opn.help[key]) { + html += ''; + } + if (thos.field[key].order !== undefined) { + var style = ''; + if (thos.field[key].order == 'r') + style = ' style="right:0.5em;"'; + html += ''; + html += ''; + } + html += ' | '; + } + html += '
|---|
0?"right":"left":L>0?"left":"right"}var F=y.get("rotate");if(O="number"==typeof F?F*(Math.PI/180):F?L<0?-A+Math.PI:-A:0,o=!!O,p.x=I,p.y=T,p.rotation=O,p.setStyle({verticalAlign:"middle"}),R){p.setStyle({align:D});var G=p.states.select;G&&(G.x+=p.x,G.y+=p.y)}else{var H=p.getBoundingRect().clone();H.applyTransform(p.getComputedTransform());var W=(p.style.margin||0)+2.1;H.y-=W/2,H.height+=W,r.push({label:p,labelLine:f,position:v,len:S,len2:M,minTurnAngle:w.get("minTurnAngle"),maxSurfaceAngle:w.get("maxSurfaceAngle"),surfaceNormal:new ai(L,k),linePoints:C,textAlign:D,labelDistance:m,labelAlignTo:_,edgeDistance:x,bleedMargin:b,rect:H})}s.setTextConfig({inside:R})}})),!o&&t.get("avoidLabelOverlap")&&function(t,e,n,i,r,o,a,s){for(var l=[],u=[],h=Number.MAX_VALUE,c=-Number.MAX_VALUE,p=0;p i&&(i=e);var o=i%2?i+2:i+3;r=[];for(var a=0;a 0){var I=o(v)?s:l;v>0&&(v=v*S+w),_[x++]=I[M],_[x++]=I[M+1],_[x++]=I[M+2],_[x++]=I[M+3]*v*256}else x+=4}return c.putImageData(m,0,0),h},t.prototype._getBrush=function(){var t=this._brushCanvas||(this._brushCanvas=C()),e=this.pointSize+this.blurSize,n=2*e;t.width=n,t.height=n;var i=t.getContext("2d");return i.clearRect(0,0,n,n),i.shadowOffsetX=n,i.shadowBlur=this.blurSize,i.shadowColor="#000",i.beginPath(),i.arc(-e,e,this.pointSize,0,2*Math.PI,!0),i.closePath(),i.fill(),t},t.prototype._getGradient=function(t,e){for(var n=this._gradientPixels,i=n[e]||(n[e]=new Uint8ClampedArray(1024)),r=[0,0,0,0],o=0,a=0;a<256;a++)t[e](a/255,!0,r),i[o++]=r[0],i[o++]=r[1],i[o++]=r[2],i[o++]=r[3];return i},t}();function ok(t){var e=t.dimensions;return"lng"===e[0]&&"lat"===e[1]}var ak=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return n(e,t),e.prototype.render=function(t,e,n){var i;e.eachComponent("visualMap",(function(e){e.eachTargetSeries((function(n){n===t&&(i=e)}))})),this.group.removeAll(),this._incrementalDisplayable=null;var r=t.coordinateSystem;"cartesian2d"===r.type||"calendar"===r.type?this._renderOnCartesianAndCalendar(t,n,0,t.getData().count()):ok(r)&&this._renderOnGeo(r,t,i,n)},e.prototype.incrementalPrepareRender=function(t,e,n){this.group.removeAll()},e.prototype.incrementalRender=function(t,e,n,i){var r=e.coordinateSystem;r&&(ok(r)?this.render(e,n,i):this._renderOnCartesianAndCalendar(e,i,t.start,t.end,!0))},e.prototype._renderOnCartesianAndCalendar=function(t,e,n,i,r){var o,a,s,l,u=t.coordinateSystem;if(Nw(u,"cartesian2d")){var h=u.getAxis("x"),c=u.getAxis("y");0,o=h.getBandWidth(),a=c.getBandWidth(),s=h.scale.getExtent(),l=c.scale.getExtent()}for(var p=this.group,d=t.getData(),f=t.getModel(["emphasis","itemStyle"]).getItemStyle(),g=t.getModel(["blur","itemStyle"]).getItemStyle(),y=t.getModel(["select","itemStyle"]).getItemStyle(),v=ch(t),m=t.get(["emphasis","focus"]),_=t.get(["emphasis","blurScope"]),x=Nw(u,"cartesian2d")?[d.mapDimension("x"),d.mapDimension("y"),d.mapDimension("value")]:[d.mapDimension("time"),d.mapDimension("value")],b=n;bs[1]||I 1;)r=r.parentNode;var o=n.getColorFromPalette(r.name||r.dataIndex+"",e);return t.depth>1&&"string"==typeof o&&(o=Ue(o,(t.depth-1)/(i-1)*.5)),o}(r,t,i.root.height)),I(n.ensureUniqueItemVisual(r.dataIndex,"style"),o)}))}))}function Uk(t,e){return e=e||[0,0],O(["x","y"],(function(n,i){var r=this.getAxis(n),o=e[i],a=t[i]/2;return"category"===r.type?r.getBandWidth():Math.abs(r.dataToCoord(o-a)-r.dataToCoord(o+a))}),this)}function Xk(t,e){return e=e||[0,0],O([0,1],(function(n){var i=e[n],r=t[n]/2,o=[],a=[];return o[n]=i-r,a[n]=i+r,o[1-n]=a[1-n]=e[1-n],Math.abs(this.dataToPoint(o)[n]-this.dataToPoint(a)[n])}),this)}function Yk(t,e){var n=this.getAxis(),i=e instanceof Array?e[0]:e,r=(t instanceof Array?t[0]:t)/2;return"category"===n.type?n.getBandWidth():Math.abs(n.dataToCoord(i-r)-n.dataToCoord(i+r))}function Zk(t,e){return e=e||[0,0],O(["Radius","Angle"],(function(n,i){var r=this["get"+n+"Axis"](),o=e[i],a=t[i]/2,s="category"===r.type?r.getBandWidth():Math.abs(r.dataToCoord(o-a)-r.dataToCoord(o+a));return"Angle"===n&&(s=s*Math.PI/180),s}),this)}function jk(t,e,n,i){return t&&(t.legacy||!1!==t.legacy&&!n&&!i&&"tspan"!==e&&("text"===e||dt(t,"text")))}function qk(t,e,n){var i,r,o,a=t;if("text"===e)o=a;else{o={},dt(a,"text")&&(o.text=a.text),dt(a,"rich")&&(o.rich=a.rich),dt(a,"textFill")&&(o.fill=a.textFill),dt(a,"textStroke")&&(o.stroke=a.textStroke),r={type:"text",style:o,silent:!0},i={};var s=dt(a,"textPosition");n?i.position=s?a.textPosition:"inside":s&&(i.position=a.textPosition),dt(a,"textPosition")&&(i.position=a.textPosition),dt(a,"textOffset")&&(i.offset=a.textOffset),dt(a,"textRotation")&&(i.rotation=a.textRotation),dt(a,"textDistance")&&(i.distance=a.textDistance)}return Kk(o,t),P(o.rich,(function(t){Kk(t,t)})),{textConfig:i,textContent:r}}function Kk(t,e){e&&(e.font=e.textFont||e.font,dt(e,"textStrokeWidth")&&(t.lineWidth=e.textStrokeWidth),dt(e,"textAlign")&&(t.align=e.textAlign),dt(e,"textVerticalAlign")&&(t.verticalAlign=e.textVerticalAlign),dt(e,"textLineHeight")&&(t.lineHeight=e.textLineHeight),dt(e,"textWidth")&&(t.width=e.textWidth),dt(e,"textHeight")&&(t.height=e.textHeight),dt(e,"textBackgroundColor")&&(t.backgroundColor=e.textBackgroundColor),dt(e,"textPadding")&&(t.padding=e.textPadding),dt(e,"textBorderColor")&&(t.borderColor=e.textBorderColor),dt(e,"textBorderWidth")&&(t.borderWidth=e.textBorderWidth),dt(e,"textBorderRadius")&&(t.borderRadius=e.textBorderRadius),dt(e,"textBoxShadowColor")&&(t.shadowColor=e.textBoxShadowColor),dt(e,"textBoxShadowBlur")&&(t.shadowBlur=e.textBoxShadowBlur),dt(e,"textBoxShadowOffsetX")&&(t.shadowOffsetX=e.textBoxShadowOffsetX),dt(e,"textBoxShadowOffsetY")&&(t.shadowOffsetY=e.textBoxShadowOffsetY))}function $k(t,e,n){var i=t;i.textPosition=i.textPosition||n.position||"inside",null!=n.offset&&(i.textOffset=n.offset),null!=n.rotation&&(i.textRotation=n.rotation),null!=n.distance&&(i.textDistance=n.distance);var r=i.textPosition.indexOf("inside")>=0,o=t.fill||"#000";Jk(i,e);var a=null==i.textFill;return r?a&&(i.textFill=n.insideFill||"#fff",!i.textStroke&&n.insideStroke&&(i.textStroke=n.insideStroke),!i.textStroke&&(i.textStroke=o),null==i.textStrokeWidth&&(i.textStrokeWidth=2)):(a&&(i.textFill=t.fill||n.outsideFill||"#000"),!i.textStroke&&n.outsideStroke&&(i.textStroke=n.outsideStroke)),i.text=e.text,i.rich=e.rich,P(e.rich,(function(t){Jk(t,t)})),i}function Jk(t,e){e&&(dt(e,"fill")&&(t.textFill=e.fill),dt(e,"stroke")&&(t.textStroke=e.fill),dt(e,"lineWidth")&&(t.textStrokeWidth=e.lineWidth),dt(e,"font")&&(t.font=e.font),dt(e,"fontStyle")&&(t.fontStyle=e.fontStyle),dt(e,"fontWeight")&&(t.fontWeight=e.fontWeight),dt(e,"fontSize")&&(t.fontSize=e.fontSize),dt(e,"fontFamily")&&(t.fontFamily=e.fontFamily),dt(e,"align")&&(t.textAlign=e.align),dt(e,"verticalAlign")&&(t.textVerticalAlign=e.verticalAlign),dt(e,"lineHeight")&&(t.textLineHeight=e.lineHeight),dt(e,"width")&&(t.textWidth=e.width),dt(e,"height")&&(t.textHeight=e.height),dt(e,"backgroundColor")&&(t.textBackgroundColor=e.backgroundColor),dt(e,"padding")&&(t.textPadding=e.padding),dt(e,"borderColor")&&(t.textBorderColor=e.borderColor),dt(e,"borderWidth")&&(t.textBorderWidth=e.borderWidth),dt(e,"borderRadius")&&(t.textBorderRadius=e.borderRadius),dt(e,"shadowColor")&&(t.textBoxShadowColor=e.shadowColor),dt(e,"shadowBlur")&&(t.textBoxShadowBlur=e.shadowBlur),dt(e,"shadowOffsetX")&&(t.textBoxShadowOffsetX=e.shadowOffsetX),dt(e,"shadowOffsetY")&&(t.textBoxShadowOffsetY=e.shadowOffsetY),dt(e,"textShadowColor")&&(t.textShadowColor=e.textShadowColor),dt(e,"textShadowBlur")&&(t.textShadowBlur=e.textShadowBlur),dt(e,"textShadowOffsetX")&&(t.textShadowOffsetX=e.textShadowOffsetX),dt(e,"textShadowOffsetY")&&(t.textShadowOffsetY=e.textShadowOffsetY))}var Qk=La.CMD,tP=2*Math.PI,eP=["x","y"],nP=["width","height"],iP=[];function rP(t,e){return Math.abs(t-e)<1e-5}function oP(t){var e,n,i,r,o,a=t.data,s=t.len(),l=[],u=0,h=0,c=0,p=0;function d(t,n){e&&e.length>2&&l.push(e),e=[t,n]}function f(t,n,i,r){rP(t,i)&&rP(n,r)||e.push(t,n,i,r,i,r)}function g(t,n,i,r,o,a){var s=Math.abs(n-t),l=4*Math.tan(s/4)/3,u=n =0},e.prototype.getOrient=function(){return"vertical"===this.get("orient")?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},e.type="legend.plain",e.dependencies=["series"],e.defaultOption={zlevel:0,z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",decal:"inherit",shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit",shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:" sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},e}(Xc),hV=B,cV=P,pV=Ei,dV=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n.newlineDisabled=!1,n}return n(e,t),e.prototype.init=function(){this.group.add(this._contentGroup=new pV),this.group.add(this._selectorGroup=new pV),this._isFirstRender=!0},e.prototype.getContentGroup=function(){return this._contentGroup},e.prototype.getSelectorGroup=function(){return this._selectorGroup},e.prototype.render=function(t,e,n){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),t.get("show",!0)){var r=t.get("align"),o=t.get("orient");r&&"auto"!==r||(r="right"===t.get("left")&&"vertical"===o?"right":"left");var a=t.get("selector",!0),s=t.get("selectorPosition",!0);!a||s&&"auto"!==s||(s="horizontal"===o?"end":"start"),this.renderInner(r,t,e,n,a,o,s);var l=t.getBoxLayoutParams(),u={width:n.getWidth(),height:n.getHeight()},h=t.get("padding"),c=Vc(l,u,h),p=this.layoutInner(t,r,c,i,a,s),d=Vc(T({width:p.width,height:p.height},l),u,h);this.group.x=d.x-p.x,this.group.y=d.y-p.y,this.group.markRedraw(),this.group.add(this._backgroundEl=BN(p,t))}},e.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},e.prototype.renderInner=function(t,e,n,i,r,o,a){var s=this.getContentGroup(),l=ht(),u=e.get("selectedMode"),h=[];n.eachRawSeries((function(t){!t.get("legendHoverLink")&&h.push(t.id)})),cV(e.getData(),(function(r,o){var a=r.get("name");if(!this.newlineDisabled&&(""===a||"\n"===a)){var c=new pV;return c.newline=!0,void s.add(c)}var p=n.getSeriesByName(a)[0];if(!l.get(a)){if(p){var d=p.getData(),f=d.getVisual("legendLineStyle")||{},g=d.getVisual("legendIcon"),y=d.getVisual("style");this._createItem(p,a,o,r,e,t,f,y,g,u).on("click",hV(fV,a,null,i,h)).on("mouseover",hV(yV,p.name,null,i,h)).on("mouseout",hV(vV,p.name,null,i,h)),l.set(a,!0)}else n.eachRawSeries((function(n){if(!l.get(a)&&n.legendVisualProvider){var s=n.legendVisualProvider;if(!s.containName(a))return;var c=s.indexOfName(a),p=s.getItemVisual(c,"style"),d=s.getItemVisual(c,"legendIcon"),f=He(p.fill);f&&0===f[3]&&(f[3]=.2,p.fill=Je(f,"rgba")),this._createItem(n,a,o,r,e,t,{},p,d,u).on("click",hV(fV,null,a,i,h)).on("mouseover",hV(yV,null,a,i,h)).on("mouseout",hV(vV,null,a,i,h)),l.set(a,!0)}}),this);0}}),this),r&&this._createSelector(r,e,i,o,a)},e.prototype._createSelector=function(t,e,n,i,r){var o=this.getSelectorGroup();cV(t,(function(t){var i=t.type,r=new cs({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){n.dispatchAction({type:"all"===i?"legendAllSelect":"legendInverseSelect"})}});o.add(r),hh(r,{normal:e.getModel("selectorLabel"),emphasis:e.getModel(["emphasis","selectorLabel"])},{defaultText:t.title}),sl(r)}))},e.prototype._createItem=function(t,e,n,i,r,o,a,s,l,u){var h=t.visualDrawType,c=r.get("itemWidth"),p=r.get("itemHeight"),d=r.isSelected(e),f=i.get("symbolRotate"),g=i.get("icon"),y=function(t,e,n,i,r,o,a){for(var s=e.getModel("itemStyle"),l=Lh.concat([["decal"]]),u={},h=0;h5)return;var i=this._model.coordinateSystem.getSlidedAxisExpandWindow([t.offsetX,t.offsetY]);"none"!==i.behavior&&this._dispatchExpand({axisExpandWindow:i.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(t){if(!this._mouseDownPoint&&AD(this,"mousemove")){var e=this._model,n=e.coordinateSystem.getSlidedAxisExpandWindow([t.offsetX,t.offsetY]),i=n.behavior;"jump"===i&&this._throttledDispatchExpand.debounceNextCall(e.get("axisExpandDebounce")),this._throttledDispatchExpand("none"===i?null:{axisExpandWindow:n.axisExpandWindow,animation:"jump"===i?null:{duration:0}})}}};function AD(t,e){var n=t._model;return n.get("axisExpandable")&&n.get("axisExpandTriggerOn")===e}var LD=function(t){function e(){var n=null!==t&&t.apply(this,arguments)||this;return n.type=e.type,n}return n(e,t),e.prototype.init=function(){t.prototype.init.apply(this,arguments),this.mergeOption({})},e.prototype.mergeOption=function(t){var e=this.option;t&&S(e,t,!0),this._initDimensions()},e.prototype.contains=function(t,e){var n=t.get("parallelIndex");return null!=n&&e.getComponent("parallel",n)===this},e.prototype.setAxisExpand=function(t){P(["axisExpandable","axisExpandCenter","axisExpandCount","axisExpandWidth","axisExpandWindow"],(function(e){t.hasOwnProperty(e)&&(this.option[e]=t[e])}),this)},e.prototype._initDimensions=function(){var t=this.dimensions=[],e=this.parallelAxisIndex=[];P(N(this.ecModel.queryComponents({mainType:"parallelAxis"}),(function(t){return(t.get("parallelIndex")||0)===this.componentIndex}),this),(function(n){t.push("dim"+n.get("dim")),e.push(n.componentIndex)}))},e.type="parallel",e.dependencies=["parallelAxis"],e.layoutMode="box",e.defaultOption={zlevel:0,z:0,left:80,top:60,right:80,bottom:60,layout:"horizontal",axisExpandable:!1,axisExpandCenter:null,axisExpandCount:0,axisExpandWidth:50,axisExpandRate:17,axisExpandDebounce:50,axisExpandSlideTriggerArea:[-.15,.05,.4],axisExpandTriggerOn:"click",parallelAxisDefault:null},e}(Xc),kD=function(t){function e(e,n,i,r,o){var a=t.call(this,e,n,i)||this;return a.type=r||"value",a.axisIndex=o,a}return n(e,t),e.prototype.isHorizontal=function(){return"horizontal"!==this.coordinateSystem.getModel().get("layout")},e}(hb);function PD(t,e,n,i,r,o){t=t||0;var a=n[1]-n[0];if(null!=r&&(r=RD(r,[0,a])),null!=o&&(o=Math.max(o,null!=r?r:0)),"all"===i){var s=Math.abs(e[1]-e[0]);s=RD(s,[0,a]),r=o=RD(s,[r,o]),i=0}e[0]=RD(e[0],n),e[1]=RD(e[1],n);var l=OD(e,i);e[i]+=t;var u,h=r||0,c=n.slice();return l.sign<0?c[0]+=h:c[1]-=h,e[i]=RD(e[i],c),u=OD(e,i),null!=r&&(u.sign!==l.sign||u.span',x=window.open();x.document.write(_),x.document.title=i}else{var b=document.createElement("a");b.download=i+"."+o,b.target="_blank",b.href=s;var w=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});b.dispatchEvent(w)}},e.getDefaultOption=function(t){return{show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:t.getLocale(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:"#fff",name:"",excludeComponents:["toolbox"],lang:t.getLocale(["toolbox","saveAsImage","lang"])}},e}(RN);GN.prototype.unusable=!a.canvasSupported;var HN="__ec_magicType_stack__",WN=[["line","bar"],["stack"]],UN=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.getIcons=function(){var t=this.model,e=t.get("icon"),n={};return P(t.get("type"),(function(t){e[t]&&(n[t]=e[t])})),n},e.getDefaultOption=function(t){return{show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:t.getLocale(["toolbox","magicType","title"]),option:{},seriesIndex:{}}},e.prototype.onclick=function(t,e,n){var i=this.model,r=i.get(["seriesIndex",n]);if(XN[n]){var o,a={series:[]};P(WN,(function(t){D(t,n)>=0&&P(t,(function(t){i.setIconStatus(t,"normal")}))})),i.setIconStatus(n,"emphasis"),t.eachComponent({mainType:"series",query:null==r?null:{seriesIndex:r}},(function(t){var e=t.subType,r=t.id,o=XN[n](e,r,t,i);o&&(T(o,t.option),a.series.push(o));var s=t.coordinateSystem;if(s&&"cartesian2d"===s.type&&("line"===n||"bar"===n)){var l=s.getAxesByScale("ordinal")[0];if(l){var u=l.dim+"Axis",h=t.getReferringComponents(u,Nr).models[0].componentIndex;a[u]=a[u]||[];for(var c=0;c<=h;c++)a[u][h]=a[u][h]||{};a[u][h].boundaryGap="bar"===n}}}));var s=n;"stack"===n&&(o=S({stack:i.option.title.tiled,tiled:i.option.title.stack},i.option.title),"emphasis"!==i.get(["iconStatus",n])&&(s="tiled")),e.dispatchAction({type:"changeMagicType",currentType:s,newOption:a,newTitle:o,featureName:"magicType"})}},e}(RN),XN={line:function(t,e,n,i){if("bar"===t)return S({id:e,type:"line",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","line"])||{},!0)},bar:function(t,e,n,i){if("line"===t)return S({id:e,type:"bar",data:n.get("data"),stack:n.get("stack"),markPoint:n.get("markPoint"),markLine:n.get("markLine")},i.get(["option","bar"])||{},!0)},stack:function(t,e,n,i){var r=n.get("stack")===HN;if("line"===t||"bar"===t)return i.setIconStatus("stack",r?"normal":"emphasis"),S({id:e,stack:r?"":HN},i.get(["option","stack"])||{},!0)}};Hm({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},(function(t,e){e.mergeOption(t.newOption)}));var YN=new Array(60).join("-"),ZN="\t";function jN(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}var qN=new RegExp("[\t]+","g");function KN(t,e){var n=t.split(new RegExp("\n*"+YN+"\n*","g")),i={series:[]};return P(n,(function(t,n){if(function(t){if(t.slice(0,t.indexOf("\n")).indexOf(ZN)>=0)return!0}(t)){var r=function(t){for(var e=t.split(/\n+/g),n=[],i=O(jN(e.shift()).split(qN),(function(t){return{name:t,data:[]}})),r=0;r
",g=u.join(f);this._showOrMove(o,(function(){this._updateContentNotChangedOnAxis(t)?this._updatePosition(o,c,r[0],r[1],this._tooltipContent,s):this._showTooltipContent(o,g,s,Math.random()+"",r[0],r[1],c,null,h)}))},e.prototype._showSeriesItemTooltip=function(t,e,n){var i=this._ecModel,r=_s(e),o=r.seriesIndex,a=i.getSeriesByIndex(o),s=r.dataModel||a,l=r.dataIndex,u=r.dataType,h=s.getData(u),c=this._renderMode,p=t.positionDefault,d=Uz([h.getItemModel(l),s,a&&(a.coordinateSystem||{}).model],this._tooltipModel,p?{position:p}:null),f=d.get("trigger");if(null==f||"item"===f){var g=s.getDataParams(l,u),y=new hf;g.marker=y.makeTooltipMarker("item",kc(g.color),c);var v=Cd(s.formatTooltip(l,!1,u)),m=d.get("order"),_=v.markupFragment?rf(v.markupFragment,y,c,m,i.get("useUTC"),d.get("textStyle")):v.markupText,x="item_"+s.name+"_"+l;this._showOrMove(d,(function(){this._showTooltipContent(d,_,g,x,t.offsetX,t.offsetY,t.position,t.target,y)})),n({type:"showTip",dataIndexInside:l,dataIndex:h.getRawIndex(l),seriesIndex:o,from:this.uid})}},e.prototype._showComponentItemTooltip=function(t,e,n){var i=_s(e),r=i.tooltipConfig.option||{};if(H(r)){r={content:r,formatter:r}}var o=[r],a=this._ecModel.getComponent(i.componentMainType,i.componentIndex);a&&o.push(a),o.push({formatter:r.content});var s=t.positionDefault,l=Uz(o,this._tooltipModel,s?{position:s}:null),u=l.get("content"),h=Math.random()+"",c=new hf;this._showOrMove(l,(function(){var n=w(l.get("formatterParams")||{});this._showTooltipContent(l,u,n,h,t.offsetX,t.offsetY,t.position,e,c)})),n({type:"showTip",from:this.uid})},e.prototype._showTooltipContent=function(t,e,n,i,r,o,a,s,l){if(this._ticket="",t.get("showContent")&&t.get("show")){var u=this._tooltipContent,h=t.get("formatter");a=a||t.get("position");var c=e,p=this._getNearestPoint([r,o],n,t.get("trigger"),t.get("borderColor")).color;if(h&&H(h)){var d=t.ecModel.get("useUTC"),f=F(n)?n[0]:n;c=h,f&&f.axisType&&f.axisType.indexOf("time")>=0&&(c=ic(f.axisValue,c,d)),c=Ac(c,n,!0)}else if(G(h)){var g=Bz((function(e,i){e===this._ticket&&(u.setContent(i,l,t,p,a),this._updatePosition(t,a,r,o,u,n,s))}),this);this._ticket=i,c=h(n,i,g)}u.setContent(c,l,t,p,a),u.show(t,p),this._updatePosition(t,a,r,o,u,n,s)}},e.prototype._getNearestPoint=function(t,e,n,i){return"axis"===n||F(e)?{color:i||("html"===this._renderMode?"#fff":"none")}:F(e)?void 0:{color:i||e.color||e.borderColor}},e.prototype._updatePosition=function(t,e,n,i,r,o,a){var s=this._api.getWidth(),l=this._api.getHeight();e=e||t.get("position");var u=r.getSize(),h=t.get("align"),c=t.get("verticalAlign"),p=a&&a.getBoundingRect().clone();if(a&&p.applyTransform(a.transform),G(e)&&(e=e([n,i],o,r.el,p,{viewSize:[s,l],contentSize:u.slice()})),F(e))n=Gz(e[0],s),i=Gz(e[1],l);else if(X(e)){var d=e;d.width=u[0],d.height=u[1];var f=Vc(d,{width:s,height:l});n=f.x,i=f.y,h=null,c=null}else if(H(e)&&a){var g=function(t,e,n){var i=n[0],r=n[1],o=10,a=5,s=0,l=0,u=e.width,h=e.height;switch(t){case"inside":s=e.x+u/2-i/2,l=e.y+h/2-r/2;break;case"top":s=e.x+u/2-i/2,l=e.y-r-o;break;case"bottom":s=e.x+u/2-i/2,l=e.y+h+o;break;case"left":s=e.x-i-o-a,l=e.y+h/2-r/2;break;case"right":s=e.x+u+o+a,l=e.y+h/2-r/2}return[s,l]}(e,p,u);n=g[0],i=g[1]}else{g=function(t,e,n,i,r,o,a){var s=n.getOuterSize(),l=s.width,u=s.height;null!=o&&(t+l+o+2>i?t-=l+o:t+=o);null!=a&&(e+u+a>r?e-=u+a:e+=a);return[t,e]}(n,i,r,s,l,h?null:20,c?null:20);n=g[0],i=g[1]}if(h&&(n-=Yz(h)?u[0]/2:"right"===h?u[0]:0),c&&(i-=Yz(c)?u[1]/2:"bottom"===c?u[1]:0),Sz(t)){g=function(t,e,n,i,r){var o=n.getOuterSize(),a=o.width,s=o.height;return t=Math.min(t+a,i)-a,e=Math.min(e+s,r)-s,t=Math.max(t,0),e=Math.max(e,0),[t,e]}(n,i,r,s,l);n=g[0],i=g[1]}r.moveTo(n,i)},e.prototype._updateContentNotChangedOnAxis=function(t){var e=this._lastDataByCoordSys,n=!!e&&e.length===t.length;return n&&Fz(e,(function(e,i){var r=e.dataByAxis||[],o=(t[i]||{}).dataByAxis||[];(n=n&&r.length===o.length)&&Fz(r,(function(t,e){var i=o[e]||{},r=t.seriesDataIndices||[],a=i.seriesDataIndices||[];(n=n&&t.value===i.value&&t.axisType===i.axisType&&t.axisId===i.axisId&&r.length===a.length)&&Fz(r,(function(t,e){var i=a[e];n=n&&t.seriesIndex===i.seriesIndex&&t.dataIndex===i.dataIndex}))}))})),this._lastDataByCoordSys=t,!!n},e.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},e.prototype.dispose=function(t,e){a.node||(this._tooltipContent.dispose(),KO("itemTooltip",e))},e.type="tooltip",e}(wf);function Uz(t,e,n){var i,r=e.ecModel;n?(i=new Oh(n,r,r),i=new Oh(e.option,i,r)):i=e;for(var o=t.length-1;o>=0;o--){var a=t[o];a&&(a instanceof Oh&&(a=a.get("tooltip",!0)),H(a)&&(a={formatter:a}),a&&(i=new Oh(a,i,r)))}return i}function Xz(t,e){return t.dispatchAction||V(e.dispatchAction,e)}function Yz(t){return"center"===t||"middle"===t}var Zz=["rect","polygon","keep","clear"];function jz(t,e){var n=xr(t?t.brush:[]);if(n.length){var i=[];P(n,(function(t){var e=t.hasOwnProperty("toolbox")?t.toolbox:[];e instanceof Array&&(i=i.concat(e))}));var r=t&&t.toolbox;F(r)&&(r=r[0]),r||(r={feature:{}},t.toolbox=[r]);var o=r.feature||(r.feature={}),a=o.brush||(o.brush={}),s=a.type||(a.type=[]);s.push.apply(s,i),function(t){var e={};P(t,(function(t){e[t]=1})),t.length=0,P(e,(function(e,n){t.push(n)}))}(s),e&&!s.length&&s.push.apply(s,Zz)}}var qz=P;function Kz(t){if(t)for(var e in t)if(t.hasOwnProperty(e))return!0}function $z(t,e,n){var i={};return qz(e,(function(e){var r,o=i[e]=((r=function(){}).prototype.__hidden=r.prototype,new r);qz(t[e],(function(t,i){if(TT.isValidType(i)){var r={type:i,visual:t};n&&n(r,e),o[i]=new TT(r),"opacity"===i&&((r=w(r)).type="colorAlpha",o.__hidden.__alphaForOpacity=new TT(r))}}))})),i}function Jz(t,e,n){var i;P(n,(function(t){e.hasOwnProperty(t)&&Kz(e[t])&&(i=!0)})),i&&P(n,(function(n){e.hasOwnProperty(n)&&Kz(e[n])?t[n]=w(e[n]):delete t[n]}))}var Qz={lineX:tE(0),lineY:tE(1),rect:{point:function(t,e,n){return t&&n.boundingRect.contain(t[0],t[1])},rect:function(t,e,n){return t&&n.boundingRect.intersect(t)}},polygon:{point:function(t,e,n){return t&&n.boundingRect.contain(t[0],t[1])&&uv(n.range,t[0],t[1])},rect:function(t,e,n){var i=n.range;if(!t||i.length<=1)return!1;var r=t.x,o=t.y,a=t.width,s=t.height,l=i[0];return!!(uv(i,r,o)||uv(i,r+a,o)||uv(i,r,o+s)||uv(i,r+a,o+s)||gi.create(t).contain(l[0],l[1])||nh(r,o,r+a,o,i)||nh(r,o,r,o+s,i)||nh(r+a,o,r+a,o+s,i)||nh(r,o+s,r+a,o+s,i))||void 0}}};function tE(t){var e=["x","y"],n=["width","height"];return{point:function(e,n,i){if(e){var r=i.range;return eE(e[t],r)}},rect:function(i,r,o){if(i){var a=o.range,s=[i[e[t]],i[e[t]]+i[n[t]]];return s[1]e[0][1]&&(e[0][1]=o[0]),o[1]a",l.leadingWhitespace=3===a.firstChild.nodeType,l.tbody=!a.getElementsByTagName("tbody").length,l.htmlSerialize=!!a.getElementsByTagName("link").length,l.html5Clone="<:nav>"!==d.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,b.appendChild(c),l.appendChecked=c.checked,a.innerHTML="",l.noCloneChecked=!!a.cloneNode(!0).lastChild.defaultValue,b.appendChild(a),c=d.createElement("input"),c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),a.appendChild(c),l.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!!a.addEventListener,a[n.expando]=1,l.attributes=!a.getAttribute(n.expando)}();var da={option:[1,""],legend:[1,""],area:[1,""],param:[1,""],thead:[1,"
","
"],tr:[2,"","
"],col:[2,"
"],td:[3,"
"],_default:l.htmlSerialize?[0,"",""]:[1,"X","