├── .circleci └── config.yml ├── .gitignore ├── .vscode └── launch.json ├── README.md ├── docker-compose.yml ├── formatter.json ├── frontEnd ├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.json ├── .gitignore ├── .postcssrc.js ├── README.md ├── build │ ├── analyz.js │ ├── build.js │ ├── check-versions.js │ ├── logo.png │ ├── utils.js │ ├── vue-loader.conf.js │ ├── webpack.analyz.conf.js │ ├── webpack.base.conf.js │ ├── webpack.dev.conf.js │ └── webpack.prod.conf.js ├── config │ ├── dev.env.js │ ├── index.js │ ├── prod.env.js │ └── test.env.js ├── index.html ├── package.json ├── src │ ├── .htaccess │ ├── App.vue │ ├── assets │ │ ├── css │ │ │ ├── base.css │ │ │ ├── font-awesome.css.map │ │ │ ├── font-awesome.min.css │ │ │ └── global.css │ │ ├── fonts │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ └── fontawesome-webfont.woff2 │ │ ├── images │ │ │ ├── bg1.jpg │ │ │ ├── logo.png │ │ │ ├── logo1.png │ │ │ ├── logo2.png │ │ │ ├── logo3.png │ │ │ ├── logo4.png │ │ │ ├── logo5.png │ │ │ ├── logout_16.png │ │ │ ├── logout_24.png │ │ │ └── logout_36.png │ │ └── js │ │ │ ├── base_http.js │ │ │ ├── bus.js │ │ │ ├── config.js │ │ │ ├── filter.js │ │ │ ├── form_com.js │ │ │ ├── global.js │ │ │ ├── http.js │ │ │ └── list_com.js │ ├── components │ │ ├── Account │ │ │ ├── Login.vue │ │ │ └── changePwd.vue │ │ ├── Admin │ │ │ ├── personnel │ │ │ │ └── users │ │ │ │ │ ├── add.vue │ │ │ │ │ ├── edit.vue │ │ │ │ │ └── list.vue │ │ │ ├── structures │ │ │ │ ├── groups │ │ │ │ │ ├── add.vue │ │ │ │ │ ├── edit.vue │ │ │ │ │ └── list.vue │ │ │ │ ├── position │ │ │ │ │ ├── add.vue │ │ │ │ │ ├── edit.vue │ │ │ │ │ └── list.vue │ │ │ │ └── structures │ │ │ │ │ ├── add.vue │ │ │ │ │ ├── edit.vue │ │ │ │ │ └── list.vue │ │ │ └── system │ │ │ │ ├── config │ │ │ │ ├── add.vue │ │ │ │ └── preview.vue │ │ │ │ ├── menu │ │ │ │ ├── add.vue │ │ │ │ ├── edit.vue │ │ │ │ ├── list.vue │ │ │ │ └── rule.vue │ │ │ │ └── rule │ │ │ │ ├── add.vue │ │ │ │ ├── edit.vue │ │ │ │ └── list.vue │ │ ├── Busi │ │ │ └── mail │ │ │ │ └── mail │ │ │ │ ├── add.vue │ │ │ │ ├── edit.vue │ │ │ │ └── list.vue │ │ ├── Common │ │ │ ├── btn-group.vue │ │ │ └── leftMenu.vue │ │ ├── Home.vue │ │ └── refresh.vue │ ├── main.js │ ├── router │ │ └── index.js │ └── vuex │ │ ├── actions.js │ │ ├── getters.js │ │ ├── mutations.js │ │ ├── state.js │ │ └── store.js ├── static │ └── .gitkeep └── test │ ├── e2e │ ├── custom-assertions │ │ └── elementCount.js │ ├── nightwatch.conf.js │ ├── runner.js │ └── specs │ │ └── test.js │ └── unit │ ├── .eslintrc │ ├── jest.conf.js │ ├── setup.js │ └── specs │ └── HelloWorld.spec.js ├── npm-debug.log ├── php ├── .gitignore ├── .htaccess ├── LICENSE.txt ├── application │ ├── .htaccess │ ├── admin │ │ ├── config.php │ │ ├── controller │ │ │ ├── Base.php │ │ │ ├── Groups.php │ │ │ ├── Infos.php │ │ │ ├── Menus.php │ │ │ ├── Posts.php │ │ │ ├── Rules.php │ │ │ ├── Structures.php │ │ │ ├── SystemConfigs.php │ │ │ ├── Upload.php │ │ │ └── Users.php │ │ ├── model │ │ │ ├── Group.php │ │ │ ├── Menu.php │ │ │ ├── Post.php │ │ │ ├── Rule.php │ │ │ ├── Structure.php │ │ │ ├── SystemConfig.php │ │ │ └── User.php │ │ └── validate │ │ │ ├── AdminGroup.php │ │ │ ├── AdminMenu.php │ │ │ ├── AdminPost.php │ │ │ ├── AdminRule.php │ │ │ ├── AdminStructure.php │ │ │ └── AdminUser.php │ ├── command.php │ ├── common.php │ ├── common │ │ ├── adapter │ │ │ └── AuthAdapter.php │ │ ├── behavior │ │ │ └── InitConfigBehavior.php │ │ ├── controller │ │ │ ├── ApiCommon.php │ │ │ ├── BaseCommon.php │ │ │ └── Common.php │ │ └── model │ │ │ └── Common.php │ ├── extra │ │ └── queue.php │ └── tags.php ├── composer.json ├── config │ ├── config.php │ ├── database.php │ ├── extra │ │ └── cus_config.php │ └── route_admin.php ├── extend │ ├── Lcobucci │ │ └── JWT │ │ │ ├── Builder.php │ │ │ ├── Claim.php │ │ │ ├── Claim │ │ │ ├── Basic.php │ │ │ ├── EqualsTo.php │ │ │ ├── Factory.php │ │ │ ├── GreaterOrEqualsTo.php │ │ │ ├── LesserOrEqualsTo.php │ │ │ └── Validatable.php │ │ │ ├── Parser.php │ │ │ ├── Parsing │ │ │ ├── Decoder.php │ │ │ └── Encoder.php │ │ │ ├── Signature.php │ │ │ ├── Signer.php │ │ │ ├── Signer │ │ │ ├── BaseSigner.php │ │ │ ├── Ecdsa.php │ │ │ ├── Ecdsa │ │ │ │ ├── KeyParser.php │ │ │ │ ├── Sha256.php │ │ │ │ ├── Sha384.php │ │ │ │ └── Sha512.php │ │ │ ├── Hmac.php │ │ │ ├── Hmac │ │ │ │ ├── Sha256.php │ │ │ │ ├── Sha384.php │ │ │ │ └── Sha512.php │ │ │ ├── Key.php │ │ │ ├── Keychain.php │ │ │ ├── Rsa.php │ │ │ └── Rsa │ │ │ │ ├── Sha256.php │ │ │ │ ├── Sha384.php │ │ │ │ └── Sha512.php │ │ │ ├── Token.php │ │ │ └── ValidationData.php │ └── com │ │ ├── Category.php │ │ ├── HonrayAuth.php │ │ ├── SystemLog.php │ │ ├── Tree.php │ │ └── verify │ │ ├── HonrayVerify.php │ │ └── 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 ├── index.php ├── install.sql ├── phpunit.xml ├── public │ ├── .htaccess │ ├── index.php │ └── router.php ├── think └── thinkphp │ ├── .gitignore │ ├── .htaccess │ ├── .travis.yml │ ├── CONTRIBUTING.md │ ├── LICENSE.txt │ ├── README.md │ ├── base.php │ ├── codecov.yml │ ├── composer.json │ ├── console.php │ ├── convention.php │ ├── helper.php │ ├── lang │ └── zh-cn.php │ ├── library │ ├── think │ │ ├── App.php │ │ ├── Build.php │ │ ├── Cache.php │ │ ├── Collection.php │ │ ├── Config.php │ │ ├── Console.php │ │ ├── Container.php │ │ ├── Controller.php │ │ ├── Cookie.php │ │ ├── Db.php │ │ ├── Debug.php │ │ ├── Env.php │ │ ├── Error.php │ │ ├── Exception.php │ │ ├── Facade.php │ │ ├── File.php │ │ ├── Hook.php │ │ ├── Lang.php │ │ ├── Loader.php │ │ ├── Log.php │ │ ├── Model.php │ │ ├── Paginator.php │ │ ├── Process.php │ │ ├── Request.php │ │ ├── Response.php │ │ ├── Route.php │ │ ├── Session.php │ │ ├── Template.php │ │ ├── Url.php │ │ ├── Validate.php │ │ ├── View.php │ │ ├── cache │ │ │ ├── Driver.php │ │ │ └── driver │ │ │ │ ├── File.php │ │ │ │ ├── Lite.php │ │ │ │ ├── Memcache.php │ │ │ │ ├── Memcached.php │ │ │ │ ├── Redis.php │ │ │ │ ├── Sqlite.php │ │ │ │ ├── Wincache.php │ │ │ │ └── Xcache.php │ │ ├── config │ │ │ └── driver │ │ │ │ ├── Ini.php │ │ │ │ ├── Json.php │ │ │ │ └── Xml.php │ │ ├── console │ │ │ ├── Command.php │ │ │ ├── Input.php │ │ │ ├── LICENSE │ │ │ ├── Output.php │ │ │ ├── bin │ │ │ │ ├── README.md │ │ │ │ └── hiddeninput.exe │ │ │ ├── command │ │ │ │ ├── Build.php │ │ │ │ ├── Clear.php │ │ │ │ ├── Help.php │ │ │ │ ├── Lists.php │ │ │ │ ├── Make.php │ │ │ │ ├── RunServer.php │ │ │ │ ├── make │ │ │ │ │ ├── Controller.php │ │ │ │ │ ├── Model.php │ │ │ │ │ └── stubs │ │ │ │ │ │ ├── controller.plain.stub │ │ │ │ │ │ ├── controller.stub │ │ │ │ │ │ └── model.stub │ │ │ │ └── optimize │ │ │ │ │ ├── Autoload.php │ │ │ │ │ ├── Config.php │ │ │ │ │ ├── Route.php │ │ │ │ │ └── Schema.php │ │ │ ├── input │ │ │ │ ├── Argument.php │ │ │ │ ├── Definition.php │ │ │ │ └── Option.php │ │ │ └── output │ │ │ │ ├── Ask.php │ │ │ │ ├── Descriptor.php │ │ │ │ ├── Formatter.php │ │ │ │ ├── Question.php │ │ │ │ ├── descriptor │ │ │ │ └── Console.php │ │ │ │ ├── driver │ │ │ │ ├── Buffer.php │ │ │ │ ├── Console.php │ │ │ │ └── Nothing.php │ │ │ │ ├── formatter │ │ │ │ ├── Stack.php │ │ │ │ └── Style.php │ │ │ │ └── question │ │ │ │ ├── Choice.php │ │ │ │ └── Confirmation.php │ │ ├── controller │ │ │ ├── Rest.php │ │ │ └── Yar.php │ │ ├── db │ │ │ ├── Builder.php │ │ │ ├── Connection.php │ │ │ ├── Query.php │ │ │ ├── builder │ │ │ │ ├── Mysql.php │ │ │ │ ├── Pgsql.php │ │ │ │ ├── Sqlite.php │ │ │ │ └── Sqlsrv.php │ │ │ ├── connector │ │ │ │ ├── Mysql.php │ │ │ │ ├── Pgsql.php │ │ │ │ ├── Sqlite.php │ │ │ │ ├── Sqlsrv.php │ │ │ │ └── pgsql.sql │ │ │ └── exception │ │ │ │ ├── BindParamException.php │ │ │ │ ├── DataNotFoundException.php │ │ │ │ └── ModelNotFoundException.php │ │ ├── debug │ │ │ ├── Console.php │ │ │ └── Html.php │ │ ├── exception │ │ │ ├── ClassNotFoundException.php │ │ │ ├── DbException.php │ │ │ ├── ErrorException.php │ │ │ ├── Handle.php │ │ │ ├── HttpException.php │ │ │ ├── HttpResponseException.php │ │ │ ├── PDOException.php │ │ │ ├── RouteNotFoundException.php │ │ │ ├── TemplateNotFoundException.php │ │ │ ├── ThrowableError.php │ │ │ └── ValidateException.php │ │ ├── facade │ │ │ ├── App.php │ │ │ ├── Build.php │ │ │ ├── Cache.php │ │ │ ├── Config.php │ │ │ ├── Cookie.php │ │ │ ├── Debug.php │ │ │ ├── Env.php │ │ │ ├── Hook.php │ │ │ ├── Lang.php │ │ │ ├── Log.php │ │ │ ├── Request.php │ │ │ ├── Response.php │ │ │ ├── Route.php │ │ │ ├── Session.php │ │ │ ├── Url.php │ │ │ ├── Validate.php │ │ │ └── View.php │ │ ├── http │ │ │ ├── middleware │ │ │ │ ├── Dispatcher.php │ │ │ │ ├── DispatcherInterface.php │ │ │ │ └── MissingResponseException.php │ │ │ └── tests │ │ │ │ └── middleware │ │ │ │ └── DispatcherTest.php │ │ ├── log │ │ │ └── driver │ │ │ │ ├── File.php │ │ │ │ ├── Socket.php │ │ │ │ └── Test.php │ │ ├── model │ │ │ ├── Collection.php │ │ │ ├── Merge.php │ │ │ ├── Pivot.php │ │ │ ├── Relation.php │ │ │ ├── concern │ │ │ │ ├── Attribute.php │ │ │ │ ├── Conversion.php │ │ │ │ ├── ModelEvent.php │ │ │ │ ├── RelationShip.php │ │ │ │ ├── SoftDelete.php │ │ │ │ └── TimeStamp.php │ │ │ └── relation │ │ │ │ ├── BelongsTo.php │ │ │ │ ├── BelongsToMany.php │ │ │ │ ├── HasMany.php │ │ │ │ ├── HasManyThrough.php │ │ │ │ ├── HasOne.php │ │ │ │ ├── MorphMany.php │ │ │ │ ├── MorphOne.php │ │ │ │ ├── MorphTo.php │ │ │ │ └── OneToOne.php │ │ ├── paginator │ │ │ ├── Collection.php │ │ │ └── driver │ │ │ │ └── Bootstrap.php │ │ ├── process │ │ │ ├── Builder.php │ │ │ ├── Utils.php │ │ │ ├── exception │ │ │ │ ├── Faild.php │ │ │ │ ├── Failed.php │ │ │ │ └── Timeout.php │ │ │ └── pipes │ │ │ │ ├── Pipes.php │ │ │ │ ├── Unix.php │ │ │ │ └── Windows.php │ │ ├── response │ │ │ ├── Json.php │ │ │ ├── Jsonp.php │ │ │ ├── Jump.php │ │ │ ├── Redirect.php │ │ │ ├── View.php │ │ │ └── Xml.php │ │ ├── route │ │ │ ├── Dispatch.php │ │ │ ├── Domain.php │ │ │ ├── Resource.php │ │ │ ├── Rule.php │ │ │ ├── RuleGroup.php │ │ │ ├── RuleItem.php │ │ │ └── dispatch │ │ │ │ ├── Callback.php │ │ │ │ ├── Controller.php │ │ │ │ ├── Module.php │ │ │ │ ├── Redirect.php │ │ │ │ ├── Response.php │ │ │ │ ├── Url.php │ │ │ │ └── View.php │ │ ├── session │ │ │ └── driver │ │ │ │ ├── Memcache.php │ │ │ │ ├── Memcached.php │ │ │ │ └── Redis.php │ │ ├── template │ │ │ ├── TagLib.php │ │ │ ├── driver │ │ │ │ └── File.php │ │ │ └── taglib │ │ │ │ └── Cx.php │ │ ├── validate │ │ │ └── ValidateRule.php │ │ └── view │ │ │ └── driver │ │ │ ├── Php.php │ │ │ └── Think.php │ └── traits │ │ ├── controller │ │ └── Jump.php │ │ ├── model │ │ └── SoftDelete.php │ │ └── think │ │ └── Instance.php │ ├── logo.png │ ├── phpunit.xml │ ├── phpunit.xml.dist │ ├── start.php │ └── tpl │ ├── default_index.tpl │ ├── dispatch_jump.tpl │ ├── page_trace.tpl │ └── think_exception.tpl ├── site.template └── www.conf /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | runtime -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // 使用 IntelliSense 了解相关属性。 3 | // 悬停以查看现有属性的描述。 4 | // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "npm run build", 11 | "program": "${workspaceFolder}/frontEnd/build/build.js", 12 | "cwd": "${workspaceFolder}/frontEnd", 13 | "skipFiles": [ 14 | "/**" 15 | ] 16 | }, 17 | { 18 | "name": "Listen for XDebug", 19 | "type": "php", 20 | "request": "launch", 21 | "port": 9000 22 | }, 23 | { 24 | "name": "Launch currently open script", 25 | "type": "php", 26 | "request": "launch", 27 | "program": "${file}", 28 | "cwd": "${fileDirname}", 29 | "port": 9000 30 | } 31 | ] 32 | } -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | nginx: 4 | image: nginx 5 | volumes: 6 | - ./site.template:/etc/nginx/conf.d/site.template 7 | - ./frontEnd/dist:/home/site/vue-think-web 8 | - ./php:/home/site/vue-think-server 9 | depends_on: 10 | - php-fpm 11 | ports: 12 | - "80:80" 13 | command: /bin/bash -c "cat /etc/nginx/conf.d/site.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'" 14 | networks: 15 | - php 16 | php-fpm: 17 | container_name: php-fpm 18 | image: crunchgeek/php-fpm:7.2 19 | environment: 20 | - PHP_ACCESS_LOG=on 21 | - PHP_UID=1000 22 | - PHP_GID=1000 23 | - PHP_HOME=/app 24 | - PHP_USER=php-fpm 25 | - PHP_POOL_PATH=/app/www.conf 26 | volumes: 27 | - ./php:/home/site/vue-think-server 28 | - ./www.conf:/app/www.conf 29 | networks: 30 | - php 31 | networks: 32 | php: 33 | driver: bridge -------------------------------------------------------------------------------- /formatter.json: -------------------------------------------------------------------------------- 1 | { 2 | "onSave": true, 3 | "javascript": { 4 | "indent_size": 2, 5 | "indent_char": " ", 6 | "eol": "auto", 7 | "end_with_newline": true, 8 | "preserve_newlines": true, 9 | "break_chained_methods": false, 10 | "max_preserve_newlines": 0, 11 | "space_in_paren": false, 12 | "space_in_empty_paren": false, 13 | "jslint_happy": false, 14 | "space_after_anon_function": true, 15 | "keep_array_indentation": true, 16 | "space_before_conditional": true, 17 | "unescape_strings": false, 18 | "wrap_line_length": 0, 19 | "e4x": false, 20 | "comma_first": false, 21 | "brace_style": "collapse-preserve-inline" 22 | }, 23 | "css": { 24 | "indent_size": 2, 25 | "indentCharacter": " ", 26 | "indent_char": " ", 27 | "selector_separator_newline": true, 28 | "end_with_newline": false, 29 | "newline_between_rules": true, 30 | "eol": "\n" 31 | }, 32 | "html": { 33 | "indent_inner_html": false, 34 | "indent_size": 2, 35 | "indent_char": " ", 36 | "indent_character": " " 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /frontEnd/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": [ 12 | "transform-vue-jsx", 13 | "transform-runtime", 14 | ["component", [{ "libraryName": "element-ui", "styleLibraryName": "theme-chalk" }]] 15 | ], 16 | "env": { 17 | "test": { 18 | "presets": ["env", "stage-2"], 19 | "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"] 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /frontEnd/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /frontEnd/.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /dist/ 4 | /*.js 5 | /test/unit/coverage/ 6 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /frontEnd/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | /test/unit/coverage/ 8 | /test/e2e/reports/ 9 | selenium-debug.log 10 | compilation-stats.json 11 | 12 | # Editor directories and files 13 | .idea 14 | .vscode 15 | *.suo 16 | *.ntvs* 17 | *.njsproj 18 | *.sln 19 | -------------------------------------------------------------------------------- /frontEnd/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /frontEnd/README.md: -------------------------------------------------------------------------------- 1 | # fontend 2 | 3 | > A Vue.js project 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | npm install 10 | 11 | # serve with hot reload at localhost:8080 12 | npm run dev 13 | 14 | # build for production with minification 15 | npm run build 16 | 17 | # build for production and view the bundle analyzer report 18 | npm run build --report 19 | 20 | # run unit tests 21 | npm run unit 22 | 23 | # run e2e tests 24 | npm run e2e 25 | 26 | # run all tests 27 | npm test 28 | ``` 29 | 30 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 31 | -------------------------------------------------------------------------------- /frontEnd/build/analyz.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.analyz.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | process.exit(1) 33 | } 34 | 35 | console.log(chalk.cyan(' Build complete.\n')) 36 | console.log(chalk.yellow( 37 | ' Tip: built files are meant to be served over an HTTP server.\n' + 38 | ' Opening index.html over file:// won\'t work.\n' 39 | )) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /frontEnd/build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | const info = stats.toJson(); 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | info.errors.forEach(function(item) { 33 | console.error(item) 34 | }) 35 | process.exit(1) 36 | } 37 | if (stats.hasWarnings()) { 38 | info.warnings.forEach(function(item) { 39 | console.warn(item) 40 | }) 41 | } 42 | console.log(chalk.cyan(' Build complete.\n')) 43 | console.log(stats.toString({ 44 | // Add console colors 45 | colors: true 46 | })); 47 | console.log(chalk.yellow( 48 | ' Tip: built files are meant to be served over an HTTP server.\n' + 49 | ' Opening index.html over file:// won\'t work.\n' 50 | )) 51 | }) 52 | }) 53 | -------------------------------------------------------------------------------- /frontEnd/build/check-versions.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const chalk = require('chalk') 3 | const semver = require('semver') 4 | const packageConfig = require('../package.json') 5 | const shell = require('shelljs') 6 | 7 | function exec (cmd) { 8 | return require('child_process').execSync(cmd).toString().trim() 9 | } 10 | 11 | const versionRequirements = [ 12 | { 13 | name: 'node', 14 | currentVersion: semver.clean(process.version), 15 | versionRequirement: packageConfig.engines.node 16 | } 17 | ] 18 | 19 | if (shell.which('npm')) { 20 | versionRequirements.push({ 21 | name: 'npm', 22 | currentVersion: exec('npm --version'), 23 | versionRequirement: packageConfig.engines.npm 24 | }) 25 | } 26 | 27 | module.exports = function () { 28 | const warnings = [] 29 | 30 | for (let i = 0; i < versionRequirements.length; i++) { 31 | const mod = versionRequirements[i] 32 | 33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 34 | warnings.push(mod.name + ': ' + 35 | chalk.red(mod.currentVersion) + ' should be ' + 36 | chalk.green(mod.versionRequirement) 37 | ) 38 | } 39 | } 40 | 41 | if (warnings.length) { 42 | console.log('') 43 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 44 | console.log() 45 | 46 | for (let i = 0; i < warnings.length; i++) { 47 | const warning = warnings[i] 48 | console.log(' ' + warning) 49 | } 50 | 51 | console.log() 52 | process.exit(1) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /frontEnd/build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/build/logo.png -------------------------------------------------------------------------------- /frontEnd/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const sourceMapEnabled = isProduction 6 | ? config.build.productionSourceMap 7 | : config.dev.cssSourceMap 8 | 9 | module.exports = { 10 | loaders: utils.cssLoaders({ 11 | sourceMap: sourceMapEnabled, 12 | extract: isProduction 13 | }), 14 | cssSourceMap: sourceMapEnabled, 15 | cacheBusting: config.dev.cacheBusting, 16 | transformToRequire: { 17 | video: ['src', 'poster'], 18 | source: 'src', 19 | img: 'src', 20 | image: 'xlink:href' 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /frontEnd/config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /frontEnd/config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /frontEnd/config/test.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const devEnv = require('./dev.env') 4 | 5 | module.exports = merge(devEnv, { 6 | NODE_ENV: '"testing"' 7 | }) 8 | -------------------------------------------------------------------------------- /frontEnd/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | fontend 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /frontEnd/src/.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine on 2 | RewriteCond %{REQUEST_FILENAME} !-d 3 | RewriteCond %{REQUEST_FILENAME} !-f 4 | RewriteRule ^(.*)$ index.html [QSA,PT,L] 5 | -------------------------------------------------------------------------------- /frontEnd/src/App.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /frontEnd/src/assets/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /frontEnd/src/assets/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /frontEnd/src/assets/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /frontEnd/src/assets/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /frontEnd/src/assets/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /frontEnd/src/assets/images/bg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/images/bg1.jpg -------------------------------------------------------------------------------- /frontEnd/src/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/images/logo.png -------------------------------------------------------------------------------- /frontEnd/src/assets/images/logo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/images/logo1.png -------------------------------------------------------------------------------- /frontEnd/src/assets/images/logo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/images/logo2.png -------------------------------------------------------------------------------- /frontEnd/src/assets/images/logo3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/images/logo3.png -------------------------------------------------------------------------------- /frontEnd/src/assets/images/logo4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/images/logo4.png -------------------------------------------------------------------------------- /frontEnd/src/assets/images/logo5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/images/logo5.png -------------------------------------------------------------------------------- /frontEnd/src/assets/images/logout_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/images/logout_16.png -------------------------------------------------------------------------------- /frontEnd/src/assets/images/logout_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/images/logout_24.png -------------------------------------------------------------------------------- /frontEnd/src/assets/images/logout_36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/src/assets/images/logout_36.png -------------------------------------------------------------------------------- /frontEnd/src/assets/js/bus.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | export default new Vue() 3 | -------------------------------------------------------------------------------- /frontEnd/src/assets/js/config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | HOST: HOST, // 域名 3 | advanceTime: 600 // 提前获取新token的时间(s) 4 | } 5 | -------------------------------------------------------------------------------- /frontEnd/src/assets/js/form_com.js: -------------------------------------------------------------------------------- 1 | import router from '@/router/index.js' 2 | const formMixin = { 3 | methods: { 4 | goback() { 5 | router.go(-1) 6 | } 7 | } 8 | } 9 | 10 | export default formMixin 11 | -------------------------------------------------------------------------------- /frontEnd/src/assets/js/global.js: -------------------------------------------------------------------------------- 1 | import store from '@/vuex/store' 2 | import router from '@/router/index.js' 3 | import bus from '@/assets/js/bus.js' 4 | import { Message } from 'element-ui' 5 | Vue.prototype.$message = Message 6 | 7 | const commonFn = { 8 | j2s(obj) { 9 | return JSON.stringify(obj) 10 | }, 11 | shallowRefresh(name) { 12 | router.replace({ path: '/refresh', query: { name: name }}) 13 | }, 14 | closeGlobalLoading() { 15 | setTimeout(() => { 16 | store.dispatch('showLoading', false) 17 | }, 0) 18 | }, 19 | openGlobalLoading() { 20 | setTimeout(() => { 21 | store.dispatch('showLoading', true) 22 | }, 0) 23 | }, 24 | cloneJson(obj) { 25 | return JSON.parse(JSON.stringify(obj)) 26 | }, 27 | toastMsg(type, msg) { 28 | switch (type) { 29 | case 'normal': 30 | bus.$message(msg) 31 | break 32 | case 'success': 33 | bus.$message({ 34 | message: msg, 35 | type: 'success' 36 | }) 37 | break 38 | case 'warning': 39 | bus.$message({ 40 | message: msg, 41 | type: 'warning' 42 | }) 43 | break 44 | case 'error': 45 | bus.$message.error(msg) 46 | break 47 | } 48 | }, 49 | clearVuex(cate) { 50 | store.dispatch(cate, []) 51 | }, 52 | getHasRule(val) { 53 | const moduleRule = 'admin' 54 | let userInfo = store.state.users 55 | if (userInfo.id == 1) { 56 | return true 57 | } else { 58 | let authList = store.state.rules 59 | const ruleName = moduleRule + '-' + val 60 | return _.includes(authList, ruleName) 61 | } 62 | } 63 | } 64 | 65 | export default commonFn 66 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /frontEnd/src/components/Admin/structures/position/add.vue: -------------------------------------------------------------------------------- 1 | 23 | -------------------------------------------------------------------------------- /frontEnd/src/components/Admin/system/config/preview.vue: -------------------------------------------------------------------------------- 1 | 6 | 11 | -------------------------------------------------------------------------------- /frontEnd/src/components/Busi/mail/mail/add.vue: -------------------------------------------------------------------------------- 1 | 23 | -------------------------------------------------------------------------------- /frontEnd/src/components/Common/leftMenu.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | -------------------------------------------------------------------------------- /frontEnd/src/components/refresh.vue: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /frontEnd/src/main.js: -------------------------------------------------------------------------------- 1 | import 'babel-polyfill' 2 | import Vue from 'vue' 3 | import App from './App' 4 | import router from '@/router/index.js' 5 | import store from './vuex/store' 6 | import filter from './assets/js/filter' 7 | import 'assets/css/global.css' 8 | import 'assets/css/base.css' 9 | import './.htaccess' 10 | 11 | new Vue({ 12 | el: '#app', 13 | template: '', 14 | filters: filter, 15 | router, 16 | store, 17 | components: { App } 18 | }).$mount('#app') 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /frontEnd/src/vuex/getters.js: -------------------------------------------------------------------------------- 1 | const getters = { 2 | // getCount: state => state.count, 3 | } 4 | 5 | export default getters 6 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /frontEnd/src/vuex/state.js: -------------------------------------------------------------------------------- 1 | const state = { 2 | showLeftMenu: true, 3 | globalLoading: true, 4 | menus: [], 5 | rules: [], 6 | users: {}, 7 | userGroups: [], 8 | organizes: [], 9 | pageSize: 15 10 | } 11 | 12 | export default state 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /frontEnd/static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/frontEnd/static/.gitkeep -------------------------------------------------------------------------------- /frontEnd/test/e2e/custom-assertions/elementCount.js: -------------------------------------------------------------------------------- 1 | // A custom Nightwatch assertion. 2 | // The assertion name is the filename. 3 | // Example usage: 4 | // 5 | // browser.assert.elementCount(selector, count) 6 | // 7 | // For more information on custom assertions see: 8 | // http://nightwatchjs.org/guide#writing-custom-assertions 9 | 10 | exports.assertion = function (selector, count) { 11 | this.message = 'Testing if element <' + selector + '> has count: ' + count 12 | this.expected = count 13 | this.pass = function (val) { 14 | return val === this.expected 15 | } 16 | this.value = function (res) { 17 | return res.value 18 | } 19 | this.command = function (cb) { 20 | var self = this 21 | return this.api.execute(function (selector) { 22 | return document.querySelectorAll(selector).length 23 | }, [selector], function (res) { 24 | cb.call(self, res) 25 | }) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /frontEnd/test/e2e/nightwatch.conf.js: -------------------------------------------------------------------------------- 1 | require('babel-register') 2 | var config = require('../../config') 3 | 4 | // http://nightwatchjs.org/gettingstarted#settings-file 5 | module.exports = { 6 | src_folders: ['test/e2e/specs'], 7 | output_folder: 'test/e2e/reports', 8 | custom_assertions_path: ['test/e2e/custom-assertions'], 9 | 10 | selenium: { 11 | start_process: true, 12 | server_path: require('selenium-server').path, 13 | host: '127.0.0.1', 14 | port: 4444, 15 | cli_args: { 16 | 'webdriver.chrome.driver': require('chromedriver').path 17 | } 18 | }, 19 | 20 | test_settings: { 21 | default: { 22 | selenium_port: 4444, 23 | selenium_host: 'localhost', 24 | silent: true, 25 | globals: { 26 | devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port) 27 | } 28 | }, 29 | 30 | chrome: { 31 | desiredCapabilities: { 32 | browserName: 'chrome', 33 | javascriptEnabled: true, 34 | acceptSslCerts: true 35 | } 36 | }, 37 | 38 | firefox: { 39 | desiredCapabilities: { 40 | browserName: 'firefox', 41 | javascriptEnabled: true, 42 | acceptSslCerts: true 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /frontEnd/test/e2e/runner.js: -------------------------------------------------------------------------------- 1 | // 1. start the dev server using production config 2 | process.env.NODE_ENV = 'testing' 3 | 4 | const webpack = require('webpack') 5 | const DevServer = require('webpack-dev-server') 6 | 7 | const webpackConfig = require('../../build/webpack.prod.conf') 8 | const devConfigPromise = require('../../build/webpack.dev.conf') 9 | 10 | let server 11 | 12 | devConfigPromise.then(devConfig => { 13 | const devServerOptions = devConfig.devServer 14 | const compiler = webpack(webpackConfig) 15 | server = new DevServer(compiler, devServerOptions) 16 | const port = devServerOptions.port 17 | const host = devServerOptions.host 18 | return server.listen(port, host) 19 | }) 20 | .then(() => { 21 | // 2. run the nightwatch test suite against it 22 | // to run in additional browsers: 23 | // 1. add an entry in test/e2e/nightwatch.conf.js under "test_settings" 24 | // 2. add it to the --env flag below 25 | // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` 26 | // For more information on Nightwatch's config file, see 27 | // http://nightwatchjs.org/guide#settings-file 28 | let opts = process.argv.slice(2) 29 | if (opts.indexOf('--config') === -1) { 30 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) 31 | } 32 | if (opts.indexOf('--env') === -1) { 33 | opts = opts.concat(['--env', 'chrome']) 34 | } 35 | 36 | const spawn = require('cross-spawn') 37 | const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) 38 | 39 | runner.on('exit', function (code) { 40 | server.close() 41 | process.exit(code) 42 | }) 43 | 44 | runner.on('error', function (err) { 45 | server.close() 46 | throw err 47 | }) 48 | }) 49 | -------------------------------------------------------------------------------- /frontEnd/test/e2e/specs/test.js: -------------------------------------------------------------------------------- 1 | // For authoring Nightwatch tests, see 2 | // http://nightwatchjs.org/guide#usage 3 | 4 | module.exports = { 5 | 'default e2e tests': function (browser) { 6 | // automatically uses dev Server port from /config.index.js 7 | // default: http://localhost:8080 8 | // see nightwatch.conf.js 9 | const devServer = browser.globals.devServerURL 10 | 11 | browser 12 | .url(devServer) 13 | .waitForElementVisible('#app', 5000) 14 | .assert.elementPresent('.hello') 15 | .assert.containsText('h1', 'Welcome to Your Vue.js App') 16 | .assert.elementCount('img', 1) 17 | .end() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /frontEnd/test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jest": true 4 | }, 5 | "globals": { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /frontEnd/test/unit/jest.conf.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | module.exports = { 4 | rootDir: path.resolve(__dirname, '../../'), 5 | moduleFileExtensions: [ 6 | 'js', 7 | 'json', 8 | 'vue' 9 | ], 10 | moduleNameMapper: { 11 | '^@/(.*)$': '/src/$1' 12 | }, 13 | transform: { 14 | '^.+\\.js$': '/node_modules/babel-jest', 15 | '.*\\.(vue)$': '/node_modules/vue-jest' 16 | }, 17 | testPathIgnorePatterns: [ 18 | '/test/e2e' 19 | ], 20 | snapshotSerializers: ['/node_modules/jest-serializer-vue'], 21 | setupFiles: ['/test/unit/setup'], 22 | mapCoverage: true, 23 | coverageDirectory: '/test/unit/coverage', 24 | collectCoverageFrom: [ 25 | 'src/**/*.{js,vue}', 26 | '!src/main.js', 27 | '!src/router/index.js', 28 | '!**/node_modules/**' 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /frontEnd/test/unit/setup.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | Vue.config.productionTip = false 4 | -------------------------------------------------------------------------------- /frontEnd/test/unit/specs/HelloWorld.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import HelloWorld from '@/components/HelloWorld' 3 | 4 | describe('HelloWorld.vue', () => { 5 | it('should render correct contents', () => { 6 | const Constructor = Vue.extend(HelloWorld) 7 | const vm = new Constructor().$mount() 8 | expect(vm.$el.querySelector('.hello h1').textContent) 9 | .toEqual('Welcome to Your Vue.js App') 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /npm-debug.log: -------------------------------------------------------------------------------- 1 | 0 info it worked if it ends with ok 2 | 1 verbose cli [ 'D:\\node\\node.exe', 3 | 1 verbose cli 'D:\\node\\node_modules\\npm\\bin\\npm-cli.js', 4 | 1 verbose cli 'run', 5 | 1 verbose cli 'dev' ] 6 | 2 info using npm@3.10.9 7 | 3 info using node@v6.9.2 8 | 4 verbose stack Error: ENOENT: no such file or directory, open 'C:\wamp64\www\vue-think\VueThink\package.json' 9 | 4 verbose stack at Error (native) 10 | 5 verbose cwd C:\wamp64\www\vue-think\VueThink 11 | 6 error Windows_NT 6.1.7601 12 | 7 error argv "D:\\node\\node.exe" "D:\\node\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev" 13 | 8 error node v6.9.2 14 | 9 error npm v3.10.9 15 | 10 error path C:\wamp64\www\vue-think\VueThink\package.json 16 | 11 error code ENOENT 17 | 12 error errno -4058 18 | 13 error syscall open 19 | 14 error enoent ENOENT: no such file or directory, open 'C:\wamp64\www\vue-think\VueThink\package.json' 20 | 15 error enoent ENOENT: no such file or directory, open 'C:\wamp64\www\vue-think\VueThink\package.json' 21 | 15 error enoent This is most likely not a problem with npm itself 22 | 15 error enoent and is related to npm not being able to find a file. 23 | 16 verbose exit [ -4058, true ] 24 | -------------------------------------------------------------------------------- /php/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | composer.lock 3 | *.log 4 | runtime/ -------------------------------------------------------------------------------- /php/.htaccess: -------------------------------------------------------------------------------- 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/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/application/.htaccess: -------------------------------------------------------------------------------- 1 | deny from all -------------------------------------------------------------------------------- /php/application/admin/config.php: -------------------------------------------------------------------------------- 1 | uid; 12 | $data = $userModel->getInfo($uid); 13 | return resultArray(['data' => $data]); 14 | } 15 | public function refresh(){ 16 | $userModel = model('User'); 17 | $uid = $this->uid; 18 | $authData = $userModel->createJwt($uid); 19 | return resultArray(['data' => $authData]); 20 | } 21 | } -------------------------------------------------------------------------------- /php/application/admin/controller/SystemConfigs.php: -------------------------------------------------------------------------------- 1 | 6 | // +---------------------------------------------------------------------- 7 | 8 | namespace app\admin\controller; 9 | 10 | use app\common\controller\ApiCommon; 11 | 12 | class SystemConfigs extends ApiCommon 13 | { 14 | public function save() 15 | { 16 | $configModel = model('SystemConfig'); 17 | $param = $this->param; 18 | $data = $configModel->createData($param); 19 | if (!$data) { 20 | return resultArray(['error' => $configModel->getError()]); 21 | } 22 | return resultArray(['data' => '添加成功']); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /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/Group.php: -------------------------------------------------------------------------------- 1 | 6 | // +---------------------------------------------------------------------- 7 | 8 | namespace app\admin\model; 9 | 10 | use app\common\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/Post.php: -------------------------------------------------------------------------------- 1 | 6 | // +---------------------------------------------------------------------- 7 | 8 | namespace app\admin\model; 9 | 10 | use app\common\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/application/admin/model/Rule.php: -------------------------------------------------------------------------------- 1 | 6 | // +---------------------------------------------------------------------- 7 | 8 | namespace app\admin\model; 9 | 10 | use app\common\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 | } -------------------------------------------------------------------------------- /php/application/admin/model/Structure.php: -------------------------------------------------------------------------------- 1 | 6 | // +---------------------------------------------------------------------- 7 | 8 | namespace app\admin\model; 9 | 10 | use app\common\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/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/admin/validate/AdminGroup.php: -------------------------------------------------------------------------------- 1 | 'require', 12 | 'rules' => 'require', 13 | ); 14 | protected $message = array( 15 | 'title.require' => '标题必须填写', 16 | 'rules.require' => '规则必须填写', 17 | ); 18 | } -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /php/application/admin/validate/AdminPost.php: -------------------------------------------------------------------------------- 1 | 'require', 12 | ); 13 | protected $message = array( 14 | 'name.require' => '部门名称必须填写', 15 | ); 16 | } -------------------------------------------------------------------------------- /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/AdminStructure.php: -------------------------------------------------------------------------------- 1 | 'require', 12 | ); 13 | protected $message = array( 14 | 'name.require' => '标题必须填写', 15 | ); 16 | } -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /php/application/command.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | return []; -------------------------------------------------------------------------------- /php/application/common/adapter/AuthAdapter.php: -------------------------------------------------------------------------------- 1 | uid = $uid; 17 | } 18 | 19 | //实例化权限类 20 | public static function getInstance($uid) 21 | { 22 | if (!(self::$_instance instanceof HonrayAuth)) { 23 | self::$_instance = new HonrayAuth($uid); 24 | } 25 | return self::$_instance; 26 | } 27 | //登录认证 28 | public function checkLogin($names, $uid, $relation='or') 29 | { 30 | self::getInstance($this->uid)->_config['AUTH_TYPE'] = 2; 31 | if ($uid == 1){ 32 | return true; 33 | } 34 | if (!self::getInstance($this->uid)->check($names, $uid, $relation)) { 35 | return false; 36 | } else { 37 | return true; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /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/application/common/controller/ApiCommon.php: -------------------------------------------------------------------------------- 1 | 6 | // +---------------------------------------------------------------------- 7 | 8 | namespace app\common\controller; 9 | 10 | use think\Request; 11 | use think\Db; 12 | use app\common\adapter\AuthAdapter; 13 | 14 | class ApiCommon extends BaseCommon 15 | { 16 | public function _initialize() 17 | { 18 | parent::_initialize(); 19 | // 检查账号有效性 20 | $uid = $this->uid; 21 | $userInfo = model('app\admin\model\User')->getUserById($uid); 22 | $map['id'] = $userInfo['id']; 23 | $map['status'] = 1; 24 | if (!Db::name('admin_user')->where($map)->value('id')) { 25 | header('Content-Type:application/json; charset=utf-8'); 26 | exit(json_encode(['code'=>103, 'error'=>'账号已被删除或禁用'])); 27 | } 28 | $authAdapter = new AuthAdapter($userInfo['id']); 29 | $request = Request::instance(); 30 | $ruleName = $request->module().'-'.$request->controller() .'-'.$request->action(); 31 | if (!$authAdapter->checkLogin($ruleName, $userInfo['id'])) { 32 | header('Content-Type:application/json; charset=utf-8'); 33 | exit(json_encode(['code'=>102,'error'=>'没有权限'])); 34 | } 35 | $GLOBALS['userInfo'] = $userInfo; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /php/application/common/controller/BaseCommon.php: -------------------------------------------------------------------------------- 1 | header(); 17 | $authKey = $header['authkey']; 18 | $userModel = model('app\admin\model\User'); 19 | $uid = $userModel->getUid($authKey); 20 | if(!empty($authKey) && $uid){ 21 | $this->uid = $uid; 22 | }else{ 23 | header('Content-Type:application/json; charset=utf-8'); 24 | exit(json_encode(['code'=>101, 'error'=>'登录已失效'])); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /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/application/extra/queue.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | return [ 13 | 'connector' => 'Sync' 14 | ]; 15 | -------------------------------------------------------------------------------- /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/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/config/database.php: -------------------------------------------------------------------------------- 1 | 6 | // +---------------------------------------------------------------------- 7 | return [ 8 | // 数据库类型 9 | 'type' => 'mysql', 10 | // 服务器地址 11 | 'hostname' => 'host.docker.internal', 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/config/extra/cus_config.php: -------------------------------------------------------------------------------- 1 | 6 | // +---------------------------------------------------------------------- 7 | 8 | return [ 9 | //jwt密钥 10 | 'secret' => '5802b372c71d009efaf37c866730c09d', 11 | ]; -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Claim.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 2.0.0 17 | */ 18 | interface Claim extends JsonSerializable 19 | { 20 | /** 21 | * Returns the claim name 22 | * 23 | * @return string 24 | */ 25 | public function getName(); 26 | 27 | /** 28 | * Returns the claim value 29 | * 30 | * @return string 31 | */ 32 | public function getValue(); 33 | 34 | /** 35 | * Returns the string representation of the claim 36 | * 37 | * @return string 38 | */ 39 | public function __toString(); 40 | } 41 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Claim/Basic.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 2.0.0 17 | */ 18 | class Basic implements Claim 19 | { 20 | /** 21 | * @var string 22 | */ 23 | private $name; 24 | 25 | /** 26 | * @var mixed 27 | */ 28 | private $value; 29 | 30 | /** 31 | * Initializes the claim 32 | * 33 | * @param string $name 34 | * @param mixed $value 35 | */ 36 | public function __construct($name, $value) 37 | { 38 | $this->name = $name; 39 | $this->value = $value; 40 | } 41 | 42 | /** 43 | * {@inheritdoc} 44 | */ 45 | public function getName() 46 | { 47 | return $this->name; 48 | } 49 | 50 | /** 51 | * {@inheritdoc} 52 | */ 53 | public function getValue() 54 | { 55 | return $this->value; 56 | } 57 | 58 | /** 59 | * {@inheritdoc} 60 | */ 61 | public function jsonSerialize() 62 | { 63 | return $this->value; 64 | } 65 | 66 | /** 67 | * {@inheritdoc} 68 | */ 69 | public function __toString() 70 | { 71 | return (string) $this->value; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Claim/EqualsTo.php: -------------------------------------------------------------------------------- 1 | 17 | * @since 2.0.0 18 | */ 19 | class EqualsTo extends Basic implements Claim, Validatable 20 | { 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function validate(ValidationData $data) 25 | { 26 | if ($data->has($this->getName())) { 27 | return $this->getValue() === $data->get($this->getName()); 28 | } 29 | 30 | return true; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Claim/GreaterOrEqualsTo.php: -------------------------------------------------------------------------------- 1 | 17 | * @since 2.0.0 18 | */ 19 | class GreaterOrEqualsTo extends Basic implements Claim, Validatable 20 | { 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function validate(ValidationData $data) 25 | { 26 | if ($data->has($this->getName())) { 27 | return $this->getValue() >= $data->get($this->getName()); 28 | } 29 | 30 | return true; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Claim/LesserOrEqualsTo.php: -------------------------------------------------------------------------------- 1 | 17 | * @since 2.0.0 18 | */ 19 | class LesserOrEqualsTo extends Basic implements Claim, Validatable 20 | { 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function validate(ValidationData $data) 25 | { 26 | if ($data->has($this->getName())) { 27 | return $this->getValue() <= $data->get($this->getName()); 28 | } 29 | 30 | return true; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Claim/Validatable.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 2.0.0 17 | */ 18 | interface Validatable 19 | { 20 | /** 21 | * Returns if claim is valid according with given data 22 | * 23 | * @param ValidationData $data 24 | * 25 | * @return boolean 26 | */ 27 | public function validate(ValidationData $data); 28 | } 29 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Parsing/Decoder.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 0.1.0 17 | * 18 | * @link http://tools.ietf.org/html/rfc4648#section-5 19 | */ 20 | class Decoder 21 | { 22 | /** 23 | * Decodes from JSON, validating the errors (will return an associative array 24 | * instead of objects) 25 | * 26 | * @param string $json 27 | * @return mixed 28 | * 29 | * @throws RuntimeException When something goes wrong while decoding 30 | */ 31 | public function jsonDecode($json) 32 | { 33 | $data = json_decode($json); 34 | 35 | if (json_last_error() != JSON_ERROR_NONE) { 36 | throw new RuntimeException('Error while decoding to JSON: ' . json_last_error_msg()); 37 | } 38 | 39 | return $data; 40 | } 41 | 42 | /** 43 | * Decodes from base64url 44 | * 45 | * @param string $data 46 | * @return string 47 | */ 48 | public function base64UrlDecode($data) 49 | { 50 | if ($remainder = strlen($data) % 4) { 51 | $data .= str_repeat('=', 4 - $remainder); 52 | } 53 | 54 | return base64_decode(strtr($data, '-_', '+/')); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Parsing/Encoder.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 0.1.0 17 | * 18 | * @link http://tools.ietf.org/html/rfc4648#section-5 19 | */ 20 | class Encoder 21 | { 22 | /** 23 | * Encodes to JSON, validating the errors 24 | * 25 | * @param mixed $data 26 | * @return string 27 | * 28 | * @throws RuntimeException When something goes wrong while encoding 29 | */ 30 | public function jsonEncode($data) 31 | { 32 | $json = json_encode($data); 33 | 34 | if (json_last_error() != JSON_ERROR_NONE) { 35 | throw new RuntimeException('Error while encoding to JSON: ' . json_last_error_msg()); 36 | } 37 | 38 | return $json; 39 | } 40 | 41 | /** 42 | * Encodes to base64url 43 | * 44 | * @param string $data 45 | * @return string 46 | */ 47 | public function base64UrlEncode($data) 48 | { 49 | return str_replace('=', '', strtr(base64_encode($data), '+/', '-_')); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signature.php: -------------------------------------------------------------------------------- 1 | 14 | * @since 0.1.0 15 | */ 16 | class Signature 17 | { 18 | /** 19 | * The resultant hash 20 | * 21 | * @var string 22 | */ 23 | protected $hash; 24 | 25 | /** 26 | * Initializes the object 27 | * 28 | * @param string $hash 29 | */ 30 | public function __construct($hash) 31 | { 32 | $this->hash = $hash; 33 | } 34 | 35 | /** 36 | * Verifies if the current hash matches with with the result of the creation of 37 | * a new signature with given data 38 | * 39 | * @param Signer $signer 40 | * @param string $payload 41 | * @param string $key 42 | * 43 | * @return boolean 44 | */ 45 | public function verify(Signer $signer, $payload, $key) 46 | { 47 | return $signer->verify($this->hash, $payload, $key); 48 | } 49 | 50 | /** 51 | * Returns the current hash as a string representation of the signature 52 | * 53 | * @return string 54 | */ 55 | public function __toString() 56 | { 57 | return $this->hash; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signer.php: -------------------------------------------------------------------------------- 1 | 17 | * @since 0.1.0 18 | */ 19 | interface Signer 20 | { 21 | /** 22 | * Returns the algorithm id 23 | * 24 | * @return string 25 | */ 26 | public function getAlgorithmId(); 27 | 28 | /** 29 | * Apply changes on headers according with algorithm 30 | * 31 | * @param array $headers 32 | */ 33 | public function modifyHeader(array &$headers); 34 | 35 | /** 36 | * Returns a signature for given data 37 | * 38 | * @param string $payload 39 | * @param Key|string $key 40 | * 41 | * @return Signature 42 | * 43 | * @throws InvalidArgumentException When given key is invalid 44 | */ 45 | public function sign($payload, $key); 46 | 47 | /** 48 | * Returns if the expected hash matches with the data and key 49 | * 50 | * @param string $expected 51 | * @param string $payload 52 | * @param Key|string $key 53 | * 54 | * @return boolean 55 | * 56 | * @throws InvalidArgumentException When given key is invalid 57 | */ 58 | public function verify($expected, $payload, $key); 59 | } 60 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signer/BaseSigner.php: -------------------------------------------------------------------------------- 1 | 17 | * @since 0.1.0 18 | */ 19 | abstract class BaseSigner implements Signer 20 | { 21 | /** 22 | * {@inheritdoc} 23 | */ 24 | public function modifyHeader(array &$headers) 25 | { 26 | $headers['alg'] = $this->getAlgorithmId(); 27 | } 28 | 29 | /** 30 | * {@inheritdoc} 31 | */ 32 | public function sign($payload, $key) 33 | { 34 | return new Signature($this->createHash($payload, $this->getKey($key))); 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function verify($expected, $payload, $key) 41 | { 42 | return $this->doVerify($expected, $payload, $this->getKey($key)); 43 | } 44 | 45 | /** 46 | * @param Key|string $key 47 | * 48 | * @return Key 49 | */ 50 | private function getKey($key) 51 | { 52 | if (is_string($key)) { 53 | $key = new Key($key); 54 | } 55 | 56 | return $key; 57 | } 58 | 59 | /** 60 | * Creates a hash with the given data 61 | * 62 | * @param string $payload 63 | * @param Key $key 64 | * 65 | * @return string 66 | */ 67 | abstract public function createHash($payload, Key $key); 68 | 69 | /** 70 | * Creates a hash with the given data 71 | * 72 | * @param string $payload 73 | * @param Key $key 74 | * 75 | * @return boolean 76 | */ 77 | abstract public function doVerify($expected, $payload, Key $key); 78 | } 79 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signer/Ecdsa/Sha256.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 2.1.0 17 | */ 18 | class Sha256 extends Ecdsa 19 | { 20 | /** 21 | * {@inheritdoc} 22 | */ 23 | public function getAlgorithmId() 24 | { 25 | return 'ES256'; 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function getAlgorithm() 32 | { 33 | return 'sha256'; 34 | } 35 | 36 | /** 37 | * {@inheritdoc} 38 | */ 39 | public function getSignatureLength() 40 | { 41 | return 64; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signer/Ecdsa/Sha384.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 2.1.0 17 | */ 18 | class Sha384 extends Ecdsa 19 | { 20 | /** 21 | * {@inheritdoc} 22 | */ 23 | public function getAlgorithmId() 24 | { 25 | return 'ES384'; 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function getAlgorithm() 32 | { 33 | return 'sha384'; 34 | } 35 | 36 | /** 37 | * {@inheritdoc} 38 | */ 39 | public function getSignatureLength() 40 | { 41 | return 96; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signer/Ecdsa/Sha512.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 2.1.0 17 | */ 18 | class Sha512 extends Ecdsa 19 | { 20 | /** 21 | * {@inheritdoc} 22 | */ 23 | public function getAlgorithmId() 24 | { 25 | return 'ES512'; 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function getAlgorithm() 32 | { 33 | return 'sha512'; 34 | } 35 | 36 | /** 37 | * {@inheritdoc} 38 | */ 39 | public function getSignatureLength() 40 | { 41 | return 132; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signer/Hmac.php: -------------------------------------------------------------------------------- 1 | 14 | * @since 0.1.0 15 | */ 16 | abstract class Hmac extends BaseSigner 17 | { 18 | /** 19 | * {@inheritdoc} 20 | */ 21 | public function createHash($payload, Key $key) 22 | { 23 | return hash_hmac($this->getAlgorithm(), $payload, $key->getContent(), true); 24 | } 25 | 26 | /** 27 | * {@inheritdoc} 28 | */ 29 | public function doVerify($expected, $payload, Key $key) 30 | { 31 | if (!is_string($expected)) { 32 | return false; 33 | } 34 | 35 | $callback = function_exists('hash_equals') ? 'hash_equals' : [$this, 'hashEquals']; 36 | 37 | return call_user_func($callback, $expected, $this->createHash($payload, $key)); 38 | } 39 | 40 | /** 41 | * PHP < 5.6 timing attack safe hash comparison 42 | * 43 | * @param string $expected 44 | * @param string $generated 45 | * 46 | * @return boolean 47 | */ 48 | public function hashEquals($expected, $generated) 49 | { 50 | $expectedLength = strlen($expected); 51 | 52 | if ($expectedLength !== strlen($generated)) { 53 | return false; 54 | } 55 | 56 | $res = 0; 57 | 58 | for ($i = 0; $i < $expectedLength; ++$i) { 59 | $res |= ord($expected[$i]) ^ ord($generated[$i]); 60 | } 61 | 62 | return $res === 0; 63 | } 64 | 65 | /** 66 | * Returns the algorithm name 67 | * 68 | * @return string 69 | */ 70 | abstract public function getAlgorithm(); 71 | } 72 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signer/Hmac/Sha256.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 0.1.0 17 | */ 18 | class Sha256 extends Hmac 19 | { 20 | /** 21 | * {@inheritdoc} 22 | */ 23 | public function getAlgorithmId() 24 | { 25 | return 'HS256'; 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function getAlgorithm() 32 | { 33 | return 'sha256'; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signer/Hmac/Sha384.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 0.1.0 17 | */ 18 | class Sha384 extends Hmac 19 | { 20 | /** 21 | * {@inheritdoc} 22 | */ 23 | public function getAlgorithmId() 24 | { 25 | return 'HS384'; 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function getAlgorithm() 32 | { 33 | return 'sha384'; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signer/Hmac/Sha512.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 0.1.0 17 | */ 18 | class Sha512 extends Hmac 19 | { 20 | /** 21 | * {@inheritdoc} 22 | */ 23 | public function getAlgorithmId() 24 | { 25 | return 'HS512'; 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function getAlgorithm() 32 | { 33 | return 'sha512'; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signer/Key.php: -------------------------------------------------------------------------------- 1 | 14 | * @since 3.0.4 15 | */ 16 | final class Key 17 | { 18 | /** 19 | * @var string 20 | */ 21 | private $content; 22 | 23 | /** 24 | * @var string 25 | */ 26 | private $passphrase; 27 | 28 | /** 29 | * @param string $content 30 | * @param string $passphrase 31 | */ 32 | public function __construct($content, $passphrase = null) 33 | { 34 | $this->setContent($content); 35 | $this->passphrase = $passphrase; 36 | } 37 | 38 | /** 39 | * @param string $content 40 | * 41 | * @throws InvalidArgumentException 42 | */ 43 | private function setContent($content) 44 | { 45 | if (strpos($content, 'file://') === 0) { 46 | $content = $this->readFile($content); 47 | } 48 | 49 | $this->content = $content; 50 | } 51 | 52 | /** 53 | * @param string $content 54 | * 55 | * @return string 56 | * 57 | * @throws \InvalidArgumentException 58 | */ 59 | private function readFile($content) 60 | { 61 | $file = substr($content, 7); 62 | 63 | if (!is_readable($file)) { 64 | throw new \InvalidArgumentException('You must inform a valid key file'); 65 | } 66 | 67 | return file_get_contents($file); 68 | } 69 | 70 | /** 71 | * @return string 72 | */ 73 | public function getContent() 74 | { 75 | return $this->content; 76 | } 77 | 78 | /** 79 | * @return string 80 | */ 81 | public function getPassphrase() 82 | { 83 | return $this->passphrase; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signer/Keychain.php: -------------------------------------------------------------------------------- 1 | 14 | * @since 2.1.0 15 | * 16 | * @deprecated Since we've removed OpenSSL from ECDSA there's no reason to use this class 17 | */ 18 | class Keychain 19 | { 20 | /** 21 | * Returns a private key from file path or content 22 | * 23 | * @param string $key 24 | * @param string $passphrase 25 | * 26 | * @return Key 27 | */ 28 | public function getPrivateKey($key, $passphrase = null) 29 | { 30 | return new Key($key, $passphrase); 31 | } 32 | 33 | /** 34 | * Returns a public key from file path or content 35 | * 36 | * @param string $certificate 37 | * 38 | * @return Key 39 | */ 40 | public function getPublicKey($certificate) 41 | { 42 | return new Key($certificate); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signer/Rsa/Sha256.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 2.1.0 17 | */ 18 | class Sha256 extends Rsa 19 | { 20 | /** 21 | * {@inheritdoc} 22 | */ 23 | public function getAlgorithmId() 24 | { 25 | return 'RS256'; 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function getAlgorithm() 32 | { 33 | return OPENSSL_ALGO_SHA256; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signer/Rsa/Sha384.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 2.1.0 17 | */ 18 | class Sha384 extends Rsa 19 | { 20 | /** 21 | * {@inheritdoc} 22 | */ 23 | public function getAlgorithmId() 24 | { 25 | return 'RS384'; 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function getAlgorithm() 32 | { 33 | return OPENSSL_ALGO_SHA384; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /php/extend/Lcobucci/JWT/Signer/Rsa/Sha512.php: -------------------------------------------------------------------------------- 1 | 16 | * @since 2.1.0 17 | */ 18 | class Sha512 extends Rsa 19 | { 20 | /** 21 | * {@inheritdoc} 22 | */ 23 | public function getAlgorithmId() 24 | { 25 | return 'RS512'; 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function getAlgorithm() 32 | { 33 | return OPENSSL_ALGO_SHA512; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /php/extend/com/verify/assets/bgs/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/bgs/1.jpg -------------------------------------------------------------------------------- /php/extend/com/verify/assets/bgs/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/bgs/2.jpg -------------------------------------------------------------------------------- /php/extend/com/verify/assets/bgs/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/bgs/3.jpg -------------------------------------------------------------------------------- /php/extend/com/verify/assets/bgs/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/bgs/4.jpg -------------------------------------------------------------------------------- /php/extend/com/verify/assets/bgs/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/bgs/5.jpg -------------------------------------------------------------------------------- /php/extend/com/verify/assets/bgs/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/bgs/6.jpg -------------------------------------------------------------------------------- /php/extend/com/verify/assets/bgs/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/bgs/7.jpg -------------------------------------------------------------------------------- /php/extend/com/verify/assets/bgs/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/bgs/8.jpg -------------------------------------------------------------------------------- /php/extend/com/verify/assets/ttfs/1.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/ttfs/1.ttf -------------------------------------------------------------------------------- /php/extend/com/verify/assets/ttfs/2.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/ttfs/2.ttf -------------------------------------------------------------------------------- /php/extend/com/verify/assets/ttfs/3.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/ttfs/3.ttf -------------------------------------------------------------------------------- /php/extend/com/verify/assets/ttfs/4.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/ttfs/4.ttf -------------------------------------------------------------------------------- /php/extend/com/verify/assets/ttfs/5.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/ttfs/5.ttf -------------------------------------------------------------------------------- /php/extend/com/verify/assets/ttfs/6.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/ttfs/6.ttf -------------------------------------------------------------------------------- /php/extend/com/verify/assets/zhttfs/1.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/extend/com/verify/assets/zhttfs/1.ttf -------------------------------------------------------------------------------- /php/index.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | // [ 应用入口文件 ] 13 | 14 | // 应用目录 15 | define('APP_PATH', __DIR__.'/application/'); 16 | // 定义配置文件目录和应用目录同级 17 | define('CONF_PATH', __DIR__.'/config/'); 18 | // 定义runtime目录 19 | define('RUNTIME_PATH', __DIR__.'/runtime/'); 20 | // 加载框架引导文件 21 | require './thinkphp/start.php'; 22 | -------------------------------------------------------------------------------- /php/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/ 14 | 15 | 16 | 17 | 18 | application/ 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /php/public/.htaccess: -------------------------------------------------------------------------------- 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/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/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/think: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | 11 | // +---------------------------------------------------------------------- 12 | 13 | // 定义项目路径 14 | define('APP_PATH', './application/'); 15 | 16 | // 加载框架引导文件 17 | require './thinkphp/console.php'; -------------------------------------------------------------------------------- /php/thinkphp/.gitignore: -------------------------------------------------------------------------------- 1 | /composer.lock 2 | /vendor 3 | .idea 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /php/thinkphp/.htaccess: -------------------------------------------------------------------------------- 1 | deny from all -------------------------------------------------------------------------------- /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/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/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/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/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 | -------------------------------------------------------------------------------- /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.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/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 | -------------------------------------------------------------------------------- /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/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/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/bin/README.md: -------------------------------------------------------------------------------- 1 | console 工具使用 hiddeninput.exe 在 windows 上隐藏密码输入,该二进制文件由第三方提供,相关源码和其他细节可以在 [Hidden Input](https://github.com/Seldaek/hidden-input) 找到。 2 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/console/bin/hiddeninput.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/thinkphp/library/think/console/bin/hiddeninput.exe -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/RunServer.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 | use think\facade\App; 18 | 19 | class RunServer extends Command 20 | { 21 | 22 | public function configure() 23 | { 24 | $this->setName('run') 25 | ->addOption('host', 'H', Option::VALUE_OPTIONAL, 26 | 'The host to server the application on', '127.0.0.1') 27 | ->addOption('port', 'p', Option::VALUE_OPTIONAL, 28 | 'The port to server the application on', 8000) 29 | ->addOption('root', 'r', Option::VALUE_OPTIONAL, 30 | 'The document root of the application', App::getRootPath() . 'public') 31 | ->setDescription('PHP Built-in Server for ThinkPHP'); 32 | } 33 | 34 | public function execute(Input $input, Output $output) 35 | { 36 | $host = $input->getOption('host'); 37 | $port = $input->getOption('port'); 38 | $root = $input->getOption('root'); 39 | 40 | $command = sprintf( 41 | 'php -S %s:%d -t %s %s', 42 | $host, 43 | $port, 44 | escapeshellarg($root), 45 | escapeshellarg($root . '/router.php') 46 | ); 47 | 48 | $output->writeln(sprintf('ThinkPHP Development server is started On ', $host, $port)); 49 | $output->writeln(sprintf('You can exit with `CTRL-C`')); 50 | $output->writeln(sprintf('Document root is: %s', $root)); 51 | passthru($command); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/library/think/console/command/make/stubs/controller.plain.stub: -------------------------------------------------------------------------------- 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/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/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/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/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 | -------------------------------------------------------------------------------- /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/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/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/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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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/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/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/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/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/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/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/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/facade/Build.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Build 18 | * @mixin \think\Build 19 | * @method void run(array $build = [], string $namespace = 'app', bool $suffix = false) static 根据传入的build资料创建目录和文件 20 | * @method void module(string $module = '', array $list = [], string $namespace = 'app', bool $suffix = false) static 创建模块 21 | */ 22 | class Build extends Facade 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/facade/Cache.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Cache 18 | * @mixin \think\Cache 19 | * @method \think\cache\Driver connect(array $options = [], mixed $name = false) static 连接缓存 20 | * @method \think\cache\Driver init(array $options = []) static 初始化缓存 21 | * @method \think\cache\Driver store(string $name = '') static 切换缓存类型 22 | * @method bool has(string $name) static 判断缓存是否存在 23 | * @method mixed get(string $name, mixed $default = false) static 读取缓存 24 | * @method mixed pull(string $name) static 读取缓存并删除 25 | * @method mixed set(string $name, mixed $value, int $expire = null) static 设置缓存 26 | * @method mixed remember(string $name, mixed $value, int $expire = null) static 如果不存在则写入缓存 27 | * @method mixed inc(string $name, int $step = 1) static 自增缓存(针对数值缓存) 28 | * @method mixed dec(string $name, int $step = 1) static 自减缓存(针对数值缓存) 29 | * @method bool rm(string $name) static 删除缓存 30 | * @method bool clear(string $tag = null) static 清除缓存 31 | * @method mixed tag(string $name, mixed $keys = null, bool $overlay = false) static 缓存标签 32 | * @method object handler() static 返回句柄对象,可执行其它高级方法 33 | */ 34 | class Cache extends Facade 35 | { 36 | } 37 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/facade/Config.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Config 18 | * @mixin \think\Config 19 | * @method bool has(string $name) static 检测配置是否存在 20 | * @method array pull(string $name) static 获取一级配置 21 | * @method mixed get(string $name) static 获取配置参数 22 | * @method mixed set(string $name, mixed $value = null) static 设置配置参数 23 | * @method array reset(string $prefix ='') static 重置配置参数 24 | */ 25 | class Config extends Facade 26 | { 27 | } 28 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/facade/Cookie.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Cookie 18 | * @mixin \think\Cookie 19 | * @method void init(array $config = []) static 初始化 20 | * @method bool has(string $name,string $prefix = null) static 判断Cookie数据 21 | * @method mixed prefix(string $prefix = '') static 设置或者获取cookie作用域(前缀) 22 | * @method mixed get(string $name,string $prefix = null) static Cookie获取 23 | * @method mixed set(string $name, mixed $value = null, mixed $option = null) static 设置Cookie 24 | * @method void forever(string $name, mixed $value = null, mixed $option = null) static 永久保存Cookie数据 25 | * @method void delete(string $name, string $prefix = null) static Cookie删除 26 | * @method void clear($prefix = null) static Cookie清空 27 | */ 28 | class Cookie extends Facade 29 | { 30 | } 31 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/facade/Debug.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Debug 18 | * @mixin \think\Debug 19 | * @method void remark(string $name, mixed $value = '') static 记录时间(微秒)和内存使用情况 20 | * @method int getRangeTime(string $start, string $end, mixed $dec = 6) static 统计某个区间的时间(微秒)使用情况 21 | * @method int getUseTime(int $dec = 6) static 统计从开始到统计时的时间(微秒)使用情况 22 | * @method string getThroughputRate(string $start, string $end, mixed $dec = 6) static 获取当前访问的吞吐率情况 23 | * @method string getRangeMem(string $start, string $end, mixed $dec = 2) static 记录区间的内存使用情况 24 | * @method int getUseMem(int $dec = 2) static 统计从开始到统计时的内存使用情况 25 | * @method string getMemPeak(string $start, string $end, mixed $dec = 2) static 统计区间的内存峰值情况 26 | * @method mixed getFile(bool $detail = false) static 获取文件加载信息 27 | * @method mixed dump(mixed $var, bool $echo = true, string $label = null, int $flags = ENT_SUBSTITUTE) static 浏览器友好的变量输出 28 | */ 29 | class Debug extends Facade 30 | { 31 | } 32 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/facade/Env.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Env 18 | * @mixin \think\Env 19 | * @method void load(string $file) static 读取环境变量定义文件 20 | * @method mixed get(string $name = null, mixed $default = null) static 获取环境变量值 21 | * @method void set(mixed $env, string $value = null) static 设置环境变量值 22 | */ 23 | class Env extends Facade 24 | { 25 | } 26 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/facade/Hook.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Hook 18 | * @mixin \think\Hook 19 | * @method \think\Hook alias(mixed $name, mixed $behavior = null) static 指定行为标识 20 | * @method void add(string $tag, mixed $behavior, bool $first = false) static 动态添加行为扩展到某个标签 21 | * @method void import(array $tags, bool $recursive = true) static 批量导入插件 22 | * @method array get(string $tag = '') static 获取插件信息 23 | * @method mixed listen(string $tag, mixed $params = null, bool $once = false) static 监听标签的行为 24 | * @method mixed exec(mixed $class, mixed $params = null) static 执行行为 25 | */ 26 | class Hook extends Facade 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/facade/Lang.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Lang 18 | * @mixin \think\Lang 19 | * @method mixed range($range = '') static 设定当前的语言 20 | * @method mixed set(mixed $name, string $value = null, string $range = '') static 设置语言定义 21 | * @method array load(mixed $file, string $range = '') static 加载语言定义 22 | * @method mixed get(string $name = null, array $vars = [], string $range = '') static 获取语言定义 23 | * @method mixed has(string $name, string $range = '') static 获取语言定义 24 | * @method string detect() static 自动侦测设置获取语言选择 25 | * @method void saveToCookie(string $lang = null) static 设置当前语言到Cookie 26 | * @method void setLangDetectVar(string $var) static 设置语言自动侦测的变量 27 | * @method void setLangCookieVar(string $var) static 设置语言的cookie保存变量 28 | * @method void setAllowLangList(array $list) static 设置允许的语言列表 29 | */ 30 | class Lang extends Facade 31 | { 32 | } 33 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/facade/Log.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Log 18 | * @mixin \think\Log 19 | * @method \think\Log init(array $config = []) static 日志初始化 20 | * @method mixed getLog(string $type = '') static 获取日志信息 21 | * @method \think\Log record(mixed $msg, string $type = 'info', array $context = []) static 记录日志信息 22 | * @method \think\Log clear() static 清空日志信息 23 | * @method \think\Log key(string $key) static 当前日志记录的授权key 24 | * @method bool check(array $config) static 检查日志写入权限 25 | * @method bool save() static 保存调试信息 26 | * @method void write(mixed $msg, string $type = 'info', bool $force = false) static 实时写入日志信息 27 | * @method void log(string $level,mixed $message, array $context = []) static 记录日志信息 28 | * @method void emergency(mixed $message, array $context = []) static 记录emergency信息 29 | * @method void alert(mixed $message, array $context = []) static 记录alert信息 30 | * @method void critical(mixed $message, array $context = []) static 记录critical信息 31 | * @method void error(mixed $message, array $context = []) static 记录error信息 32 | * @method void warning(mixed $message, array $context = []) static 记录warning信息 33 | * @method void notice(mixed $message, array $context = []) static 记录notice信息 34 | * @method void info(mixed $message, array $context = []) static 记录info信息 35 | * @method void debug(mixed $message, array $context = []) static 记录debug信息 36 | * @method void sql(mixed $message, array $context = []) static 记录sql信息 37 | */ 38 | class Log extends Facade 39 | { 40 | } 41 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/facade/Response.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Response 18 | * @mixin \think\Response 19 | * @method \think\response create(mixed $data = '', string $type = '', int $code = 200, array $header = [], array $options = []) static 创建Response对象 20 | * @method void send() static 发送数据到客户端 21 | * @method \think\Response options(mixed $options = []) static 输出的参数 22 | * @method \think\Response data(mixed $data) static 输出数据设置 23 | * @method \think\Response header(mixed $name, string $value = null) static 设置响应头 24 | * @method \think\Response content(mixed $content) static 设置页面输出内容 25 | * @method \think\Response code(int $code) static 发送HTTP状态 26 | * @method \think\Response lastModified(string $time) static LastModified 27 | * @method \think\Response expires(string $time) static expires 28 | * @method \think\Response eTag(string $eTag) static eTag 29 | * @method \think\Response cacheControl(string $cache) static 页面缓存控制 30 | * @method \think\Response contentType(string $contentType, string $charset = 'utf-8') static 页面输出类型 31 | * @method mixed getHeader(string $name) static 获取头部信息 32 | * @method mixed getData() static 获取原始数据 33 | * @method mixed getContent() static 获取输出数据 34 | * @method int getCode() static 获取状态码 35 | */ 36 | class Response extends Facade 37 | { 38 | } 39 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/facade/Session.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Session 18 | * @mixin \think\Session 19 | * @method void init(array $config = []) static session初始化 20 | * @method bool has(string $name,string $prefix = null) static 判断session数据 21 | * @method mixed prefix(string $prefix = '') static 设置或者获取session作用域(前缀) 22 | * @method mixed get(string $name,string $prefix = null) static session获取 23 | * @method mixed pull(string $name,string $prefix = null) static session获取并删除 24 | * @method void push(string $key, mixed $value) static 添加数据到一个session数组 25 | * @method void set(string $name, mixed $value , string $prefix = null) static 设置session数据 26 | * @method void flash(string $name, mixed $value = null) static session设置 下一次请求有效 27 | * @method void flush() static 清空当前请求的session数据 28 | * @method void delete(string $name, string $prefix = null) static 删除session数据 29 | * @method void clear($prefix = null) static 清空session数据 30 | * @method void start() static 启动session 31 | * @method void destroy() static 销毁session 32 | * @method void pause() static 暂停session 33 | * @method void regenerate(bool $delete = false) static 重新生成session_id 34 | */ 35 | class Session extends Facade 36 | { 37 | } 38 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/facade/Url.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\Url 18 | * @mixin \think\Url 19 | * @method string build(string $url = '', mixed $vars = '', mixed $suffix = true, mixed $domain = false) static URL生成 支持路由反射 20 | * @method void root(string $root) static 指定当前生成URL地址的root 21 | */ 22 | class Url extends Facade 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/facade/View.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\facade; 13 | 14 | use think\Facade; 15 | 16 | /** 17 | * @see \think\View 18 | * @mixin \think\View 19 | * @method \think\View init(mixed $engine = [], array $replace = []) static 初始化 20 | * @method \think\View share(mixed $name, mixed $value = '') static 模板变量静态赋值 21 | * @method \think\View assign(mixed $name, mixed $value = '') static 模板变量赋值 22 | * @method \think\View config(mixed $name, mixed $value = '') static 配置模板引擎 23 | * @method \think\View exists(mixed $name) static 检查模板是否存在 24 | * @method \think\View filter(Callable $filter) static 视图内容过滤 25 | * @method \think\View engine(mixed $engine = []) static 设置当前模板解析的引擎 26 | * @method string fetch(string $template = '', array $vars = [], array $replace = [], array $config = [], bool $renderContent = false) static 解析和获取模板内容 27 | * @method string display(string $content = '', array $vars = [], array $replace = [], array $config = []) static 渲染内容输出 28 | */ 29 | class View extends Facade 30 | { 31 | } 32 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/http/middleware/DispatcherInterface.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\http\middleware; 13 | 14 | use think\Request; 15 | use think\Response; 16 | 17 | interface DispatcherInterface 18 | { 19 | /** 20 | * 在队尾添加 middleware 21 | * @param callable $middleware 22 | * @return DispatcherInterface 23 | */ 24 | public function add($middleware); 25 | 26 | /** 27 | * 在队前插入 middleware 28 | * @param callable $middleware 29 | * @return DispatcherInterface 30 | */ 31 | public function insert($middleware); 32 | 33 | /** 34 | * 获取所有的middleware 35 | * @return array 36 | */ 37 | public function all(); 38 | 39 | /** 40 | * 处理 request 并返回 response 41 | * @param Request $request 42 | * @return Response 43 | */ 44 | public function dispatch(Request $request); 45 | } 46 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/http/middleware/MissingResponseException.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\http\middleware; 13 | 14 | class MissingResponseException extends \InvalidArgumentException 15 | {} 16 | -------------------------------------------------------------------------------- /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/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/process/exception/Faild.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\process\exception; 13 | 14 | use think\Process; 15 | 16 | class Faild 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/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/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/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/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/response/Jump.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\response; 13 | 14 | use think\Container; 15 | use think\Response; 16 | 17 | class Jump extends Response 18 | { 19 | protected $contentType = 'text/html'; 20 | 21 | /** 22 | * 处理数据 23 | * @access protected 24 | * @param mixed $data 要处理的数据 25 | * @return mixed 26 | * @throws \Exception 27 | */ 28 | protected function output($data) 29 | { 30 | $config = Container::get('config'); 31 | $data = Container::get('view') 32 | ->init($config->pull('template')) 33 | ->fetch($this->options['jump_template'], $data); 34 | return $data; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/route/Dispatch.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\route; 13 | 14 | use think\Container; 15 | 16 | abstract class Dispatch 17 | { 18 | // 应用实例 19 | protected $app; 20 | // 调度信息 21 | protected $dispatch; 22 | // 调度参数 23 | protected $param; 24 | // 状态码 25 | protected $code; 26 | // 是否进行大小写转换 27 | protected $convert; 28 | 29 | public function __construct($dispatch, $param = [], $code = null) 30 | { 31 | $this->app = Container::get('app'); 32 | $this->dispatch = $dispatch; 33 | $this->param = $param; 34 | $this->code = $code; 35 | } 36 | 37 | public function convert($convert) 38 | { 39 | $this->convert = $convert; 40 | 41 | return $this; 42 | } 43 | 44 | public function getDispatch() 45 | { 46 | return $this->dispatch; 47 | } 48 | 49 | public function getParam() 50 | { 51 | return $this->param; 52 | } 53 | 54 | abstract public function run(); 55 | 56 | } 57 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/route/dispatch/Callback.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\route\dispatch; 13 | 14 | use think\Container; 15 | use think\route\Dispatch; 16 | 17 | class Callback extends Dispatch 18 | { 19 | public function run() 20 | { 21 | // 执行回调方法 22 | $vars = array_merge($this->app['request']->param(), $this->param); 23 | 24 | return Container::getInstance()->invoke($this->dispatch, $vars); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/route/dispatch/Controller.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\route\dispatch; 13 | 14 | use think\route\Dispatch; 15 | 16 | class Controller extends Dispatch 17 | { 18 | public function run() 19 | { 20 | // 执行控制器的操作方法 21 | $vars = array_merge($this->app['request']->param(), $this->param); 22 | 23 | return $this->app->action( 24 | $this->dispatch, $vars, 25 | $this->app->config('app.url_controller_layer'), 26 | $this->app->config('app.controller_suffix') 27 | ); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/route/dispatch/Redirect.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\route\dispatch; 13 | 14 | use think\Response; 15 | use think\route\Dispatch; 16 | 17 | class Redirect extends Dispatch 18 | { 19 | public function run() 20 | { 21 | return Response::create($this->dispatch, 'redirect')->code($this->code); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/route/dispatch/Response.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\route\dispatch; 13 | 14 | use think\route\Dispatch; 15 | 16 | class Response extends Dispatch 17 | { 18 | public function run() 19 | { 20 | return $this->dispatch; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /php/thinkphp/library/think/route/dispatch/View.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | namespace think\route\dispatch; 13 | 14 | use think\Container; 15 | use think\route\Dispatch; 16 | 17 | class View extends Dispatch 18 | { 19 | public function run() 20 | { 21 | // 渲染模板输出 22 | $vars = array_merge($this->app['request']->param(), $this->param); 23 | 24 | return Container::get('view') 25 | ->init(Container::get('config')->pull('template')) 26 | ->fetch($this->dispatch, $vars); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /php/thinkphp/library/traits/think/Instance.php: -------------------------------------------------------------------------------- 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/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaolu289/vue-think/61a87d6e56bbcd8ee1888eb14d510cdff7957cd1/php/thinkphp/logo.png -------------------------------------------------------------------------------- /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/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | ./library/think/*/tests/ 27 | 28 | 29 | 30 | 31 | 32 | ./library/ 33 | 34 | ./library/think/*/tests 35 | ./library/think/*/assets 36 | ./library/think/*/resources 37 | ./library/think/*/vendor 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /site.template: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name www.test.com; 4 | index index.html index.htm index.php; 5 | root /home/site/vue-think-web; 6 | location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ 7 | { 8 | expires 30d; 9 | } 10 | location ~ .*\.(js|css)?$ 11 | { 12 | expires 1h; 13 | } 14 | } 15 | 16 | server { 17 | listen 80; 18 | server_name www.test2.com; 19 | index index.html index.htm index.php; 20 | root /home/site/vue-think-server; 21 | location / { 22 | if (!-e $request_filename) { 23 | rewrite ^(.*)$ /index.php?s=$1 last; 24 | break; 25 | } 26 | } 27 | location ~ .*\.(php|php5)?$ 28 | { 29 | fastcgi_index index.php; 30 | fastcgi_pass php-fpm:9000; 31 | include fastcgi_params; 32 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 33 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 34 | 35 | } 36 | location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ 37 | { 38 | expires 30d; 39 | } 40 | location ~ .*\.(js|css)?$ 41 | { 42 | expires 1h; 43 | } 44 | } --------------------------------------------------------------------------------