├── app ├── WebAdmin │ ├── static │ │ └── .gitkeep │ ├── .eslintignore │ ├── config │ │ ├── prod.env.js │ │ ├── test.env.js │ │ ├── dev.env.js │ │ └── index.js │ ├── src │ │ ├── assets │ │ │ └── logo.png │ │ ├── router │ │ │ └── index.js │ │ ├── main.js │ │ ├── App.vue │ │ └── components │ │ │ └── Hello.vue │ ├── test │ │ ├── unit │ │ │ ├── .eslintrc │ │ │ ├── specs │ │ │ │ └── Hello.spec.js │ │ │ ├── index.js │ │ │ └── karma.conf.js │ │ └── e2e │ │ │ ├── specs │ │ │ └── test.js │ │ │ ├── custom-assertions │ │ │ └── elementCount.js │ │ │ ├── runner.js │ │ │ └── nightwatch.conf.js │ ├── .gitignore │ ├── .editorconfig │ ├── .postcssrc.js │ ├── index.html │ ├── build │ │ ├── dev-client.js │ │ ├── vue-loader.conf.js │ │ ├── webpack.test.conf.js │ │ ├── build.js │ │ ├── webpack.dev.conf.js │ │ ├── check-versions.js │ │ ├── webpack.base.conf.js │ │ ├── utils.js │ │ ├── dev-server.js │ │ └── webpack.prod.conf.js │ ├── .babelrc │ ├── README.md │ ├── .eslintrc.js │ └── package.json ├── WebFront │ ├── static │ │ └── .gitkeep │ ├── .eslintignore │ ├── config │ │ ├── prod.env.js │ │ ├── test.env.js │ │ ├── dev.env.js │ │ └── index.js │ ├── src │ │ ├── assets │ │ │ └── logo.png │ │ ├── views │ │ │ └── Home.vue │ │ ├── main.js │ │ ├── router │ │ │ └── index.js │ │ ├── App.vue │ │ └── components │ │ │ └── Hello.vue │ ├── test │ │ ├── unit │ │ │ ├── .eslintrc │ │ │ ├── specs │ │ │ │ └── Hello.spec.js │ │ │ ├── index.js │ │ │ └── karma.conf.js │ │ └── e2e │ │ │ ├── specs │ │ │ └── test.js │ │ │ ├── custom-assertions │ │ │ └── elementCount.js │ │ │ ├── runner.js │ │ │ └── nightwatch.conf.js │ ├── .gitignore │ ├── .editorconfig │ ├── .postcssrc.js │ ├── index.html │ ├── build │ │ ├── dev-client.js │ │ ├── vue-loader.conf.js │ │ ├── webpack.test.conf.js │ │ ├── build.js │ │ ├── webpack.dev.conf.js │ │ ├── check-versions.js │ │ ├── webpack.base.conf.js │ │ ├── utils.js │ │ ├── dev-server.js │ │ └── webpack.prod.conf.js │ ├── .babelrc │ ├── README.md │ ├── .eslintrc.js │ └── package.json └── WebApiServer │ ├── application │ ├── .htaccess │ ├── command.php │ ├── common.php │ ├── extra │ │ └── queue.php │ ├── route.php │ ├── tags.php │ ├── index │ │ └── controller │ │ │ └── Index.php │ ├── database.php │ └── config.php │ ├── extend │ └── .gitignore │ ├── runtime │ └── .gitignore │ ├── vendor │ └── .gitignore │ ├── public │ ├── static │ │ └── .gitignore │ ├── robots.txt │ ├── favicon.ico │ ├── .htaccess │ ├── index.php │ └── router.php │ ├── .bowerrc │ ├── .gitignore │ ├── .user.ini │ ├── phpunit.xml │ ├── tests │ ├── TestCase.php │ └── ExampleTest.php │ ├── think │ ├── composer.json │ ├── build.php │ ├── LICENSE.txt │ └── README.md ├── data └── backup │ └── data-default.sql ├── dockerfiles ├── mysql │ └── my.conf ├── redis │ └── Dockerfile ├── webpack │ ├── entrypoint.sh │ └── Dockerfile ├── php │ ├── php.ini │ ├── Dockerfile │ └── php-fpm.conf └── nginx │ ├── Dockerfile │ ├── nginx.conf │ └── conf.d │ ├── web.debug.conf │ └── web.product.conf-default ├── test └── docker-volume-watch │ ├── a.txt │ ├── Dockerfile │ └── app.js ├── .gitignore ├── README.md └── docker-compose.yml /app/WebAdmin/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/WebFront/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data/backup/data-default.sql: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dockerfiles/mysql/my.conf: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/docker-volume-watch/a.txt: -------------------------------------------------------------------------------- 1 | 12311212 -------------------------------------------------------------------------------- /app/WebApiServer/application/.htaccess: -------------------------------------------------------------------------------- 1 | deny from all -------------------------------------------------------------------------------- /app/WebApiServer/extend/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /app/WebApiServer/runtime/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /app/WebApiServer/vendor/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /app/WebAdmin/.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | config/*.js 3 | -------------------------------------------------------------------------------- /app/WebApiServer/public/static/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /app/WebApiServer/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /app/WebFront/.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | config/*.js 3 | *.* 4 | -------------------------------------------------------------------------------- /app/WebApiServer/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "./public/static/" 3 | } -------------------------------------------------------------------------------- /app/WebApiServer/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | composer.lock 3 | *.log 4 | thinkphp 5 | -------------------------------------------------------------------------------- /app/WebApiServer/.user.ini: -------------------------------------------------------------------------------- 1 | display_errors = On 2 | error_reporting = E_ALL | E_STRICT -------------------------------------------------------------------------------- /dockerfiles/redis/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM redis 2 | MAINTAINER Godtoy -------------------------------------------------------------------------------- /dockerfiles/webpack/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd /web 3 | npm install 4 | npm run dev -------------------------------------------------------------------------------- /app/WebAdmin/config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"production"' 3 | } 4 | -------------------------------------------------------------------------------- /app/WebFront/config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"production"' 3 | } 4 | -------------------------------------------------------------------------------- /dockerfiles/webpack/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:6.10 2 | MAINTAINER Godtoy -------------------------------------------------------------------------------- /test/docker-volume-watch/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:6.10 2 | VOLUME ./ /web 3 | WORKDIR /web 4 | CMD node app.js -------------------------------------------------------------------------------- /app/WebAdmin/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtsigner/docker-thinkphp5-vue-stack/HEAD/app/WebAdmin/src/assets/logo.png -------------------------------------------------------------------------------- /app/WebFront/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtsigner/docker-thinkphp5-vue-stack/HEAD/app/WebFront/src/assets/logo.png -------------------------------------------------------------------------------- /app/WebApiServer/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtsigner/docker-thinkphp5-vue-stack/HEAD/app/WebApiServer/public/favicon.ico -------------------------------------------------------------------------------- /dockerfiles/php/php.ini: -------------------------------------------------------------------------------- 1 | [PHP] 2 | short_open_tag = off 3 | display_errors = On 4 | error_reporting = E_ALL 5 | [Date] 6 | date.timezone = PRC -------------------------------------------------------------------------------- /app/WebAdmin/test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "mocha": true 4 | }, 5 | "globals": { 6 | "expect": true, 7 | "sinon": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /app/WebFront/test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "mocha": true 4 | }, 5 | "globals": { 6 | "expect": true, 7 | "sinon": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /dockerfiles/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:1.11-alpine 2 | MAINTAINER Godtoy 3 | #COPY ./nginx.conf /etc/nginx/nginx.conf 4 | #COPY ./conf.d /etc/nginx/conf.d -------------------------------------------------------------------------------- /app/WebAdmin/config/test.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var devEnv = require('./dev.env') 3 | 4 | module.exports = merge(devEnv, { 5 | NODE_ENV: '"testing"' 6 | }) 7 | -------------------------------------------------------------------------------- /app/WebFront/config/test.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var devEnv = require('./dev.env') 3 | 4 | module.exports = merge(devEnv, { 5 | NODE_ENV: '"testing"' 6 | }) 7 | -------------------------------------------------------------------------------- /app/WebAdmin/config/dev.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var prodEnv = require('./prod.env') 3 | 4 | module.exports = merge(prodEnv, { 5 | NODE_ENV: '"development"' 6 | }) 7 | -------------------------------------------------------------------------------- /app/WebFront/config/dev.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var prodEnv = require('./prod.env') 3 | 4 | module.exports = merge(prodEnv, { 5 | NODE_ENV: '"development"' 6 | }) 7 | -------------------------------------------------------------------------------- /app/WebAdmin/.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 | -------------------------------------------------------------------------------- /app/WebFront/.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 | -------------------------------------------------------------------------------- /app/WebAdmin/.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 | -------------------------------------------------------------------------------- /app/WebFront/.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 | -------------------------------------------------------------------------------- /app/WebFront/src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /app/WebAdmin/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | // to edit target browsers: use "browserlist" field in package.json 6 | "autoprefixer": {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /app/WebFront/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | // to edit target browsers: use "browserlist" field in package.json 6 | "autoprefixer": {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /app/WebFront/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Docker-China 6 | 7 | 8 |
9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/WebAdmin/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | website 6 | 7 | 8 |
9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | /.idea 3 | /data/mysql/* 4 | /data/redis/* 5 | /data/backup/* 6 | !/data/backup/data-default.sql 7 | /app/webroot/Application/Runtime/* 8 | /logs/mysql/* 9 | /logs/nginx/* 10 | /logs/php-fpm/* 11 | /logs/redis/* -------------------------------------------------------------------------------- /app/WebApiServer/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 | 9 | -------------------------------------------------------------------------------- /app/WebAdmin/build/dev-client.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | require('eventsource-polyfill') 3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') 4 | 5 | hotClient.subscribe(function (event) { 6 | if (event.action === 'reload') { 7 | window.location.reload() 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /app/WebFront/build/dev-client.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | require('eventsource-polyfill') 3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') 4 | 5 | hotClient.subscribe(function (event) { 6 | if (event.action === 'reload') { 7 | window.location.reload() 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /app/WebAdmin/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { "modules": false }], 4 | "stage-2" 5 | ], 6 | "plugins": ["transform-runtime"], 7 | "comments": false, 8 | "env": { 9 | "test": { 10 | "presets": ["env", "stage-2"], 11 | "plugins": [ "istanbul" ] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/WebFront/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { "modules": false }], 4 | "stage-2" 5 | ], 6 | "plugins": ["transform-runtime"], 7 | "comments": false, 8 | "env": { 9 | "test": { 10 | "presets": ["env", "stage-2"], 11 | "plugins": [ "istanbul" ] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/docker-volume-watch/app.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | var fileName = 'a.txt'; 3 | fs.watch(fileName, (function () { 4 | var count = 0; 5 | return function () { 6 | count++; 7 | console.log("文件" + fileName + " 内容刚刚改变。。第" + count + "次"); 8 | }; 9 | })()); 10 | console.log("watching file..."); -------------------------------------------------------------------------------- /app/WebAdmin/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import Hello from '@/components/Hello' 4 | 5 | Vue.use(Router) 6 | 7 | export default new Router({ 8 | routes: [ 9 | { 10 | path: '/', 11 | name: 'Hello', 12 | component: Hello 13 | } 14 | ] 15 | }) 16 | -------------------------------------------------------------------------------- /app/WebAdmin/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var config = require('../config') 3 | var isProduction = process.env.NODE_ENV === 'production' 4 | 5 | module.exports = { 6 | loaders: utils.cssLoaders({ 7 | sourceMap: isProduction 8 | ? config.build.productionSourceMap 9 | : config.dev.cssSourceMap, 10 | extract: isProduction 11 | }) 12 | } 13 | -------------------------------------------------------------------------------- /app/WebFront/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var config = require('../config') 3 | var isProduction = process.env.NODE_ENV === 'production' 4 | 5 | module.exports = { 6 | loaders: utils.cssLoaders({ 7 | sourceMap: isProduction 8 | ? config.build.productionSourceMap 9 | : config.dev.cssSourceMap, 10 | extract: isProduction 11 | }) 12 | } 13 | -------------------------------------------------------------------------------- /app/WebAdmin/test/unit/specs/Hello.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Hello from '@/components/Hello' 3 | 4 | describe('Hello.vue', () => { 5 | it('should render correct contents', () => { 6 | const Constructor = Vue.extend(Hello) 7 | const vm = new Constructor().$mount() 8 | expect(vm.$el.querySelector('.hello h1').textContent) 9 | .to.equal('Welcome to Your Vue.js App') 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /app/WebFront/test/unit/specs/Hello.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Hello from '@/components/Hello' 3 | 4 | describe('Hello.vue', () => { 5 | it('should render correct contents', () => { 6 | const Constructor = Vue.extend(Hello) 7 | const vm = new Constructor().$mount() 8 | expect(vm.$el.querySelector('.hello h1').textContent) 9 | .to.equal('Welcome to Your Vue.js App') 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /app/WebFront/src/main.js: -------------------------------------------------------------------------------- 1 | //Author:Godtoy 2 | import Vue from 'vue' 3 | import App from './App' 4 | import MuseUI from 'muse-ui' 5 | import 'muse-ui/dist/muse-ui.css' 6 | 7 | import router from './router' 8 | 9 | Vue.config.productionTip = false 10 | 11 | Vue.use(MuseUI) 12 | 13 | /* eslint-disable no-new */ 14 | new Vue({ 15 | el: '#app', 16 | router, 17 | template: '', 18 | components: {App} 19 | }) 20 | -------------------------------------------------------------------------------- /app/WebAdmin/src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | import router from './router' 6 | 7 | Vue.config.productionTip = false 8 | 9 | /* eslint-disable no-new */ 10 | new Vue({ 11 | el: '#app', 12 | router, 13 | template: '', 14 | components: { App } 15 | }) 16 | -------------------------------------------------------------------------------- /app/WebFront/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import Hello from '@/components/Hello' 4 | import Home from '@/views/Home' 5 | 6 | Vue.use(Router) 7 | 8 | export default new Router({ 9 | routes: [ 10 | { 11 | path: '/', 12 | name: 'Hello', 13 | component: Hello 14 | }, 15 | { 16 | path: 'home', 17 | name: 'Hello Home', 18 | component: Home 19 | } 20 | ] 21 | }) 22 | -------------------------------------------------------------------------------- /app/WebAdmin/src/App.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | 14 | 24 | -------------------------------------------------------------------------------- /app/WebFront/src/App.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | 15 | 25 | -------------------------------------------------------------------------------- /app/WebAdmin/test/unit/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | Vue.config.productionTip = false 4 | 5 | // require all test files (files that ends with .spec.js) 6 | const testsContext = require.context('./specs', true, /\.spec$/) 7 | testsContext.keys().forEach(testsContext) 8 | 9 | // require all src files except main.js for coverage. 10 | // you can also change this to match only the subset of files that 11 | // you want coverage for. 12 | const srcContext = require.context('../../src', true, /^\.\/(?!main(\.js)?$)/) 13 | srcContext.keys().forEach(srcContext) 14 | -------------------------------------------------------------------------------- /app/WebFront/test/unit/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | Vue.config.productionTip = false 4 | 5 | // require all test files (files that ends with .spec.js) 6 | const testsContext = require.context('./specs', true, /\.spec$/) 7 | testsContext.keys().forEach(testsContext) 8 | 9 | // require all src files except main.js for coverage. 10 | // you can also change this to match only the subset of files that 11 | // you want coverage for. 12 | const srcContext = require.context('../../src', true, /^\.\/(?!main(\.js)?$)/) 13 | srcContext.keys().forEach(srcContext) 14 | -------------------------------------------------------------------------------- /dockerfiles/php/Dockerfile: -------------------------------------------------------------------------------- 1 | #可以按照需求切换版本 2 | FROM php:5.6-fpm 3 | MAINTAINER Godtoy 4 | RUN apt-get update && apt-get install -y \ 5 | libfreetype6-dev \ 6 | libjpeg62-turbo-dev \ 7 | libmcrypt-dev \ 8 | libpng12-dev \ 9 | && docker-php-ext-install -j$(nproc) iconv mcrypt pdo_mysql mbstring opcache \ 10 | && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ 11 | && docker-php-ext-install -j$(nproc) gd \ 12 | && pecl install redis-3.1.0 \ 13 | && docker-php-ext-enable redis \ 14 | #Flag:最后记得清理apt产生的垃圾,减少空间占用 rm -rf /.... 15 | -------------------------------------------------------------------------------- /app/WebAdmin/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 | -------------------------------------------------------------------------------- /app/WebFront/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 | -------------------------------------------------------------------------------- /app/WebApiServer/application/command.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | return []; -------------------------------------------------------------------------------- /app/WebApiServer/application/common.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | // 应用公共文件 13 | -------------------------------------------------------------------------------- /app/WebAdmin/README.md: -------------------------------------------------------------------------------- 1 | # website 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 detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 31 | -------------------------------------------------------------------------------- /app/WebFront/README.md: -------------------------------------------------------------------------------- 1 | # website 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 detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 31 | -------------------------------------------------------------------------------- /app/WebApiServer/application/extra/queue.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | return [ 13 | 'connector' => 'Sync' 14 | ]; -------------------------------------------------------------------------------- /app/WebApiServer/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/ 14 | 15 | 16 | 17 | 18 | application/ 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/WebAdmin/.eslintrc.js: -------------------------------------------------------------------------------- 1 | // http://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parser: 'babel-eslint', 6 | parserOptions: { 7 | sourceType: 'module' 8 | }, 9 | env: { 10 | browser: true, 11 | }, 12 | // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style 13 | extends: 'standard', 14 | // required to lint *.vue files 15 | plugins: [ 16 | 'html' 17 | ], 18 | // add your custom rules here 19 | 'rules': { 20 | // allow paren-less arrow functions 21 | 'arrow-parens': 0, 22 | // allow async-await 23 | 'generator-star-spacing': 0, 24 | // allow debugger during development 25 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/WebApiServer/tests/TestCase.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace tests; 12 | 13 | class TestCase extends \think\testing\TestCase 14 | { 15 | protected $baseUrl = 'http://localhost'; 16 | } -------------------------------------------------------------------------------- /app/WebApiServer/think: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | 11 | // +---------------------------------------------------------------------- 12 | 13 | // 定义项目路径 14 | define('APP_PATH', __DIR__ . '/application/'); 15 | 16 | // 加载框架引导文件 17 | require __DIR__.'/thinkphp/console.php'; 18 | -------------------------------------------------------------------------------- /app/WebApiServer/public/index.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | 13 | // [ 应用入口文件 ] 14 | 15 | // 定义应用目录 16 | define('APP_PATH', __DIR__ . '/../application/'); 17 | // 加载框架引导文件 18 | require __DIR__ . '/../thinkphp/start.php'; 19 | -------------------------------------------------------------------------------- /app/WebApiServer/public/router.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | // $Id$ 12 | 13 | if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["REQUEST_URI"])) { 14 | return false; 15 | } else { 16 | require __DIR__ . "/index.php"; 17 | } 18 | -------------------------------------------------------------------------------- /app/WebApiServer/tests/ExampleTest.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | namespace tests; 12 | 13 | class ExampleTest extends TestCase 14 | { 15 | 16 | public function testBasicExample() 17 | { 18 | $this->visit('/')->see('ThinkPHP'); 19 | } 20 | } -------------------------------------------------------------------------------- /dockerfiles/php/php-fpm.conf: -------------------------------------------------------------------------------- 1 | ; This file was initially adapated from the output of: (on PHP 5.6) 2 | ; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default 3 | 4 | [global] 5 | daemonize = no 6 | ;error_log = /proc/self/fd/2 7 | error_log = /var/log/php-fpm/php-fpm.err.log 8 | [www] 9 | access.log = /var/log/php-fpm/php-fpm.access.log 10 | 11 | user = www-data 12 | group = www-data 13 | 14 | listen = [::]:9000 15 | 16 | pm = dynamic 17 | pm.max_children = 5 18 | pm.start_servers = 2 19 | pm.min_spare_servers = 1 20 | pm.max_spare_servers = 3 21 | pm.status_path = /php/fpm/status 22 | 23 | clear_env = no 24 | 25 | 26 | access.format = "%t \"%m %r%Q%q\" %s %{mili}dms %{kilo}Mkb %C%%" 27 | catch_workers_output = yes 28 | 29 | php_flag[display_errors] = on 30 | ;php_admin_flag[log_errors] = true 31 | php_admin_value[date.timezone] = "Europe/Amsterdam" -------------------------------------------------------------------------------- /app/WebAdmin/test/e2e/custom-assertions/elementCount.js: -------------------------------------------------------------------------------- 1 | // A custom Nightwatch assertion. 2 | // the name of the method is the filename. 3 | // can be used in tests like this: 4 | // 5 | // browser.assert.elementCount(selector, count) 6 | // 7 | // for how to write custom assertions see 8 | // http://nightwatchjs.org/guide#writing-custom-assertions 9 | exports.assertion = function (selector, count) { 10 | this.message = 'Testing if element <' + selector + '> has count: ' + count 11 | this.expected = count 12 | this.pass = function (val) { 13 | return val === this.expected 14 | } 15 | this.value = function (res) { 16 | return res.value 17 | } 18 | this.command = function (cb) { 19 | var self = this 20 | return this.api.execute(function (selector) { 21 | return document.querySelectorAll(selector).length 22 | }, [selector], function (res) { 23 | cb.call(self, res) 24 | }) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/WebFront/test/e2e/custom-assertions/elementCount.js: -------------------------------------------------------------------------------- 1 | // A custom Nightwatch assertion. 2 | // the name of the method is the filename. 3 | // can be used in tests like this: 4 | // 5 | // browser.assert.elementCount(selector, count) 6 | // 7 | // for how to write custom assertions see 8 | // http://nightwatchjs.org/guide#writing-custom-assertions 9 | exports.assertion = function (selector, count) { 10 | this.message = 'Testing if element <' + selector + '> has count: ' + count 11 | this.expected = count 12 | this.pass = function (val) { 13 | return val === this.expected 14 | } 15 | this.value = function (res) { 16 | return res.value 17 | } 18 | this.command = function (cb) { 19 | var self = this 20 | return this.api.execute(function (selector) { 21 | return document.querySelectorAll(selector).length 22 | }, [selector], function (res) { 23 | cb.call(self, res) 24 | }) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/WebApiServer/application/route.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | return [ 13 | '__pattern__' => [ 14 | 'name' => '\w+', 15 | ], 16 | '[hello]' => [ 17 | ':id' => ['index/hello', ['method' => 'get'], ['id' => '\d+']], 18 | ':name' => ['index/hello', ['method' => 'post']], 19 | ], 20 | 21 | ]; 22 | -------------------------------------------------------------------------------- /app/WebFront/.eslintrc.js: -------------------------------------------------------------------------------- 1 | // http://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parser: 'babel-eslint', 6 | parserOptions: { 7 | sourceType: 'module' 8 | }, 9 | env: { 10 | browser: true, 11 | }, 12 | // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style 13 | extends: 'standard', 14 | // required to lint *.vue files 15 | plugins: [ 16 | 'html' 17 | ], 18 | // add your custom rules here 19 | 'rules': { 20 | // allow paren-less arrow functions 21 | "space-before-function-paren": 0, 22 | "eol-last": 0, 23 | "no-extra-semi": 0, 24 | "semi": 0, 25 | "eqeqeq": 0, 26 | "one-var": 0, 27 | "no-undef": 0, 28 | 'arrow-parens': 0, 29 | // allow async-await 30 | 'generator-star-spacing': 0, 31 | // allow debugger during development 32 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/WebAdmin/build/webpack.test.conf.js: -------------------------------------------------------------------------------- 1 | // This is the webpack config used for unit tests. 2 | 3 | var utils = require('./utils') 4 | var webpack = require('webpack') 5 | var merge = require('webpack-merge') 6 | var baseConfig = require('./webpack.base.conf') 7 | 8 | var webpackConfig = merge(baseConfig, { 9 | // use inline sourcemap for karma-sourcemap-loader 10 | module: { 11 | rules: utils.styleLoaders() 12 | }, 13 | devtool: '#inline-source-map', 14 | resolveLoader: { 15 | alias: { 16 | // necessary to to make lang="scss" work in test when using vue-loader's ?inject option 17 | // see discussion at https://github.com/vuejs/vue-loader/issues/724 18 | 'scss-loader': 'sass-loader' 19 | } 20 | }, 21 | plugins: [ 22 | new webpack.DefinePlugin({ 23 | 'process.env': require('../config/test.env') 24 | }) 25 | ] 26 | }) 27 | 28 | // no need for app entry during tests 29 | delete webpackConfig.entry 30 | 31 | module.exports = webpackConfig 32 | -------------------------------------------------------------------------------- /app/WebFront/build/webpack.test.conf.js: -------------------------------------------------------------------------------- 1 | // This is the webpack config used for unit tests. 2 | 3 | var utils = require('./utils') 4 | var webpack = require('webpack') 5 | var merge = require('webpack-merge') 6 | var baseConfig = require('./webpack.base.conf') 7 | 8 | var webpackConfig = merge(baseConfig, { 9 | // use inline sourcemap for karma-sourcemap-loader 10 | module: { 11 | rules: utils.styleLoaders() 12 | }, 13 | devtool: '#inline-source-map', 14 | resolveLoader: { 15 | alias: { 16 | // necessary to to make lang="scss" work in test when using vue-loader's ?inject option 17 | // see discussion at https://github.com/vuejs/vue-loader/issues/724 18 | 'scss-loader': 'sass-loader' 19 | } 20 | }, 21 | plugins: [ 22 | new webpack.DefinePlugin({ 23 | 'process.env': require('../config/test.env') 24 | }) 25 | ] 26 | }) 27 | 28 | // no need for app entry during tests 29 | delete webpackConfig.entry 30 | 31 | module.exports = webpackConfig 32 | -------------------------------------------------------------------------------- /app/WebApiServer/application/tags.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | // 应用行为扩展定义文件 13 | return [ 14 | // 应用初始化 15 | 'app_init' => [], 16 | // 应用开始 17 | 'app_begin' => [], 18 | // 模块初始化 19 | 'module_init' => [], 20 | // 操作开始执行 21 | 'action_begin' => [], 22 | // 视图内容过滤 23 | 'view_filter' => [], 24 | // 日志写入 25 | 'log_write' => [], 26 | // 应用结束 27 | 'app_end' => [], 28 | ]; 29 | -------------------------------------------------------------------------------- /dockerfiles/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | user nginx; 2 | worker_processes 1; 3 | 4 | error_log /var/log/nginx/error.log warn; 5 | pid /var/run/nginx.pid; 6 | 7 | 8 | events { 9 | worker_connections 1024; 10 | } 11 | 12 | 13 | http { 14 | include /etc/nginx/mime.types; 15 | default_type application/octet-stream; 16 | 17 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 18 | '$status $body_bytes_sent "$http_referer" ' 19 | '"$http_user_agent" "$http_x_forwarded_for"'; 20 | 21 | access_log /var/log/nginx/access.log main; 22 | 23 | sendfile on; 24 | #tcp_nopush on; 25 | 26 | keepalive_timeout 65; 27 | 28 | gzip on; 29 | gzip_disable "msie6"; 30 | 31 | gzip_vary on; 32 | gzip_proxied any; 33 | gzip_comp_level 6; 34 | gzip_buffers 16 8k; 35 | gzip_http_version 1.1; 36 | gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; 37 | 38 | include /etc/nginx/conf.d/*.conf; 39 | } 40 | -------------------------------------------------------------------------------- /app/WebAdmin/build/build.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | process.env.NODE_ENV = 'production' 4 | 5 | var ora = require('ora') 6 | var rm = require('rimraf') 7 | var path = require('path') 8 | var chalk = require('chalk') 9 | var webpack = require('webpack') 10 | var config = require('../config') 11 | var webpackConfig = require('./webpack.prod.conf') 12 | 13 | var spinner = ora('building for production...') 14 | spinner.start() 15 | 16 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 17 | if (err) throw err 18 | webpack(webpackConfig, function (err, stats) { 19 | spinner.stop() 20 | if (err) throw err 21 | process.stdout.write(stats.toString({ 22 | colors: true, 23 | modules: false, 24 | children: false, 25 | chunks: false, 26 | chunkModules: false 27 | }) + '\n\n') 28 | 29 | console.log(chalk.cyan(' Build complete.\n')) 30 | console.log(chalk.yellow( 31 | ' Tip: built files are meant to be served over an HTTP server.\n' + 32 | ' Opening index.html over file:// won\'t work.\n' 33 | )) 34 | }) 35 | }) 36 | -------------------------------------------------------------------------------- /app/WebApiServer/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-image": "^1.0", 22 | "topthink/think-migration": "^1.0", 23 | "topthink/think-captcha": "^1.0", 24 | "topthink/think-mongo": "^1.0", 25 | "topthink/think-testing": "^1.0", 26 | "topthink/think-worker": "^1.0", 27 | "topthink/think-helper": "^1.0", 28 | "topthink/think-queue": "^1.0", 29 | "topthink/think-angular": "^1.0" 30 | }, 31 | "extra": { 32 | "think-path": "thinkphp" 33 | }, 34 | "config": { 35 | "preferred-install": "dist" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/WebFront/build/build.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | process.env.NODE_ENV = 'production' 4 | 5 | var ora = require('ora') 6 | var rm = require('rimraf') 7 | var path = require('path') 8 | var chalk = require('chalk') 9 | var webpack = require('webpack') 10 | var config = require('../config') 11 | var webpackConfig = require('./webpack.prod.conf') 12 | 13 | var spinner = ora('building for production...') 14 | spinner.start() 15 | 16 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 17 | if (err) throw err 18 | webpack(webpackConfig, function (err, stats) { 19 | spinner.stop() 20 | if (err) throw err 21 | process.stdout.write(stats.toString({ 22 | colors: true, 23 | modules: false, 24 | children: false, 25 | chunks: false, 26 | chunkModules: false 27 | }) + '\n\n') 28 | 29 | console.log(chalk.cyan(' Build complete.\n')) 30 | console.log(chalk.yellow( 31 | ' Tip: built files are meant to be served over an HTTP server.\n' + 32 | ' Opening index.html over file:// won\'t work.\n' 33 | )) 34 | }) 35 | }) 36 | -------------------------------------------------------------------------------- /app/WebApiServer/build.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | return [ 13 | // 生成应用公共文件 14 | '__file__' => ['common.php', 'config.php', 'database.php'], 15 | 16 | // 定义demo模块的自动生成 (按照实际定义的文件名生成) 17 | 'demo' => [ 18 | '__file__' => ['common.php'], 19 | '__dir__' => ['behavior', 'controller', 'model', 'view'], 20 | 'controller' => ['Index', 'Test', 'UserType'], 21 | 'model' => ['User', 'UserType'], 22 | 'view' => ['index/index'], 23 | ], 24 | // 其他更多的模块定义 25 | ]; 26 | -------------------------------------------------------------------------------- /app/WebAdmin/test/unit/karma.conf.js: -------------------------------------------------------------------------------- 1 | // This is a karma config file. For more details see 2 | // http://karma-runner.github.io/0.13/config/configuration-file.html 3 | // we are also using it with karma-webpack 4 | // https://github.com/webpack/karma-webpack 5 | 6 | var webpackConfig = require('../../build/webpack.test.conf') 7 | 8 | module.exports = function (config) { 9 | config.set({ 10 | // to run in additional browsers: 11 | // 1. install corresponding karma launcher 12 | // http://karma-runner.github.io/0.13/config/browsers.html 13 | // 2. add it to the `browsers` array below. 14 | browsers: ['PhantomJS'], 15 | frameworks: ['mocha', 'sinon-chai', 'phantomjs-shim'], 16 | reporters: ['spec', 'coverage'], 17 | files: ['./index.js'], 18 | preprocessors: { 19 | './index.js': ['webpack', 'sourcemap'] 20 | }, 21 | webpack: webpackConfig, 22 | webpackMiddleware: { 23 | noInfo: true 24 | }, 25 | coverageReporter: { 26 | dir: './coverage', 27 | reporters: [ 28 | { type: 'lcov', subdir: '.' }, 29 | { type: 'text-summary' } 30 | ] 31 | } 32 | }) 33 | } 34 | -------------------------------------------------------------------------------- /app/WebFront/test/unit/karma.conf.js: -------------------------------------------------------------------------------- 1 | // This is a karma config file. For more details see 2 | // http://karma-runner.github.io/0.13/config/configuration-file.html 3 | // we are also using it with karma-webpack 4 | // https://github.com/webpack/karma-webpack 5 | 6 | var webpackConfig = require('../../build/webpack.test.conf') 7 | 8 | module.exports = function (config) { 9 | config.set({ 10 | // to run in additional browsers: 11 | // 1. install corresponding karma launcher 12 | // http://karma-runner.github.io/0.13/config/browsers.html 13 | // 2. add it to the `browsers` array below. 14 | browsers: ['PhantomJS'], 15 | frameworks: ['mocha', 'sinon-chai', 'phantomjs-shim'], 16 | reporters: ['spec', 'coverage'], 17 | files: ['./index.js'], 18 | preprocessors: { 19 | './index.js': ['webpack', 'sourcemap'] 20 | }, 21 | webpack: webpackConfig, 22 | webpackMiddleware: { 23 | noInfo: true 24 | }, 25 | coverageReporter: { 26 | dir: './coverage', 27 | reporters: [ 28 | { type: 'lcov', subdir: '.' }, 29 | { type: 'text-summary' } 30 | ] 31 | } 32 | }) 33 | } 34 | -------------------------------------------------------------------------------- /app/WebApiServer/application/index/controller/Index.php: -------------------------------------------------------------------------------- 1 | *{ padding: 0; margin: 0; } .think_default_text{ 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 版本由 七牛云 独家赞助发布 ]
'; 12 | } 13 | 14 | public function test() 15 | { 16 | return "hello world"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## docker-compose的lnmp环境编排实战 2 | 3 | ## 开发+线上环境 4 | 5 | 环境: Redis3.1+PHP5.6-fpm+Nginx+Mysql5.7 6 | 7 | ## Copyright@ Godtoy 8 | 9 | ## Usage 10 | 1.git clone . 11 | 12 | 2.docker-compose up --build 13 | 14 | ## 第一次需要手动导入测试数据 15 | 16 | 17 | 18 | 1.查看docker-compose 网络 19 | 20 | ``` 21 | $docker network ls 22 | NETWORK ID NAME DRIVER SCOPE 23 | eb94c90c4aae 30goinghome_default bridge local 24 | 70e90a580013 bridge bridge local 25 | 92abe5bb5b5e host host local 26 | 4e85e7e6b5f3 none null local 27 | 28 | ``` 29 | 30 | 2.查看backup真实路径 31 | ``` 32 | $ pwd 33 | /c/Users/zhaojunlike/Documents/WorkSpace/PHP/30-going-home 34 | ``` 35 | 36 | 3.导入默认得数据 37 | 38 | //启动一个迁移数据容器 39 | ```shell 40 | $ docker run -it --link mysql-db:mysql --network 30goinghome_default -v /c/Users/zhaojunlike/Documents/WorkSpace/PHP/30-going-home/data/backup:/data/backup:ro --rm mysql:5.7 sh -c 'exec mysql -h"mysql" -P"3306" -uroot -p"zhaojun" packag 41 | e_v1 { 6 | // 2. run the nightwatch test suite against it 7 | // to run in additional browsers: 8 | // 1. add an entry in test/e2e/nightwatch.conf.json under "test_settings" 9 | // 2. add it to the --env flag below 10 | // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` 11 | // For more information on Nightwatch's config file, see 12 | // http://nightwatchjs.org/guide#settings-file 13 | var opts = process.argv.slice(2) 14 | if (opts.indexOf('--config') === -1) { 15 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) 16 | } 17 | if (opts.indexOf('--env') === -1) { 18 | opts = opts.concat(['--env', 'chrome']) 19 | } 20 | 21 | var spawn = require('cross-spawn') 22 | var runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) 23 | 24 | runner.on('exit', function (code) { 25 | server.close() 26 | process.exit(code) 27 | }) 28 | 29 | runner.on('error', function (err) { 30 | server.close() 31 | throw err 32 | }) 33 | }) 34 | -------------------------------------------------------------------------------- /app/WebFront/test/e2e/runner.js: -------------------------------------------------------------------------------- 1 | // 1. start the dev server using production config 2 | process.env.NODE_ENV = 'testing' 3 | var server = require('../../build/dev-server.js') 4 | 5 | server.ready.then(() => { 6 | // 2. run the nightwatch test suite against it 7 | // to run in additional browsers: 8 | // 1. add an entry in test/e2e/nightwatch.conf.json under "test_settings" 9 | // 2. add it to the --env flag below 10 | // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` 11 | // For more information on Nightwatch's config file, see 12 | // http://nightwatchjs.org/guide#settings-file 13 | var opts = process.argv.slice(2) 14 | if (opts.indexOf('--config') === -1) { 15 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) 16 | } 17 | if (opts.indexOf('--env') === -1) { 18 | opts = opts.concat(['--env', 'chrome']) 19 | } 20 | 21 | var spawn = require('cross-spawn') 22 | var runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) 23 | 24 | runner.on('exit', function (code) { 25 | server.close() 26 | process.exit(code) 27 | }) 28 | 29 | runner.on('error', function (err) { 30 | server.close() 31 | throw err 32 | }) 33 | }) 34 | -------------------------------------------------------------------------------- /app/WebAdmin/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 | -------------------------------------------------------------------------------- /app/WebFront/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 | -------------------------------------------------------------------------------- /app/WebFront/build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var webpack = require('webpack') 3 | var config = require('../config') 4 | var merge = require('webpack-merge') 5 | var baseWebpackConfig = require('./webpack.base.conf') 6 | var HtmlWebpackPlugin = require('html-webpack-plugin') 7 | var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 8 | 9 | // add hot-reload related code to entry chunks 10 | Object.keys(baseWebpackConfig.entry).forEach(function (name) { 11 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) 12 | }) 13 | 14 | module.exports = merge(baseWebpackConfig, { 15 | module: { 16 | rules: utils.styleLoaders({sourceMap: config.dev.cssSourceMap}) 17 | }, 18 | // cheap-module-eval-source-map is faster for development 19 | devtool: '#cheap-module-eval-source-map', 20 | plugins: [ 21 | new webpack.DefinePlugin({ 22 | 'process.env': config.dev.env 23 | }), 24 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage 25 | new webpack.HotModuleReplacementPlugin(), 26 | new webpack.NoEmitOnErrorsPlugin(), 27 | // https://github.com/ampedandwired/html-webpack-plugin 28 | new HtmlWebpackPlugin({ 29 | filename: 'index.html', 30 | template: 'index.html', 31 | inject: true 32 | }), 33 | new FriendlyErrorsPlugin() 34 | ] 35 | }) 36 | -------------------------------------------------------------------------------- /app/WebAdmin/build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var webpack = require('webpack') 3 | var config = require('../config') 4 | var merge = require('webpack-merge') 5 | var baseWebpackConfig = require('./webpack.base.conf') 6 | var HtmlWebpackPlugin = require('html-webpack-plugin') 7 | var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 8 | 9 | // add hot-reload related code to entry chunks 10 | Object.keys(baseWebpackConfig.entry).forEach(function (name) { 11 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) 12 | }) 13 | 14 | module.exports = merge(baseWebpackConfig, { 15 | module: { 16 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }) 17 | }, 18 | // cheap-module-eval-source-map is faster for development 19 | devtool: '#cheap-module-eval-source-map', 20 | plugins: [ 21 | new webpack.DefinePlugin({ 22 | 'process.env': config.dev.env 23 | }), 24 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage 25 | new webpack.HotModuleReplacementPlugin(), 26 | new webpack.NoEmitOnErrorsPlugin(), 27 | // https://github.com/ampedandwired/html-webpack-plugin 28 | new HtmlWebpackPlugin({ 29 | filename: 'index.html', 30 | template: 'index.html', 31 | inject: true 32 | }), 33 | new FriendlyErrorsPlugin() 34 | ] 35 | }) 36 | -------------------------------------------------------------------------------- /app/WebApiServer/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 | -------------------------------------------------------------------------------- /dockerfiles/nginx/conf.d/web.debug.conf: -------------------------------------------------------------------------------- 1 | #upstream php { 2 | # server php-fpm:9000; 3 | #} 4 | 5 | ##WebFont 6 | upstream FrontServer { 7 | server webpack-dev-front:8080; 8 | } 9 | ##WebAdmin 10 | upstream AdminServer { 11 | server webpack-dev-admin:8080; 12 | } 13 | 14 | ##ApiServer 15 | server { 16 | listen 80 default; 17 | root /var/www/html/WebApiServer/public; 18 | index index.html index.php admin.php api.php; 19 | 20 | location / { 21 | #默认访问前台html 22 | index index.html index.php admin.php api.php; 23 | #autoindex on; 24 | if (!-e $request_filename) { 25 | rewrite ^(.*)$ /index.php?s=/$1 last; 26 | break; 27 | } 28 | } 29 | 30 | location ~ \.php(.*)$ { 31 | fastcgi_pass php-fpm:9000; 32 | fastcgi_index index.php; 33 | fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; 34 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 35 | fastcgi_param PATH_INFO $fastcgi_path_info; 36 | fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; 37 | include fastcgi_params; 38 | } 39 | 40 | location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { 41 | expires 0; 42 | log_not_found on; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/WebAdmin/build/check-versions.js: -------------------------------------------------------------------------------- 1 | var chalk = require('chalk') 2 | var semver = require('semver') 3 | var packageConfig = require('../package.json') 4 | var shell = require('shelljs') 5 | function exec (cmd) { 6 | return require('child_process').execSync(cmd).toString().trim() 7 | } 8 | 9 | var versionRequirements = [ 10 | { 11 | name: 'node', 12 | currentVersion: semver.clean(process.version), 13 | versionRequirement: packageConfig.engines.node 14 | }, 15 | ] 16 | 17 | if (shell.which('npm')) { 18 | versionRequirements.push({ 19 | name: 'npm', 20 | currentVersion: exec('npm --version'), 21 | versionRequirement: packageConfig.engines.npm 22 | }) 23 | } 24 | 25 | module.exports = function () { 26 | var warnings = [] 27 | for (var i = 0; i < versionRequirements.length; i++) { 28 | var mod = versionRequirements[i] 29 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 30 | warnings.push(mod.name + ': ' + 31 | chalk.red(mod.currentVersion) + ' should be ' + 32 | chalk.green(mod.versionRequirement) 33 | ) 34 | } 35 | } 36 | 37 | if (warnings.length) { 38 | console.log('') 39 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 40 | console.log() 41 | for (var i = 0; i < warnings.length; i++) { 42 | var warning = warnings[i] 43 | console.log(' ' + warning) 44 | } 45 | console.log() 46 | process.exit(1) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/WebFront/build/check-versions.js: -------------------------------------------------------------------------------- 1 | var chalk = require('chalk') 2 | var semver = require('semver') 3 | var packageConfig = require('../package.json') 4 | var shell = require('shelljs') 5 | function exec (cmd) { 6 | return require('child_process').execSync(cmd).toString().trim() 7 | } 8 | 9 | var versionRequirements = [ 10 | { 11 | name: 'node', 12 | currentVersion: semver.clean(process.version), 13 | versionRequirement: packageConfig.engines.node 14 | }, 15 | ] 16 | 17 | if (shell.which('npm')) { 18 | versionRequirements.push({ 19 | name: 'npm', 20 | currentVersion: exec('npm --version'), 21 | versionRequirement: packageConfig.engines.npm 22 | }) 23 | } 24 | 25 | module.exports = function () { 26 | var warnings = [] 27 | for (var i = 0; i < versionRequirements.length; i++) { 28 | var mod = versionRequirements[i] 29 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 30 | warnings.push(mod.name + ': ' + 31 | chalk.red(mod.currentVersion) + ' should be ' + 32 | chalk.green(mod.versionRequirement) 33 | ) 34 | } 35 | } 36 | 37 | if (warnings.length) { 38 | console.log('') 39 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 40 | console.log() 41 | for (var i = 0; i < warnings.length; i++) { 42 | var warning = warnings[i] 43 | console.log(' ' + warning) 44 | } 45 | console.log() 46 | process.exit(1) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/WebAdmin/src/components/Hello.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 33 | 34 | 35 | 54 | -------------------------------------------------------------------------------- /app/WebAdmin/config/index.js: -------------------------------------------------------------------------------- 1 | // see http://vuejs-templates.github.io/webpack for documentation. 2 | var path = require('path') 3 | 4 | module.exports = { 5 | build: { 6 | env: require('./prod.env'), 7 | index: path.resolve(__dirname, '../dist/index.html'), 8 | assetsRoot: path.resolve(__dirname, '../dist'), 9 | assetsSubDirectory: 'static', 10 | assetsPublicPath: '/', 11 | productionSourceMap: true, 12 | // Gzip off by default as many popular static hosts such as 13 | // Surge or Netlify already gzip all static assets for you. 14 | // Before setting to `true`, make sure to: 15 | // npm install --save-dev compression-webpack-plugin 16 | productionGzip: false, 17 | productionGzipExtensions: ['js', 'css'], 18 | // Run the build command with an extra argument to 19 | // View the bundle analyzer report after build finishes: 20 | // `npm run build --report` 21 | // Set to `true` or `false` to always turn it on or off 22 | bundleAnalyzerReport: process.env.npm_config_report 23 | }, 24 | dev: { 25 | env: require('./dev.env'), 26 | port: 8080, 27 | autoOpenBrowser: true, 28 | assetsSubDirectory: 'static', 29 | assetsPublicPath: '/', 30 | proxyTable: {}, 31 | // CSS Sourcemaps off by default because relative paths are "buggy" 32 | // with this option, according to the CSS-Loader README 33 | // (https://github.com/webpack/css-loader#sourcemaps) 34 | // In our experience, they generally work as expected, 35 | // just be aware of this issue when enabling this option. 36 | cssSourceMap: false 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/WebFront/config/index.js: -------------------------------------------------------------------------------- 1 | // see http://vuejs-templates.github.io/webpack for documentation. 2 | var path = require('path') 3 | 4 | module.exports = { 5 | build: { 6 | env: require('./prod.env'), 7 | index: path.resolve(__dirname, '../dist/index.html'), 8 | assetsRoot: path.resolve(__dirname, '../dist'), 9 | assetsSubDirectory: 'static', 10 | assetsPublicPath: '/', 11 | productionSourceMap: true, 12 | // Gzip off by default as many popular static hosts such as 13 | // Surge or Netlify already gzip all static assets for you. 14 | // Before setting to `true`, make sure to: 15 | // npm install --save-dev compression-webpack-plugin 16 | productionGzip: false, 17 | productionGzipExtensions: ['js', 'css'], 18 | // Run the build command with an extra argument to 19 | // View the bundle analyzer report after build finishes: 20 | // `npm run build --report` 21 | // Set to `true` or `false` to always turn it on or off 22 | bundleAnalyzerReport: process.env.npm_config_report 23 | }, 24 | dev: { 25 | env: require('./dev.env'), 26 | port: 8080, 27 | autoOpenBrowser: true, 28 | assetsSubDirectory: 'static', 29 | assetsPublicPath: '/', 30 | proxyTable: {}, 31 | // CSS Sourcemaps off by default because relative paths are "buggy" 32 | // with this option, according to the CSS-Loader README 33 | // (https://github.com/webpack/css-loader#sourcemaps) 34 | // In our experience, they generally work as expected, 35 | // just be aware of this issue when enabling this option. 36 | cssSourceMap: false 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/WebFront/src/components/Hello.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 34 | 35 | 36 | 55 | -------------------------------------------------------------------------------- /app/WebApiServer/application/database.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | return [ 13 | // 数据库类型 14 | 'type' => 'mysql', 15 | // 服务器地址 16 | 'hostname' => '127.0.0.1', 17 | // 数据库名 18 | 'database' => '', 19 | // 用户名 20 | 'username' => 'root', 21 | // 密码 22 | 'password' => '', 23 | // 端口 24 | 'hostport' => '', 25 | // 连接dsn 26 | 'dsn' => '', 27 | // 数据库连接参数 28 | 'params' => [], 29 | // 数据库编码默认采用utf8 30 | 'charset' => 'utf8', 31 | // 数据库表前缀 32 | 'prefix' => '', 33 | // 数据库调试模式 34 | 'debug' => true, 35 | // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) 36 | 'deploy' => 0, 37 | // 数据库读写是否分离 主从式有效 38 | 'rw_separate' => false, 39 | // 读写分离后 主服务器数量 40 | 'master_num' => 1, 41 | // 指定从服务器序号 42 | 'slave_no' => '', 43 | // 是否严格检查字段是否存在 44 | 'fields_strict' => true, 45 | // 数据集返回类型 array 数组 collection Collection对象 46 | 'resultset_type' => 'array', 47 | // 是否自动写入时间戳字段 48 | 'auto_timestamp' => false, 49 | // 是否需要进行SQL性能分析 50 | 'sql_explain' => false, 51 | ]; 52 | -------------------------------------------------------------------------------- /app/WebAdmin/build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var config = require('../config') 4 | var vueLoaderConfig = require('./vue-loader.conf') 5 | 6 | function resolve (dir) { 7 | return path.join(__dirname, '..', dir) 8 | } 9 | 10 | module.exports = { 11 | entry: { 12 | app: './src/main.js' 13 | }, 14 | output: { 15 | path: config.build.assetsRoot, 16 | filename: '[name].js', 17 | publicPath: process.env.NODE_ENV === 'production' 18 | ? config.build.assetsPublicPath 19 | : config.dev.assetsPublicPath 20 | }, 21 | resolve: { 22 | extensions: ['.js', '.vue', '.json'], 23 | alias: { 24 | 'vue$': 'vue/dist/vue.esm.js', 25 | '@': resolve('src') 26 | } 27 | }, 28 | module: { 29 | rules: [ 30 | { 31 | test: /\.(js|vue)$/, 32 | loader: 'eslint-loader', 33 | enforce: 'pre', 34 | include: [resolve('src'), resolve('test')], 35 | options: { 36 | formatter: require('eslint-friendly-formatter') 37 | } 38 | }, 39 | { 40 | test: /\.vue$/, 41 | loader: 'vue-loader', 42 | options: vueLoaderConfig 43 | }, 44 | { 45 | test: /\.js$/, 46 | loader: 'babel-loader', 47 | include: [resolve('src'), resolve('test')] 48 | }, 49 | { 50 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 51 | loader: 'url-loader', 52 | options: { 53 | limit: 10000, 54 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 55 | } 56 | }, 57 | { 58 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 59 | loader: 'url-loader', 60 | options: { 61 | limit: 10000, 62 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 63 | } 64 | } 65 | ] 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/WebFront/build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var config = require('../config') 4 | var vueLoaderConfig = require('./vue-loader.conf') 5 | 6 | function resolve(dir) { 7 | return path.join(__dirname, '..', dir) 8 | } 9 | 10 | module.exports = { 11 | entry: { 12 | app: './src/main.js' 13 | }, 14 | output: { 15 | path: config.build.assetsRoot, 16 | filename: '[name].js', 17 | publicPath: process.env.NODE_ENV === 'production' 18 | ? config.build.assetsPublicPath 19 | : config.dev.assetsPublicPath 20 | }, 21 | resolve: { 22 | extensions: ['.js', '.vue', '.json'], 23 | alias: { 24 | 'vue$': 'vue/dist/vue.esm.js', 25 | '@': resolve('src'), 26 | 'muse-components': 'muse-ui/src' 27 | } 28 | }, 29 | module: { 30 | rules: [ 31 | { 32 | test: /muse-ui.src.*?js$/, 33 | loader: 'babel-loader' 34 | }, 35 | { 36 | test: /\.(js|vue)$/, 37 | loader: 'eslint-loader', 38 | enforce: 'pre', 39 | include: [resolve('src'), resolve('test')], 40 | options: { 41 | formatter: require('eslint-friendly-formatter') 42 | } 43 | }, 44 | { 45 | test: /\.vue$/, 46 | loader: 'vue-loader', 47 | options: vueLoaderConfig 48 | }, 49 | { 50 | test: /\.js$/, 51 | loader: 'babel-loader', 52 | include: [resolve('src'), resolve('test')] 53 | }, 54 | { 55 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 56 | loader: 'url-loader', 57 | options: { 58 | limit: 10000, 59 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 60 | } 61 | }, 62 | { 63 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 64 | loader: 'url-loader', 65 | options: { 66 | limit: 10000, 67 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 68 | } 69 | } 70 | ] 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/WebAdmin/build/utils.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var config = require('../config') 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 4 | 5 | exports.assetsPath = function (_path) { 6 | var assetsSubDirectory = process.env.NODE_ENV === 'production' 7 | ? config.build.assetsSubDirectory 8 | : config.dev.assetsSubDirectory 9 | return path.posix.join(assetsSubDirectory, _path) 10 | } 11 | 12 | exports.cssLoaders = function (options) { 13 | options = options || {} 14 | 15 | var cssLoader = { 16 | loader: 'css-loader', 17 | options: { 18 | minimize: process.env.NODE_ENV === 'production', 19 | sourceMap: options.sourceMap 20 | } 21 | } 22 | 23 | // generate loader string to be used with extract text plugin 24 | function generateLoaders (loader, loaderOptions) { 25 | var loaders = [cssLoader] 26 | if (loader) { 27 | loaders.push({ 28 | loader: loader + '-loader', 29 | options: Object.assign({}, loaderOptions, { 30 | sourceMap: options.sourceMap 31 | }) 32 | }) 33 | } 34 | 35 | // Extract CSS when that option is specified 36 | // (which is the case during production build) 37 | if (options.extract) { 38 | return ExtractTextPlugin.extract({ 39 | use: loaders, 40 | fallback: 'vue-style-loader' 41 | }) 42 | } else { 43 | return ['vue-style-loader'].concat(loaders) 44 | } 45 | } 46 | 47 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 48 | return { 49 | css: generateLoaders(), 50 | postcss: generateLoaders(), 51 | less: generateLoaders('less'), 52 | sass: generateLoaders('sass', { indentedSyntax: true }), 53 | scss: generateLoaders('sass'), 54 | stylus: generateLoaders('stylus'), 55 | styl: generateLoaders('stylus') 56 | } 57 | } 58 | 59 | // Generate loaders for standalone style files (outside of .vue) 60 | exports.styleLoaders = function (options) { 61 | var output = [] 62 | var loaders = exports.cssLoaders(options) 63 | for (var extension in loaders) { 64 | var loader = loaders[extension] 65 | output.push({ 66 | test: new RegExp('\\.' + extension + '$'), 67 | use: loader 68 | }) 69 | } 70 | return output 71 | } 72 | -------------------------------------------------------------------------------- /app/WebFront/build/utils.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var config = require('../config') 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 4 | 5 | exports.assetsPath = function (_path) { 6 | var assetsSubDirectory = process.env.NODE_ENV === 'production' 7 | ? config.build.assetsSubDirectory 8 | : config.dev.assetsSubDirectory 9 | return path.posix.join(assetsSubDirectory, _path) 10 | } 11 | 12 | exports.cssLoaders = function (options) { 13 | options = options || {} 14 | 15 | var cssLoader = { 16 | loader: 'css-loader', 17 | options: { 18 | minimize: process.env.NODE_ENV === 'production', 19 | sourceMap: options.sourceMap 20 | } 21 | } 22 | 23 | // generate loader string to be used with extract text plugin 24 | function generateLoaders (loader, loaderOptions) { 25 | var loaders = [cssLoader] 26 | if (loader) { 27 | loaders.push({ 28 | loader: loader + '-loader', 29 | options: Object.assign({}, loaderOptions, { 30 | sourceMap: options.sourceMap 31 | }) 32 | }) 33 | } 34 | 35 | // Extract CSS when that option is specified 36 | // (which is the case during production build) 37 | if (options.extract) { 38 | return ExtractTextPlugin.extract({ 39 | use: loaders, 40 | fallback: 'vue-style-loader' 41 | }) 42 | } else { 43 | return ['vue-style-loader'].concat(loaders) 44 | } 45 | } 46 | 47 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 48 | return { 49 | css: generateLoaders(), 50 | postcss: generateLoaders(), 51 | less: generateLoaders('less'), 52 | sass: generateLoaders('sass', { indentedSyntax: true }), 53 | scss: generateLoaders('sass'), 54 | stylus: generateLoaders('stylus'), 55 | styl: generateLoaders('stylus') 56 | } 57 | } 58 | 59 | // Generate loaders for standalone style files (outside of .vue) 60 | exports.styleLoaders = function (options) { 61 | var output = [] 62 | var loaders = exports.cssLoaders(options) 63 | for (var extension in loaders) { 64 | var loader = loaders[extension] 65 | output.push({ 66 | test: new RegExp('\\.' + extension + '$'), 67 | use: loader 68 | }) 69 | } 70 | return output 71 | } 72 | -------------------------------------------------------------------------------- /dockerfiles/nginx/conf.d/web.product.conf-default: -------------------------------------------------------------------------------- 1 | #upstream php { 2 | # server php-fpm:9000; 3 | #} 4 | 5 | ##WebFont 6 | upstream FontServer { 7 | server webpack-dev-font:8080; 8 | } 9 | server { 10 | listen 80; 11 | server_name www.dockerchina.dist; 12 | root /var/www/html/WebFont/dist/; 13 | index index.html; 14 | location / { 15 | #默认访问前台html 16 | index index.html; 17 | proxy_pass http://FontServer; 18 | proxy_set_header Host $host; 19 | proxy_set_header X-Real-IP $remote_addr; 20 | } 21 | 22 | location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { 23 | expires 0; 24 | log_not_found on; 25 | } 26 | } 27 | 28 | 29 | ##WebAdmin 30 | upstream AdminServer { 31 | server webpack-dev-admin:8080; 32 | } 33 | server { 34 | listen 80; 35 | server_name admin.dockerchina.dist; 36 | root /var/www/html/WebAdmin/dist/; 37 | index index.html; 38 | location / { 39 | #默认访问前台html 40 | index index.html; 41 | proxy_pass http://AdminServer; 42 | proxy_set_header Host $host; 43 | proxy_set_header X-Real-IP $remote_addr; 44 | } 45 | location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { 46 | expires 0; 47 | # log_not_found on; 48 | } 49 | } 50 | 51 | ##ApiServer 52 | server { 53 | listen 80 api.dockerchina.dist; 54 | root /var/www/html/WebApiServer/public; 55 | index index.html index.php api.php; 56 | location / { 57 | #默认访问前台html 58 | index index.html index.php api.php; 59 | #autoindex on; 60 | if (!-e $request_filename) { 61 | #重写路由,去掉前缀 62 | rewrite ^/(.*)$ /index.php/$1 last; 63 | break; 64 | } 65 | } 66 | 67 | location ~ \.php$ { 68 | fastcgi_pass php-fpm:9000; 69 | fastcgi_index index.php; 70 | fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; 71 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 72 | fastcgi_param PATH_INFO $fastcgi_path_info; 73 | fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; 74 | include fastcgi_params; 75 | } 76 | 77 | location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { 78 | expires 0; 79 | log_not_found on; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.2' 2 | services: 3 | nginx: 4 | build: ./dockerfiles/nginx/ 5 | container_name: nginx-server 6 | ports: 7 | - "80:80" 8 | links: 9 | - "php-fpm" 10 | - "webpack-dev-front" 11 | volumes: 12 | #网站目录 13 | - ./app:/var/www/html 14 | - ./dockerfiles/nginx/conf.d:/etc/nginx/conf.d:ro 15 | - ./dockerfiles/nginx/nginx.conf:/etc/nginx/nginx.conf:ro 16 | #日志文件 17 | - ./logs/nginx:/var/log/nginx 18 | depends_on: 19 | - redis-db 20 | - webpack-dev-front 21 | restart: always 22 | expose: 23 | - "80" 24 | - "8080" 25 | - "6379" 26 | - "3306" 27 | - "9000" 28 | command: nginx -g 'daemon off;' 29 | mysql-db: 30 | image: mysql:5.7 31 | container_name: mysql-db 32 | #很重要导入到处数据 33 | volumes: 34 | - ./data/mysql:/var/lib/mysql:rw 35 | restart: always 36 | environment: 37 | MYSQL_ROOT_PASSWORD: zhaojun 38 | MYSQL_DATABASE: package_v1 39 | MYSQL_USER: zhaojun 40 | MYSQL_PASSWORD: zhaojun 41 | redis-db: 42 | build: ./dockerfiles/redis 43 | container_name: redis-db 44 | volumes: 45 | - ./data/redis:/data 46 | php-fpm: 47 | build: ./dockerfiles/php/ 48 | container_name: php-fpm 49 | volumes: 50 | #网站目录 51 | - ./app:/var/www/html:rw 52 | #配置文件 53 | - ./dockerfiles/php/php.ini:/usr/local/etc/php/php.ini:ro 54 | - ./dockerfiles/php/php-fpm.conf:/usr/local/etc/php-fpm.conf:ro 55 | 56 | #挂载站点日志 57 | - ./logs/php-fpm:/var/log/php-fpm:rw 58 | depends_on: 59 | - mysql-db 60 | - redis-db 61 | links: 62 | - mysql-db 63 | - redis-db 64 | command: php-fpm 65 | #不推荐使用,因为这个nodejs模块无法监控docker容器内部文件变化。 66 | ##前台 67 | webpack-dev-front: 68 | build: ./dockerfiles/webpack/ 69 | container_name: webpack-dev-front 70 | volumes: 71 | - ./app/WebFront:/web:rw 72 | - ./dockerfiles/webpack/entrypoint.sh:/entrypoint.sh 73 | ports: 74 | - "8081:8080" 75 | expose: 76 | - "8080" 77 | command: /bin/bash -c "cd /web && npm run dev" 78 | ##后胎 79 | webpack-dev-admin: 80 | build: ./dockerfiles/webpack/ 81 | container_name: webpack-dev-admin 82 | volumes: 83 | - ./app/WebAdmin:/web:rw 84 | - ./dockerfiles/webpack/entrypoint.sh:/entrypoint.sh 85 | ports: 86 | - "8082:8080" 87 | expose: 88 | - "8080" 89 | command: /bin/bash -c "cd /web && npm run dev" 90 | ##node-fontServer 91 | 92 | ##node-adminServer 93 | 94 | ##第一次迁移数据所需的镜像 version0.3 README手动迁移 95 | # mysql-database: 96 | # image: mysql:5.7 97 | # volumes: 98 | # - ./data/backup:/data/backup 99 | 100 | volumes: 101 | wwwroot: 102 | driver: local -------------------------------------------------------------------------------- /app/WebAdmin/build/dev-server.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | var config = require('../config') 4 | if (!process.env.NODE_ENV) { 5 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) 6 | } 7 | 8 | var opn = require('opn') 9 | var path = require('path') 10 | var express = require('express') 11 | var webpack = require('webpack') 12 | var proxyMiddleware = require('http-proxy-middleware') 13 | var webpackConfig = process.env.NODE_ENV === 'testing' 14 | ? require('./webpack.prod.conf') 15 | : require('./webpack.dev.conf') 16 | 17 | // default port where dev server listens for incoming traffic 18 | var port = process.env.PORT || config.dev.port 19 | // automatically open browser, if not set will be false 20 | var autoOpenBrowser = !!config.dev.autoOpenBrowser 21 | // Define HTTP proxies to your custom API backend 22 | // https://github.com/chimurai/http-proxy-middleware 23 | var proxyTable = config.dev.proxyTable 24 | 25 | var app = express() 26 | var compiler = webpack(webpackConfig) 27 | 28 | var devMiddleware = require('webpack-dev-middleware')(compiler, { 29 | publicPath: webpackConfig.output.publicPath, 30 | quiet: true 31 | }) 32 | 33 | var hotMiddleware = require('webpack-hot-middleware')(compiler, { 34 | log: () => {} 35 | }) 36 | // force page reload when html-webpack-plugin template changes 37 | compiler.plugin('compilation', function (compilation) { 38 | compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { 39 | hotMiddleware.publish({ action: 'reload' }) 40 | cb() 41 | }) 42 | }) 43 | 44 | // proxy api requests 45 | Object.keys(proxyTable).forEach(function (context) { 46 | var options = proxyTable[context] 47 | if (typeof options === 'string') { 48 | options = { target: options } 49 | } 50 | app.use(proxyMiddleware(options.filter || context, options)) 51 | }) 52 | 53 | // handle fallback for HTML5 history API 54 | app.use(require('connect-history-api-fallback')()) 55 | 56 | // serve webpack bundle output 57 | app.use(devMiddleware) 58 | 59 | // enable hot-reload and state-preserving 60 | // compilation error display 61 | app.use(hotMiddleware) 62 | 63 | // serve pure static assets 64 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) 65 | app.use(staticPath, express.static('./static')) 66 | 67 | var uri = 'http://localhost:' + port 68 | 69 | var _resolve 70 | var readyPromise = new Promise(resolve => { 71 | _resolve = resolve 72 | }) 73 | 74 | console.log('> Starting dev server...') 75 | devMiddleware.waitUntilValid(() => { 76 | console.log('> Listening at ' + uri + '\n') 77 | // when env is testing, don't need open it 78 | if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { 79 | opn(uri) 80 | } 81 | _resolve() 82 | }) 83 | 84 | var server = app.listen(port) 85 | 86 | module.exports = { 87 | ready: readyPromise, 88 | close: () => { 89 | server.close() 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /app/WebFront/build/dev-server.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | var config = require('../config') 4 | if (!process.env.NODE_ENV) { 5 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) 6 | } 7 | 8 | var opn = require('opn') 9 | var path = require('path') 10 | var express = require('express') 11 | var webpack = require('webpack') 12 | var proxyMiddleware = require('http-proxy-middleware') 13 | var webpackConfig = process.env.NODE_ENV === 'testing' 14 | ? require('./webpack.prod.conf') 15 | : require('./webpack.dev.conf') 16 | 17 | // default port where dev server listens for incoming traffic 18 | var port = process.env.PORT || config.dev.port 19 | // automatically open browser, if not set will be false 20 | var autoOpenBrowser = !!config.dev.autoOpenBrowser 21 | // Define HTTP proxies to your custom API backend 22 | // https://github.com/chimurai/http-proxy-middleware 23 | var proxyTable = config.dev.proxyTable 24 | 25 | var app = express() 26 | var compiler = webpack(webpackConfig) 27 | 28 | var devMiddleware = require('webpack-dev-middleware')(compiler, { 29 | publicPath: webpackConfig.output.publicPath, 30 | quiet: true 31 | }) 32 | 33 | var hotMiddleware = require('webpack-hot-middleware')(compiler, { 34 | log: () => { 35 | } 36 | }) 37 | // force page reload when html-webpack-plugin template changes 38 | compiler.plugin('compilation', function (compilation) { 39 | compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { 40 | hotMiddleware.publish({action: 'reload'}) 41 | cb() 42 | }) 43 | }) 44 | 45 | // proxy api requests 46 | Object.keys(proxyTable).forEach(function (context) { 47 | var options = proxyTable[context] 48 | if (typeof options === 'string') { 49 | options = {target: options} 50 | } 51 | app.use(proxyMiddleware(options.filter || context, options)) 52 | }) 53 | 54 | // handle fallback for HTML5 history API 55 | app.use(require('connect-history-api-fallback')()) 56 | 57 | // serve webpack bundle output 58 | app.use(devMiddleware) 59 | 60 | // enable hot-reload and state-preserving 61 | // compilation error display 62 | app.use(hotMiddleware) 63 | 64 | // serve pure static assets 65 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) 66 | app.use(staticPath, express.static('./static')) 67 | 68 | var uri = 'http://localhost:' + port 69 | 70 | var _resolve 71 | var readyPromise = new Promise(resolve => { 72 | _resolve = resolve 73 | }) 74 | 75 | console.log('> Starting dev server...') 76 | devMiddleware.waitUntilValid(() => { 77 | console.log('> Listening at ' + uri + '\n') 78 | // when env is testing, don't need open it 79 | if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { 80 | opn(uri) 81 | } 82 | _resolve() 83 | }) 84 | 85 | var server = app.listen(port) 86 | 87 | module.exports = { 88 | ready: readyPromise, 89 | close: () => { 90 | server.close() 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /app/WebAdmin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "website", 3 | "version": "1.0.0", 4 | "description": "A Vue.js project", 5 | "author": "zhaojunlike@gmail.com", 6 | "private": true, 7 | "scripts": { 8 | "dev": "node build/dev-server.js", 9 | "start": "node build/dev-server.js", 10 | "build": "node build/build.js", 11 | "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run", 12 | "e2e": "node test/e2e/runner.js", 13 | "test": "npm run unit && npm run e2e", 14 | "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs" 15 | }, 16 | "dependencies": { 17 | "vue": "^2.2.6", 18 | "vue-router": "^2.3.1" 19 | }, 20 | "devDependencies": { 21 | "autoprefixer": "^6.7.2", 22 | "babel-core": "^6.22.1", 23 | "babel-eslint": "^7.1.1", 24 | "babel-loader": "^6.2.10", 25 | "babel-plugin-transform-runtime": "^6.22.0", 26 | "babel-preset-env": "^1.3.2", 27 | "babel-preset-stage-2": "^6.22.0", 28 | "babel-register": "^6.22.0", 29 | "chalk": "^1.1.3", 30 | "connect-history-api-fallback": "^1.3.0", 31 | "copy-webpack-plugin": "^4.0.1", 32 | "css-loader": "^0.28.0", 33 | "eslint": "^3.19.0", 34 | "eslint-friendly-formatter": "^2.0.7", 35 | "eslint-loader": "^1.7.1", 36 | "eslint-plugin-html": "^2.0.0", 37 | "eslint-config-standard": "^6.2.1", 38 | "eslint-plugin-promise": "^3.4.0", 39 | "eslint-plugin-standard": "^2.0.1", 40 | "eventsource-polyfill": "^0.9.6", 41 | "express": "^4.14.1", 42 | "extract-text-webpack-plugin": "^2.0.0", 43 | "file-loader": "^0.11.1", 44 | "friendly-errors-webpack-plugin": "^1.1.3", 45 | "html-webpack-plugin": "^2.28.0", 46 | "http-proxy-middleware": "^0.17.3", 47 | "webpack-bundle-analyzer": "^2.2.1", 48 | "cross-env": "^4.0.0", 49 | "karma": "^1.4.1", 50 | "karma-coverage": "^1.1.1", 51 | "karma-mocha": "^1.3.0", 52 | "karma-phantomjs-launcher": "^1.0.2", 53 | "karma-phantomjs-shim": "^1.4.0", 54 | "karma-sinon-chai": "^1.3.1", 55 | "karma-sourcemap-loader": "^0.3.7", 56 | "karma-spec-reporter": "0.0.30", 57 | "karma-webpack": "^2.0.2", 58 | "lolex": "^1.5.2", 59 | "mocha": "^3.2.0", 60 | "chai": "^3.5.0", 61 | "sinon": "^2.1.0", 62 | "sinon-chai": "^2.8.0", 63 | "inject-loader": "^3.0.0", 64 | "babel-plugin-istanbul": "^4.1.1", 65 | "phantomjs-prebuilt": "^2.1.14", 66 | "chromedriver": "^2.27.2", 67 | "cross-spawn": "^5.0.1", 68 | "nightwatch": "^0.9.12", 69 | "selenium-server": "^3.0.1", 70 | "semver": "^5.3.0", 71 | "shelljs": "^0.7.6", 72 | "opn": "^4.0.2", 73 | "optimize-css-assets-webpack-plugin": "^1.3.0", 74 | "ora": "^1.2.0", 75 | "rimraf": "^2.6.0", 76 | "url-loader": "^0.5.8", 77 | "vue-loader": "^11.3.4", 78 | "vue-style-loader": "^2.0.5", 79 | "vue-template-compiler": "^2.2.6", 80 | "webpack": "^2.3.3", 81 | "webpack-dev-middleware": "^1.10.0", 82 | "webpack-hot-middleware": "^2.18.0", 83 | "webpack-merge": "^4.1.0" 84 | }, 85 | "engines": { 86 | "node": ">= 4.0.0", 87 | "npm": ">= 3.0.0" 88 | }, 89 | "browserslist": [ 90 | "> 1%", 91 | "last 2 versions", 92 | "not ie <= 8" 93 | ] 94 | } 95 | -------------------------------------------------------------------------------- /app/WebFront/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docker-china-web", 3 | "version": "0.0.1", 4 | "description": "", 5 | "author": "zhaojunlike@gmail.com", 6 | "private": true, 7 | "scripts": { 8 | "dev": "node build/dev-server.js", 9 | "start": "node build/dev-server.js", 10 | "build": "node build/build.js", 11 | "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run", 12 | "e2e": "node test/e2e/runner.js", 13 | "test": "npm run unit && npm run e2e", 14 | "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs" 15 | }, 16 | "dependencies": { 17 | "axios": "^0.16.1", 18 | "muse-ui": "^2.0.3", 19 | "vue": "^2.2.6", 20 | "vue-router": "^2.3.1" 21 | }, 22 | "devDependencies": { 23 | "autoprefixer": "^6.7.2", 24 | "babel-core": "^6.22.1", 25 | "babel-eslint": "^7.1.1", 26 | "babel-loader": "^6.2.10", 27 | "babel-plugin-transform-runtime": "^6.22.0", 28 | "babel-preset-env": "^1.3.2", 29 | "babel-preset-stage-2": "^6.22.0", 30 | "babel-register": "^6.22.0", 31 | "chalk": "^1.1.3", 32 | "connect-history-api-fallback": "^1.3.0", 33 | "copy-webpack-plugin": "^4.0.1", 34 | "css-loader": "^0.28.0", 35 | "eslint": "^3.19.0", 36 | "eslint-friendly-formatter": "^2.0.7", 37 | "eslint-loader": "^1.7.1", 38 | "eslint-plugin-html": "^2.0.0", 39 | "eslint-config-standard": "^6.2.1", 40 | "eslint-plugin-promise": "^3.4.0", 41 | "eslint-plugin-standard": "^2.0.1", 42 | "eventsource-polyfill": "^0.9.6", 43 | "express": "^4.14.1", 44 | "extract-text-webpack-plugin": "^2.0.0", 45 | "file-loader": "^0.11.1", 46 | "friendly-errors-webpack-plugin": "^1.1.3", 47 | "html-webpack-plugin": "^2.28.0", 48 | "http-proxy-middleware": "^0.17.3", 49 | "webpack-bundle-analyzer": "^2.2.1", 50 | "cross-env": "^4.0.0", 51 | "karma": "^1.4.1", 52 | "karma-coverage": "^1.1.1", 53 | "karma-mocha": "^1.3.0", 54 | "karma-phantomjs-launcher": "^1.0.2", 55 | "karma-phantomjs-shim": "^1.4.0", 56 | "karma-sinon-chai": "^1.3.1", 57 | "karma-sourcemap-loader": "^0.3.7", 58 | "karma-spec-reporter": "0.0.30", 59 | "karma-webpack": "^2.0.2", 60 | "lolex": "^1.5.2", 61 | "mocha": "^3.2.0", 62 | "chai": "^3.5.0", 63 | "sinon": "^2.1.0", 64 | "sinon-chai": "^2.8.0", 65 | "inject-loader": "^3.0.0", 66 | "babel-plugin-istanbul": "^4.1.1", 67 | "phantomjs-prebuilt": "^2.1.14", 68 | "chromedriver": "^2.27.2", 69 | "cross-spawn": "^5.0.1", 70 | "nightwatch": "^0.9.12", 71 | "selenium-server": "^3.0.1", 72 | "semver": "^5.3.0", 73 | "shelljs": "^0.7.6", 74 | "opn": "^4.0.2", 75 | "optimize-css-assets-webpack-plugin": "^1.3.0", 76 | "ora": "^1.2.0", 77 | "rimraf": "^2.6.0", 78 | "url-loader": "^0.5.8", 79 | "vue-loader": "^11.3.4", 80 | "vue-style-loader": "^2.0.5", 81 | "vue-template-compiler": "^2.2.6", 82 | "webpack": "^2.3.3", 83 | "webpack-dev-middleware": "^1.10.0", 84 | "webpack-hot-middleware": "^2.18.0", 85 | "webpack-merge": "^4.1.0" 86 | }, 87 | "engines": { 88 | "node": ">= 4.0.0", 89 | "npm": ">= 3.0.0" 90 | }, 91 | "browserslist": [ 92 | "> 1%", 93 | "last 2 versions", 94 | "not ie <= 8" 95 | ] 96 | } 97 | -------------------------------------------------------------------------------- /app/WebApiServer/README.md: -------------------------------------------------------------------------------- 1 | ThinkPHP 5.0 2 | =============== 3 | 4 | [![Total Downloads](https://poser.pugx.org/topthink/think/downloads)](https://packagist.org/packages/topthink/think) 5 | [![Latest Stable Version](https://poser.pugx.org/topthink/think/v/stable)](https://packagist.org/packages/topthink/think) 6 | [![Latest Unstable Version](https://poser.pugx.org/topthink/think/v/unstable)](https://packagist.org/packages/topthink/think) 7 | [![License](https://poser.pugx.org/topthink/think/license)](https://packagist.org/packages/topthink/think) 8 | 9 | ThinkPHP5在保持快速开发和大道至简的核心理念不变的同时,PHP版本要求提升到5.4,对已有的CBD模式做了更深的强化,优化核心,减少依赖,基于全新的架构思想和命名空间实现,是ThinkPHP突破原有框架思路的颠覆之作,其主要特性包括: 10 | 11 | + 基于命名空间和众多PHP新特性 12 | + 核心功能组件化 13 | + 强化路由功能 14 | + 更灵活的控制器 15 | + 重构的模型和数据库类 16 | + 配置文件可分离 17 | + 重写的自动验证和完成 18 | + 简化扩展机制 19 | + API支持完善 20 | + 改进的Log类 21 | + 命令行访问支持 22 | + REST支持 23 | + 引导文件支持 24 | + 方便的自动生成定义 25 | + 真正惰性加载 26 | + 分布式环境支持 27 | + 更多的社交类库 28 | 29 | > ThinkPHP5的运行环境要求PHP5.4以上。 30 | 31 | 详细开发文档参考 [ThinkPHP5完全开发手册](http://www.kancloud.cn/manual/thinkphp5) 32 | 33 | ## 目录结构 34 | 35 | 初始的目录结构如下: 36 | 37 | ~~~ 38 | www WEB部署目录(或者子目录) 39 | ├─application 应用目录 40 | │ ├─common 公共模块目录(可以更改) 41 | │ ├─module_name 模块目录 42 | │ │ ├─config.php 模块配置文件 43 | │ │ ├─common.php 模块函数文件 44 | │ │ ├─controller 控制器目录 45 | │ │ ├─model 模型目录 46 | │ │ ├─view 视图目录 47 | │ │ └─ ... 更多类库目录 48 | │ │ 49 | │ ├─command.php 命令行工具配置文件 50 | │ ├─common.php 公共函数文件 51 | │ ├─config.php 公共配置文件 52 | │ ├─route.php 路由配置文件 53 | │ ├─tags.php 应用行为扩展定义文件 54 | │ └─database.php 数据库配置文件 55 | │ 56 | ├─public WEB目录(对外访问目录) 57 | │ ├─index.php 入口文件 58 | │ ├─router.php 快速测试文件 59 | │ └─.htaccess 用于apache的重写 60 | │ 61 | ├─thinkphp 框架系统目录 62 | │ ├─lang 语言文件目录 63 | │ ├─library 框架类库目录 64 | │ │ ├─think Think类库包目录 65 | │ │ └─traits 系统Trait目录 66 | │ │ 67 | │ ├─tpl 系统模板目录 68 | │ ├─base.php 基础定义文件 69 | │ ├─console.php 控制台入口文件 70 | │ ├─convention.php 框架惯例配置文件 71 | │ ├─helper.php 助手函数文件 72 | │ ├─phpunit.xml phpunit配置文件 73 | │ └─start.php 框架入口文件 74 | │ 75 | ├─extend 扩展类库目录 76 | ├─runtime 应用的运行时目录(可写,可定制) 77 | ├─vendor 第三方类库目录(Composer依赖库) 78 | ├─build.php 自动生成定义文件(参考) 79 | ├─composer.json composer 定义文件 80 | ├─LICENSE.txt 授权说明文件 81 | ├─README.md README 文件 82 | ├─think 命令行入口文件 83 | ~~~ 84 | 85 | > router.php用于php自带webserver支持,可用于快速测试 86 | > 切换到public目录后,启动命令:php -S localhost:8888 router.php 87 | > 上面的目录结构和名称是可以改变的,这取决于你的入口文件和配置参数。 88 | 89 | ## 命名规范 90 | 91 | `ThinkPHP5`遵循PSR-2命名规范和PSR-4自动加载规范,并且注意如下规范: 92 | 93 | ### 目录和文件 94 | 95 | * 目录不强制规范,驼峰和小写+下划线模式均支持; 96 | * 类库、函数文件统一以`.php`为后缀; 97 | * 类的文件名均以命名空间定义,并且命名空间的路径和类库文件所在路径一致; 98 | * 类名和类文件名保持一致,统一采用驼峰法命名(首字母大写); 99 | 100 | ### 函数和类、属性命名 101 | * 类的命名采用驼峰法,并且首字母大写,例如 `User`、`UserType`,默认不需要添加后缀,例如`UserController`应该直接命名为`User`; 102 | * 函数的命名使用小写字母和下划线(小写字母开头)的方式,例如 `get_client_ip`; 103 | * 方法的命名使用驼峰法,并且首字母小写,例如 `getUserName`; 104 | * 属性的命名使用驼峰法,并且首字母小写,例如 `tableName`、`instance`; 105 | * 以双下划线“__”打头的函数或方法作为魔法方法,例如 `__call` 和 `__autoload`; 106 | 107 | ### 常量和配置 108 | * 常量以大写字母和下划线命名,例如 `APP_PATH`和 `THINK_PATH`; 109 | * 配置参数以小写字母和下划线命名,例如 `url_route_on` 和`url_convert`; 110 | 111 | ### 数据表和字段 112 | * 数据表和字段采用小写加下划线方式命名,并注意字段名不要以下划线开头,例如 `think_user` 表和 `user_name`字段,不建议使用驼峰和中文作为数据表字段命名。 113 | 114 | ## 参与开发 115 | 请参阅 [ThinkPHP5 核心框架包](https://github.com/top-think/framework)。 116 | 117 | ## 版权信息 118 | 119 | ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 120 | 121 | 本项目包含的第三方源码和二进制文件之版权信息另行标注。 122 | 123 | 版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn) 124 | 125 | All rights reserved。 126 | 127 | ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 128 | 129 | 更多细节参阅 [LICENSE.txt](LICENSE.txt) 130 | -------------------------------------------------------------------------------- /app/WebAdmin/build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var webpack = require('webpack') 4 | var config = require('../config') 5 | var merge = require('webpack-merge') 6 | var baseWebpackConfig = require('./webpack.base.conf') 7 | var CopyWebpackPlugin = require('copy-webpack-plugin') 8 | var HtmlWebpackPlugin = require('html-webpack-plugin') 9 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 10 | var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 11 | 12 | var env = process.env.NODE_ENV === 'testing' 13 | ? require('../config/test.env') 14 | : config.build.env 15 | 16 | var webpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ 19 | sourceMap: config.build.productionSourceMap, 20 | extract: true 21 | }) 22 | }, 23 | devtool: config.build.productionSourceMap ? '#source-map' : false, 24 | output: { 25 | path: config.build.assetsRoot, 26 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 27 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 28 | }, 29 | plugins: [ 30 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 31 | new webpack.DefinePlugin({ 32 | 'process.env': env 33 | }), 34 | new webpack.optimize.UglifyJsPlugin({ 35 | compress: { 36 | warnings: false 37 | }, 38 | sourceMap: true 39 | }), 40 | // extract css into its own file 41 | new ExtractTextPlugin({ 42 | filename: utils.assetsPath('css/[name].[contenthash].css') 43 | }), 44 | // Compress extracted CSS. We are using this plugin so that possible 45 | // duplicated CSS from different components can be deduped. 46 | new OptimizeCSSPlugin({ 47 | cssProcessorOptions: { 48 | safe: true 49 | } 50 | }), 51 | // generate dist index.html with correct asset hash for caching. 52 | // you can customize output by editing /index.html 53 | // see https://github.com/ampedandwired/html-webpack-plugin 54 | new HtmlWebpackPlugin({ 55 | filename: process.env.NODE_ENV === 'testing' 56 | ? 'index.html' 57 | : config.build.index, 58 | template: 'index.html', 59 | inject: true, 60 | minify: { 61 | removeComments: true, 62 | collapseWhitespace: true, 63 | removeAttributeQuotes: true 64 | // more options: 65 | // https://github.com/kangax/html-minifier#options-quick-reference 66 | }, 67 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 68 | chunksSortMode: 'dependency' 69 | }), 70 | // split vendor js into its own file 71 | new webpack.optimize.CommonsChunkPlugin({ 72 | name: 'vendor', 73 | minChunks: function (module, count) { 74 | // any required modules inside node_modules are extracted to vendor 75 | return ( 76 | module.resource && 77 | /\.js$/.test(module.resource) && 78 | module.resource.indexOf( 79 | path.join(__dirname, '../node_modules') 80 | ) === 0 81 | ) 82 | } 83 | }), 84 | // extract webpack runtime and module manifest to its own file in order to 85 | // prevent vendor hash from being updated whenever app bundle is updated 86 | new webpack.optimize.CommonsChunkPlugin({ 87 | name: 'manifest', 88 | chunks: ['vendor'] 89 | }), 90 | // copy custom static assets 91 | new CopyWebpackPlugin([ 92 | { 93 | from: path.resolve(__dirname, '../static'), 94 | to: config.build.assetsSubDirectory, 95 | ignore: ['.*'] 96 | } 97 | ]) 98 | ] 99 | }) 100 | 101 | if (config.build.productionGzip) { 102 | var CompressionWebpackPlugin = require('compression-webpack-plugin') 103 | 104 | webpackConfig.plugins.push( 105 | new CompressionWebpackPlugin({ 106 | asset: '[path].gz[query]', 107 | algorithm: 'gzip', 108 | test: new RegExp( 109 | '\\.(' + 110 | config.build.productionGzipExtensions.join('|') + 111 | ')$' 112 | ), 113 | threshold: 10240, 114 | minRatio: 0.8 115 | }) 116 | ) 117 | } 118 | 119 | if (config.build.bundleAnalyzerReport) { 120 | var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 121 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 122 | } 123 | 124 | module.exports = webpackConfig 125 | -------------------------------------------------------------------------------- /app/WebFront/build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var webpack = require('webpack') 4 | var config = require('../config') 5 | var merge = require('webpack-merge') 6 | var baseWebpackConfig = require('./webpack.base.conf') 7 | var CopyWebpackPlugin = require('copy-webpack-plugin') 8 | var HtmlWebpackPlugin = require('html-webpack-plugin') 9 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 10 | var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 11 | 12 | var env = process.env.NODE_ENV === 'testing' 13 | ? require('../config/test.env') 14 | : config.build.env 15 | 16 | var webpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ 19 | sourceMap: config.build.productionSourceMap, 20 | extract: true 21 | }) 22 | }, 23 | devtool: config.build.productionSourceMap ? '#source-map' : false, 24 | output: { 25 | path: config.build.assetsRoot, 26 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 27 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 28 | }, 29 | plugins: [ 30 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 31 | new webpack.DefinePlugin({ 32 | 'process.env': env 33 | }), 34 | new webpack.optimize.UglifyJsPlugin({ 35 | compress: { 36 | warnings: false 37 | }, 38 | sourceMap: true 39 | }), 40 | // extract css into its own file 41 | new ExtractTextPlugin({ 42 | filename: utils.assetsPath('css/[name].[contenthash].css') 43 | }), 44 | // Compress extracted CSS. We are using this plugin so that possible 45 | // duplicated CSS from different components can be deduped. 46 | new OptimizeCSSPlugin({ 47 | cssProcessorOptions: { 48 | safe: true 49 | } 50 | }), 51 | // generate dist index.html with correct asset hash for caching. 52 | // you can customize output by editing /index.html 53 | // see https://github.com/ampedandwired/html-webpack-plugin 54 | new HtmlWebpackPlugin({ 55 | filename: process.env.NODE_ENV === 'testing' 56 | ? 'index.html' 57 | : config.build.index, 58 | template: 'index.html', 59 | inject: true, 60 | minify: { 61 | removeComments: true, 62 | collapseWhitespace: true, 63 | removeAttributeQuotes: true 64 | // more options: 65 | // https://github.com/kangax/html-minifier#options-quick-reference 66 | }, 67 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 68 | chunksSortMode: 'dependency' 69 | }), 70 | // split vendor js into its own file 71 | new webpack.optimize.CommonsChunkPlugin({ 72 | name: 'vendor', 73 | minChunks: function (module, count) { 74 | // any required modules inside node_modules are extracted to vendor 75 | return ( 76 | module.resource && 77 | /\.js$/.test(module.resource) && 78 | module.resource.indexOf( 79 | path.join(__dirname, '../node_modules') 80 | ) === 0 81 | ) 82 | } 83 | }), 84 | // extract webpack runtime and module manifest to its own file in order to 85 | // prevent vendor hash from being updated whenever app bundle is updated 86 | new webpack.optimize.CommonsChunkPlugin({ 87 | name: 'manifest', 88 | chunks: ['vendor'] 89 | }), 90 | // copy custom static assets 91 | new CopyWebpackPlugin([ 92 | { 93 | from: path.resolve(__dirname, '../static'), 94 | to: config.build.assetsSubDirectory, 95 | ignore: ['.*'] 96 | } 97 | ]) 98 | ] 99 | }) 100 | 101 | if (config.build.productionGzip) { 102 | var CompressionWebpackPlugin = require('compression-webpack-plugin') 103 | 104 | webpackConfig.plugins.push( 105 | new CompressionWebpackPlugin({ 106 | asset: '[path].gz[query]', 107 | algorithm: 'gzip', 108 | test: new RegExp( 109 | '\\.(' + 110 | config.build.productionGzipExtensions.join('|') + 111 | ')$' 112 | ), 113 | threshold: 10240, 114 | minRatio: 0.8 115 | }) 116 | ) 117 | } 118 | 119 | if (config.build.bundleAnalyzerReport) { 120 | var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 121 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 122 | } 123 | 124 | module.exports = webpackConfig 125 | -------------------------------------------------------------------------------- /app/WebApiServer/application/config.php: -------------------------------------------------------------------------------- 1 | 10 | // +---------------------------------------------------------------------- 11 | 12 | return [ 13 | // +---------------------------------------------------------------------- 14 | // | 应用设置 15 | // +---------------------------------------------------------------------- 16 | 17 | // 应用调试模式 18 | 'app_debug' => true, 19 | // 应用Trace 20 | 'app_trace' => true, 21 | // 应用模式状态 22 | 'app_status' => '', 23 | // 是否支持多模块 24 | 'app_multi_module' => true, 25 | // 入口自动绑定模块 26 | 'auto_bind_module' => false, 27 | // 注册的根命名空间 28 | 'root_namespace' => [], 29 | // 扩展函数文件 30 | 'extra_file_list' => [THINK_PATH . 'helper' . EXT], 31 | // 默认输出类型 32 | 'default_return_type' => 'html', 33 | // 默认AJAX 数据返回格式,可选json xml ... 34 | 'default_ajax_return' => 'json', 35 | // 默认JSONP格式返回的处理方法 36 | 'default_jsonp_handler' => 'jsonpReturn', 37 | // 默认JSONP处理方法 38 | 'var_jsonp_handler' => 'callback', 39 | // 默认时区 40 | 'default_timezone' => 'PRC', 41 | // 是否开启多语言 42 | 'lang_switch_on' => false, 43 | // 默认全局过滤方法 用逗号分隔多个 44 | 'default_filter' => '', 45 | // 默认语言 46 | 'default_lang' => 'zh-cn', 47 | // 应用类库后缀 48 | 'class_suffix' => false, 49 | // 控制器类后缀 50 | 'controller_suffix' => false, 51 | 52 | // +---------------------------------------------------------------------- 53 | // | 模块设置 54 | // +---------------------------------------------------------------------- 55 | 56 | // 默认模块名 57 | 'default_module' => 'index', 58 | // 禁止访问模块 59 | 'deny_module_list' => ['common'], 60 | // 默认控制器名 61 | 'default_controller' => 'Index', 62 | // 默认操作名 63 | 'default_action' => 'index', 64 | // 默认验证器 65 | 'default_validate' => '', 66 | // 默认的空控制器名 67 | 'empty_controller' => 'Error', 68 | // 操作方法后缀 69 | 'action_suffix' => '', 70 | // 自动搜索控制器 71 | 'controller_auto_search' => false, 72 | 73 | // +---------------------------------------------------------------------- 74 | // | URL设置 75 | // +---------------------------------------------------------------------- 76 | 77 | // PATHINFO变量名 用于兼容模式 78 | 'var_pathinfo' => 's', 79 | // 兼容PATH_INFO获取 80 | 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], 81 | // pathinfo分隔符 82 | 'pathinfo_depr' => '/', 83 | // URL伪静态后缀 84 | 'url_html_suffix' => 'html', 85 | // URL普通方式参数 用于自动生成 86 | 'url_common_param' => false, 87 | // URL参数方式 0 按名称成对解析 1 按顺序解析 88 | 'url_param_type' => 0, 89 | // 是否开启路由 90 | 'url_route_on' => true, 91 | // 路由使用完整匹配 92 | 'route_complete_match' => false, 93 | // 路由配置文件(支持配置多个) 94 | 'route_config_file' => ['route'], 95 | // 是否强制使用路由 96 | 'url_route_must' => false, 97 | // 域名部署 98 | 'url_domain_deploy' => false, 99 | // 域名根,如thinkphp.cn 100 | 'url_domain_root' => '', 101 | // 是否自动转换URL中的控制器和操作名 102 | 'url_convert' => true, 103 | // 默认的访问控制器层 104 | 'url_controller_layer' => 'controller', 105 | // 表单请求类型伪装变量 106 | 'var_method' => '_method', 107 | // 表单ajax伪装变量 108 | 'var_ajax' => '_ajax', 109 | // 表单pjax伪装变量 110 | 'var_pjax' => '_pjax', 111 | // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 112 | 'request_cache' => false, 113 | // 请求缓存有效期 114 | 'request_cache_expire' => null, 115 | 116 | // +---------------------------------------------------------------------- 117 | // | 模板设置 118 | // +---------------------------------------------------------------------- 119 | 120 | 'template' => [ 121 | // 模板引擎类型 支持 php think 支持扩展 122 | 'type' => 'Think', 123 | // 模板路径 124 | 'view_path' => '', 125 | // 模板后缀 126 | 'view_suffix' => 'html', 127 | // 模板文件名分隔符 128 | 'view_depr' => DS, 129 | // 模板引擎普通标签开始标记 130 | 'tpl_begin' => '{', 131 | // 模板引擎普通标签结束标记 132 | 'tpl_end' => '}', 133 | // 标签库标签开始标记 134 | 'taglib_begin' => '{', 135 | // 标签库标签结束标记 136 | 'taglib_end' => '}', 137 | ], 138 | 139 | // 视图输出字符串内容替换 140 | 'view_replace_str' => [], 141 | // 默认跳转页面对应的模板文件 142 | 'dispatch_success_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl', 143 | 'dispatch_error_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl', 144 | 145 | // +---------------------------------------------------------------------- 146 | // | 异常及错误设置 147 | // +---------------------------------------------------------------------- 148 | 149 | // 异常页面的模板文件 150 | 'exception_tmpl' => THINK_PATH . 'tpl' . DS . 'think_exception.tpl', 151 | 152 | // 错误显示信息,非调试模式有效 153 | 'error_message' => '页面错误!请稍后再试~', 154 | // 显示错误信息 155 | 'show_error_msg' => true, 156 | // 异常处理handle类 留空使用 \think\exception\Handle 157 | 'exception_handle' => '', 158 | 159 | // +---------------------------------------------------------------------- 160 | // | 日志设置 161 | // +---------------------------------------------------------------------- 162 | 163 | 'log' => [ 164 | // 日志记录方式,内置 file socket 支持扩展 165 | 'type' => 'File', 166 | // 日志保存目录 167 | 'path' => LOG_PATH, 168 | // 日志记录级别 169 | 'level' => [], 170 | ], 171 | 172 | // +---------------------------------------------------------------------- 173 | // | Trace设置 开启 app_trace 后 有效 174 | // +---------------------------------------------------------------------- 175 | 'trace' => [ 176 | // 内置Html Console 支持扩展 177 | 'type' => 'Html', 178 | ], 179 | 180 | // +---------------------------------------------------------------------- 181 | // | 缓存设置 182 | // +---------------------------------------------------------------------- 183 | 184 | 'cache' => [ 185 | // 驱动方式 186 | 'type' => 'Redis', 187 | // 缓存保存目录 188 | 'path' => CACHE_PATH, 189 | // 缓存前缀 190 | 'prefix' => '', 191 | // 缓存有效期 0表示永久缓存 192 | 'expire' => 0, 193 | ], 194 | 195 | // +---------------------------------------------------------------------- 196 | // | 会话设置 197 | // +---------------------------------------------------------------------- 198 | 199 | 'session' => [ 200 | 'id' => '', 201 | // SESSION_ID的提交变量,解决flash上传跨域 202 | 'var_session_id' => '', 203 | // SESSION 前缀 204 | 'prefix' => 'think', 205 | // 驱动方式 支持redis memcache memcached 206 | 'type' => '', 207 | // 是否自动开启 SESSION 208 | 'auto_start' => true, 209 | ], 210 | 211 | // +---------------------------------------------------------------------- 212 | // | Cookie设置 213 | // +---------------------------------------------------------------------- 214 | 'cookie' => [ 215 | // cookie 名称前缀 216 | 'prefix' => '', 217 | // cookie 保存时间 218 | 'expire' => 0, 219 | // cookie 保存路径 220 | 'path' => '/', 221 | // cookie 有效域名 222 | 'domain' => '', 223 | // cookie 启用安全传输 224 | 'secure' => false, 225 | // httponly设置 226 | 'httponly' => '', 227 | // 是否使用 setcookie 228 | 'setcookie' => true, 229 | ], 230 | 231 | //分页配置 232 | 'paginate' => [ 233 | 'type' => 'bootstrap', 234 | 'var_page' => 'page', 235 | 'list_rows' => 15, 236 | ], 237 | ]; 238 | --------------------------------------------------------------------------------