├── php
├── application
│ ├── .htaccess
│ ├── admin
│ │ ├── config.php
│ │ ├── validate
│ │ │ ├── AdminPost.php
│ │ │ ├── AdminStructure.php
│ │ │ ├── AdminGroup.php
│ │ │ ├── AdminRule.php
│ │ │ ├── AdminMenu.php
│ │ │ └── AdminUser.php
│ │ ├── controller
│ │ │ ├── SystemConfigs.php
│ │ │ ├── Upload.php
│ │ │ ├── ApiCommon.php
│ │ │ ├── Menus.php
│ │ │ ├── Groups.php
│ │ │ ├── Rules.php
│ │ │ ├── Posts.php
│ │ │ ├── Structures.php
│ │ │ └── Users.php
│ │ └── model
│ │ │ ├── Group.php
│ │ │ ├── Structure.php
│ │ │ ├── Post.php
│ │ │ ├── Rule.php
│ │ │ ├── SystemConfig.php
│ │ │ └── Menu.php
│ ├── command.php
│ ├── common
│ │ ├── behavior
│ │ │ └── InitConfigBehavior.php
│ │ ├── adapter
│ │ │ └── AuthAdapter.php
│ │ └── controller
│ │ │ └── Common.php
│ ├── tags.php
│ └── common.php
├── thinkphp
│ ├── .htaccess
│ ├── .gitignore
│ ├── logo.png
│ ├── library
│ │ ├── think
│ │ │ ├── console
│ │ │ │ ├── bin
│ │ │ │ │ ├── hiddeninput.exe
│ │ │ │ │ └── README.md
│ │ │ │ ├── command
│ │ │ │ │ ├── make
│ │ │ │ │ │ ├── stubs
│ │ │ │ │ │ │ ├── model.stub
│ │ │ │ │ │ │ ├── controller.plain.stub
│ │ │ │ │ │ │ └── controller.stub
│ │ │ │ │ │ ├── Model.php
│ │ │ │ │ │ └── Controller.php
│ │ │ │ │ ├── Clear.php
│ │ │ │ │ ├── Build.php
│ │ │ │ │ ├── Help.php
│ │ │ │ │ ├── Lists.php
│ │ │ │ │ └── optimize
│ │ │ │ │ │ └── Route.php
│ │ │ │ ├── LICENSE
│ │ │ │ └── output
│ │ │ │ │ ├── driver
│ │ │ │ │ ├── Nothing.php
│ │ │ │ │ └── Buffer.php
│ │ │ │ │ └── question
│ │ │ │ │ └── Confirmation.php
│ │ │ ├── exception
│ │ │ │ ├── RouteNotFoundException.php
│ │ │ │ ├── HttpResponseException.php
│ │ │ │ ├── ClassNotFoundException.php
│ │ │ │ ├── TemplateNotFoundException.php
│ │ │ │ ├── ValidateException.php
│ │ │ │ ├── HttpException.php
│ │ │ │ ├── DbException.php
│ │ │ │ ├── PDOException.php
│ │ │ │ ├── ThrowableError.php
│ │ │ │ └── ErrorException.php
│ │ │ ├── config
│ │ │ │ └── driver
│ │ │ │ │ ├── Ini.php
│ │ │ │ │ ├── Json.php
│ │ │ │ │ └── Xml.php
│ │ │ ├── log
│ │ │ │ └── driver
│ │ │ │ │ └── Test.php
│ │ │ ├── Env.php
│ │ │ ├── model
│ │ │ │ ├── Pivot.php
│ │ │ │ └── Collection.php
│ │ │ ├── db
│ │ │ │ ├── exception
│ │ │ │ │ ├── BindParamException.php
│ │ │ │ │ ├── ModelNotFoundException.php
│ │ │ │ │ └── DataNotFoundException.php
│ │ │ │ └── builder
│ │ │ │ │ ├── Mysql.php
│ │ │ │ │ ├── Sqlite.php
│ │ │ │ │ └── Pgsql.php
│ │ │ ├── controller
│ │ │ │ └── Yar.php
│ │ │ ├── Exception.php
│ │ │ ├── process
│ │ │ │ ├── exception
│ │ │ │ │ ├── Failed.php
│ │ │ │ │ └── Timeout.php
│ │ │ │ ├── Utils.php
│ │ │ │ └── pipes
│ │ │ │ │ └── Pipes.php
│ │ │ ├── response
│ │ │ │ ├── Json.php
│ │ │ │ ├── Jsonp.php
│ │ │ │ ├── View.php
│ │ │ │ └── Redirect.php
│ │ │ └── template
│ │ │ │ └── driver
│ │ │ │ └── File.php
│ │ └── traits
│ │ │ └── think
│ │ │ └── Instance.php
│ ├── codecov.yml
│ ├── start.php
│ ├── console.php
│ ├── composer.json
│ ├── tpl
│ │ ├── default_index.tpl
│ │ └── dispatch_jump.tpl
│ ├── .travis.yml
│ ├── phpunit.xml
│ ├── LICENSE.txt
│ ├── base.php
│ └── CONTRIBUTING.md
├── vendor
│ └── .gitignore
├── .gitignore
├── extend
│ └── com
│ │ └── verify
│ │ └── assets
│ │ ├── bgs
│ │ ├── 1.jpg
│ │ ├── 2.jpg
│ │ ├── 3.jpg
│ │ ├── 4.jpg
│ │ ├── 5.jpg
│ │ ├── 6.jpg
│ │ ├── 7.jpg
│ │ └── 8.jpg
│ │ ├── ttfs
│ │ ├── 1.ttf
│ │ ├── 2.ttf
│ │ ├── 3.ttf
│ │ ├── 4.ttf
│ │ ├── 5.ttf
│ │ └── 6.ttf
│ │ └── zhttfs
│ │ └── 1.ttf
├── runtime
│ └── cache
│ │ ├── 70
│ │ └── 07ab3cc418e68745bd911eec958ef7.php
│ │ ├── 95
│ │ └── a1fe934b68ebfee8468bf0bc4f0000.php
│ │ └── c9
│ │ └── c7be4947290e7d74716c772aad2457.php
├── .htaccess
├── public
│ ├── .htaccess
│ ├── router.php
│ └── index.php
├── config
│ ├── deploy.php
│ ├── database.php
│ └── route_admin.php
├── README.md
├── phpunit.xml
├── think
├── index.php
├── composer.json
└── LICENSE.txt
└── frontEnd
├── config
├── prod.env.js
├── dev.env.js
└── index.js
├── src
├── .DS_Store
├── assets
│ ├── .DS_Store
│ ├── js
│ │ ├── .DS_Store
│ │ ├── form_com.js
│ │ ├── list_com.js
│ │ ├── global.js
│ │ └── filter.js
│ ├── images
│ │ ├── bg1.jpg
│ │ ├── .DS_Store
│ │ ├── logo.png
│ │ ├── logo1.png
│ │ ├── logo2.png
│ │ ├── logo3.png
│ │ ├── logo4.png
│ │ ├── logo5.png
│ │ ├── logout_16.png
│ │ ├── logout_24.png
│ │ └── logout_36.png
│ ├── plugins
│ │ └── .DS_Store
│ ├── fonts
│ │ ├── FontAwesome.otf
│ │ ├── fontawesome-webfont.eot
│ │ ├── fontawesome-webfont.ttf
│ │ ├── fontawesome-webfont.woff
│ │ └── fontawesome-webfont.woff2
│ └── css
│ │ └── base.css
├── components
│ ├── .DS_Store
│ ├── Common
│ │ ├── .DS_Store
│ │ ├── leftMenu.vue
│ │ └── btn-group.vue
│ ├── Administrative
│ │ ├── .DS_Store
│ │ ├── system
│ │ │ ├── .DS_Store
│ │ │ ├── rule
│ │ │ │ └── .DS_Store
│ │ │ ├── config
│ │ │ │ └── preview.vue
│ │ │ └── menu
│ │ │ │ └── rule.vue
│ │ ├── personnel
│ │ │ ├── .DS_Store
│ │ │ └── users
│ │ │ │ └── .DS_Store
│ │ └── structures
│ │ │ ├── .DS_Store
│ │ │ ├── groups
│ │ │ └── .DS_Store
│ │ │ ├── position
│ │ │ ├── .DS_Store
│ │ │ ├── add.vue
│ │ │ └── edit.vue
│ │ │ └── structures
│ │ │ ├── .DS_Store
│ │ │ ├── add.vue
│ │ │ └── edit.vue
│ ├── refresh.vue
│ └── Account
│ │ └── changePwd.vue
├── vuex
│ ├── getters.js
│ ├── state.js
│ ├── store.js
│ ├── mutations.js
│ └── actions.js
├── App.vue
└── main.js
├── .babelrc
├── index.html
├── build
├── dev-client.js
├── build.js
├── webpack.dev.conf.js
├── check-versions.js
├── utils.js
└── dev-server.js
├── .eslintrc.json
├── README.md
└── package.json
/php/application/.htaccess:
--------------------------------------------------------------------------------
1 | deny from all
--------------------------------------------------------------------------------
/php/thinkphp/.htaccess:
--------------------------------------------------------------------------------
1 | deny from all
--------------------------------------------------------------------------------
/php/vendor/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
--------------------------------------------------------------------------------
/php/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | composer.lock
3 | *.log
4 |
--------------------------------------------------------------------------------
/php/thinkphp/.gitignore:
--------------------------------------------------------------------------------
1 | /composer.lock
2 | /vendor
3 | .idea
4 | .DS_Store
5 |
--------------------------------------------------------------------------------
/frontEnd/config/prod.env.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | NODE_ENV: '"production"'
3 | }
4 |
--------------------------------------------------------------------------------
/php/application/admin/config.php:
--------------------------------------------------------------------------------
1 | state.count,
3 | }
4 |
5 | export default getters
6 |
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/bgs/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/bgs/1.jpg
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/bgs/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/bgs/2.jpg
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/bgs/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/bgs/3.jpg
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/bgs/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/bgs/4.jpg
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/bgs/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/bgs/5.jpg
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/bgs/6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/bgs/6.jpg
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/bgs/7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/bgs/7.jpg
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/bgs/8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/bgs/8.jpg
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/ttfs/1.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/ttfs/1.ttf
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/ttfs/2.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/ttfs/2.ttf
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/ttfs/3.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/ttfs/3.ttf
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/ttfs/4.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/ttfs/4.ttf
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/ttfs/5.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/ttfs/5.ttf
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/ttfs/6.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/ttfs/6.ttf
--------------------------------------------------------------------------------
/frontEnd/src/assets/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/assets/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/frontEnd/src/assets/images/logout_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/assets/images/logout_16.png
--------------------------------------------------------------------------------
/frontEnd/src/assets/images/logout_24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/assets/images/logout_24.png
--------------------------------------------------------------------------------
/frontEnd/src/assets/images/logout_36.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/assets/images/logout_36.png
--------------------------------------------------------------------------------
/frontEnd/src/components/Common/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/components/Common/.DS_Store
--------------------------------------------------------------------------------
/php/extend/com/verify/assets/zhttfs/1.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/extend/com/verify/assets/zhttfs/1.ttf
--------------------------------------------------------------------------------
/frontEnd/src/assets/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/assets/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/frontEnd/src/assets/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/assets/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/components/Administrative/.DS_Store
--------------------------------------------------------------------------------
/frontEnd/src/assets/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/assets/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/frontEnd/src/assets/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/assets/fonts/fontawesome-webfont.woff2
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/bin/hiddeninput.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/php/thinkphp/library/think/console/bin/hiddeninput.exe
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/system/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/components/Administrative/system/.DS_Store
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/personnel/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/components/Administrative/personnel/.DS_Store
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/structures/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/components/Administrative/structures/.DS_Store
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/system/rule/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/components/Administrative/system/rule/.DS_Store
--------------------------------------------------------------------------------
/php/runtime/cache/c9/c7be4947290e7d74716c772aad2457.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontEnd/src/assets/js/form_com.js:
--------------------------------------------------------------------------------
1 | const formMixin = {
2 | methods: {
3 | goback() {
4 | router.go(-1)
5 | }
6 | }
7 | }
8 |
9 | export default formMixin
10 |
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/personnel/users/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/components/Administrative/personnel/users/.DS_Store
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/bin/README.md:
--------------------------------------------------------------------------------
1 | console 工具使用 hiddeninput.exe 在 windows 上隐藏密码输入,该二进制文件由第三方提供,相关源码和其他细节可以在 [Hidden Input](https://github.com/Seldaek/hidden-input) 找到。
2 |
--------------------------------------------------------------------------------
/frontEnd/config/dev.env.js:
--------------------------------------------------------------------------------
1 | var merge = require('webpack-merge')
2 | var prodEnv = require('./prod.env')
3 |
4 | module.exports = merge(prodEnv, {
5 | NODE_ENV: '"development"'
6 | })
7 |
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/structures/groups/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/components/Administrative/structures/groups/.DS_Store
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/structures/position/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/components/Administrative/structures/position/.DS_Store
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/structures/structures/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SiberianMark/vuephpPrac/HEAD/frontEnd/src/components/Administrative/structures/structures/.DS_Store
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/command/make/stubs/model.stub:
--------------------------------------------------------------------------------
1 |
2 | RewriteEngine on
3 | RewriteBase /
4 | RewriteCond %{REQUEST_FILENAME} !-f
5 | RewriteCond %{REQUEST_FILENAME} !-d
6 | RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
7 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/command/make/stubs/controller.plain.stub:
--------------------------------------------------------------------------------
1 |
2 | Options +FollowSymlinks -Multiviews
3 | RewriteEngine On
4 |
5 | RewriteCond %{REQUEST_FILENAME} !-d
6 | RewriteCond %{REQUEST_FILENAME} !-f
7 | RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
8 |
--------------------------------------------------------------------------------
/php/thinkphp/codecov.yml:
--------------------------------------------------------------------------------
1 | comment:
2 | layout: header, changes, diff
3 | coverage:
4 | ignore:
5 | - base.php
6 | - helper.php
7 | - convention.php
8 | - lang/zh-cn.php
9 | - start.php
10 | - console.php
11 | status:
12 | patch: false
13 |
--------------------------------------------------------------------------------
/php/runtime/cache/95/a1fe934b68ebfee8468bf0bc4f0000.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontEnd/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | vue element admin
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/frontEnd/build/dev-client.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | require('eventsource-polyfill')
3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
4 |
5 | hotClient.subscribe(function (event) {
6 | if (event.action === 'reload') {
7 | window.location.reload()
8 | }
9 | })
10 |
--------------------------------------------------------------------------------
/frontEnd/src/components/refresh.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/php/application/admin/validate/AdminPost.php:
--------------------------------------------------------------------------------
1 | 'require',
12 | );
13 | protected $message = array(
14 | 'name.require' => '部门名称必须填写',
15 | );
16 | }
--------------------------------------------------------------------------------
/frontEnd/src/vuex/store.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 | Vue.use(Vuex)
4 | import state from './state'
5 | import mutations from './mutations'
6 | import getters from './getters'
7 | import actions from './actions'
8 | export default new Vuex.Store({
9 | state,
10 | mutations,
11 | getters,
12 | actions
13 | })
14 |
--------------------------------------------------------------------------------
/php/application/admin/validate/AdminStructure.php:
--------------------------------------------------------------------------------
1 | 'require',
12 | );
13 | protected $message = array(
14 | 'name.require' => '标题必须填写',
15 | );
16 | }
--------------------------------------------------------------------------------
/php/application/admin/validate/AdminGroup.php:
--------------------------------------------------------------------------------
1 | 'require',
12 | 'rules' => 'require',
13 | );
14 | protected $message = array(
15 | 'title.require' => '标题必须填写',
16 | 'rules.require' => '规则必须填写',
17 | );
18 | }
--------------------------------------------------------------------------------
/php/config/deploy.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | return [
9 | //分页配置,每页条数
10 | 'page_num' => 15,
11 | ];
--------------------------------------------------------------------------------
/php/application/admin/validate/AdminRule.php:
--------------------------------------------------------------------------------
1 | 'require',
12 | 'name' => 'require',
13 | 'level' => 'require'
14 | );
15 | protected $message = array(
16 | 'title.require' => '标题必须填写',
17 | 'name.require' => '规则定义必须填写',
18 | 'level.require' => '级别类型必须填写',
19 | );
20 | }
--------------------------------------------------------------------------------
/php/application/admin/validate/AdminMenu.php:
--------------------------------------------------------------------------------
1 | 'require',
12 | 'menu_type' => 'require',
13 | 'rule_id' => 'require',
14 | );
15 | protected $message = array(
16 | 'title.require' => '标题必须填写',
17 | 'menu_type.require' => '菜单类型必须填写',
18 | 'rule_id.require' => '绑定权限标识必须填写',
19 | );
20 | }
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/system/config/preview.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
11 |
--------------------------------------------------------------------------------
/php/README.md:
--------------------------------------------------------------------------------
1 | VueThink
2 | ===============
3 |
4 | VueThink不仅适用于管理后台或管理系统开发,且广泛适用于B/S架构的项目开发。VueThink是对前后端分离技术的应用实践,2016年由洪睿科技的技术团队研发并投入商业开发使用,已有许多的商业项目实践。而今框架开源,希望能有更多志同道合的伙伴参与VueThink的迭代 ^_^
5 |
6 | 使用许可:VueThink是基于MIT协议的开源框架,它完全免费。你可以免费下载VueThink,用来搭建自己的或者团体的软件。
7 |
8 | 主要适用技术栈:
9 | 后端框架:ThinkPHP 5.x
10 | 前端MVVM框架:Vue.JS 2.x
11 | 开发工作流:Webpack 1.x
12 | 路由:Vue-Router 2.x
13 | 数据交互:Axios
14 | 代码风格检测:Eslint
15 | UI框架:Element-UI 1.1.6
16 | JS函数库:Lodash
17 |
18 | > VueThink的运行环境要求PHP5.4以上。
19 |
20 | 详细开发文档参考 [ThinkPHP5完全开发手册](http://www.kancloud.cn/manual/thinkphp5)
21 |
22 |
23 |
--------------------------------------------------------------------------------
/php/application/admin/validate/AdminUser.php:
--------------------------------------------------------------------------------
1 | 'require|length:6,12|unique:user',
12 | 'password' => 'require',
13 | 'realname' => 'require',
14 | );
15 | protected $message = array(
16 | 'username.require' => '用户名必须填写',
17 | 'username.length' => '用户名长度在6到12位',
18 | 'username.unique' => '用户名已存在',
19 | 'password.require' => '密码必须填写',
20 | 'realname.require' => '真实姓名必须填写',
21 | );
22 | }
--------------------------------------------------------------------------------
/frontEnd/src/vuex/mutations.js:
--------------------------------------------------------------------------------
1 | const mutations = {
2 | showLeftMenu(state, status) {
3 | state.showLeftMenu = status
4 | },
5 | showLoading(state, status) {
6 | state.globalLoading = status
7 | },
8 | setMenus(state, menus) {
9 | state.menus = menus
10 | },
11 | setRules(state, rules) {
12 | state.rules = rules
13 | },
14 | setUsers(state, users) {
15 | state.users = users
16 | },
17 | setUserGroups(state, userGroups) {
18 | state.userGroups = userGroups
19 | },
20 | setOrganizes(state, organizes) {
21 | state.organizes = organizes
22 | }
23 | }
24 |
25 | export default mutations
26 |
--------------------------------------------------------------------------------
/php/application/command.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | return [];
--------------------------------------------------------------------------------
/frontEnd/src/vuex/actions.js:
--------------------------------------------------------------------------------
1 | const actions = {
2 | showLeftMenu ({ commit }, status) {
3 | commit('showLeftMenu', status)
4 | },
5 | showLoading ({ commit }, status) {
6 | commit('showLoading', status)
7 | },
8 | setMenus({ commit }, menus) {
9 | commit('setMenus', menus)
10 | },
11 | setRules({ commit }, rules) {
12 | commit('setRules', rules)
13 | },
14 | setUsers({ commit }, users) {
15 | commit('setUsers', users)
16 | },
17 | setUserGroups({ commit }, userGroups) {
18 | commit('setUserGroups', userGroups)
19 | },
20 | setOrganizes({ commit }, organizes) {
21 | commit('setOrganizes', organizes)
22 | }
23 | }
24 |
25 | export default actions
26 |
--------------------------------------------------------------------------------
/php/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | ./tests/
14 |
15 |
16 |
17 |
18 | application/
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/php/think:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 |
11 | // +----------------------------------------------------------------------
12 |
13 | // 定义项目路径
14 | define('APP_PATH', './application/');
15 |
16 | // 加载框架引导文件
17 | require './thinkphp/console.php';
--------------------------------------------------------------------------------
/php/thinkphp/start.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think;
13 |
14 | // ThinkPHP 引导文件
15 | // 加载基础文件
16 | require __DIR__ . '/base.php';
17 | // 执行应用
18 | App::run()->send();
19 |
--------------------------------------------------------------------------------
/php/public/router.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 | // $Id$
12 | if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["REQUEST_URI"])) {
13 | return false;
14 | } else {
15 | require __DIR__ . "/index.php";
16 | }
17 |
--------------------------------------------------------------------------------
/php/thinkphp/console.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think;
13 |
14 | // ThinkPHP 引导文件
15 | // 加载基础文件
16 | require __DIR__ . '/base.php';
17 |
18 | // 执行应用
19 | App::initCommon();
20 | Console::init();
21 |
--------------------------------------------------------------------------------
/frontEnd/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "parser": "babel-eslint",
3 | "extends": "vue",
4 | "env": {
5 | "browser": true,
6 | "es6": true
7 | },
8 | "parserOptions": {
9 | "sourceType": "module"
10 | },
11 | "rules": {
12 | "linebreak-style": ["error", "unix"], // 换行风格
13 | "quotes": [1, "single"], // 引号类型:使用单引号
14 | "semi": ["error", "never"], // 禁止分号作为语句结尾
15 | "eqeqeq": 0, // 关闭强制使用 '===' 和 '!==' 来做判断比较
16 | "no-unused-vars": 0, // 关闭强制 声明未使用变量
17 | "space-before-function-paren": 0, // 关闭函数名后的空格
18 | "prefer-const": 0, // 关闭首选const
19 | "no-undef": 0, // 关闭不能使用未定义变量
20 | "camelcase": 0
21 | }
22 | }
--------------------------------------------------------------------------------
/php/application/admin/controller/SystemConfigs.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\admin\controller;
9 |
10 | class SystemConfigs extends ApiCommon
11 | {
12 | public function save()
13 | {
14 | $configModel = model('SystemConfig');
15 | $param = $this->param;
16 | $data = $configModel->createData($param);
17 | if (!$data) {
18 | return resultArray(['error' => $configModel->getError()]);
19 | }
20 | return resultArray(['data' => '添加成功']);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/php/index.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | // [ 应用入口文件 ]
13 |
14 | // 应用目录
15 | define('APP_PATH', __DIR__.'/application/');
16 | // 定义配置文件目录和应用目录同级
17 | define('CONF_PATH', __DIR__.'/config/');
18 | // 加载框架引导文件
19 | require './thinkphp/start.php';
20 |
--------------------------------------------------------------------------------
/php/public/index.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | // [ 应用入口文件 ]
13 |
14 | // 应用目录
15 | define('APP_PATH', __DIR__ . '/../application/');
16 | // 定义配置文件目录和应用目录同级
17 | define('CONF_PATH', __DIR__.'/../config/');
18 | // 加载框架引导文件
19 | require __DIR__ . '/../thinkphp/start.php';
20 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/exception/RouteNotFoundException.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\exception;
13 |
14 | class RouteNotFoundException extends HttpException
15 | {
16 |
17 | public function __construct()
18 | {
19 | parent::__construct(404);
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/php/application/common/behavior/InitConfigBehavior.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 | namespace app\common\behavior;
8 | class InitConfigBehavior
9 | {
10 | public function run(&$content)
11 | {
12 | //读取数据库中的配置
13 | $system_config = cache('DB_CONFIG_DATA');
14 | if(!$system_config){
15 | //获取所有系统配置
16 | $system_config = \think\Loader::model('admin/SystemConfig')->getDataList();
17 | cache('DB_CONFIG_DATA', null);
18 | cache('DB_CONFIG_DATA', $system_config, 36000); //缓存配置
19 | }
20 | config($system_config); //添加配置
21 | }
22 | }
--------------------------------------------------------------------------------
/php/thinkphp/library/think/config/driver/Ini.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\config\driver;
13 |
14 | class Ini
15 | {
16 | public function parse($config)
17 | {
18 | if (is_file($config)) {
19 | return parse_ini_file($config, true);
20 | } else {
21 | return parse_ini_string($config, true);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/frontEnd/src/assets/js/list_com.js:
--------------------------------------------------------------------------------
1 | const listMixin = {
2 | data() {
3 | return {
4 | currentPage: null, // 分页当前页
5 | keywords: '', // 关键字搜索
6 | multipleSelection: [], // 列表当前已勾选项
7 | limit: 15, // 每页数据数目
8 | dataCount: 0
9 | }
10 | },
11 | methods: {
12 | selectItem(val) {
13 | this.multipleSelection = val
14 | },
15 | getCurrentPage() {
16 | let data = this.$route.query
17 | if (data) {
18 | if (data.page) {
19 | this.currentPage = parseInt(data.page)
20 | } else {
21 | this.currentPage = 1
22 | }
23 | }
24 | },
25 | getKeywords() {
26 | let data = this.$route.query
27 | if (data) {
28 | if (data.keywords) {
29 | this.keywords = data.keywords
30 | } else {
31 | this.keywords = ''
32 | }
33 | }
34 | }
35 | }
36 | }
37 |
38 | export default listMixin
39 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/config/driver/Json.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\config\driver;
13 |
14 | class Json
15 | {
16 | public function parse($config)
17 | {
18 | if (is_file($config)) {
19 | $config = file_get_contents($config);
20 | }
21 | $result = json_decode($config, true);
22 | return $result;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/php/thinkphp/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "topthink/framework",
3 | "description": "the new thinkphp framework",
4 | "type": "think-framework",
5 | "keywords": [
6 | "framework",
7 | "thinkphp",
8 | "ORM"
9 | ],
10 | "homepage": "http://thinkphp.cn/",
11 | "license": "Apache-2.0",
12 | "authors": [
13 | {
14 | "name": "liu21st",
15 | "email": "liu21st@gmail.com"
16 | }
17 | ],
18 | "require": {
19 | "php": ">=5.4.0",
20 | "topthink/think-installer": "~1.0"
21 | },
22 | "require-dev": {
23 | "phpunit/phpunit": "4.8.*",
24 | "johnkary/phpunit-speedtrap": "^1.0",
25 | "mikey179/vfsStream": "~1.6",
26 | "phploc/phploc": "2.*",
27 | "sebastian/phpcpd": "2.*",
28 | "phpdocumentor/reflection-docblock": "^2.0"
29 | },
30 | "autoload": {
31 | "psr-4": {
32 | "think\\": "library/think"
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/log/driver/Test.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\log\driver;
13 |
14 | /**
15 | * 模拟测试输出
16 | */
17 | class Test
18 | {
19 | /**
20 | * 日志写入接口
21 | * @access public
22 | * @param array $log 日志信息
23 | * @return bool
24 | */
25 | public function save(array $log = [])
26 | {
27 | return true;
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/php/application/admin/model/Group.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\admin\model;
9 |
10 | use app\admin\model\Common;
11 |
12 | class Group extends Common
13 | {
14 | /**
15 | * 为了数据库的整洁,同时又不影响Model和Controller的名称
16 | * 我们约定每个模块的数据表都加上相同的前缀,比如微信模块用weixin作为数据表前缀
17 | */
18 | protected $name = 'admin_group';
19 |
20 | /**
21 | * [getDataList 获取列表]
22 | * @linchuangbin
23 | * @DateTime 2017-02-10T21:07:18+0800
24 | * @return [array]
25 | */
26 | public function getDataList()
27 | {
28 | $cat = new \com\Category('admin_group', array('id', 'pid', 'title', 'title'));
29 | $data = $cat->getList('', 0, 'id');
30 |
31 | return $data;
32 | }
33 | }
--------------------------------------------------------------------------------
/php/application/admin/model/Structure.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\admin\model;
9 |
10 | use app\admin\model\Common;
11 |
12 | class Structure extends Common
13 | {
14 |
15 | /**
16 | * 为了数据库的整洁,同时又不影响Model和Controller的名称
17 | * 我们约定每个模块的数据表都加上相同的前缀,比如微信模块用weixin作为数据表前缀
18 | */
19 | protected $name = 'admin_structure';
20 | /**
21 | * [getDataList 获取列表]
22 | * @linchuangbin
23 | * @DateTime 2017-02-10T21:07:18+0800
24 | * @return [array]
25 | */
26 | public function getDataList()
27 | {
28 | $cat = new \com\Category('admin_structure', array('id', 'pid', 'name', 'title'));
29 | $data = $cat->getList('', 0, 'id');
30 |
31 | return $data;
32 | }
33 |
34 | }
--------------------------------------------------------------------------------
/php/thinkphp/tpl/default_index.tpl:
--------------------------------------------------------------------------------
1 | *{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px } :)
ThinkPHP V5
十年磨一剑 - 为API开发设计的高性能框架
[ V5.0 版本由 七牛云 独家赞助发布 ] ';
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/frontEnd/build/build.js:
--------------------------------------------------------------------------------
1 | // https://github.com/shelljs/shelljs
2 | require('./check-versions')()
3 | require('shelljs/global')
4 | env.NODE_ENV = 'production'
5 |
6 | var path = require('path')
7 | var config = require('../config')
8 | var ora = require('ora')
9 | var webpack = require('webpack')
10 | var webpackConfig = require('./webpack.prod.conf')
11 |
12 | console.log(
13 | ' Tip:\n' +
14 | ' Built files are meant to be served over an HTTP server.\n' +
15 | ' Opening index.html over file:// won\'t work.\n'
16 | )
17 |
18 | var spinner = ora('building for production...')
19 | spinner.start()
20 |
21 | var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
22 | rm('-rf', assetsPath)
23 | mkdir('-p', assetsPath)
24 | cp('-R', 'static/*', assetsPath)
25 |
26 | webpack(webpackConfig, function (err, stats) {
27 | spinner.stop()
28 | if (err) throw err
29 | process.stdout.write(stats.toString({
30 | colors: true,
31 | modules: false,
32 | children: false,
33 | chunks: false,
34 | chunkModules: false
35 | }) + '\n')
36 | })
37 |
--------------------------------------------------------------------------------
/php/application/tags.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | // 应用行为扩展定义文件
13 | return [
14 | // 应用初始化
15 | 'app_init' => [
16 | 'app\\common\\behavior\\InitConfigBehavior'
17 | ],
18 | // 应用开始
19 | 'app_begin' => [],
20 | // 模块初始化
21 | 'module_init' => [],
22 | // 操作开始执行
23 | 'action_begin' => [],
24 | // 视图内容过滤
25 | 'view_filter' => [],
26 | // 日志写入
27 | 'log_write' => [],
28 | // 应用结束
29 | 'app_end' => [],
30 | ];
31 |
--------------------------------------------------------------------------------
/php/application/common.php:
--------------------------------------------------------------------------------
1 | $code,
23 | 'data' => $array['data'],
24 | 'error' => $array['error']
25 | ];
26 | }
27 |
28 | /**
29 | * 调试方法
30 | * @param array $data [description]
31 | */
32 | function p($data,$die=1)
33 | {
34 | echo "";
35 | print_r($data);
36 | echo "
";
37 | if ($die) die;
38 | }
39 |
40 | /**
41 | * 用户密码加密方法
42 | * @param string $str 加密的字符串
43 | * @param [type] $auth_key 加密符
44 | * @return string 加密后长度为32的字符串
45 | */
46 | function user_md5($str, $auth_key = '')
47 | {
48 | return '' === $str ? '' : md5(sha1($str) . $auth_key);
49 | }
50 |
51 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/exception/HttpResponseException.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\exception;
13 |
14 | use think\Response;
15 |
16 | class HttpResponseException extends \RuntimeException
17 | {
18 | /**
19 | * @var Response
20 | */
21 | protected $response;
22 |
23 | public function __construct(Response $response)
24 | {
25 | $this->response = $response;
26 | }
27 |
28 | public function getResponse()
29 | {
30 | return $this->response;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/php/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "topthink/think",
3 | "description": "the new thinkphp framework",
4 | "type": "project",
5 | "keywords": [
6 | "framework",
7 | "thinkphp",
8 | "ORM"
9 | ],
10 | "homepage": "http://thinkphp.cn/",
11 | "license": "Apache-2.0",
12 | "authors": [
13 | {
14 | "name": "liu21st",
15 | "email": "liu21st@gmail.com"
16 | }
17 | ],
18 | "require": {
19 | "php": ">=5.4.0",
20 | "topthink/framework": "^5.0",
21 | "topthink/think-mongo": "^1.0",
22 | "topthink/think-image": "^1.0",
23 | "topthink/think-testing": "^1.0",
24 | "topthink/think-sae": "^1.0",
25 | "topthink/think-queue": "^1.0",
26 | "topthink/think-migration": "^1.0"
27 | },
28 | "extra": {
29 | "think-path": "thinkphp"
30 | },
31 | "config": {
32 | "preferred-install": "dist"
33 | },
34 | "repositories": {
35 | "packagist": {
36 | "type": "composer",
37 | "url": "https://packagist.phpcomposer.com"
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2004-2016 Fabien Potencier
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is furnished
8 | to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/output/driver/Nothing.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\console\output\driver;
13 |
14 | use think\console\Output;
15 |
16 | class Nothing
17 | {
18 |
19 | public function __construct(Output $output)
20 | {
21 | // do nothing
22 | }
23 |
24 | public function write($messages, $newline = false, $options = Output::OUTPUT_NORMAL)
25 | {
26 | // do nothing
27 | }
28 |
29 | public function renderException(\Exception $e)
30 | {
31 | // do nothing
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/php/thinkphp/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 |
3 | language: php
4 |
5 | services:
6 | - memcached
7 | - mongodb
8 | - mysql
9 | - postgresql
10 | - redis-server
11 |
12 | matrix:
13 | fast_finish: true
14 | include:
15 | - php: 5.4
16 | - php: 5.5
17 | - php: 5.6
18 | - php: 7.0
19 | - php: hhvm
20 | allow_failures:
21 | - php: hhvm
22 |
23 | cache:
24 | directories:
25 | - $HOME/.composer/cache
26 |
27 | before_install:
28 | - composer self-update
29 | - mysql -e "create database IF NOT EXISTS test;" -uroot
30 | - psql -c 'DROP DATABASE IF EXISTS test;' -U postgres
31 | - psql -c 'create database test;' -U postgres
32 |
33 | install:
34 | - ./tests/script/install.sh
35 |
36 | script:
37 | ## LINT
38 | - find . -path ./vendor -prune -o -type f -name \*.php -exec php -l {} \;
39 | ## PHP Copy/Paste Detector
40 | - vendor/bin/phpcpd --verbose --exclude vendor ./ || true
41 | ## PHPLOC
42 | - vendor/bin/phploc --exclude vendor ./
43 | ## PHPUNIT
44 | - vendor/bin/phpunit --coverage-clover=coverage.xml --configuration=phpunit.xml
45 |
46 | after_success:
47 | - bash <(curl -s https://codecov.io/bash)
48 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/exception/ClassNotFoundException.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\exception;
13 |
14 | class ClassNotFoundException extends \RuntimeException
15 | {
16 | protected $class;
17 | public function __construct($message, $class = '')
18 | {
19 | $this->message = $message;
20 | $this->class = $class;
21 | }
22 |
23 | /**
24 | * 获取类名
25 | * @access public
26 | * @return string
27 | */
28 | public function getClass()
29 | {
30 | return $this->class;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/Env.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think;
13 |
14 | class Env
15 | {
16 | /**
17 | * 获取环境变量值
18 | * @param string $name 环境变量名(支持二级 .号分割)
19 | * @param string $default 默认值
20 | * @return mixed
21 | */
22 | public static function get($name, $default = null)
23 | {
24 | $result = getenv(ENV_PREFIX . strtoupper(str_replace('.', '_', $name)));
25 | if (false !== $result) {
26 | return $result;
27 | } else {
28 | return $default;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/exception/TemplateNotFoundException.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\exception;
13 |
14 | class TemplateNotFoundException extends \RuntimeException
15 | {
16 | protected $template;
17 |
18 | public function __construct($message, $template = '')
19 | {
20 | $this->message = $message;
21 | $this->template = $template;
22 | }
23 |
24 | /**
25 | * 获取模板文件
26 | * @access public
27 | * @return string
28 | */
29 | public function getTemplate()
30 | {
31 | return $this->template;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/exception/ValidateException.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\exception;
13 |
14 | class ValidateException extends \RuntimeException
15 | {
16 | protected $error;
17 |
18 | public function __construct($error)
19 | {
20 | $this->error = $error;
21 | $this->message = is_array($error) ? implode("\n\r", $error) : $error;
22 | }
23 |
24 | /**
25 | * 获取验证错误信息
26 | * @access public
27 | * @return array|string
28 | */
29 | public function getError()
30 | {
31 | return $this->error;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/model/Pivot.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\model;
13 |
14 | use think\Model;
15 |
16 | class Pivot extends Model
17 | {
18 |
19 | /**
20 | * 架构函数
21 | * @access public
22 | * @param array|object $data 数据
23 | * @param string $table 中间数据表名
24 | */
25 | public function __construct($data = [], $table = '')
26 | {
27 | if (is_object($data)) {
28 | $this->data = get_object_vars($data);
29 | } else {
30 | $this->data = $data;
31 | }
32 |
33 | $this->table = $table;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/config/driver/Xml.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\config\driver;
13 |
14 | class Xml
15 | {
16 | public function parse($config)
17 | {
18 | if (is_file($config)) {
19 | $content = simplexml_load_file($config);
20 | } else {
21 | $content = simplexml_load_string($config);
22 | }
23 | $result = (array) $content;
24 | foreach ($result as $key => $val) {
25 | if (is_object($val)) {
26 | $result[$key] = (array) $val;
27 | }
28 | }
29 | return $result;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/php/application/admin/controller/Upload.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 | namespace app\admin\controller;
8 |
9 | use think\Request;
10 | use think\Controller;
11 |
12 | class Upload extends Controller
13 | {
14 | public function index()
15 | {
16 |
17 | header('Access-Control-Allow-Origin: *');
18 | header('Access-Control-Allow-Methods: POST');
19 | header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
20 | $file = request()->file('file');
21 | if (!$file) {
22 | return resultArray(['error' => '请上传文件']);
23 | }
24 |
25 | $info = $file->validate(['ext'=>'jpg,png,gif'])->move(ROOT_PATH . DS . 'uploads');
26 | if ($info) {
27 | return resultArray(['data' => 'uploads'. DS .$info->getSaveName()]);
28 | }
29 |
30 | return resultArray(['error' => $file->getError()]);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/php/application/admin/model/Post.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\admin\model;
9 |
10 | use app\admin\model\Common;
11 |
12 | class Post extends Common
13 | {
14 |
15 | /**
16 | * 为了数据库的整洁,同时又不影响Model和Controller的名称
17 | * 我们约定每个模块的数据表都加上相同的前缀,比如微信模块用weixin作为数据表前缀
18 | */
19 | protected $name = 'admin_post';
20 | protected $createTime = 'create_time';
21 | protected $updateTime = false;
22 | protected $autoWriteTimestamp = true;
23 | protected $insert = [
24 | 'status' => 1,
25 | ];
26 |
27 | /**
28 | * [getDataList 获取列表]
29 | * @linchuangbin
30 | * @DateTime 2017-02-10T21:07:18+0800
31 | * @return [array]
32 | */
33 | public function getDataList($keywords)
34 | {
35 | $map = [];
36 | if ($param['keywords']) {
37 | $map['name'] = ['like', '%'.$keywords.'%'];
38 | }
39 | $data = $this->where($map)->select();
40 | return $data;
41 | }
42 | }
--------------------------------------------------------------------------------
/php/runtime/cache/70/07ab3cc418e68745bd911eec958ef7.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/frontEnd/config/index.js:
--------------------------------------------------------------------------------
1 | // see http://vuejs-templates.github.io/webpack for documentation.
2 | var path = require('path')
3 |
4 | module.exports = {
5 | build: {
6 | env: require('./prod.env'),
7 | index: path.resolve(__dirname, '../dist/index.html'),
8 | assetsRoot: path.resolve(__dirname, '../dist'),
9 | assetsSubDirectory: 'static',
10 | assetsPublicPath: '/',
11 | productionSourceMap: true,
12 | // Gzip off by default as many popular static hosts such as
13 | // Surge or Netlify already gzip all static assets for you.
14 | // Before setting to `true`, make sure to:
15 | // npm install --save-dev compression-webpack-plugin
16 | productionGzip: false,
17 | productionGzipExtensions: ['js', 'css']
18 | },
19 | dev: {
20 | env: require('./dev.env'),
21 | port: 8080,
22 | assetsSubDirectory: 'static',
23 | assetsPublicPath: '/',
24 | proxyTable: {},
25 | // CSS Sourcemaps off by default because relative paths are "buggy"
26 | // with this option, according to the CSS-Loader README
27 | // (https://github.com/webpack/css-loader#sourcemaps)
28 | // In our experience, they generally work as expected,
29 | // just be aware of this issue when enabling this option.
30 | cssSourceMap: false
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/frontEnd/build/webpack.dev.conf.js:
--------------------------------------------------------------------------------
1 | var config = require('../config')
2 | var webpack = require('webpack')
3 | var merge = require('webpack-merge')
4 | var utils = require('./utils')
5 | var baseWebpackConfig = require('./webpack.base.conf')
6 | var HtmlWebpackPlugin = require('html-webpack-plugin')
7 |
8 | // add hot-reload related code to entry chunks
9 | Object.keys(baseWebpackConfig.entry).forEach(function (name) {
10 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
11 | })
12 |
13 |
14 | module.exports = merge(baseWebpackConfig, {
15 | module: {
16 | loaders: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
17 | },
18 | // eval-source-map is faster for development
19 | devtool: '#eval-source-map',
20 | plugins: [
21 | new webpack.DefinePlugin({
22 | 'process.env': config.dev.env
23 | }),
24 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
25 | new webpack.optimize.OccurenceOrderPlugin(),
26 | new webpack.HotModuleReplacementPlugin(),
27 | new webpack.NoErrorsPlugin(),
28 | // https://github.com/ampedandwired/html-webpack-plugin
29 | new HtmlWebpackPlugin({
30 | filename: 'index.html',
31 | template: 'index.html',
32 | inject: true
33 | })
34 | ]
35 | })
36 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/command/make/Model.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\console\command\make;
13 |
14 | use think\console\command\Make;
15 |
16 | class Model extends Make
17 | {
18 | protected $type = "Model";
19 |
20 | protected function configure()
21 | {
22 | parent::configure();
23 | $this->setName('make:model')
24 | ->setDescription('Create a new model class');
25 | }
26 |
27 | protected function getStub()
28 | {
29 | return __DIR__ . '/stubs/model.stub';
30 | }
31 |
32 | protected function getNamespace($appNamespace, $module)
33 | {
34 | return parent::getNamespace($appNamespace, $module) . '\model';
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/php/thinkphp/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 | ./tests/thinkphp/
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | ./
23 |
24 | tests
25 | vendor
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/db/exception/BindParamException.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\db\exception;
13 |
14 | use think\exception\DbException;
15 |
16 | /**
17 | * PDO参数绑定异常
18 | */
19 | class BindParamException extends DbException
20 | {
21 |
22 | /**
23 | * BindParamException constructor.
24 | * @param string $message
25 | * @param array $config
26 | * @param string $sql
27 | * @param array $bind
28 | * @param int $code
29 | */
30 | public function __construct($message, $config, $sql, $bind, $code = 10502)
31 | {
32 | $this->setData('Bind Param', $bind);
33 | parent::__construct($message, $config, $sql, $code);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/exception/HttpException.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\exception;
13 |
14 | class HttpException extends \RuntimeException
15 | {
16 | private $statusCode;
17 | private $headers;
18 |
19 | public function __construct($statusCode, $message = null, \Exception $previous = null, array $headers = [], $code = 0)
20 | {
21 | $this->statusCode = $statusCode;
22 | $this->headers = $headers;
23 |
24 | parent::__construct($message, $code, $previous);
25 | }
26 |
27 | public function getStatusCode()
28 | {
29 | return $this->statusCode;
30 | }
31 |
32 | public function getHeaders()
33 | {
34 | return $this->headers;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/php/application/admin/model/Rule.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\admin\model;
9 |
10 | use app\admin\model\Common;
11 |
12 | class Rule extends Common
13 | {
14 |
15 | /**
16 | * 为了数据库的整洁,同时又不影响Model和Controller的名称
17 | * 我们约定每个模块的数据表都加上相同的前缀,比如微信模块用weixin作为数据表前缀
18 | */
19 | protected $name = 'admin_rule';
20 | /**
21 | * [getDataList 获取列表]
22 | * @linchuangbin
23 | * @DateTime 2017-02-10T21:07:18+0800
24 | * @param string $type [是否为树状结构]
25 | * @return [array]
26 | */
27 | public function getDataList($type = '')
28 | {
29 | $cat = new \com\Category('admin_rule', array('id', 'pid', 'title', 'title'));
30 | $data = $cat->getList('', 0, 'id');
31 | // 若type为tree,则返回树状结构
32 | if ($type == 'tree') {
33 | foreach ($data as $k => $v) {
34 | $data[$k]['check'] = false;
35 | }
36 | $tree = new \com\Tree();
37 | $data = $tree->list_to_tree($data, 'id', 'pid', 'child', 0, true, array('pid'));
38 | }
39 |
40 | return $data;
41 | }
42 |
43 | }
--------------------------------------------------------------------------------
/frontEnd/build/check-versions.js:
--------------------------------------------------------------------------------
1 | var semver = require('semver')
2 | var chalk = require('chalk')
3 | var packageConfig = require('../package.json')
4 | var exec = function (cmd) {
5 | return require('child_process')
6 | .execSync(cmd).toString().trim()
7 | }
8 |
9 | var versionRequirements = [
10 | {
11 | name: 'node',
12 | currentVersion: semver.clean(process.version),
13 | versionRequirement: packageConfig.engines.node
14 | },
15 | {
16 | name: 'npm',
17 | currentVersion: exec('npm --version'),
18 | versionRequirement: packageConfig.engines.npm
19 | }
20 | ]
21 |
22 | module.exports = function () {
23 | var warnings = []
24 | for (var i = 0; i < versionRequirements.length; i++) {
25 | var mod = versionRequirements[i]
26 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
27 | warnings.push(mod.name + ': ' +
28 | chalk.red(mod.currentVersion) + ' should be ' +
29 | chalk.green(mod.versionRequirement)
30 | )
31 | }
32 | }
33 |
34 | if (warnings.length) {
35 | console.log('')
36 | console.log(chalk.yellow('To use this template, you must update following to modules:'))
37 | console.log()
38 | for (var i = 0; i < warnings.length; i++) {
39 | var warning = warnings[i]
40 | console.log(' ' + warning)
41 | }
42 | console.log()
43 | process.exit(1)
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/php/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
3 | 版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn)
4 | All rights reserved。
5 | ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
6 |
7 | Apache Licence是著名的非盈利开源组织Apache采用的协议。
8 | 该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
9 | 允许代码修改,再作为开源或商业软件发布。需要满足
10 | 的条件:
11 | 1. 需要给代码的用户一份Apache Licence ;
12 | 2. 如果你修改了代码,需要在被修改的文件中说明;
13 | 3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
14 | 带有原来代码中的协议,商标,专利声明和其他原来作者规
15 | 定需要包含的说明;
16 | 4. 如果再发布的产品中包含一个Notice文件,则在Notice文
17 | 件中需要带有本协议内容。你可以在Notice中增加自己的
18 | 许可,但不可以表现为对Apache Licence构成更改。
19 | 具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
20 |
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 | POSSIBILITY OF SUCH DAMAGE.
33 |
--------------------------------------------------------------------------------
/php/thinkphp/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
3 | 版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn)
4 | All rights reserved。
5 | ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
6 |
7 | Apache Licence是著名的非盈利开源组织Apache采用的协议。
8 | 该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
9 | 允许代码修改,再作为开源或商业软件发布。需要满足
10 | 的条件:
11 | 1. 需要给代码的用户一份Apache Licence ;
12 | 2. 如果你修改了代码,需要在被修改的文件中说明;
13 | 3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
14 | 带有原来代码中的协议,商标,专利声明和其他原来作者规
15 | 定需要包含的说明;
16 | 4. 如果再发布的产品中包含一个Notice文件,则在Notice文
17 | 件中需要带有本协议内容。你可以在Notice中增加自己的
18 | 许可,但不可以表现为对Apache Licence构成更改。
19 | 具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
20 |
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 | POSSIBILITY OF SUCH DAMAGE.
33 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/db/exception/ModelNotFoundException.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\db\exception;
13 |
14 | use think\exception\DbException;
15 |
16 | class ModelNotFoundException extends DbException
17 | {
18 | protected $model;
19 |
20 | /**
21 | * 构造方法
22 | * @param string $message
23 | * @param string $model
24 | */
25 | public function __construct($message, $model = '', array $config = [])
26 | {
27 | $this->message = $message;
28 | $this->model = $model;
29 |
30 | $this->setData('Database Config', $config);
31 | }
32 |
33 | /**
34 | * 获取模型类名
35 | * @access public
36 | * @return string
37 | */
38 | public function getModel()
39 | {
40 | return $this->model;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/frontEnd/src/components/Common/leftMenu.vue:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
{{secMenu.title}}
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/php/application/common/adapter/AuthAdapter.php:
--------------------------------------------------------------------------------
1 | auth_key = $auth_key;
17 | }
18 |
19 | //实例化权限类
20 | public static function getInstance($auth_key)
21 | {
22 | if (!(self::$_instance instanceof HonrayAuth)) {
23 | self::$_instance = new HonrayAuth($auth_key);
24 | }
25 | return self::$_instance;
26 | }
27 | //登录认证
28 | public function checkLogin($names, $uid, $relation='or')
29 | {
30 | self::getInstance($this->auth_key)->_config['AUTH_TYPE'] = 2;
31 | if ($uid == 1){
32 | return true;
33 | }
34 | if (!self::getInstance($this->auth_key)->check($names, $uid, $relation)) {
35 | return false;
36 | } else {
37 | return true;
38 | }
39 | }
40 | //实时认证
41 | public function checkIntime($names, $uid, $relation='or')
42 | {
43 | self::getInstance($this->auth_key)->_config['AUTH_TYPE'] = 1;
44 | if ($uid == 1) {
45 | return true;
46 | }
47 | if (!self::getInstance($this->auth_key)->check($names, $uid, $relation)) {
48 | return false;
49 | } else {
50 | return true;
51 | }
52 | }
53 | //更新缓存auth_list
54 | public function updateCacheAuth()
55 | {
56 | $res = self::getInstance($this->auth_key)->updateCacheAuth();
57 | return $res;
58 | }
59 | }
--------------------------------------------------------------------------------
/frontEnd/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
16 |
17 |
--------------------------------------------------------------------------------
/frontEnd/src/assets/js/global.js:
--------------------------------------------------------------------------------
1 | const commonFn = {
2 | j2s(obj) {
3 | return JSON.stringify(obj)
4 | },
5 | shallowRefresh(name) {
6 | router.replace({ path: '/refresh', query: { name: name }})
7 | },
8 | closeGlobalLoading() {
9 | setTimeout(() => {
10 | store.dispatch('showLoading', false)
11 | }, 0)
12 | },
13 | openGlobalLoading() {
14 | setTimeout(() => {
15 | store.dispatch('showLoading', true)
16 | }, 0)
17 | },
18 | cloneJson(obj) {
19 | return JSON.parse(JSON.stringify(obj))
20 | },
21 | toastMsg(type, msg) {
22 | switch (type) {
23 | case 'normal':
24 | bus.$message(msg)
25 | break
26 | case 'success':
27 | bus.$message({
28 | message: msg,
29 | type: 'success'
30 | })
31 | break
32 | case 'warning':
33 | bus.$message({
34 | message: msg,
35 | type: 'warning'
36 | })
37 | break
38 | case 'error':
39 | bus.$message.error(msg)
40 | break
41 | }
42 | },
43 | clearVuex(cate) {
44 | store.dispatch(cate, [])
45 | },
46 | getHasRule(val) {
47 | const moduleRule = 'admin'
48 | let userInfo = Lockr.get('userInfo')
49 | if (userInfo.id == 1) {
50 | return true
51 | } else {
52 | let authList = moduleRule + Lockr.get('authList')
53 | return _.includes(authList, val)
54 | }
55 | }
56 | }
57 |
58 | export default commonFn
59 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/db/exception/DataNotFoundException.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\db\exception;
13 |
14 | use think\exception\DbException;
15 |
16 | class DataNotFoundException extends DbException
17 | {
18 | protected $table;
19 |
20 | /**
21 | * DbException constructor.
22 | * @param string $message
23 | * @param string $table
24 | * @param array $config
25 | */
26 | public function __construct($message, $table = '', array $config = [])
27 | {
28 | $this->message = $message;
29 | $this->table = $table;
30 |
31 | $this->setData('Database Config', $config);
32 | }
33 |
34 | /**
35 | * 获取数据表名
36 | * @access public
37 | * @return string
38 | */
39 | public function getTable()
40 | {
41 | return $this->table;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/php/application/admin/model/SystemConfig.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\admin\model;
9 |
10 | use think\Model;
11 |
12 | class SystemConfig extends Model
13 | {
14 |
15 | /**
16 | * 获取配置列表
17 | * @param array $param [description]
18 | */
19 | public function getDataList()
20 | {
21 | $list = $this->select();
22 | $data = array();
23 | foreach ($list as $key => $val) {
24 | $data[$val['name']] = $val['value'];
25 | }
26 | return $data;
27 | }
28 |
29 | /**
30 | * 批量修改配置
31 | * @param array $param [description]
32 | */
33 | public function createData($param)
34 | {
35 | $list = [
36 | ['id' => 1, 'value' => $param['SYSTEM_NAME']],
37 | ['id' => 2, 'value' => $param['SYSTEM_LOGO']],
38 | ['id' => 3, 'value' => $param['LOGIN_SESSION_VALID']],
39 | ['id' => 4, 'value' => $param['IDENTIFYING_CODE']],
40 | ['id' => 5, 'value' => $param['LOGO_TYPE']],
41 | ];
42 | if ($this->saveAll($list)) {
43 | $data = $this->getDataList();
44 | cache('DB_CONFIG_DATA', $data, 3600);
45 | return $data;
46 | }
47 | $this->error = '更新失败';
48 | return false;
49 | }
50 | }
--------------------------------------------------------------------------------
/php/application/common/controller/Common.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\common\controller;
9 |
10 | use think\Controller;
11 | use think\Request;
12 |
13 | class Common extends Controller
14 | {
15 | public $param;
16 | public function _initialize()
17 | {
18 | parent::_initialize();
19 | /*防止跨域*/
20 | header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']);
21 | header('Access-Control-Allow-Credentials: true');
22 | header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
23 | header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, authKey, sessionId");
24 | $param = Request::instance()->param();
25 | $this->param = $param;
26 | }
27 |
28 | public function object_array($array)
29 | {
30 | if (is_object($array)) {
31 | $array = (array)$array;
32 | }
33 | if (is_array($array)) {
34 | foreach ($array as $key=>$value) {
35 | $array[$key] = $this->object_array($value);
36 | }
37 | }
38 | return $array;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/exception/DbException.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\exception;
13 |
14 | use think\Exception;
15 |
16 | /**
17 | * Database相关异常处理类
18 | */
19 | class DbException extends Exception
20 | {
21 | /**
22 | * DbException constructor.
23 | * @param string $message
24 | * @param array $config
25 | * @param string $sql
26 | * @param int $code
27 | */
28 | public function __construct($message, array $config, $sql, $code = 10500)
29 | {
30 | $this->message = $message;
31 | $this->code = $code;
32 |
33 | $this->setData('Database Status', [
34 | 'Error Code' => $code,
35 | 'Error Message' => $message,
36 | 'Error SQL' => $sql,
37 | ]);
38 |
39 | $this->setData('Database Config', $config);
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/frontEnd/README.md:
--------------------------------------------------------------------------------
1 | # VueThink
2 | ### 简介
3 | ```
4 | VueThink是一套基于Vue全家桶(Vue2.x + Vue-router2.x + Vuex)+ Thinkphp的前后端分离框架。
5 | 脚手架构建也可以通过vue官方的vue-cli脚手架工具构建
6 | 实现了一般后台所需要的功能模块
7 |
8 | * 登录、退出登录
9 | * 修改密码、记住密码
10 | * 菜单管理
11 | * 系统参数
12 | * 权限节点
13 | * 岗位管理
14 | * 部门管理
15 | * 用户组管理
16 | * 用户管理
17 | ```
18 |
19 | ### 开发依赖
20 | * vue
21 | * element-ui@1.1.3
22 | * axios
23 | * fontawesome
24 | * js-cookie
25 | * lockr
26 | * lodash
27 | * moment
28 |
29 |
30 | ### 数据交互
31 | 数据交互通过axios以及RESTful架构来实现
32 |
33 | 用户校验通过登录返回的auth_key放在header
34 |
35 | 值得注意的一点是:跨域的情况下,会有预请求OPTION的情况
36 |
37 | 附上接口文档:
38 |
39 |
40 | ### 前端部署
41 | ```
42 | 部署前准备
43 | 1.安装node.js
44 | 前端部分是基于node.js上运行的,所以必须先安装node.js,版本要求为6.9.0以上(推荐安装官方推荐版本),下载地址:https://nodejs.org/zh-cn/
45 | 2.程序运行之前需搭建好Server端
46 | vueThink的后端搭建请参考这里(https://github.com/honraytech/VueThink/tree/master/php),此处不再多述。
47 |
48 | 完成以上两个步骤之后,我们进入到frontEnd这个目录,然后按顺序执行以下两行代码就可以愉快地玩耍了。
49 | npm install
50 | npm run dev
51 |
52 | 注意:前端服务启动,默认会占用8080端口,所以在启动前端服务之前,请确认8080端口没有被占用。
53 | 如果想替换前端默认端口,可修改config/index.js里面的dev对象的port参数,但不建议这么做。
54 | 另外接口请求本地服务的端口是80端口,如果配置后端服务的时候启动的不是80端口,可在build/webpack.base.conf.js里修改DEV_HOST(开发环境请求地址)。
55 | ```
56 |
--------------------------------------------------------------------------------
/php/config/database.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 | return [
8 | // 数据库类型
9 | 'type' => 'mysql',
10 | // 服务器地址
11 | 'hostname' => '127.0.0.1',
12 | // 数据库名
13 | 'database' => 'vuethink',
14 | // 用户名
15 | 'username' => 'root',
16 | // 密码
17 | 'password' => 'root',
18 | // 端口
19 | 'hostport' => '3306',
20 | // 连接dsn
21 | 'dsn' => '',
22 | // 数据库连接参数
23 | 'params' => [],
24 | // 数据库编码默认采用utf8
25 | 'charset' => 'utf8',
26 | // 数据库表前缀
27 | 'prefix' => 'oa_',
28 | // 数据库调试模式
29 | 'debug' => true,
30 | // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
31 | 'deploy' => 0,
32 | // 数据库读写是否分离 主从式有效
33 | 'rw_separate' => false,
34 | // 读写分离后 主服务器数量
35 | 'master_num' => 1,
36 | // 指定从服务器序号
37 | 'slave_no' => '',
38 | // 是否严格检查字段是否存在
39 | 'fields_strict' => true,
40 | // 数据集返回类型 array 数组 collection Collection对象
41 | 'resultset_type' => 'array',
42 | // 是否自动写入时间戳字段
43 | 'auto_timestamp' => false,
44 | // 是否需要进行SQL性能分析
45 | 'sql_explain' => false,
46 | // 时间字段是否自动格式化输出
47 | 'datetime_format' => false,
48 | ];
49 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/controller/Yar.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\controller;
13 |
14 | /**
15 | * ThinkPHP Yar控制器类
16 | */
17 | abstract class Yar
18 | {
19 |
20 | /**
21 | * 架构函数
22 | * @access public
23 | */
24 | public function __construct()
25 | {
26 | //控制器初始化
27 | if (method_exists($this, '_initialize')) {
28 | $this->_initialize();
29 | }
30 |
31 | //判断扩展是否存在
32 | if (!extension_loaded('yar')) {
33 | throw new \Exception('not support yar');
34 | }
35 |
36 | //实例化Yar_Server
37 | $server = new \Yar_Server($this);
38 | // 启动server
39 | $server->handle();
40 | }
41 |
42 | /**
43 | * 魔术方法 有不存在的操作的时候执行
44 | * @access public
45 | * @param string $method 方法名
46 | * @param array $args 参数
47 | * @return mixed
48 | */
49 | public function __call($method, $args)
50 | {}
51 | }
52 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/exception/PDOException.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\exception;
13 |
14 | /**
15 | * PDO异常处理类
16 | * 重新封装了系统的\PDOException类
17 | */
18 | class PDOException extends DbException
19 | {
20 | /**
21 | * PDOException constructor.
22 | * @param \PDOException $exception
23 | * @param array $config
24 | * @param string $sql
25 | * @param int $code
26 | */
27 | public function __construct(\PDOException $exception, array $config, $sql, $code = 10501)
28 | {
29 | $error = $exception->errorInfo;
30 |
31 | $this->setData('PDO Error Info', [
32 | 'SQLSTATE' => $error[0],
33 | 'Driver Error Code' => isset($error[1]) ? $error[1] : 0,
34 | 'Driver Error Message' => isset($error[2]) ? $error[2] : '',
35 | ]);
36 |
37 | parent::__construct($exception->getMessage(), $config, $sql, $code);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/output/driver/Buffer.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\console\output\driver;
13 |
14 | use think\console\Output;
15 |
16 | class Buffer
17 | {
18 | /**
19 | * @var string
20 | */
21 | private $buffer = '';
22 |
23 | public function __construct(Output $output)
24 | {
25 | // do nothing
26 | }
27 |
28 | public function fetch()
29 | {
30 | $content = $this->buffer;
31 | $this->buffer = '';
32 | return $content;
33 | }
34 |
35 | public function write($messages, $newline = false, $options = Output::OUTPUT_NORMAL)
36 | {
37 | $messages = (array) $messages;
38 |
39 | foreach ($messages as $message) {
40 | $this->buffer .= $message;
41 | }
42 | if ($newline) {
43 | $this->buffer .= "\n";
44 | }
45 | }
46 |
47 | public function renderException(\Exception $e)
48 | {
49 | // do nothing
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/command/make/stubs/controller.stub:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace traits\think;
13 |
14 | use think\Exception;
15 |
16 | trait Instance
17 | {
18 | protected static $instance = null;
19 |
20 | /**
21 | * @param array $options
22 | * @return static
23 | */
24 | public static function instance($options = [])
25 | {
26 | if (is_null(self::$instance)) {
27 | self::$instance = new self($options);
28 | }
29 | return self::$instance;
30 | }
31 |
32 | // 静态调用
33 | public static function __callStatic($method, $params)
34 | {
35 | if (is_null(self::$instance)) {
36 | self::$instance = new self();
37 | }
38 | $call = substr($method, 1);
39 | if (0 === strpos($method, '_') && is_callable([self::$instance, $call])) {
40 | return call_user_func_array([self::$instance, $call], $params);
41 | } else {
42 | throw new Exception("method not exists:" . $method);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/Exception.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think;
13 |
14 | class Exception extends \Exception
15 | {
16 |
17 | /**
18 | * 保存异常页面显示的额外Debug数据
19 | * @var array
20 | */
21 | protected $data = [];
22 |
23 | /**
24 | * 设置异常额外的Debug数据
25 | * 数据将会显示为下面的格式
26 | *
27 | * Exception Data
28 | * --------------------------------------------------
29 | * Label 1
30 | * key1 value1
31 | * key2 value2
32 | * Label 2
33 | * key1 value1
34 | * key2 value2
35 | *
36 | * @param string $label 数据分类,用于异常页面显示
37 | * @param array $data 需要显示的数据,必须为关联数组
38 | */
39 | final protected function setData($label, array $data)
40 | {
41 | $this->data[$label] = $data;
42 | }
43 |
44 | /**
45 | * 获取异常额外Debug数据
46 | * 主要用于输出到异常页面便于调试
47 | * @return array 由setData设置的Debug数据
48 | */
49 | final public function getData()
50 | {
51 | return $this->data;
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/process/exception/Failed.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\process\exception;
13 |
14 | use think\Process;
15 |
16 | class Failed extends \RuntimeException
17 | {
18 |
19 | private $process;
20 |
21 | public function __construct(Process $process)
22 | {
23 | if ($process->isSuccessful()) {
24 | throw new \InvalidArgumentException('Expected a failed process, but the given process was successful.');
25 | }
26 |
27 | $error = sprintf('The command "%s" failed.' . "\nExit Code: %s(%s)", $process->getCommandLine(), $process->getExitCode(), $process->getExitCodeText());
28 |
29 | if (!$process->isOutputDisabled()) {
30 | $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s", $process->getOutput(), $process->getErrorOutput());
31 | }
32 |
33 | parent::__construct($error);
34 |
35 | $this->process = $process;
36 | }
37 |
38 | public function getProcess()
39 | {
40 | return $this->process;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/response/Json.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\response;
13 |
14 | use think\Response;
15 |
16 | class Json extends Response
17 | {
18 | // 输出参数
19 | protected $options = [
20 | 'json_encode_param' => JSON_UNESCAPED_UNICODE,
21 | ];
22 |
23 | protected $contentType = 'application/json';
24 |
25 | /**
26 | * 处理数据
27 | * @access protected
28 | * @param mixed $data 要处理的数据
29 | * @return mixed
30 | * @throws \Exception
31 | */
32 | protected function output($data)
33 | {
34 | try {
35 | // 返回JSON数据格式到客户端 包含状态信息
36 | $data = json_encode($data, $this->options['json_encode_param']);
37 |
38 | if ($data === false) {
39 | throw new \InvalidArgumentException(json_last_error_msg());
40 | }
41 |
42 | return $data;
43 | } catch (\Exception $e) {
44 | if ($e->getPrevious()) {
45 | throw $e->getPrevious();
46 | }
47 | throw $e;
48 | }
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/exception/ThrowableError.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\exception;
13 |
14 | class ThrowableError extends \ErrorException
15 | {
16 | public function __construct(\Throwable $e)
17 | {
18 |
19 | if ($e instanceof \ParseError) {
20 | $message = 'Parse error: ' . $e->getMessage();
21 | $severity = E_PARSE;
22 | } elseif ($e instanceof \TypeError) {
23 | $message = 'Type error: ' . $e->getMessage();
24 | $severity = E_RECOVERABLE_ERROR;
25 | } else {
26 | $message = 'Fatal error: ' . $e->getMessage();
27 | $severity = E_ERROR;
28 | }
29 |
30 | parent::__construct(
31 | $message,
32 | $e->getCode(),
33 | $severity,
34 | $e->getFile(),
35 | $e->getLine()
36 | );
37 |
38 | $this->setTrace($e->getTrace());
39 | }
40 |
41 | protected function setTrace($trace)
42 | {
43 | $traceReflector = new \ReflectionProperty('Exception', 'trace');
44 | $traceReflector->setAccessible(true);
45 | $traceReflector->setValue($this, $trace);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/command/Clear.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 | namespace think\console\command;
12 |
13 | use think\console\Command;
14 | use think\console\Input;
15 | use think\console\input\Option;
16 | use think\console\Output;
17 |
18 | class Clear extends Command
19 | {
20 | protected function configure()
21 | {
22 | // 指令配置
23 | $this
24 | ->setName('clear')
25 | ->addOption('path', 'd', Option::VALUE_OPTIONAL, 'path to clear', null)
26 | ->setDescription('Clear runtime file');
27 | }
28 |
29 | protected function execute(Input $input, Output $output)
30 | {
31 | $path = $input->getOption('path') ?: RUNTIME_PATH;
32 | $files = scandir($path);
33 | if ($files) {
34 | foreach ($files as $file) {
35 | if ('.' != $file && '..' != $file && is_dir($path . $file)) {
36 | array_map('unlink', glob($path . $file . '/*.*'));
37 | } elseif (is_file($path . $file)) {
38 | unlink($path . $file);
39 | }
40 | }
41 | }
42 | $output->writeln("Clear Successed");
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/command/make/Controller.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\console\command\make;
13 |
14 | use think\Config;
15 | use think\console\command\Make;
16 | use think\console\input\Option;
17 |
18 | class Controller extends Make
19 | {
20 |
21 | protected $type = "Controller";
22 |
23 | protected function configure()
24 | {
25 | parent::configure();
26 | $this->setName('make:controller')
27 | ->addOption('plain', null, Option::VALUE_NONE, 'Generate an empty controller class.')
28 | ->setDescription('Create a new resource controller class');
29 | }
30 |
31 | protected function getStub()
32 | {
33 | if ($this->input->getOption('plain')) {
34 | return __DIR__ . '/stubs/controller.plain.stub';
35 | }
36 |
37 | return __DIR__ . '/stubs/controller.stub';
38 | }
39 |
40 | protected function getClassName($name)
41 | {
42 | return parent::getClassName($name) . (Config::get('controller_suffix') ? ucfirst(Config::get('url_controller_layer')) : '');
43 | }
44 |
45 | protected function getNamespace($appNamespace, $module)
46 | {
47 | return parent::getNamespace($appNamespace, $module) . '\controller';
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/frontEnd/src/main.js:
--------------------------------------------------------------------------------
1 | import 'babel-polyfill'
2 | import Vue from 'vue'
3 | import App from './App'
4 | import axios from 'axios'
5 | import Lockr from 'lockr'
6 | import Cookies from 'js-cookie'
7 | import _ from 'lodash'
8 | import moment from 'moment'
9 | import ElementUI from 'element-ui'
10 | import 'element-ui/lib/theme-default/index.css'
11 | import routes from './routes'
12 | import VueRouter from 'vue-router'
13 | import store from './vuex/store'
14 | import filter from './assets/js/filter'
15 | import _g from './assets/js/global'
16 | import NProgress from 'nprogress'
17 | import 'nprogress/nprogress.css'
18 | import 'assets/css/global.css'
19 | import 'assets/css/base.css'
20 |
21 | axios.defaults.baseURL = HOST
22 | axios.defaults.timeout = 1000 * 15
23 | axios.defaults.headers.authKey = Lockr.get('authKey')
24 | axios.defaults.headers.sessionId = Lockr.get('sessionId')
25 | axios.defaults.headers['Content-Type'] = 'application/json'
26 |
27 | const router = new VueRouter({
28 | mode: 'history',
29 | base: __dirname,
30 | routes
31 | })
32 |
33 | router.beforeEach((to, from, next) => {
34 | const hideLeft = to.meta.hideLeft
35 | store.dispatch('showLeftMenu', hideLeft)
36 | store.dispatch('showLoading', true)
37 | NProgress.start()
38 | next()
39 | })
40 |
41 | router.afterEach(transition => {
42 | NProgress.done()
43 | })
44 |
45 | Vue.use(ElementUI)
46 | Vue.use(VueRouter)
47 |
48 | window.router = router
49 | window.store = store
50 | window.HOST = HOST
51 | window.axios = axios
52 | window._ = _
53 | window.moment = moment
54 | window.Lockr = Lockr
55 | window.Cookies = Cookies
56 | window._g = _g
57 | window.pageSize = 15
58 |
59 | const bus = new Vue()
60 | window.bus = bus
61 |
62 | new Vue({
63 | el: '#app',
64 | template: '',
65 | filters: filter,
66 | router,
67 | store,
68 | components: { App }
69 | // render: h => h(Login)
70 | }).$mount('#app')
71 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/exception/ErrorException.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\exception;
13 |
14 | use think\Exception;
15 |
16 | /**
17 | * ThinkPHP错误异常
18 | * 主要用于封装 set_error_handler 和 register_shutdown_function 得到的错误
19 | * 除开从 think\Exception 继承的功能
20 | * 其他和PHP系统\ErrorException功能基本一样
21 | */
22 | class ErrorException extends Exception
23 | {
24 | /**
25 | * 用于保存错误级别
26 | * @var integer
27 | */
28 | protected $severity;
29 |
30 | /**
31 | * 错误异常构造函数
32 | * @param integer $severity 错误级别
33 | * @param string $message 错误详细信息
34 | * @param string $file 出错文件路径
35 | * @param integer $line 出错行号
36 | * @param array $context 错误上下文,会包含错误触发处作用域内所有变量的数组
37 | */
38 | public function __construct($severity, $message, $file, $line, array $context = [])
39 | {
40 | $this->severity = $severity;
41 | $this->message = $message;
42 | $this->file = $file;
43 | $this->line = $line;
44 | $this->code = 0;
45 |
46 | empty($context) || $this->setData('Error Context', $context);
47 | }
48 |
49 | /**
50 | * 获取错误级别
51 | * @return integer 错误级别
52 | */
53 | final public function getSeverity()
54 | {
55 | return $this->severity;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/output/question/Confirmation.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\console\output\question;
13 |
14 | use think\console\output\Question;
15 |
16 | class Confirmation extends Question
17 | {
18 |
19 | private $trueAnswerRegex;
20 |
21 | /**
22 | * 构造方法
23 | * @param string $question 问题
24 | * @param bool $default 默认答案
25 | * @param string $trueAnswerRegex 验证正则
26 | */
27 | public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
28 | {
29 | parent::__construct($question, (bool) $default);
30 |
31 | $this->trueAnswerRegex = $trueAnswerRegex;
32 | $this->setNormalizer($this->getDefaultNormalizer());
33 | }
34 |
35 | /**
36 | * 获取默认的答案回调
37 | * @return callable
38 | */
39 | private function getDefaultNormalizer()
40 | {
41 | $default = $this->getDefault();
42 | $regex = $this->trueAnswerRegex;
43 |
44 | return function ($answer) use ($default, $regex) {
45 | if (is_bool($answer)) {
46 | return $answer;
47 | }
48 |
49 | $answerIsTrue = (bool) preg_match($regex, $answer);
50 | if (false === $default) {
51 | return $answer && $answerIsTrue;
52 | }
53 |
54 | return !$answer || $answerIsTrue;
55 | };
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/command/Build.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\console\command;
13 |
14 | use think\console\Command;
15 | use think\console\Input;
16 | use think\console\input\Option;
17 | use think\console\Output;
18 |
19 | class Build extends Command
20 | {
21 |
22 | /**
23 | * {@inheritdoc}
24 | */
25 | protected function configure()
26 | {
27 | $this->setName('build')
28 | ->setDefinition([
29 | new Option('config', null, Option::VALUE_OPTIONAL, "build.php path"),
30 | new Option('module', null, Option::VALUE_OPTIONAL, "module name"),
31 | ])
32 | ->setDescription('Build Application Dirs');
33 | }
34 |
35 | protected function execute(Input $input, Output $output)
36 | {
37 | if ($input->hasOption('module')) {
38 | \think\Build::module($input->getOption('module'));
39 | $output->writeln("Successed");
40 | return;
41 | }
42 |
43 | if ($input->hasOption('config')) {
44 | $build = include $input->getOption('config');
45 | } else {
46 | $build = include APP_PATH . 'build.php';
47 | }
48 | if (empty($build)) {
49 | $output->writeln("Build Config Is Empty");
50 | return;
51 | }
52 | \think\Build::run($build);
53 | $output->writeln("Successed");
54 |
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/structures/position/add.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
14 |
15 |
16 |
17 | 提交
18 | 返回
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/process/exception/Timeout.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\process\exception;
13 |
14 | use think\Process;
15 |
16 | class Timeout extends \RuntimeException
17 | {
18 |
19 | const TYPE_GENERAL = 1;
20 | const TYPE_IDLE = 2;
21 |
22 | private $process;
23 | private $timeoutType;
24 |
25 | public function __construct(Process $process, $timeoutType)
26 | {
27 | $this->process = $process;
28 | $this->timeoutType = $timeoutType;
29 |
30 | parent::__construct(sprintf('The process "%s" exceeded the timeout of %s seconds.', $process->getCommandLine(), $this->getExceededTimeout()));
31 | }
32 |
33 | public function getProcess()
34 | {
35 | return $this->process;
36 | }
37 |
38 | public function isGeneralTimeout()
39 | {
40 | return $this->timeoutType === self::TYPE_GENERAL;
41 | }
42 |
43 | public function isIdleTimeout()
44 | {
45 | return $this->timeoutType === self::TYPE_IDLE;
46 | }
47 |
48 | public function getExceededTimeout()
49 | {
50 | switch ($this->timeoutType) {
51 | case self::TYPE_GENERAL:
52 | return $this->process->getTimeout();
53 |
54 | case self::TYPE_IDLE:
55 | return $this->process->getIdleTimeout();
56 |
57 | default:
58 | throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/php/application/admin/controller/ApiCommon.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\admin\controller;
9 |
10 | use think\Request;
11 | use think\Db;
12 | use app\common\adapter\AuthAdapter;
13 | use app\common\controller\Common;
14 |
15 |
16 | class ApiCommon extends Common
17 | {
18 | public function _initialize()
19 | {
20 | parent::_initialize();
21 | /*获取头部信息*/
22 | $header = Request::instance()->header();
23 |
24 | $authKey = $header['authkey'];
25 | $sessionId = $header['sessionid'];
26 | $cache = cache('Auth_'.$authKey);
27 |
28 | // 校验sessionid和authKey
29 | if (empty($sessionId)||empty($authKey)||empty($cache)) {
30 | header('Content-Type:application/json; charset=utf-8');
31 | exit(json_encode(['code'=>101, 'error'=>'登录已失效']));
32 | }
33 |
34 | // 检查账号有效性
35 | $userInfo = $cache['userInfo'];
36 | $map['id'] = $userInfo['id'];
37 | $map['status'] = 1;
38 | if (!Db::name('admin_user')->where($map)->value('id')) {
39 | header('Content-Type:application/json; charset=utf-8');
40 | exit(json_encode(['code'=>103, 'error'=>'账号已被删除或禁用']));
41 | }
42 | // 更新缓存
43 | cache('Auth_'.$authKey, $cache, config('LOGIN_SESSION_VALID'));
44 | $authAdapter = new AuthAdapter($authKey);
45 | $request = Request::instance();
46 | $ruleName = $request->module().'-'.$request->controller() .'-'.$request->action();
47 | if (!$authAdapter->checkLogin($ruleName, $cache['userInfo']['id'])) {
48 | header('Content-Type:application/json; charset=utf-8');
49 | exit(json_encode(['code'=>102,'error'=>'没有权限']));
50 | }
51 | $GLOBALS['userInfo'] = $userInfo;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/db/builder/Mysql.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\db\builder;
13 |
14 | use think\db\Builder;
15 |
16 | /**
17 | * mysql数据库驱动
18 | */
19 | class Mysql extends Builder
20 | {
21 | protected $updateSql = 'UPDATE %TABLE% %JOIN% SET %SET% %WHERE% %ORDER%%LIMIT% %LOCK%%COMMENT%';
22 |
23 | /**
24 | * 字段和表名处理
25 | * @access protected
26 | * @param string $key
27 | * @param array $options
28 | * @return string
29 | */
30 | protected function parseKey($key, $options = [])
31 | {
32 | $key = trim($key);
33 | if (strpos($key, '$.') && false === strpos($key, '(')) {
34 | // JSON字段支持
35 | list($field, $name) = explode('$.', $key);
36 | $key = 'json_extract(' . $field . ', \'$.' . $name . '\')';
37 | } elseif (strpos($key, '.') && !preg_match('/[,\'\"\(\)`\s]/', $key)) {
38 | list($table, $key) = explode('.', $key, 2);
39 | if (isset($options['alias'][$table])) {
40 | $table = $options['alias'][$table];
41 | }
42 | }
43 | if (!preg_match('/[,\'\"\*\(\)`.\s]/', $key)) {
44 | $key = '`' . $key . '`';
45 | }
46 | if (isset($table)) {
47 | $key = '`' . $table . '`.' . $key;
48 | }
49 | return $key;
50 | }
51 |
52 | /**
53 | * 随机排序
54 | * @access protected
55 | * @return string
56 | */
57 | protected function parseRand()
58 | {
59 | return 'rand()';
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/frontEnd/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vueThink",
3 | "version": "1.0.0",
4 | "description": "vueThink made by vue2.0",
5 | "scripts": {
6 | "dev": "node build/dev-server.js",
7 | "build": "node build/build.js"
8 | },
9 | "dependencies": {
10 | "axios": "^0.15.3",
11 | "element-ui": "1.1.3",
12 | "font-awesome": "^4.7.0",
13 | "js-cookie": "^2.1.3",
14 | "lockr": "^0.8.4",
15 | "lodash": "^4.17.2",
16 | "moment": "^2.17.1",
17 | "nprogress": "^0.2.0",
18 | "query-string": "^4.2.3",
19 | "vee-validate": "^2.0.0-beta.17",
20 | "vue": "^2.0.7",
21 | "vuex": "^2.0.0-rc.6"
22 | },
23 | "devDependencies": {
24 | "autoprefixer": "^6.4.0",
25 | "babel-cli": "^6.18.0",
26 | "babel-core": "^6.0.0",
27 | "babel-eslint": "^7.1.1",
28 | "babel-loader": "^6.2.8",
29 | "babel-plugin-transform-runtime": "^6.0.0",
30 | "babel-polyfill": "^6.20.0",
31 | "babel-preset-es2015": "^6.0.0",
32 | "babel-preset-stage-3": "^6.17.0",
33 | "babel-register": "^6.0.0",
34 | "babel-runtime": "^6.20.0",
35 | "chalk": "^1.1.3",
36 | "connect-history-api-fallback": "^1.1.0",
37 | "css-loader": "^0.26.0",
38 | "eslint": "^3.12.2",
39 | "eslint-config-vue": "^2.0.1",
40 | "eslint-loader": "^1.6.1",
41 | "eslint-plugin-vue": "^1.0.0",
42 | "eventsource-polyfill": "^0.9.6",
43 | "express": "^4.13.3",
44 | "extract-text-webpack-plugin": "^1.0.1",
45 | "file-loader": "^0.9.0",
46 | "function-bind": "^1.0.2",
47 | "html-webpack-plugin": "^2.8.1",
48 | "http-proxy-middleware": "^0.17.2",
49 | "json-loader": "^0.5.4",
50 | "opn": "^4.0.2",
51 | "ora": "^0.3.0",
52 | "semver": "^5.3.0",
53 | "shelljs": "^0.7.4",
54 | "url-loader": "^0.5.7",
55 | "vue-loader": "^9.9.5",
56 | "vue-router": "^2.0.3",
57 | "vue-style-loader": "^1.0.0",
58 | "webpack": "^1.13.2",
59 | "webpack-dev-middleware": "^1.8.3",
60 | "webpack-hot-middleware": "^2.12.2",
61 | "webpack-merge": "^0.17.0"
62 | },
63 | "engines": {
64 | "node": ">= 4.0.0",
65 | "npm": ">= 3.0.0"
66 | },
67 | "author": "Honray Inc",
68 | "license": "ISC"
69 | }
70 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/response/Jsonp.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\response;
13 |
14 | use think\Request;
15 | use think\Response;
16 |
17 | class Jsonp extends Response
18 | {
19 | // 输出参数
20 | protected $options = [
21 | 'var_jsonp_handler' => 'callback',
22 | 'default_jsonp_handler' => 'jsonpReturn',
23 | 'json_encode_param' => JSON_UNESCAPED_UNICODE,
24 | ];
25 |
26 | protected $contentType = 'application/javascript';
27 |
28 | /**
29 | * 处理数据
30 | * @access protected
31 | * @param mixed $data 要处理的数据
32 | * @return mixed
33 | * @throws \Exception
34 | */
35 | protected function output($data)
36 | {
37 | try {
38 | // 返回JSON数据格式到客户端 包含状态信息 [当url_common_param为false时是无法获取到$_GET的数据的,故使用Request来获取]
39 | $var_jsonp_handler = Request::instance()->param($this->options['var_jsonp_handler'], "");
40 | $handler = !empty($var_jsonp_handler) ? $var_jsonp_handler : $this->options['default_jsonp_handler'];
41 |
42 | $data = json_encode($data, $this->options['json_encode_param']);
43 |
44 | if ($data === false) {
45 | throw new \InvalidArgumentException(json_last_error_msg());
46 | }
47 |
48 | $data = $handler . '(' . $data . ');';
49 | return $data;
50 | } catch (\Exception $e) {
51 | if ($e->getPrevious()) {
52 | throw $e->getPrevious();
53 | }
54 | throw $e;
55 | }
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/db/builder/Sqlite.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\db\builder;
13 |
14 | use think\db\Builder;
15 |
16 | /**
17 | * Sqlite数据库驱动
18 | */
19 | class Sqlite extends Builder
20 | {
21 |
22 | /**
23 | * limit
24 | * @access public
25 | * @return string
26 | */
27 | public function parseLimit($limit)
28 | {
29 | $limitStr = '';
30 | if (!empty($limit)) {
31 | $limit = explode(',', $limit);
32 | if (count($limit) > 1) {
33 | $limitStr .= ' LIMIT ' . $limit[1] . ' OFFSET ' . $limit[0] . ' ';
34 | } else {
35 | $limitStr .= ' LIMIT ' . $limit[0] . ' ';
36 | }
37 | }
38 | return $limitStr;
39 | }
40 |
41 | /**
42 | * 随机排序
43 | * @access protected
44 | * @return string
45 | */
46 | protected function parseRand()
47 | {
48 | return 'RANDOM()';
49 | }
50 |
51 | /**
52 | * 字段和表名处理
53 | * @access protected
54 | * @param string $key
55 | * @param array $options
56 | * @return string
57 | */
58 | protected function parseKey($key, $options = [])
59 | {
60 | $key = trim($key);
61 | if (strpos($key, '.')) {
62 | list($table, $key) = explode('.', $key, 2);
63 | if (isset($options['alias'][$table])) {
64 | $table = $options['alias'][$table];
65 | }
66 | }
67 | if (isset($table)) {
68 | $key = $table . '.' . $key;
69 | }
70 | return $key;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/php/thinkphp/tpl/dispatch_jump.tpl:
--------------------------------------------------------------------------------
1 | {__NOLAYOUT__}
2 |
3 |
4 |
5 | 跳转提示
6 |
16 |
17 |
18 |
19 |
20 |
21 |
:)
22 |
23 |
24 |
25 |
:(
26 |
27 |
28 |
29 |
30 |
31 | 页面自动 跳转 等待时间:
32 |
33 |
34 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/frontEnd/src/assets/css/base.css:
--------------------------------------------------------------------------------
1 | .top-menu:hover {
2 | cursor: pointer;
3 | background: #324057;
4 | /*color: #20a0ff;*/
5 | }
6 | .top-menu:active, .left-menu:active {
7 | color: #20a0ff;
8 | }
9 | .top-active {
10 | color: #44B5DF
11 | }
12 | .top-menu, .left-menu {
13 | user-select:none;
14 | -webkit-user-select:none;
15 | -moz-user-select:none;
16 | -o-user-select:none;
17 | -ms-user-select:none;
18 | }
19 | .left-menu:hover {
20 | background: #42566C;
21 | }
22 | .pages {
23 | position: absolute;
24 | top: 20px;
25 | right: -5px;
26 | }
27 | .btn-link,.btn-link-large {
28 | display: inline-block;
29 | line-height: 1;
30 | color: #fff;
31 | white-space: nowrap;
32 | cursor: pointer;
33 | text-align: center;
34 | box-sizing: border-box;
35 | margin-right: 10px;
36 | padding: 7px 9px;
37 | font-size: 12px;
38 | border-radius: 4px;
39 | }
40 | .btn-link-large {
41 | margin: 0;
42 | padding: 10px 15px;
43 | font-size: 14px;
44 | }
45 | .add-btn {
46 | background: #4caf50
47 | }
48 | .add-btn:hover {
49 | background: #66bb6a
50 | }
51 | .add-btn:active {
52 | background: #43a047
53 | }
54 | .edit-btn {
55 | background: #339df7
56 | }
57 | .edit-btn:hover {
58 | background: #5bb1fa
59 | }
60 | .edit-btn:active {
61 | background: #047ce2
62 | }
63 | .user-menu {
64 | position: absolute;
65 | top: 0px;
66 | right: 100px;
67 | }
68 | .add-btn-right {
69 | position: absolute;
70 | top: 0px;
71 | right: 0px;
72 | }
73 | .table-head {
74 | position: relative;
75 | display: block;
76 | width: 100%;
77 | height: 30px;
78 | line-height: 30px;
79 | color: #fff;
80 | background: #515151
81 | }
82 | .table-head > .title {
83 | color: #fff;
84 | padding-left: 10px;
85 | }
86 | .table-head > .icon {
87 | position: absolute;
88 | font-size: 20px;
89 | top: 6px;
90 | right: 10px;
91 | cursor: pointer;
92 | }
93 | .table-head > .table-head-btn {
94 | position: absolute;
95 | top: 4px;
96 | right: 10px;
97 | }
98 | .table-head > .table-head-btn:last-child {
99 | right: 55px;
100 | }
101 | .form-title {
102 | padding-bottom: 10px;
103 | font-weight: bold;
104 | font-size: 20px;
105 | border-bottom: 1px solid #ccc;
106 | }
--------------------------------------------------------------------------------
/frontEnd/build/utils.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var config = require('../config')
3 | var ExtractTextPlugin = require('extract-text-webpack-plugin')
4 |
5 | exports.assetsPath = function (_path) {
6 | var assetsSubDirectory = process.env.NODE_ENV === 'production'
7 | ? config.build.assetsSubDirectory
8 | : config.dev.assetsSubDirectory
9 | return path.posix.join(assetsSubDirectory, _path)
10 | }
11 |
12 | exports.cssLoaders = function (options) {
13 | options = options || {}
14 | // generate loader string to be used with extract text plugin
15 | function generateLoaders (loaders) {
16 | var sourceLoader = loaders.map(function (loader) {
17 | var extraParamChar
18 | if (/\?/.test(loader)) {
19 | loader = loader.replace(/\?/, '-loader?')
20 | extraParamChar = '&'
21 | } else {
22 | loader = loader + '-loader'
23 | extraParamChar = '?'
24 | }
25 | return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '')
26 | }).join('!')
27 |
28 | // Extract CSS when that option is specified
29 | // (which is the case during production build)
30 | if (options.extract) {
31 | return ExtractTextPlugin.extract('vue-style-loader', sourceLoader)
32 | } else {
33 | return ['vue-style-loader', sourceLoader].join('!')
34 | }
35 | }
36 |
37 | // http://vuejs.github.io/vue-loader/en/configurations/extract-css.html
38 | return {
39 | css: generateLoaders(['css']),
40 | postcss: generateLoaders(['css']),
41 | less: generateLoaders(['css', 'less']),
42 | sass: generateLoaders(['css', 'sass?indentedSyntax']),
43 | scss: generateLoaders(['css', 'sass']),
44 | stylus: generateLoaders(['css', 'stylus']),
45 | styl: generateLoaders(['css', 'stylus']),
46 | // 额外添加
47 | // js: 'babel!eslint'
48 | }
49 | }
50 |
51 | // Generate loaders for standalone style files (outside of .vue)
52 | exports.styleLoaders = function (options) {
53 | var output = []
54 | var loaders = exports.cssLoaders(options)
55 | for (var extension in loaders) {
56 | var loader = loaders[extension]
57 | output.push({
58 | test: new RegExp('\\.' + extension + '$'),
59 | loader: loader
60 | })
61 | }
62 | return output
63 | }
64 |
--------------------------------------------------------------------------------
/frontEnd/build/dev-server.js:
--------------------------------------------------------------------------------
1 | require('./check-versions')()
2 | var config = require('../config')
3 | if (!process.env.NODE_ENV) process.env.NODE_ENV = config.dev.env
4 | var path = require('path')
5 | var express = require('express')
6 | var webpack = require('webpack')
7 | var opn = require('opn')
8 | var proxyMiddleware = require('http-proxy-middleware')
9 | var webpackConfig = require('./webpack.dev.conf')
10 |
11 | // default port where dev server listens for incoming traffic
12 | var port = process.env.PORT || config.dev.port
13 | // Define HTTP proxies to your custom API backend
14 | // https://github.com/chimurai/http-proxy-middleware
15 | var proxyTable = config.dev.proxyTable
16 |
17 | var app = express()
18 | var compiler = webpack(webpackConfig)
19 |
20 | var devMiddleware = require('webpack-dev-middleware')(compiler, {
21 | publicPath: webpackConfig.output.publicPath,
22 | stats: {
23 | colors: true,
24 | chunks: false
25 | }
26 | })
27 |
28 | var hotMiddleware = require('webpack-hot-middleware')(compiler)
29 | // force page reload when html-webpack-plugin template changes
30 | compiler.plugin('compilation', function (compilation) {
31 | compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
32 | hotMiddleware.publish({ action: 'reload' })
33 | cb()
34 | })
35 | })
36 |
37 | // proxy api requests
38 | Object.keys(proxyTable).forEach(function (context) {
39 | var options = proxyTable[context]
40 | if (typeof options === 'string') {
41 | options = { target: options }
42 | }
43 | app.use(proxyMiddleware(context, options))
44 | })
45 |
46 | // handle fallback for HTML5 history API
47 | app.use(require('connect-history-api-fallback')())
48 |
49 | // serve webpack bundle output
50 | app.use(devMiddleware)
51 |
52 | // enable hot-reload and state-preserving
53 | // compilation error display
54 | app.use(hotMiddleware)
55 |
56 | // serve pure static assets
57 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
58 | app.use(staticPath, express.static('./static'))
59 |
60 | module.exports = app.listen(port, function (err) {
61 | if (err) {
62 | console.log(err)
63 | return
64 | }
65 | var uri = 'http://localhost:' + port
66 | console.log('Listening at ' + uri + '\n')
67 | opn(uri)
68 | })
69 |
--------------------------------------------------------------------------------
/frontEnd/src/assets/js/filter.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | export default (function () {
3 | Vue.filter('status', function (value) {
4 | if (value == 1) {
5 | return '启用'
6 | } else if (value == 0) {
7 | return '禁用'
8 | } else {
9 | return '未知状态'
10 | }
11 | })
12 | Vue.filter('rules', function (value) {
13 | return value
14 | })
15 | Vue.filter('fileLink', function (value) {
16 | const link = window.imgUrl + value
17 | return link
18 | })
19 | Vue.filter('toolType', function (value) {
20 | let type = ''
21 | if (value == 1) {
22 | type = '系统工具'
23 | } else if (value == 2) {
24 | type = '说明知道'
25 | }
26 | return type
27 | })
28 | Vue.filter('numToString', function (value) {
29 | const string = value.toString()
30 | return string
31 | })
32 | Vue.filter('projectState', function (value) {
33 | let string = ''
34 | switch (value) {
35 | case '1':
36 | string = '售前项目'
37 | break
38 | case '2':
39 | string = '服务中项目'
40 | break
41 | case '3':
42 | string = '已结束项目'
43 | break
44 | }
45 | return string
46 | })
47 | Vue.filter('time', function (value) {
48 | let day = moment.unix(value)
49 | let date = moment(day).format('YYYY/MM/DD H:mm')
50 | return date
51 | })
52 | Vue.filter('date', function (value) {
53 | let day = moment.unix(value)
54 | let date = moment(day).format('YYYY/MM/DD')
55 | return date
56 | })
57 | Vue.filter('abstract', function (value) {
58 | let abstract = ''
59 | if (value.length > 70) {
60 | abstract = value.substr(0, 70) + '...'
61 | } else {
62 | abstract = value
63 | }
64 | return abstract
65 | })
66 | Vue.filter('posStatus', function (value) {
67 | let status = ''
68 | switch (value) {
69 | case 1:
70 | status = '在职'
71 | break
72 | case 2:
73 | status = '待入职'
74 | break
75 | case 3:
76 | status = '离职'
77 | break
78 | }
79 | return status
80 | })
81 | Vue.filter('template', function (value) {
82 | let template = ''
83 | if (value == '') {
84 | template = '上传'
85 | } else {
86 | template = '上传更新'
87 | }
88 | return template
89 | })
90 | })()
91 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/template/driver/File.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\template\driver;
13 |
14 | use think\Exception;
15 |
16 | class File
17 | {
18 | /**
19 | * 写入编译缓存
20 | * @param string $cacheFile 缓存的文件名
21 | * @param string $content 缓存的内容
22 | * @return void|array
23 | */
24 | public function write($cacheFile, $content)
25 | {
26 | // 检测模板目录
27 | $dir = dirname($cacheFile);
28 | if (!is_dir($dir)) {
29 | mkdir($dir, 0755, true);
30 | }
31 | // 生成模板缓存文件
32 | if (false === file_put_contents($cacheFile, $content)) {
33 | throw new Exception('cache write error:' . $cacheFile, 11602);
34 | }
35 | }
36 |
37 | /**
38 | * 读取编译编译
39 | * @param string $cacheFile 缓存的文件名
40 | * @param array $vars 变量数组
41 | * @return void
42 | */
43 | public function read($cacheFile, $vars = [])
44 | {
45 | if (!empty($vars) && is_array($vars)) {
46 | // 模板阵列变量分解成为独立变量
47 | extract($vars, EXTR_OVERWRITE);
48 | }
49 | //载入模版缓存文件
50 | include $cacheFile;
51 | }
52 |
53 | /**
54 | * 检查编译缓存是否有效
55 | * @param string $cacheFile 缓存的文件名
56 | * @param int $cacheTime 缓存时间
57 | * @return boolean
58 | */
59 | public function check($cacheFile, $cacheTime)
60 | {
61 | // 缓存文件不存在, 直接返回false
62 | if (!file_exists($cacheFile)) {
63 | return false;
64 | }
65 | if (0 != $cacheTime && $_SERVER['REQUEST_TIME'] > filemtime($cacheFile) + $cacheTime) {
66 | // 缓存是否在有效期
67 | return false;
68 | }
69 | return true;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/structures/structures/add.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | 提交
14 | 返回
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/command/Help.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\console\command;
13 |
14 | use think\console\Command;
15 | use think\console\Input;
16 | use think\console\input\Argument as InputArgument;
17 | use think\console\input\Option as InputOption;
18 | use think\console\Output;
19 |
20 | class Help extends Command
21 | {
22 |
23 | private $command;
24 |
25 | /**
26 | * {@inheritdoc}
27 | */
28 | protected function configure()
29 | {
30 | $this->ignoreValidationErrors();
31 |
32 | $this->setName('help')->setDefinition([
33 | new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
34 | new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
35 | ])->setDescription('Displays help for a command')->setHelp(<<%command.name% command displays help for a given command:
37 |
38 | php %command.full_name% list
39 |
40 | To display the list of available commands, please use the list command.
41 | EOF
42 | );
43 | }
44 |
45 | /**
46 | * Sets the command.
47 | * @param Command $command The command to set
48 | */
49 | public function setCommand(Command $command)
50 | {
51 | $this->command = $command;
52 | }
53 |
54 | /**
55 | * {@inheritdoc}
56 | */
57 | protected function execute(Input $input, Output $output)
58 | {
59 | if (null === $this->command) {
60 | $this->command = $this->getConsole()->find($input->getArgument('command_name'));
61 | }
62 |
63 | $output->describe($this->command, [
64 | 'raw_text' => $input->getOption('raw'),
65 | ]);
66 |
67 | $this->command = null;
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/frontEnd/src/components/Account/changePwd.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | 提交
15 |
16 |
17 |
18 |
21 |
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/structures/position/edit.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
14 |
15 |
16 |
17 | 提交
18 | 返回
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/db/builder/Pgsql.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\db\builder;
13 |
14 | use think\db\Builder;
15 |
16 | /**
17 | * Pgsql数据库驱动
18 | */
19 | class Pgsql extends Builder
20 | {
21 |
22 | /**
23 | * limit分析
24 | * @access protected
25 | * @param mixed $limit
26 | * @return string
27 | */
28 | public function parseLimit($limit)
29 | {
30 | $limitStr = '';
31 | if (!empty($limit)) {
32 | $limit = explode(',', $limit);
33 | if (count($limit) > 1) {
34 | $limitStr .= ' LIMIT ' . $limit[1] . ' OFFSET ' . $limit[0] . ' ';
35 | } else {
36 | $limitStr .= ' LIMIT ' . $limit[0] . ' ';
37 | }
38 | }
39 | return $limitStr;
40 | }
41 |
42 | /**
43 | * 字段和表名处理
44 | * @access protected
45 | * @param string $key
46 | * @param array $options
47 | * @return string
48 | */
49 | protected function parseKey($key, $options = [])
50 | {
51 | $key = trim($key);
52 | if (strpos($key, '$.') && false === strpos($key, '(')) {
53 | // JSON字段支持
54 | list($field, $name) = explode('$.', $key);
55 | $key = $field . '->>\'' . $name . '\'';
56 | } elseif (strpos($key, '.')) {
57 | list($table, $key) = explode('.', $key, 2);
58 | if (isset($options['alias'][$table])) {
59 | $table = $options['alias'][$table];
60 | }
61 | }
62 | if (isset($table)) {
63 | $key = $table . '.' . $key;
64 | }
65 | return $key;
66 | }
67 |
68 | /**
69 | * 随机排序
70 | * @access protected
71 | * @return string
72 | */
73 | protected function parseRand()
74 | {
75 | return 'RANDOM()';
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/system/menu/rule.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
13 |
17 |
18 |
21 |
22 |
26 |
27 |
31 |
32 | 选择
33 |
34 |
35 |
36 |
37 |
38 |
39 |
46 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/command/Lists.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\console\command;
13 |
14 | use think\console\Command;
15 | use think\console\Input;
16 | use think\console\Output;
17 | use think\console\input\Argument as InputArgument;
18 | use think\console\input\Option as InputOption;
19 | use think\console\input\Definition as InputDefinition;
20 |
21 | class Lists extends Command
22 | {
23 |
24 | /**
25 | * {@inheritdoc}
26 | */
27 | protected function configure()
28 | {
29 | $this->setName('list')->setDefinition($this->createDefinition())->setDescription('Lists commands')->setHelp(<<%command.name% command lists all commands:
31 |
32 | php %command.full_name%
33 |
34 | You can also display the commands for a specific namespace:
35 |
36 | php %command.full_name% test
37 |
38 | It's also possible to get raw list of commands (useful for embedding command runner):
39 |
40 | php %command.full_name% --raw
41 | EOF
42 | );
43 | }
44 |
45 | /**
46 | * {@inheritdoc}
47 | */
48 | public function getNativeDefinition()
49 | {
50 | return $this->createDefinition();
51 | }
52 |
53 | /**
54 | * {@inheritdoc}
55 | */
56 | protected function execute(Input $input, Output $output)
57 | {
58 | $output->describe($this->getConsole(), [
59 | 'raw_text' => $input->getOption('raw'),
60 | 'namespace' => $input->getArgument('namespace'),
61 | ]);
62 | }
63 |
64 | /**
65 | * {@inheritdoc}
66 | */
67 | private function createDefinition()
68 | {
69 | return new InputDefinition([
70 | new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
71 | new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list')
72 | ]);
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/model/Collection.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\model;
13 |
14 | use think\Collection as BaseCollection;
15 | use think\Model;
16 |
17 | class Collection extends BaseCollection
18 | {
19 | /**
20 | * 延迟预载入关联查询
21 | * @access public
22 | * @param mixed $relation 关联
23 | * @return $this
24 | */
25 | public function load($relation)
26 | {
27 | $item = current($this->items);
28 | $item->eagerlyResultSet($this->items, $relation);
29 | return $this;
30 | }
31 |
32 | /**
33 | * 设置需要隐藏的输出属性
34 | * @access public
35 | * @param array $hidden 属性列表
36 | * @param bool $override 是否覆盖
37 | * @return $this
38 | */
39 | public function hidden($hidden = [], $override = false)
40 | {
41 | $this->each(function ($model) use ($hidden, $override) {
42 | /** @var Model $model */
43 | $model->hidden($hidden, $override);
44 | });
45 | return $this;
46 | }
47 |
48 | /**
49 | * 设置需要输出的属性
50 | * @param array $visible
51 | * @param bool $override 是否覆盖
52 | * @return $this
53 | */
54 | public function visible($visible = [], $override = false)
55 | {
56 | $this->each(function ($model) use ($visible, $override) {
57 | /** @var Model $model */
58 | $model->visible($visible, $override);
59 | });
60 | return $this;
61 | }
62 |
63 | /**
64 | * 设置需要追加的输出属性
65 | * @access public
66 | * @param array $append 属性列表
67 | * @param bool $override 是否覆盖
68 | * @return $this
69 | */
70 | public function append($append = [], $override = false)
71 | {
72 | $this->each(function ($model) use ($append, $override) {
73 | /** @var Model $model */
74 | $model->append($append, $override);
75 | });
76 | return $this;
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/process/Utils.php:
--------------------------------------------------------------------------------
1 |
8 | // +----------------------------------------------------------------------
9 |
10 | namespace think\process;
11 |
12 | class Utils
13 | {
14 |
15 | /**
16 | * 转义字符串
17 | * @param string $argument
18 | * @return string
19 | */
20 | public static function escapeArgument($argument)
21 | {
22 |
23 | if ('' === $argument) {
24 | return escapeshellarg($argument);
25 | }
26 | $escapedArgument = '';
27 | $quote = false;
28 | foreach (preg_split('/(")/i', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
29 | if ('"' === $part) {
30 | $escapedArgument .= '\\"';
31 | } elseif (self::isSurroundedBy($part, '%')) {
32 | // Avoid environment variable expansion
33 | $escapedArgument .= '^%"' . substr($part, 1, -1) . '"^%';
34 | } else {
35 | // escape trailing backslash
36 | if ('\\' === substr($part, -1)) {
37 | $part .= '\\';
38 | }
39 | $quote = true;
40 | $escapedArgument .= $part;
41 | }
42 | }
43 | if ($quote) {
44 | $escapedArgument = '"' . $escapedArgument . '"';
45 | }
46 | return $escapedArgument;
47 | }
48 |
49 | /**
50 | * 验证并进行规范化Process输入。
51 | * @param string $caller
52 | * @param mixed $input
53 | * @return string
54 | * @throws \InvalidArgumentException
55 | */
56 | public static function validateInput($caller, $input)
57 | {
58 | if (null !== $input) {
59 | if (is_resource($input)) {
60 | return $input;
61 | }
62 | if (is_scalar($input)) {
63 | return (string) $input;
64 | }
65 | throw new \InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
66 | }
67 | return $input;
68 | }
69 |
70 | private static function isSurroundedBy($arg, $char)
71 | {
72 | return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/process/pipes/Pipes.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\process\pipes;
13 |
14 | abstract class Pipes
15 | {
16 |
17 | /** @var array */
18 | public $pipes = [];
19 |
20 | /** @var string */
21 | protected $inputBuffer = '';
22 | /** @var resource|null */
23 | protected $input;
24 |
25 | /** @var bool */
26 | private $blocked = true;
27 |
28 | const CHUNK_SIZE = 16384;
29 |
30 | /**
31 | * 返回用于 proc_open 描述符的数组
32 | * @return array
33 | */
34 | abstract public function getDescriptors();
35 |
36 | /**
37 | * 返回一个数组的索引由其相关的流,以防这些管道使用的临时文件的文件名。
38 | * @return string[]
39 | */
40 | abstract public function getFiles();
41 |
42 | /**
43 | * 文件句柄和管道中读取数据。
44 | * @param bool $blocking 是否使用阻塞调用
45 | * @param bool $close 是否要关闭管道,如果他们已经到达 EOF。
46 | * @return string[]
47 | */
48 | abstract public function readAndWrite($blocking, $close = false);
49 |
50 | /**
51 | * 返回当前状态如果有打开的文件句柄或管道。
52 | * @return bool
53 | */
54 | abstract public function areOpen();
55 |
56 | /**
57 | * {@inheritdoc}
58 | */
59 | public function close()
60 | {
61 | foreach ($this->pipes as $pipe) {
62 | fclose($pipe);
63 | }
64 | $this->pipes = [];
65 | }
66 |
67 | /**
68 | * 检查系统调用已被中断
69 | * @return bool
70 | */
71 | protected function hasSystemCallBeenInterrupted()
72 | {
73 | $lastError = error_get_last();
74 |
75 | return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call');
76 | }
77 |
78 | protected function unblock()
79 | {
80 | if (!$this->blocked) {
81 | return;
82 | }
83 |
84 | foreach ($this->pipes as $pipe) {
85 | stream_set_blocking($pipe, 0);
86 | }
87 | if (null !== $this->input) {
88 | stream_set_blocking($this->input, 0);
89 | }
90 |
91 | $this->blocked = false;
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/php/config/route_admin.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | return [
9 | // 定义资源路由
10 | '__rest__'=>[
11 | 'admin/rules' =>'admin/rules',
12 | 'admin/groups' =>'admin/groups',
13 | 'admin/users' =>'admin/users',
14 | 'admin/menus' =>'admin/menus',
15 | 'admin/structures' =>'admin/structures',
16 | 'admin/posts' =>'admin/posts',
17 | ],
18 |
19 | // 【基础】登录
20 | 'admin/base/login' => ['admin/base/login', ['method' => 'POST']],
21 | // 【基础】记住登录
22 | 'admin/base/relogin' => ['admin/base/relogin', ['method' => 'POST']],
23 | // 【基础】修改密码
24 | 'admin/base/setInfo' => ['admin/base/setInfo', ['method' => 'POST']],
25 | // 【基础】退出登录
26 | 'admin/base/logout' => ['admin/base/logout', ['method' => 'POST']],
27 | // 【基础】获取配置
28 | 'admin/base/getConfigs' => ['admin/base/getConfigs', ['method' => 'POST']],
29 | // 【基础】获取验证码
30 | 'admin/base/getVerify' => ['admin/base/getVerify', ['method' => 'GET']],
31 | // 【基础】上传图片
32 | 'admin/upload' => ['admin/upload/index', ['method' => 'POST']],
33 | // 保存系统配置
34 | 'admin/systemConfigs' => ['admin/systemConfigs/save', ['method' => 'POST']],
35 | // 【规则】批量删除
36 | 'admin/rules/deletes' => ['admin/rules/deletes', ['method' => 'POST']],
37 | // 【规则】批量启用/禁用
38 | 'admin/rules/enables' => ['admin/rules/enables', ['method' => 'POST']],
39 | // 【用户组】批量删除
40 | 'admin/groups/deletes' => ['admin/groups/deletes', ['method' => 'POST']],
41 | // 【用户组】批量启用/禁用
42 | 'admin/groups/enables' => ['admin/groups/enables', ['method' => 'POST']],
43 | // 【用户】批量删除
44 | 'admin/users/deletes' => ['admin/users/deletes', ['method' => 'POST']],
45 | // 【用户】批量启用/禁用
46 | 'admin/users/enables' => ['admin/users/enables', ['method' => 'POST']],
47 | // 【菜单】批量删除
48 | 'admin/menus/deletes' => ['admin/menus/deletes', ['method' => 'POST']],
49 | // 【菜单】批量启用/禁用
50 | 'admin/menus/enables' => ['admin/menus/enables', ['method' => 'POST']],
51 | // 【组织架构】批量删除
52 | 'admin/structures/deletes' => ['admin/structures/deletes', ['method' => 'POST']],
53 | // 【组织架构】批量启用/禁用
54 | 'admin/structures/enables' => ['admin/structures/enables', ['method' => 'POST']],
55 | // 【部门】批量删除
56 | 'admin/posts/deletes' => ['admin/posts/deletes', ['method' => 'POST']],
57 | // 【部门】批量启用/禁用
58 | 'admin/posts/enables' => ['admin/posts/enables', ['method' => 'POST']],
59 |
60 | // MISS路由
61 | '__miss__' => 'admin/base/miss',
62 | ];
--------------------------------------------------------------------------------
/php/thinkphp/library/think/response/View.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\response;
13 |
14 | use think\Config;
15 | use think\Response;
16 | use think\View as ViewTemplate;
17 |
18 | class View extends Response
19 | {
20 | // 输出参数
21 | protected $options = [];
22 | protected $vars = [];
23 | protected $replace = [];
24 | protected $contentType = 'text/html';
25 |
26 | /**
27 | * 处理数据
28 | * @access protected
29 | * @param mixed $data 要处理的数据
30 | * @return mixed
31 | */
32 | protected function output($data)
33 | {
34 | // 渲染模板输出
35 | return ViewTemplate::instance(Config::get('template'), Config::get('view_replace_str'))
36 | ->fetch($data, $this->vars, $this->replace);
37 | }
38 |
39 | /**
40 | * 获取视图变量
41 | * @access public
42 | * @param string $name 模板变量
43 | * @return mixed
44 | */
45 | public function getVars($name = null)
46 | {
47 | if (is_null($name)) {
48 | return $this->vars;
49 | } else {
50 | return isset($this->vars[$name]) ? $this->vars[$name] : null;
51 | }
52 | }
53 |
54 | /**
55 | * 模板变量赋值
56 | * @access public
57 | * @param mixed $name 变量名
58 | * @param mixed $value 变量值
59 | * @return $this
60 | */
61 | public function assign($name, $value = '')
62 | {
63 | if (is_array($name)) {
64 | $this->vars = array_merge($this->vars, $name);
65 | return $this;
66 | } else {
67 | $this->vars[$name] = $value;
68 | }
69 | return $this;
70 | }
71 |
72 | /**
73 | * 视图内容替换
74 | * @access public
75 | * @param string|array $content 被替换内容(支持批量替换)
76 | * @param string $replace 替换内容
77 | * @return $this
78 | */
79 | public function replace($content, $replace = '')
80 | {
81 | if (is_array($content)) {
82 | $this->replace = array_merge($this->replace, $content);
83 | } else {
84 | $this->replace[$content] = $replace;
85 | }
86 | return $this;
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/php/thinkphp/base.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | define('THINK_VERSION', '5.0.6');
13 | define('THINK_START_TIME', microtime(true));
14 | define('THINK_START_MEM', memory_get_usage());
15 | define('EXT', '.php');
16 | define('DS', DIRECTORY_SEPARATOR);
17 | defined('THINK_PATH') or define('THINK_PATH', __DIR__ . DS);
18 | define('LIB_PATH', THINK_PATH . 'library' . DS);
19 | define('CORE_PATH', LIB_PATH . 'think' . DS);
20 | define('TRAIT_PATH', LIB_PATH . 'traits' . DS);
21 | defined('APP_PATH') or define('APP_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . DS);
22 | defined('ROOT_PATH') or define('ROOT_PATH', dirname(realpath(APP_PATH)) . DS);
23 | defined('EXTEND_PATH') or define('EXTEND_PATH', ROOT_PATH . 'extend' . DS);
24 | defined('VENDOR_PATH') or define('VENDOR_PATH', ROOT_PATH . 'vendor' . DS);
25 | defined('RUNTIME_PATH') or define('RUNTIME_PATH', ROOT_PATH . 'runtime' . DS);
26 | defined('LOG_PATH') or define('LOG_PATH', RUNTIME_PATH . 'log' . DS);
27 | defined('CACHE_PATH') or define('CACHE_PATH', RUNTIME_PATH . 'cache' . DS);
28 | defined('TEMP_PATH') or define('TEMP_PATH', RUNTIME_PATH . 'temp' . DS);
29 | defined('CONF_PATH') or define('CONF_PATH', APP_PATH); // 配置文件目录
30 | defined('CONF_EXT') or define('CONF_EXT', EXT); // 配置文件后缀
31 | defined('ENV_PREFIX') or define('ENV_PREFIX', 'PHP_'); // 环境变量的配置前缀
32 |
33 | // 环境常量
34 | define('IS_CLI', PHP_SAPI == 'cli' ? true : false);
35 | define('IS_WIN', strpos(PHP_OS, 'WIN') !== false);
36 |
37 | // 载入Loader类
38 | require CORE_PATH . 'Loader.php';
39 |
40 | // 加载环境变量配置文件
41 | if (is_file(ROOT_PATH . '.env')) {
42 | $env = parse_ini_file(ROOT_PATH . '.env', true);
43 | foreach ($env as $key => $val) {
44 | $name = ENV_PREFIX . strtoupper($key);
45 | if (is_array($val)) {
46 | foreach ($val as $k => $v) {
47 | $item = $name . '_' . strtoupper($k);
48 | putenv("$item=$v");
49 | }
50 | } else {
51 | putenv("$name=$val");
52 | }
53 | }
54 | }
55 |
56 | // 注册自动加载
57 | \think\Loader::register();
58 |
59 | // 注册错误和异常处理机制
60 | \think\Error::register();
61 |
62 | // 加载惯例配置文件
63 | \think\Config::set(include THINK_PATH . 'convention' . EXT);
64 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/console/command/optimize/Route.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 | namespace think\console\command\optimize;
12 |
13 | use think\console\Command;
14 | use think\console\Input;
15 | use think\console\Output;
16 |
17 | class Route extends Command
18 | {
19 | /** @var Output */
20 | protected $output;
21 |
22 | protected function configure()
23 | {
24 | $this->setName('optimize:route')
25 | ->setDescription('Build route cache.');
26 | }
27 |
28 | protected function execute(Input $input, Output $output)
29 | {
30 | file_put_contents(RUNTIME_PATH . 'route.php', $this->buildRouteCache());
31 | $output->writeln('Succeed!');
32 | }
33 |
34 | protected function buildRouteCache()
35 | {
36 | $files = \think\Config::get('route_config_file');
37 | foreach ($files as $file) {
38 | if (is_file(CONF_PATH . $file . CONF_EXT)) {
39 | $config = include CONF_PATH . $file . CONF_EXT;
40 | if (is_array($config)) {
41 | \think\Route::import($config);
42 | }
43 | }
44 | }
45 | $rules = \think\Route::rules(true);
46 | array_walk_recursive($rules, [$this, 'buildClosure']);
47 | $content = 'getStartLine();
58 | $endLine = $reflection->getEndLine();
59 | $file = $reflection->getFileName();
60 | $item = file($file);
61 | $content = '';
62 | for ($i = $startLine - 1; $i <= $endLine - 1; $i++) {
63 | $content .= $item[$i];
64 | }
65 | $start = strpos($content, 'function');
66 | $end = strrpos($content, '}');
67 | $value = '[__start__' . substr($content, $start, $end - $start + 1) . '__end__]';
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/php/application/admin/controller/Menus.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\admin\controller;
9 |
10 | class Menus extends ApiCommon
11 | {
12 |
13 | public function index()
14 | {
15 | $menuModel = model('Menu');
16 | $param = $this->param;
17 | $data = $menuModel->getDataList();
18 | return resultArray(['data' => $data]);
19 | }
20 |
21 | public function read()
22 | {
23 | $menuModel = model('Menu');
24 | $param = $this->param;
25 | $data = $menuModel->getDataById($param['id']);
26 | if (!$data) {
27 | return resultArray(['error' => $menuModel->getError()]);
28 | }
29 | return resultArray(['data' => $data]);
30 | }
31 |
32 | public function save()
33 | {
34 | $menuModel = model('Menu');
35 | $param = $this->param;
36 | $data = $menuModel->createData($param);
37 | if (!$data) {
38 | return resultArray(['error' => $menuModel->getError()]);
39 | }
40 | return resultArray(['data' => '添加成功']);
41 | }
42 |
43 | public function update()
44 | {
45 | $menuModel = model('Menu');
46 | $param = $this->param;
47 | $data = $menuModel->updateDataById($param, $param['id']);
48 | if (!$data) {
49 | return resultArray(['error' => $menuModel->getError()]);
50 | }
51 | return resultArray(['data' => '编辑成功']);
52 | }
53 |
54 | public function delete()
55 | {
56 | $menuModel = model('Menu');
57 | $param = $this->param;
58 | $data = $menuModel->delDataById($param['id'], true);
59 | if (!$data) {
60 | return resultArray(['error' => $menuModel->getError()]);
61 | }
62 | return resultArray(['data' => '删除成功']);
63 | }
64 |
65 | public function deletes()
66 | {
67 | $menuModel = model('Menu');
68 | $param = $this->param;
69 | $data = $menuModel->delDatas($param['ids'], true);
70 | if (!$data) {
71 | return resultArray(['error' => $menuModel->getError()]);
72 | }
73 | return resultArray(['data' => '删除成功']);
74 | }
75 |
76 | public function enables()
77 | {
78 | $menuModel = model('Menu');
79 | $param = $this->param;
80 | $data = $menuModel->enableDatas($param['ids'], $param['status'], true);
81 | if (!$data) {
82 | return resultArray(['error' => $menuModel->getError()]);
83 | }
84 | return resultArray(['data' => '操作成功']);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/php/application/admin/controller/Groups.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\admin\controller;
9 |
10 | class Groups extends ApiCommon
11 | {
12 |
13 | public function index()
14 | {
15 | $groupModel = model('Group');
16 | $param = $this->param;
17 | $data = $groupModel->getDataList();
18 | return resultArray(['data' => $data]);
19 | }
20 |
21 | public function read()
22 | {
23 | $groupModel = model('Group');
24 | $param = $this->param;
25 | $data = $groupModel->getDataById($param['id']);
26 | if (!$data) {
27 | return resultArray(['error' => $groupModel->getError()]);
28 | }
29 | return resultArray(['data' => $data]);
30 | }
31 |
32 | public function save()
33 | {
34 | $groupModel = model('Group');
35 | $param = $this->param;
36 | $data = $groupModel->createData($param);
37 | if (!$data) {
38 | return resultArray(['error' => $groupModel->getError()]);
39 | }
40 | return resultArray(['data' => '添加成功']);
41 | }
42 |
43 | public function update()
44 | {
45 | $groupModel = model('Group');
46 | $param = $this->param;
47 | $data = $groupModel->updateDataById($param, $param['id']);
48 | if (!$data) {
49 | return resultArray(['error' => $groupModel->getError()]);
50 | }
51 | return resultArray(['data' => '编辑成功']);
52 | }
53 |
54 | public function delete()
55 | {
56 | $groupModel = model('Group');
57 | $param = $this->param;
58 | $data = $groupModel->delDataById($param['id'], true);
59 | if (!$data) {
60 | return resultArray(['error' => $groupModel->getError()]);
61 | }
62 | return resultArray(['data' => '删除成功']);
63 | }
64 |
65 | public function deletes()
66 | {
67 | $groupModel = model('Group');
68 | $param = $this->param;
69 | $data = $groupModel->delDatas($param['ids'], true);
70 | if (!$data) {
71 | return resultArray(['error' => $groupModel->getError()]);
72 | }
73 | return resultArray(['data' => '删除成功']);
74 | }
75 |
76 | public function enables()
77 | {
78 | $groupModel = model('Group');
79 | $param = $this->param;
80 | $data = $groupModel->enableDatas($param['ids'], $param['status'], true);
81 | if (!$data) {
82 | return resultArray(['error' => $groupModel->getError()]);
83 | }
84 | return resultArray(['data' => '操作成功']);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/frontEnd/src/components/Administrative/structures/structures/edit.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | 提交
14 | 返回
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/php/application/admin/controller/Rules.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\admin\controller;
9 |
10 | class Rules extends ApiCommon
11 | {
12 |
13 | public function index()
14 | {
15 | $ruleModel = model('Rule');
16 | $param = $this->param;
17 | $type = !empty($param['type'])? $param['type']: '';
18 | $data = $ruleModel->getDataList($type);
19 | return resultArray(['data' => $data]);
20 | }
21 |
22 | public function read()
23 | {
24 | $ruleModel = model('Rule');
25 | $param = $this->param;
26 | $data = $ruleModel->getDataById($param['id']);
27 | if (!$data) {
28 | return resultArray(['error' => $ruleModel->getError()]);
29 | }
30 | return resultArray(['data' => $data]);
31 | }
32 |
33 | public function save()
34 | {
35 | $ruleModel = model('Rule');
36 | $param = $this->param;
37 | $data = $ruleModel->createData($param);
38 | if (!$data) {
39 | return resultArray(['error' => $ruleModel->getError()]);
40 | }
41 | return resultArray(['data' => '添加成功']);
42 | }
43 |
44 | public function update()
45 | {
46 | $ruleModel = model('Rule');
47 | $param = $this->param;
48 | $data = $ruleModel->updateDataById($param, $param['id']);
49 | if (!$data) {
50 | return resultArray(['error' => $ruleModel->getError()]);
51 | }
52 | return resultArray(['data' => '编辑成功']);
53 | }
54 |
55 | public function delete()
56 | {
57 | $ruleModel = model('Rule');
58 | $param = $this->param;
59 | $data = $ruleModel->delDataById($param['id'], true);
60 | if (!$data) {
61 | return resultArray(['error' => $ruleModel->getError()]);
62 | }
63 | return resultArray(['data' => '删除成功']);
64 | }
65 |
66 | public function deletes()
67 | {
68 | $ruleModel = model('Rule');
69 | $param = $this->param;
70 | $data = $ruleModel->delDatas($param['ids'], true);
71 | if (!$data) {
72 | return resultArray(['error' => $ruleModel->getError()]);
73 | }
74 | return resultArray(['data' => '删除成功']);
75 | }
76 |
77 | public function enables()
78 | {
79 | $ruleModel = model('Rule');
80 | $param = $this->param;
81 | $data = $ruleModel->enableDatas($param['ids'], $param['status'], true);
82 | if (!$data) {
83 | return resultArray(['error' => $ruleModel->getError()]);
84 | }
85 | return resultArray(['data' => '操作成功']);
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/php/application/admin/controller/Posts.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\admin\controller;
9 |
10 | class Posts extends ApiCommon
11 | {
12 |
13 | public function index()
14 | {
15 | $postModel = model('Post');
16 | $param = $this->param;
17 | $keywords = empty($param['keywords'])? $param['keywords']: '';
18 | $data = $postModel->getDataList($keywords);
19 | return resultArray(['data' => $data]);
20 | }
21 |
22 | public function read()
23 | {
24 | $postModel = model('Post');
25 | $param = $this->param;
26 | $data = $postModel->getDataById($param['id']);
27 | if (!$data) {
28 | return resultArray(['error' => $postModel->getError()]);
29 | }
30 | return resultArray(['data' => $data]);
31 | }
32 |
33 | public function save()
34 | {
35 | $postModel = model('Post');
36 | $param = $this->param;
37 | $data = $postModel->createData($param);
38 | if (!$data) {
39 | return resultArray(['error' => $postModel->getError()]);
40 | }
41 | return resultArray(['data' => '添加成功']);
42 | }
43 |
44 | public function update()
45 | {
46 | $postModel = model('Post');
47 | $param = $this->param;
48 | $data = $postModel->updateDataById($param, $param['id']);
49 | if (!$data) {
50 | return resultArray(['error' => $postModel->getError()]);
51 | }
52 | return resultArray(['data' => '编辑成功']);
53 | }
54 |
55 | public function delete()
56 | {
57 | $postModel = model('Post');
58 | $param = $this->param;
59 | $data = $postModel->delDataById($param['id']);
60 | if (!$data) {
61 | return resultArray(['error' => $postModel->getError()]);
62 | }
63 | return resultArray(['data' => '删除成功']);
64 | }
65 |
66 | public function deletes()
67 | {
68 | $postModel = model('Post');
69 | $param = $this->param;
70 | $data = $postModel->delDatas($param['ids']);
71 | if (!$data) {
72 | return resultArray(['error' => $postModel->getError()]);
73 | }
74 | return resultArray(['data' => '删除成功']);
75 | }
76 |
77 | public function enables()
78 | {
79 | $postModel = model('Post');
80 | $param = $this->param;
81 | $data = $postModel->enableDatas($param['ids'], $param['status']);
82 | if (!$data) {
83 | return resultArray(['error' => $postModel->getError()]);
84 | }
85 | return resultArray(['data' => '操作成功']);
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/php/application/admin/controller/Structures.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\admin\controller;
9 |
10 | class Structures extends ApiCommon
11 | {
12 |
13 | public function index()
14 | {
15 | $structureModel = model('Structure');
16 | $param = $this->param;
17 | $data = $structureModel->getDataList();
18 | return resultArray(['data' => $data]);
19 | }
20 |
21 | public function read()
22 | {
23 | $structureModel = model('Structure');
24 | $param = $this->param;
25 | $data = $structureModel->getDataById($param['id']);
26 | if (!$data) {
27 | return resultArray(['error' => $structureModel->getError()]);
28 | }
29 | return resultArray(['data' => $data]);
30 | }
31 |
32 | public function save()
33 | {
34 | $structureModel = model('Structure');
35 | $param = $this->param;
36 | $data = $structureModel->createData($param);
37 | if (!$data) {
38 | return resultArray(['error' => $structureModel->getError()]);
39 | }
40 | return resultArray(['data' => '添加成功']);
41 | }
42 |
43 | public function update()
44 | {
45 | $structureModel = model('Structure');
46 | $param = $this->param;
47 | $data = $structureModel->updateDataById($param, $param['id']);
48 | if (!$data) {
49 | return resultArray(['error' => $structureModel->getError()]);
50 | }
51 | return resultArray(['data' => '编辑成功']);
52 | }
53 |
54 | public function delete()
55 | {
56 | $structureModel = model('Structure');
57 | $param = $this->param;
58 | $data = $structureModel->delDataById($param['id'], true);
59 | if (!$data) {
60 | return resultArray(['error' => $structureModel->getError()]);
61 | }
62 | return resultArray(['data' => '删除成功']);
63 | }
64 |
65 | public function deletes()
66 | {
67 | $structureModel = model('Structure');
68 | $param = $this->param;
69 | $data = $structureModel->delDatas($param['ids'], true);
70 | if (!$data) {
71 | return resultArray(['error' => $structureModel->getError()]);
72 | }
73 | return resultArray(['data' => '删除成功']);
74 | }
75 |
76 | public function enables()
77 | {
78 | $structureModel = model('Structure');
79 | $param = $this->param;
80 | $data = $structureModel->enableDatas($param['ids'], $param['status'], true);
81 | if (!$data) {
82 | return resultArray(['error' => $structureModel->getError()]);
83 | }
84 | return resultArray(['data' => '操作成功']);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/php/thinkphp/library/think/response/Redirect.php:
--------------------------------------------------------------------------------
1 |
10 | // +----------------------------------------------------------------------
11 |
12 | namespace think\response;
13 |
14 | use think\Request;
15 | use think\Response;
16 | use think\Session;
17 | use think\Url;
18 |
19 | class Redirect extends Response
20 | {
21 |
22 | protected $options = [];
23 |
24 | // URL参数
25 | protected $params = [];
26 |
27 | public function __construct($data = '', $code = 302, array $header = [], array $options = [])
28 | {
29 | parent::__construct($data, $code, $header, $options);
30 | $this->cacheControl('no-cache,must-revalidate');
31 | }
32 |
33 | /**
34 | * 处理数据
35 | * @access protected
36 | * @param mixed $data 要处理的数据
37 | * @return mixed
38 | */
39 | protected function output($data)
40 | {
41 | $this->header['Location'] = $this->getTargetUrl();
42 | return;
43 | }
44 |
45 | /**
46 | * 重定向传值(通过Session)
47 | * @access protected
48 | * @param string|array $name 变量名或者数组
49 | * @param mixed $value 值
50 | * @return $this
51 | */
52 | public function with($name, $value = null)
53 | {
54 | if (is_array($name)) {
55 | foreach ($name as $key => $val) {
56 | Session::flash($key, $val);
57 | }
58 | } else {
59 | Session::flash($name, $value);
60 | }
61 | return $this;
62 | }
63 |
64 | /**
65 | * 获取跳转地址
66 | * @return string
67 | */
68 | public function getTargetUrl()
69 | {
70 | return (strpos($this->data, '://') || 0 === strpos($this->data, '/')) ? $this->data : Url::build($this->data, $this->params);
71 | }
72 |
73 | public function params($params = [])
74 | {
75 | $this->params = $params;
76 | return $this;
77 | }
78 |
79 | /**
80 | * 记住当前url后跳转
81 | * @return $this
82 | */
83 | public function remember()
84 | {
85 | Session::set('redirect_url', Request::instance()->url());
86 | return $this;
87 | }
88 |
89 | /**
90 | * 跳转到上次记住的url
91 | * @return $this
92 | */
93 | public function restore()
94 | {
95 | if (Session::has('redirect_url')) {
96 | $this->data = Session::get('redirect_url');
97 | Session::delete('redirect_url');
98 | }
99 | return $this;
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/frontEnd/src/components/Common/btn-group.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | 启用
4 | 禁用
5 | 删除
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/php/thinkphp/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | 如何贡献我的源代码
2 | ===
3 |
4 | 此文档介绍了 ThinkPHP 团队的组成以及运转机制,您提交的代码将给 ThinkPHP 项目带来什么好处,以及如何才能加入我们的行列。
5 |
6 | ## 通过 Github 贡献代码
7 |
8 | ThinkPHP 目前使用 Git 来控制程序版本,如果你想为 ThinkPHP 贡献源代码,请先大致了解 Git 的使用方法。我们目前把项目托管在 GitHub 上,任何 GitHub 用户都可以向我们贡献代码。
9 |
10 | 参与的方式很简单,`fork`一份 ThinkPHP 的代码到你的仓库中,修改后提交,并向我们发起`pull request`申请,我们会及时对代码进行审查并处理你的申请并。审查通过后,你的代码将被`merge`进我们的仓库中,这样你就会自动出现在贡献者名单里了,非常方便。
11 |
12 | 我们希望你贡献的代码符合:
13 |
14 | * ThinkPHP 的编码规范
15 | * 适当的注释,能让其他人读懂
16 | * 遵循 Apache2 开源协议
17 |
18 | **如果想要了解更多细节或有任何疑问,请继续阅读下面的内容**
19 |
20 | ### 注意事项
21 |
22 | * 本项目代码格式化标准选用 [**PSR-2**](http://www.kancloud.cn/thinkphp/php-fig-psr/3141);
23 | * 类名和类文件名遵循 [**PSR-4**](http://www.kancloud.cn/thinkphp/php-fig-psr/3144);
24 | * 对于 Issues 的处理,请使用诸如 `fix #xxx(Issue ID)` 的 commit title 直接关闭 issue。
25 | * 系统会自动在 PHP 5.4 5.5 5.6 7.0 和 HHVM 上测试修改,其中 HHVM 下的测试容许报错,请确保你的修改符合 PHP 5.4 ~ 5.6 和 PHP 7.0 的语法规范;
26 | * 管理员不会合并造成 CI faild 的修改,若出现 CI faild 请检查自己的源代码或修改相应的[单元测试文件](tests);
27 |
28 | ## GitHub Issue
29 |
30 | GitHub 提供了 Issue 功能,该功能可以用于:
31 |
32 | * 提出 bug
33 | * 提出功能改进
34 | * 反馈使用体验
35 |
36 | 该功能不应该用于:
37 |
38 | * 提出修改意见(涉及代码署名和修订追溯问题)
39 | * 不友善的言论
40 |
41 | ## 快速修改
42 |
43 | **GitHub 提供了快速编辑文件的功能**
44 |
45 | 1. 登录 GitHub 帐号;
46 | 2. 浏览项目文件,找到要进行修改的文件;
47 | 3. 点击右上角铅笔图标进行修改;
48 | 4. 填写 `Commit changes` 相关内容(Title 必填);
49 | 5. 提交修改,等待 CI 验证和管理员合并。
50 |
51 | **若您需要一次提交大量修改,请继续阅读下面的内容**
52 |
53 | ## 完整流程
54 |
55 | 1. `fork`本项目;
56 | 2. 克隆(`clone`)你 `fork` 的项目到本地;
57 | 3. 新建分支(`branch`)并检出(`checkout`)新分支;
58 | 4. 添加本项目到你的本地 git 仓库作为上游(`upstream`);
59 | 5. 进行修改,若你的修改包含方法或函数的增减,请记得修改[单元测试文件](tests);
60 | 6. 变基(衍合 `rebase`)你的分支到上游 master 分支;
61 | 7. `push` 你的本地仓库到 GitHub;
62 | 8. 提交 `pull request`;
63 | 9. 等待 CI 验证(若不通过则重复 5~7,GitHub 会自动更新你的 `pull request`);
64 | 10. 等待管理员处理,并及时 `rebase` 你的分支到上游 master 分支(若上游 master 分支有修改)。
65 |
66 | *若有必要,可以 `git push -f` 强行推送 rebase 后的分支到自己的 `fork`*
67 |
68 | *绝对不可以使用 `git push -f` 强行推送修改到上游*
69 |
70 | ### 注意事项
71 |
72 | * 若对上述流程有任何不清楚的地方,请查阅 GIT 教程,如 [这个](http://backlogtool.com/git-guide/cn/);
73 | * 对于代码**不同方面**的修改,请在自己 `fork` 的项目中**创建不同的分支**(原因参见`完整流程`第9条备注部分);
74 | * 变基及交互式变基操作参见 [Git 交互式变基](http://pakchoi.me/2015/03/17/git-interactive-rebase/)
75 |
76 | ## 推荐资源
77 |
78 | ### 开发环境
79 |
80 | * XAMPP for Windows 5.5.x
81 | * WampServer (for Windows)
82 | * upupw Apache PHP5.4 ( for Windows)
83 |
84 | 或自行安装
85 |
86 | - Apache / Nginx
87 | - PHP 5.4 ~ 5.6
88 | - MySQL / MariaDB
89 |
90 | *Windows 用户推荐添加 PHP bin 目录到 PATH,方便使用 composer*
91 |
92 | *Linux 用户自行配置环境, Mac 用户推荐使用内置 Apache 配合 Homebrew 安装 PHP 和 MariaDB*
93 |
94 | ### 编辑器
95 |
96 | Sublime Text 3 + phpfmt 插件
97 |
98 | phpfmt 插件参数
99 |
100 | ```json
101 | {
102 | "autocomplete": true,
103 | "enable_auto_align": true,
104 | "format_on_save": true,
105 | "indent_with_space": true,
106 | "psr1_naming": false,
107 | "psr2": true,
108 | "version": 4
109 | }
110 | ```
111 |
112 | 或其他 编辑器 / IDE 配合 PSR2 自动格式化工具
113 |
114 | ### Git GUI
115 |
116 | * SourceTree
117 | * GitHub Desktop
118 |
119 | 或其他 Git 图形界面客户端
120 |
--------------------------------------------------------------------------------
/php/application/admin/controller/Users.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\admin\controller;
9 |
10 | class Users extends ApiCommon
11 | {
12 |
13 | public function index()
14 | {
15 | $userModel = model('User');
16 | $param = $this->param;
17 | $keywords = !empty($param['keywords']) ? $param['keywords']: '';
18 | $page = !empty($param['page']) ? $param['page']: '';
19 | $limit = !empty($param['limit']) ? $param['limit']: '';
20 | $data = $userModel->getDataList($keywords, $page, $limit);
21 | return resultArray(['data' => $data]);
22 | }
23 |
24 | public function read()
25 | {
26 | $userModel = model('User');
27 | $param = $this->param;
28 | $data = $userModel->getDataById($param['id']);
29 | if (!$data) {
30 | return resultArray(['error' => $userModel->getError()]);
31 | }
32 | return resultArray(['data' => $data]);
33 | }
34 |
35 | public function save()
36 | {
37 | $userModel = model('User');
38 | $param = $this->param;
39 | $data = $userModel->createData($param);
40 | if (!$data) {
41 | return resultArray(['error' => $userModel->getError()]);
42 | }
43 | return resultArray(['data' => '添加成功']);
44 | }
45 |
46 | public function update()
47 | {
48 | $userModel = model('User');
49 | $param = $this->param;
50 | $data = $userModel->updateDataById($param, $param['id']);
51 | if (!$data) {
52 | return resultArray(['error' => $userModel->getError()]);
53 | }
54 | return resultArray(['data' => '编辑成功']);
55 | }
56 |
57 | public function delete()
58 | {
59 | $userModel = model('User');
60 | $param = $this->param;
61 | $data = $userModel->delDataById($param['id']);
62 | if (!$data) {
63 | return resultArray(['error' => $userModel->getError()]);
64 | }
65 | return resultArray(['data' => '删除成功']);
66 | }
67 |
68 | public function deletes()
69 | {
70 | $userModel = model('User');
71 | $param = $this->param;
72 | $data = $userModel->delDatas($param['ids']);
73 | if (!$data) {
74 | return resultArray(['error' => $userModel->getError()]);
75 | }
76 | return resultArray(['data' => '删除成功']);
77 | }
78 |
79 | public function enables()
80 | {
81 | $userModel = model('User');
82 | $param = $this->param;
83 | $data = $userModel->enableDatas($param['ids'], $param['status']);
84 | if (!$data) {
85 | return resultArray(['error' => $userModel->getError()]);
86 | }
87 | return resultArray(['data' => '操作成功']);
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/php/application/admin/model/Menu.php:
--------------------------------------------------------------------------------
1 |
6 | // +----------------------------------------------------------------------
7 |
8 | namespace app\admin\model;
9 |
10 | use think\Db;
11 | use app\admin\model\Common;
12 |
13 | class Menu extends Common
14 | {
15 |
16 | /**
17 | * 为了数据库的整洁,同时又不影响Model和Controller的名称
18 | * 我们约定每个模块的数据表都加上相同的前缀,比如微信模块用weixin作为数据表前缀
19 | */
20 | protected $name = 'admin_menu';
21 | /**
22 | * [getDataList 获取列表]
23 | * @linchuangbin
24 | * @DateTime 2017-02-10T21:07:18+0800
25 | * @return [array]
26 | */
27 | public function getDataList()
28 | {
29 | $cat = new \com\Category('admin_menu', array('id', 'pid', 'title', 'title'));
30 | $data = $cat->getList('', 0, 'sort');
31 | return $data;
32 | }
33 |
34 | /**
35 | * [getDataById 根据主键获取详情]
36 | * @linchuangbin
37 | * @DateTime 2017-02-10T21:16:34+0800
38 | * @param string $id [主键]
39 | * @return [array]
40 | */
41 | public function getDataById($id = '')
42 | {
43 | $data = $this
44 | ->alias('menu')
45 | ->where('menu.id', $id)
46 | ->join('__ADMIN_RULE__ rule', 'menu.rule_id=rule.id', 'LEFT')
47 | ->field('menu.*, rule.title as rule_name')
48 | ->find();
49 | if (!$data) {
50 | $this->error = '暂无此数据';
51 | return false;
52 | }
53 | return $data;
54 | }
55 |
56 |
57 | /**
58 | * 整理菜单树形结构
59 | * @param array $param [description]
60 | */
61 | protected function getMenuTree()
62 | {
63 | $userInfo = $GLOBALS['userInfo'];
64 | if (!$userInfo) {
65 | return [];
66 | }
67 |
68 | $u_id = $userInfo['u_id'];
69 | if ($u_id === 1) {
70 | $map['status'] = 1;
71 | $menusList = Db::name('admin_menu')->where($map)->order('sort asc')->select();
72 | } else {
73 | $groups = model('User')->get($u_id)->groups;
74 |
75 | $ruleIds = [];
76 | foreach($groups as $k => $v) {
77 | $ruleIds = array_unique(array_merge($ruleIds, explode(',', $v['rules'])));
78 | }
79 | $ruleMap['id'] = array('in', $ruleIds);
80 | $ruleMap['status'] = 1;
81 | // 重新设置ruleIds,除去部分已删除或禁用的权限。
82 | $ruleIds = Db::name('admin_rule')->where($ruleMap)->column('id');
83 | empty($ruleIds)&&$ruleIds = '';
84 | $menuMap['status'] = 1;
85 | $menuMap['rule_id'] = array('in',$ruleIds);
86 | $menusList = Db::name('admin_menu')->where($menuMap)->order('sort asc')->select();
87 | }
88 | if (!$menusList) {
89 | return [];
90 | }
91 | //处理成树状
92 | $tree = new \com\Tree();
93 | $menusList = $tree->list_to_tree($menusList, 'id', 'pid', 'child', 0, true, array('pid'));
94 | $menusList = memuLevelClear($menusList);
95 |
96 | return $menusList? $menusList: [];
97 | }
98 |
99 | }
--------------------------------------------------------------------------------