Просмотр исходного кода

Merge branch 'master' of http://18.167.157.193:1026/guanli/ngds into feature/1540-theo-auto-mesure-up

theo 3 лет назад
Родитель
Сommit
0274d38262
32 измененных файлов с 622 добавлено и 294 удалено
  1. 6 0
      backendApi/modules/v1/models/lists/bonus/PerfOrderList.php
  2. 12 0
      backendApi/modules/v1/models/lists/bonus/PeriodBonusList.php
  3. 41 0
      backendEle/build/trial.js
  4. 150 0
      backendEle/build/webpack.trial.conf.js
  5. 4 0
      backendEle/config/trial.env.js
  6. 2 1
      backendEle/package.json
  7. 1 0
      backendEle/src/router/_import_trial.js
  8. 2 0
      backendEle/src/utils/config.js
  9. 33 0
      backendEle/src/utils/config_trial.js
  10. 2 1
      common/config/.gitignore
  11. 0 107
      common/config/config-development.php
  12. 0 107
      common/config/config-product.php
  13. 8 0
      common/config/params.php
  14. 5 0
      common/helpers/bonus/BonusCalc.php
  15. 3 0
      common/helpers/bonus/CalcCache.php
  16. 8 4
      common/helpers/bonus/PerfCalc.php
  17. 0 1
      common/models/ApproachOrder.php
  18. 0 0
      common/models/CalcBonusTourism.php
  19. 0 0
      common/models/FlowTourismPoints.php
  20. 0 0
      common/models/StarCrownLevel.php
  21. 0 0
      common/models/StarCrownLevelForm.php
  22. 20 17
      common/models/forms/ApproachOrderForm.php
  23. 34 30
      common/models/forms/DeclarationUpgradeForm.php
  24. 2 1
      frontendApi/config/params.php
  25. 42 21
      frontendApi/modules/v1/controllers/ShopController.php
  26. 41 0
      frontendEle/build/trial.js
  27. 150 0
      frontendEle/build/webpack.trial.conf.js
  28. 4 0
      frontendEle/config/trial.env.js
  29. 2 1
      frontendEle/package.json
  30. 1 0
      frontendEle/src/router/_import_trial.js
  31. 45 0
      frontendEle/src/utils/config.js
  32. 4 3
      frontendEle/src/views/user/dec.vue

+ 6 - 0
backendApi/modules/v1/models/lists/bonus/PerfOrderList.php

@@ -149,6 +149,12 @@ class PerfOrderList extends \common\libs\dataList\DataList implements DataListIn
                         'width' => '250',
                     ],
                 ],
+                'FROM_TABLES' => [
+                    'header' => '订单来源',
+                    'headerOther' => [
+                        'width' => '250',
+                    ],
+                ],
                 'CREATED_AT' => [
                     'header' => '创建时间',
                     'value' => function($row) {

+ 12 - 0
backendApi/modules/v1/models/lists/bonus/PeriodBonusList.php

@@ -323,6 +323,18 @@ class PeriodBonusList extends \common\libs\dataList\DataList implements DataList
                         'prop'=>'ORI_BONUS_QY',
                     ],
                 ],
+                'ORI_CAPPED_BONUS_QY' => [
+                    'header' => '绩效奖未封顶金额',
+                    'value' => function($row) {
+                        return (new Price([
+                            'value' => $row['ORI_CAPPED_BONUS_QY'],
+                        ]))->result();
+                    },
+                    'headerOther' => [
+                        'width' => '120',
+                        'prop'=>'ORI_CAPPED_BONUS_QY',
+                    ],
+                ],
                 'ORI_BONUS_QY_BD' => [
                     'header' => '报单团队奖原金额',
                     'value' => function($row) {

+ 41 - 0
backendEle/build/trial.js

@@ -0,0 +1,41 @@
+'use strict'
+require('./check-versions')()
+
+process.env.NODE_ENV = 'trial'
+
+const ora = require('ora')
+const rm = require('rimraf')
+const path = require('path')
+const chalk = require('chalk')
+const webpack = require('webpack')
+const config = require('../config')
+const webpackConfig = require('./webpack.trial.conf')
+
+const spinner = ora('building for trial...')
+spinner.start()
+
+rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
+  if (err) throw err
+  webpack(webpackConfig, (err, stats) => {
+    spinner.stop()
+    if (err) throw err
+    process.stdout.write(stats.toString({
+      colors: true,
+      modules: false,
+      children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
+      chunks: false,
+      chunkModules: false
+    }) + '\n\n')
+
+    if (stats.hasErrors()) {
+      console.log(chalk.red('  Build failed with errors.\n'))
+      process.exit(1)
+    }
+
+    console.log(chalk.cyan('  Build complete.\n'))
+    console.log(chalk.yellow(
+      '  Tip: built files are meant to be served over an HTTP server.\n' +
+      '  Opening index.html over file:// won\'t work.\n'
+    ))
+  })
+})

+ 150 - 0
backendEle/build/webpack.trial.conf.js

@@ -0,0 +1,150 @@
+'use strict'
+const path = require('path')
+const utils = require('./utils')
+const webpack = require('webpack')
+const config = require('../config')
+const merge = require('webpack-merge')
+const baseWebpackConfig = require('./webpack.base.conf')
+const CopyWebpackPlugin = require('copy-webpack-plugin')
+const HtmlWebpackPlugin = require('html-webpack-plugin')
+const ExtractTextPlugin = require('extract-text-webpack-plugin')
+const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
+const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
+
+// const env = process.env.NODE_ENV === 'testing'
+//   ? require('../config/test.env')
+//   : require('../config/prod.env')
+const env = require('../config/trial.env')
+
+const webpackConfig = merge(baseWebpackConfig, {
+  module: {
+    rules: utils.styleLoaders({
+      sourceMap: config.trial.productionSourceMap,
+      extract: true,
+      usePostCSS: true
+    })
+  },
+  devtool: config.trial.productionSourceMap ? config.trial.devtool : false,
+  output: {
+    path: config.trial.assetsRoot,
+    filename: utils.assetsPath('js/[name].[chunkhash].js'),
+    chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
+  },
+  plugins: [
+    // http://vuejs.github.io/vue-loader/en/workflow/production.html
+    new webpack.DefinePlugin({
+      'process.env': env
+    }),
+    new UglifyJsPlugin({
+      uglifyOptions: {
+        compress: {
+          warnings: false
+        }
+      },
+      sourceMap: config.trial.productionSourceMap,
+      parallel: true
+    }),
+    // extract css into its own file
+    new ExtractTextPlugin({
+      filename: utils.assetsPath('css/[name].[contenthash].css'),
+      // Setting the following option to `false` will not extract CSS from codesplit chunks.
+      // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
+      // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
+      // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
+      allChunks: true,
+    }),
+    // Compress extracted CSS. We are using this plugin so that possible
+    // duplicated CSS from different components can be deduped.
+    new OptimizeCSSPlugin({
+      cssProcessorOptions: config.trial.productionSourceMap
+        ? { safe: true, map: { inline: false } }
+        : { safe: true }
+    }),
+    // generate dist index.html with correct asset hash for caching.
+    // you can customize output by editing /index.html
+    // see https://github.com/ampedandwired/html-webpack-plugin
+    new HtmlWebpackPlugin({
+      filename: process.env.NODE_ENV === 'testing'
+        ? 'index.html'
+        : config.trial.index,
+      template: 'index.html',
+      inject: true,
+      minify: {
+        removeComments: true,
+        collapseWhitespace: true,
+        removeAttributeQuotes: true
+        // more options:
+        // https://github.com/kangax/html-minifier#options-quick-reference
+      },
+      // necessary to consistently work with multiple chunks via CommonsChunkPlugin
+      chunksSortMode: 'dependency'
+    }),
+    // keep module.id stable when vendor modules does not change
+    new webpack.HashedModuleIdsPlugin(),
+    // enable scope hoisting
+    new webpack.optimize.ModuleConcatenationPlugin(),
+    // split vendor js into its own file
+    new webpack.optimize.CommonsChunkPlugin({
+      name: 'vendor',
+      minChunks (module) {
+        // any required modules inside node_modules are extracted to vendor
+        return (
+          module.resource &&
+          /\.js$/.test(module.resource) &&
+          module.resource.indexOf(
+            path.join(__dirname, '../node_modules')
+          ) === 0
+        )
+      }
+    }),
+    // extract webpack runtime and module manifest to its own file in order to
+    // prevent vendor hash from being updated whenever app bundle is updated
+    new webpack.optimize.CommonsChunkPlugin({
+      name: 'manifest',
+      minChunks: Infinity
+    }),
+    // This instance extracts shared chunks from code splitted chunks and bundles them
+    // in a separate chunk, similar to the vendor chunk
+    // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
+    new webpack.optimize.CommonsChunkPlugin({
+      name: 'app',
+      async: 'vendor-async',
+      children: true,
+      minChunks: 3
+    }),
+
+    // copy custom static assets
+    new CopyWebpackPlugin([
+      {
+        from: path.resolve(__dirname, '../static'),
+        to: config.trial.assetsSubDirectory,
+        ignore: ['.*']
+      }
+    ])
+  ]
+})
+
+if (config.trial.productionGzip) {
+  const CompressionWebpackPlugin = require('compression-webpack-plugin')
+
+  webpackConfig.plugins.push(
+    new CompressionWebpackPlugin({
+      asset: '[path].gz[query]',
+      algorithm: 'gzip',
+      test: new RegExp(
+        '\\.(' +
+        config.trial.productionGzipExtensions.join('|') +
+        ')$'
+      ),
+      threshold: 10240,
+      minRatio: 0.8
+    })
+  )
+}
+
+if (config.trial.bundleAnalyzerReport) {
+  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
+  webpackConfig.plugins.push(new BundleAnalyzerPlugin())
+}
+
+module.exports = webpackConfig

+ 4 - 0
backendEle/config/trial.env.js

@@ -0,0 +1,4 @@
+'use strict'
+module.exports = {
+  NODE_ENV: '"trial"'
+}

+ 2 - 1
backendEle/package.json

@@ -11,7 +11,8 @@
     "e2e": "node test/e2e/runner.js",
     "test": "npm run unit && npm run e2e",
     "lint": "eslint --ext .js,.vue src test/unit test/e2e/specs",
-    "build": "node build/build.js"
+    "build": "node build/build.js",
+    "trial": "node build/trial.js"
   },
   "dependencies": {
     "ajv": "^6.11.0",

+ 1 - 0
backendEle/src/router/_import_trial.js

@@ -0,0 +1 @@
+module.exports = file => () => import('@/views/' + file + '.vue')

+ 2 - 0
backendEle/src/utils/config.js

@@ -1,6 +1,8 @@
 let config
 if (process.env.NODE_ENV === 'development') {
   config = require('./config_development')
+} else if(process.env.NODE_ENV === 'trial') {
+  config = require('./config_trial')
 } else {
   config = require('./config_production')
 }

+ 33 - 0
backendEle/src/utils/config_trial.js

@@ -0,0 +1,33 @@
+const APP_NAME = '奖金结算系统'
+const SERVER_API_DOMAIN = '16.163.228.151'
+const SERVER_API_HTTP_TYPE = 'http://'
+const SERVER_API_PORT = ':8025'  // ':8102'
+const SERVER_API_VERSION = 'v1'
+const REQUEST_URL = `${SERVER_API_HTTP_TYPE}${SERVER_API_DOMAIN}${SERVER_API_PORT}/${SERVER_API_VERSION}/`
+const WEBSOCKET_HOST = 'ws://127.0.0.1:9513'
+const BONUS_WEBSOCKET_HOST = 'ws://127.0.0.1:9513'
+const DEVICE_TYPE = 'pc'
+const ACCESS_TOKEN_PREFIX = 'Bearer '
+const CDN_BASE_URL = 'http://ng-upload.elken.com'
+const CDN_IMG_URL = `${CDN_BASE_URL}/cdn/`
+const PRICE_IS_ROUND = true
+const FRONTEND_SERVER = 'http://16.163.228.151:8028'
+const REGION_URL = `${CDN_BASE_URL}/cdn/jsdata/ar_region_data.js?ver=0.1`
+
+export {
+  APP_NAME,
+  SERVER_API_DOMAIN,
+  SERVER_API_HTTP_TYPE,
+  SERVER_API_PORT,
+  SERVER_API_VERSION,
+  REQUEST_URL,
+  WEBSOCKET_HOST,
+  BONUS_WEBSOCKET_HOST,
+  DEVICE_TYPE,
+  ACCESS_TOKEN_PREFIX,
+  CDN_BASE_URL,
+  CDN_IMG_URL,
+  PRICE_IS_ROUND,
+  FRONTEND_SERVER,
+  REGION_URL
+}

+ 2 - 1
common/config/.gitignore

@@ -1,4 +1,5 @@
 main-local.php
 params-local.php
 test-local.php
-config.php
+config-production.php
+config-development.php

+ 0 - 107
common/config/config-development.php

@@ -1,107 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: leo
- * Date: 2018/2/23
- * Time: 下午3:53
- */
-return [
-    // 奖金结算系统主库
-    'db' => [
-        // 数据库连接
-        'dsn' => 'mysql:host=192.168.0.7;dbname=milk_shake_0415',
-        // 数据库用户名
-        'username' => 'black_tea_0309',
-        // 数据库密码
-        'password' => 'ndZ4MXYST7',
-        // 数据库字符集
-        'charset' => 'utf8',
-        // 数据表前缀
-        'tablePrefix' => 'AR_',
-    ],
-    // 日志库
-    'dbLog' => [
-        'dsn' => 'mongodb://192.168.0.9:27017/aikang_log_db',
-        'options' => [
-            "username" => "admin",
-            "password" => "123456"
-        ],
-    ],
-    // 奖金结算专属库(为不占用主库资源,不影响会员正常业务,该库专门用于奖金结算,可单独架设,需与主库做主从同步)
-    'dbCalc' => [
-        'dsn' => 'mysql:host=192.168.0.7;dbname=milk_shake_0415',
-        'username' => 'black_tea_0309',
-        'password' => 'ndZ4MXYST7',
-        'charset' => 'utf8',
-        'tablePrefix' => 'AR_',
-    ],
-    // 移动点位时专用的点位备份库(可用来查看各个时期的会员点位情况)
-    'dbNetPoint' => [
-        'dsn' => 'mysql:host=192.168.0.7;dbname=milk_shake_0415',
-        'username' => 'black_tea_0309',
-        'password' => 'ndZ4MXYST7',
-        'charset' => 'utf8',
-        'tablePrefix' => 'AR_',
-    ],
-    // 系统从库
-    'slavesDb' => [
-        'slaveConfig' => [
-            'username' => 'black_tea_0309',
-            'password' => 'ndZ4MXYST7',
-            'charset' => 'utf8',
-            'tablePrefix' => 'AR_',
-            'attributes' => [
-                PDO::ATTR_TIMEOUT => 10,  // 从库超时切换间隔时间
-            ],
-        ],
-        'slaves' => [
-            ['dsn' => 'mysql:host=192.168.0.7;dbname=milk_shake_0415'],
-            // 其他奖金结算系统的从库从下面继续添加配置
-        ],
-    ],
-    // Token专用 Redis 库
-    'tokenRedis' => [
-        // 服务器
-        'hostname' => '192.168.0.8',
-        // 端口
-        'port' => 6379,
-        // 密码
-        'password' => 'keli123456',
-        // 库索引
-        'database' => 13,
-    ],
-    // 缓存专用 Redis 库
-    'cacheRedis' => [
-        'hostname' => '192.168.0.8',
-        'port' => 6379,
-        'password' => 'keli123456',
-        'database' => 14,
-    ],
-    // 其他数据 Redis 库
-    'otherRedis' => [
-        'hostname' => '192.168.0.8',
-        'port' => 6379,
-        'password' => 'keli123456',
-        'database' => 15,
-    ],
-    // 远程静态上传服务器地址 @todo 明哥提供
-    'remoteUploadHost' => 'http://ar.upload.ming',
-    'idCardVerify' => [
-        'host' => 'http://121.40.238.29:20000',
-        'clientId' => '122371433052508160',
-    ],
-    // swoole异步服务器及端口
-    'swooleTimerConfig' => [
-        'host' => '127.0.0.1',
-        'port' => '9513',
-    ],
-    'swooleClientConfig' => [
-        'host' => '127.0.0.1',
-        'port' => '9513',
-    ],
-    // swoole奖金服务器及端口
-    'swooleBonusClientConfig' => [
-        'host' => '127.0.0.1',
-        'port' => '9513',
-    ],
-];

+ 0 - 107
common/config/config-product.php

@@ -1,107 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: leo
- * Date: 2018/2/23
- * Time: 下午3:53
- */
-return [
-    // 奖金结算系统主库
-    'db' => [
-        // 数据库连接
-        'dsn' => 'mysql:host=ngds-db-live.cdehazle30lc.ap-east-1.rds.amazonaws.com:4000;dbname=coco_milk_0524',
-        // 数据库用户名
-        'username' => 'babysbreath',
-        // 数据库密码
-        'password' => 'FV8%#$uFL4',
-        // 数据库字符集
-        'charset' => 'utf8',
-        // 数据表前缀
-        'tablePrefix' => 'AR_',
-    ],
-    // 日志库
-    'dbLog' => [
-        'dsn' => 'mongodb://192.168.0.9:27017/aikang_log_db',
-        'options' => [
-            "username" => "admin",
-            "password" => "123456"
-        ],
-    ],
-    // 奖金结算专属库(为不占用主库资源,不影响会员正常业务,该库专门用于奖金结算,可单独架设,需与主库做主从同步)
-    'dbCalc' => [
-        'dsn' => 'mysql:host=ngds-db-live.cdehazle30lc.ap-east-1.rds.amazonaws.com:4000;dbname=coco_milk_0524',
-        'username' => 'babysbreath',
-        'password' => 'FV8%#$uFL4',
-        'charset' => 'utf8',
-        'tablePrefix' => 'AR_',
-    ],
-    // 移动点位时专用的点位备份库(可用来查看各个时期的会员点位情况)
-    'dbNetPoint' => [
-        'dsn' => 'mysql:host=ngds-db-live.cdehazle30lc.ap-east-1.rds.amazonaws.com:4000;dbname=coco_milk_0524',
-        'username' => 'babysbreath',
-        'password' => 'FV8%#$uFL4',
-        'charset' => 'utf8',
-        'tablePrefix' => 'AR_',
-    ],
-    // 系统从库
-    'slavesDb' => [
-        'slaveConfig' => [
-            'username' => 'babysbreath',
-            'password' => 'FV8%#$uFL4',
-            'charset' => 'utf8',
-            'tablePrefix' => 'AR_',
-            'attributes' => [
-                PDO::ATTR_TIMEOUT => 10,  // 从库超时切换间隔时间
-            ],
-        ],
-        'slaves' => [
-            ['dsn' => 'mysql:host=ngds-db-live.cdehazle30lc.ap-east-1.rds.amazonaws.com:4000;dbname=coco_milk_0524'],
-            // 其他奖金结算系统的从库从下面继续添加配置
-        ],
-    ],
-    // Token专用 Redis 库
-    'tokenRedis' => [
-        // 服务器
-        'hostname' => '192.168.0.8',
-        // 端口
-        'port' => 6379,
-        // 密码
-        'password' => 'keli123456',
-        // 库索引
-        'database' => 13,
-    ],
-    // 缓存专用 Redis 库
-    'cacheRedis' => [
-        'hostname' => '192.168.0.8',
-        'port' => 6379,
-        'password' => 'keli123456',
-        'database' => 14,
-    ],
-    // 其他数据 Redis 库
-    'otherRedis' => [
-        'hostname' => '192.168.0.8',
-        'port' => 6379,
-        'password' => 'keli123456',
-        'database' => 15,
-    ],
-    // 远程静态上传服务器地址 @todo 明哥提供
-    'remoteUploadHost' => 'http://ng-upload.elken.com',
-    'idCardVerify' => [
-        'host' => 'http://121.40.238.29:20000',
-        'clientId' => '122371433052508160',
-    ],
-    // swoole异步服务器及端口
-    'swooleTimerConfig' => [
-        'host' => '127.0.0.1',
-        'port' => '9513',
-    ],
-    'swooleClientConfig' => [
-        'host' => '127.0.0.1',
-        'port' => '9513',
-    ],
-    // swoole奖金服务器及端口
-    'swooleBonusClientConfig' => [
-        'host' => '127.0.0.1',
-        'port' => '9513',
-    ],
-];

+ 8 - 0
common/config/params.php

@@ -321,6 +321,14 @@ return [
             'value' => 7,
             'label' => '订单退款'
         ],
+        '-1' => [
+            'value' => -1,
+            'label' => '支付失败'
+        ],
+        'failPaid' => [
+            'value' => -1,
+            'label' => '支付失败'
+        ],
     ],
     'exportModule' => [
         'shop' => ['label' => '商城管理', 'value'=>'shop'],

+ 5 - 0
common/helpers/bonus/BonusCalc.php

@@ -1230,9 +1230,12 @@ class BonusCalc extends BaseObject {
                 if ($touchBonusArr['touchBonus'] <= 0) continue;
 
                 $teamBonus = $touchBonusArr['touchBonus'];
+                $capBonusQy = $teamBonus; // 封顶前的奖金
                 //判断级别上限,个人奖金封顶限制
                 $teamBonus = $this->declarationLevelCap($teamBonus, $userId, $userBaseInfo['DEC_LV']);
                 if( $teamBonus <= 0 ) continue;
+                // 将封顶前的金额加入用户奖金缓存中,此金额不能发放(总奖金,总实际奖金) 
+                CalcCache::bonus($userId, $periodNum, 'CAPPED_BONUS_QY', $capBonusQy); 
 
                 $teamBonus = $this->bonusTotalLimit($teamBonus, $userId, $userBaseInfo['REC_NUM'], $userBaseInfo['ZC_AMOUNT']);
                 if( $teamBonus <= 0 ) continue;
@@ -1254,6 +1257,7 @@ class BonusCalc extends BaseObject {
                 $insertBonusData[] = [
                     'ID' => SnowFake::instance()->generateId(),
                     'USER_ID' => $userId,
+                    'ORI_CAPPED_BONUS_QY' => $capBonusQy,
                     'LAST_DEC_LV' => $userBaseInfo['DEC_LV'],
                     'LAST_EMP_LV' => $userBaseInfo['EMP_LV'],
                     'LAST_STAR_LV' => $starCrown['ID'],
@@ -3664,6 +3668,7 @@ class BonusCalc extends BaseObject {
             'ORI_BONUS_YC' => $bonus['ORI_BONUS_YC'] + $bonus['ORI_BONUS_YC_EXTRA'],
             'ORI_BONUS_VIP' => $bonus['ORI_BONUS_VIP'],
             'ORI_BONUS_STANDARD' => $standardBonus,
+            'ORI_CAPPED_BONUS_QY' => $bonus['ORI_CAPPED_BONUS_QY'], // 团队奖封顶前的奖金
 
             'BONUS_TOURISM' => $tourismBonus, // 旅游奖
             'BONUS_GARAGE' => $garageBonus, // 车房奖

+ 3 - 0
common/helpers/bonus/CalcCache.php

@@ -103,6 +103,7 @@ class CalcCache {
     const INCOME_BONUS_TRAVEL = 'BONUS_TRAVEL';
     const INCOME_BONUS_CAR = 'BONUS_CAR';
     const INCOME_BONUS_HOUSE = 'BONUS_HOUSE';
+    const CAPPED_BONUS_QY = 'CAPPED_BONUS_QY'; // 团队奖封顶前的金额
     const INCOME_BONUS_LIST = [
 //        self::INCOME_TG_BONUS,
 //        self::INCOME_XF_BONUS,
@@ -117,6 +118,7 @@ class CalcCache {
         self::INCOME_BONUS_TRAVEL,
         self::INCOME_BONUS_CAR,
         self::INCOME_BONUS_HOUSE,
+        self::CAPPED_BONUS_QY,
     ];
 
     const FROM_MEANS_BD = 'BD';
@@ -1501,6 +1503,7 @@ class CalcCache {
             'BONUS_TOTAL' => 0,
             'RECONSUME_POINTS' => 0,
             'MANAGE_TAX' => 0,
+            'ORI_CAPPED_BONUS_QY' => 0,// 团队奖,封顶前金额
 
             //没有用到的
             'BONUS_FX' => 0,

+ 8 - 4
common/helpers/bonus/PerfCalc.php

@@ -470,8 +470,9 @@ class PerfCalc {
                 $decInfo = CalcCache::getUserInfo($data['USER_ID'], $this->_periodNum);
                 $sn = PerfOrder::generateSN();
                 $insertPerfOrderData[] = [
+                    'FROM_TABLES' => 'dec_order',
                     'ID' => SnowFake::instance()->generateId(),
-                    'SN' => $sn,
+                    'SN' => $data['ORDER_SN'],
                     'DEC_SN' => $data['DEC_SN'],
                     'DEC_TYPE' => strtoupper($data['TYPE']),
                     'DEC_STATUS' => PerfOrder::STATUS_NORMAL,
@@ -572,8 +573,9 @@ class PerfCalc {
                 $decInfo = CalcCache::getUserInfo($toInfo['DEC_ID'], $this->_periodNum);
                 $sn = PerfOrder::generateSN();
                 $insertPerfOrderData[] = [
+                    'FROM_TABLES' => 'order_dec',
                     'ID' => SnowFake::instance()->generateId(),
-                    'SN' => $sn,
+                    'SN' => $data['SN'],
                     'DEC_SN' => $data['SN'],
                     'DEC_TYPE' => strtoupper($data['ORDER_TYPE']),
                     'DEC_STATUS' => PerfOrder::STATUS_NORMAL,
@@ -695,8 +697,9 @@ class PerfCalc {
                 $baseInfo = CalcCache::getUserInfo($data['USER_ID'], $this->_periodNum);
                 $sn = PerfOrder::generateSN();
                 $insertPerfOrderData[] = [
+                    'FROM_TABLES' => 'order',
                     'ID' => SnowFake::instance()->generateId(),
-                    'SN' => $sn,
+                    'SN' => $data['SN'],
                     'DEC_SN' => null,
                     'DEC_TYPE' => 'FX',
                     'DEC_STATUS' => PerfOrder::STATUS_NORMAL,
@@ -811,8 +814,9 @@ class PerfCalc {
                 $baseInfo = CalcCache::getUserInfo($data['USER_ID'], $this->_periodNum);
                 $sn = PerfOrder::generateSN();
                 $insertPerfOrderData[] = [
+                    'FROM_TABLES' => 'order_shop',
                     'ID' => SnowFake::instance()->generateId(),
-                    'SN' => $sn,
+                    'SN' => $data['SN'],
                     'DEC_SN' => null,
                     'DEC_TYPE' => 'FX',
                     'DEC_STATUS' => PerfOrder::STATUS_NORMAL,

+ 0 - 1
common/models/ApproachOrder.php

@@ -97,7 +97,6 @@ class ApproachOrder extends \common\components\ActiveRecord
             'PV' => '订货BV',
             'PAY_AMOUNT' => '支付价格',
             'PAY_PV' => '实付BV',
-            'TAX_RATE' => '税率',
             'PAY_AT' => '支付时间',
             'PAY_TYPE' => '支付方式',
             'FREIGHT' => '运费',

+ 0 - 0
common/models/CalcBonusTourism.php


+ 0 - 0
common/models/FlowTourismPoints.php


+ 0 - 0
common/models/StarCrownLevel.php


+ 0 - 0
common/models/StarCrownLevelForm.php


+ 20 - 17
common/models/forms/ApproachOrderForm.php

@@ -5,6 +5,7 @@ use common\helpers\Cache;
 use common\helpers\Date;
 use common\components\Model;
 use common\helpers\Form;
+use common\helpers\LoggerTool;
 use common\helpers\PayStack;
 use common\helpers\user\Balance;
 use common\helpers\user\Cash;
@@ -124,7 +125,7 @@ class ApproachOrderForm extends Model
             // 管理员修改订单状态
             'adminStatus' => ['sn', 'status'],
             // 校验订单支付
-            'verifyPayStack' => ['sn', 'note'],
+            'verifyPayStack' => ['sn', 'note', 'status'],
             // 会员下单
             'userOrder' => ['type','addressId', 'payType','goodsId','goodsNum', 'note', 'payPassword'],
         ];
@@ -147,7 +148,7 @@ class ApproachOrderForm extends Model
         }
 
         if ($this->scenario == 'verifyPayStack'){
-            if ($this->_model['STATUS'] != \Yii::$app->params['orderStatus']['notPaid']['value']) {
+            if ($this->_model->STATUS != \Yii::$app->params['orderStatus']['notPaid']['value']) {
                 $this->addError('sn', '订单支付状态错误');
                 return false;
             }
@@ -225,8 +226,8 @@ class ApproachOrderForm extends Model
      * @param $attribute
      */
     public function isStatus($attribute){
-        if(!in_array($this->type, \Yii::$app->params['orderStatus'])){
-            $this->addError($attribute, '类型错误');
+        if($this->type && !in_array($this->type, \Yii::$app->params['orderStatus'])){
+            $this->addError($attribute, '订单状态类型错误');
             return ;
         }
         if ($this->scenario == 'adminStatus'){
@@ -281,27 +282,29 @@ class ApproachOrderForm extends Model
         }
 
         // 调用PayStack支付校验
-        $payload = PayStack::transactionVerify($this->remark['reference']);
-        if ($payload['status'] !== true) {
-            throw new Exception(Form::formatErrorsForApi($payload['message']));
-        }
-        if ($payload['data']['amount'] != $this->_model->PAY_AMOUNT * 100) {
-            throw new Exception(Form::formatErrorsForApi('支付金额与订单金额不符'));
-        }
+        LoggerTool::info([$this->note['reference'], $this->note]);
+        $payload = PayStack::transactionVerify($this->note['reference']);
+        LoggerTool::info($payload);
+//        if ($payload['status'] !== true) {
+//            throw new Exception(Form::formatErrorsForApi($payload['message']));
+//        }
+//        if ($payload['data']['amount'] != $this->_model->PAY_AMOUNT * 100) {
+//            throw new Exception(Form::formatErrorsForApi('支付金额与订单金额不符'));
+//        }
 
         $db = \Yii::$app->db;
         $transaction = $db->beginTransaction();
         try {
             // 更新准订单状态为已支付
-            $this->_model->STATUS = \Yii::$app->params['orderStatus']['paid']['value'];
-            $this->_model->NOTE = json_encode($this->remark);
-            $this->_model->PAY_AT = Date::nowTime();
-            $this->_model->EMAIL = $this->email;
+            $this->_model->STATUS = $this->status;
+            $this->_model->NOTE = json_encode($this->note);
+            $this->_model->PAY_AT = Date::utcToTime($this->note['paid_at']);
+            $this->_model->EMAIL = $this->note['email'];
             if (!$this->_model->save()) {
                 throw new Exception(Form::formatErrorsForApi($this->_model->getErrors()));
             }
             // 更新订单商品的支付Email
-            ApproachOrderGoods::updateAll(['EMAIL' => $this->email], 'ORDER_SN = :ORDER_SN', [':ORDER_SN' => $this->sn]);
+            ApproachOrderGoods::updateAll(['EMAIL' => $this->note['email']], 'ORDER_SN = :ORDER_SN', [':ORDER_SN' => $this->sn]);
 
             // 同步准订单到正式订单
             Order::insertOne($this->_model->toArray());
@@ -315,7 +318,7 @@ class ApproachOrderForm extends Model
             $transaction->commit();
         } catch (Exception $e) {
             $transaction->rollBack();
-            $this->addError('edit', $e->getMessage());
+            $this->addError('edit', $e->getFile() . '  ' . $e->getMessage());
             return null;
         }
 

+ 34 - 30
common/models/forms/DeclarationUpgradeForm.php

@@ -78,21 +78,21 @@ class DeclarationUpgradeForm extends Model
     public function attributeLabels()
     {
         return [
-            'type' => '升级类型',
-            'decLv' => '升级级别',
-            'decWay' => '报单方式',
-            'packageId' => '升级套餐',
-            'goodsId' => '商品ID',
-            'goodsNum' => '商品数量',
-            'insertUserName' => '要升级的会员编号',
-            'consignee' => '收货人',
-            'acceptMobile' => '收货人手机',
-            'province' => '收货省',
-            'city' => '收货市',
-            'county' => '收货区县',
+            'type' => 'Upgrade type',//升级类型
+            'decLv' => 'Upgrade level',//升级级别
+            'decWay' => 'Declaration method',//报单方式
+            'packageId' => 'Upgrade package',//升级套餐
+            'goodsId' => 'Product ID',//商品ID
+            'goodsNum' => 'Product quantity',//商品数量
+            'insertUserName' => 'Member number to be upgraded',//要升级的会员编号
+            'consignee' => 'consignee',//收货人
+            'acceptMobile' => 'The phone number of Consignee',//收货人手机
+            'province' => 'Receiving Province',//收货省
+            'city' => 'Receiving City',//收货市
+            'county' => 'Receiving area / county',//收货区县
             'lgaName' => 'Local Government Area',
             'cityName' => 'City',
-            'address' => '收货详细地址',
+            'address' => 'Receiving detailed address',//收货详细地址
         ];
     }
 
@@ -115,13 +115,13 @@ class DeclarationUpgradeForm extends Model
             $decLevel = $decLevelConfig[$this->decLv];
             $toDecLevel = $this->decLv;
             if(!$this->decLv){
-                throw new Exception('请选择升级级别');
+                throw new Exception('Please select upgrade level');//请选择升级级别
             }
             $baseInfo = Info::baseInfoZhByUserName($this->insertUserName);
             $userId = $baseInfo['ID'];
             $userDecPvSum = User::sumDevPvByUserId($userId); // 用户所有报单PV总和
             if ($userDecPvSum != $this->nowPerf) {
-                throw new Exception('请联系客服人员核对升级会员业绩');
+                throw new Exception('Please contact the customer service personnel to check the performance of upgraded members');//请联系客服人员核对升级会员业绩
             }
             // 获取用户是否是观察期
             $observe = Config::getConfigByType('observe'); // 获取观察期配置信息
@@ -129,7 +129,7 @@ class DeclarationUpgradeForm extends Model
             $isObserve = User::checkIsObserve($baseInfo['CREATED_AT'], $observeLimit); // 判断用户是否再观察期中
             $diffPerf = $isObserve ? $this->nowPerf : 0; // 观察期内升级要加上用户累计的PV,全额则基础PV为0,全额购买
             if ($this->decWay != 2) {
-                throw new Exception('升级方式不正确,请联系客服人员');
+                throw new Exception('The upgrade method is incorrect. Please contact the customer service personnel');//升级方式不正确,请联系客服人员
             }
             if($this->decWay==1) {
                 // 先不加套餐升级方式
@@ -173,7 +173,7 @@ class DeclarationUpgradeForm extends Model
                 // 这里特殊是用户原报单PV之和+用户购买的商品总PV
                 $checkPv = $totalPv + $diffPerf;
                 if($checkPv < $decLevel['PERF']) {
-                    throw new Exception('总PV不能小于所选级别PV');
+                    throw new Exception('Total PV cannot be less than the selected level PV');//总PV不能小于所选级别PV
                 }
                 foreach ($decLevelConfig as $key=>$val){
                     if($checkPv>=$val['PERF']){
@@ -181,21 +181,21 @@ class DeclarationUpgradeForm extends Model
                     }
                 }
                 if($this->decLv!=$toDecLevel){
-                    throw new Exception('总PV不能超过已选级别下一个级别的PV值');
+                    throw new Exception('The total PV cannot exceed the PV value of the next level under the selected level');//总PV不能超过已选级别下一个级别的PV值
                 }
                 $this->_decAmount = $totalAmount;
                 $this->_decPv = $totalPv;
             }
             //看现金余额是否充足
             if (Cash::getAvailableBalance($loginUserId) < $this->_decAmount){
-                throw new Exception('报单人现金不足,无法完成报单');
+                throw new Exception('The applicant is short of cash and cannot complete the declaration');//报单人现金不足,无法完成报单
             }
             $baseInfo = Info::baseInfoZhByUserName($this->insertUserName);
             $this->_insertUserId = $baseInfo['ID']; // 被报单人,通过insername 查找用户id
             $insertConId = $baseInfo['CON_UID'];
             $insertRecId = $baseInfo['REC_UID'];
             if(!($decResult = $this->addDecOrder($insertConId,$insertRecId, $baseInfo['DEC_LV'],$isObserve,$this->remark))) {
-                throw new Exception("操作失败");
+                throw new Exception("operation failed");//操作失败
             }
         }
         return true;
@@ -209,7 +209,7 @@ class DeclarationUpgradeForm extends Model
     public function addDecOrder($insertConId,$insertRecId,$oriDecLv,$isObserve,$remark=''){
         $warehouse = Region::getWarehouseByCode($this->province);//仓库
         if(!$warehouse){
-            throw new Exception('地区暂时不支持配送,具体联系客服');
+            throw new Exception('Delivery is temporarily not supported in the region. Contact customer service for details');//地区暂时不支持配送,具体联系客服
         }
         $upgradeType = $isObserve ? 1 : 2; // 1补差  2全额
         $periodObj = Period::instance();
@@ -300,10 +300,12 @@ class DeclarationUpgradeForm extends Model
 			                    $data->update();
 			                }
 			            }else{
-			                throw new Exception("商品".$goods['GOODS_NAME']."库存不足");
+//			                throw new Exception("商品".$goods['GOODS_NAME']."库存不足");
+                            throw new Exception("product".$goods['GOODS_NAME']."Insufficient inventory");
 			            }
 			         }else{
-			             throw new Exception("商品".$goods['GOODS_NAME']."已下架");
+//			             throw new Exception("商品".$goods['GOODS_NAME']."已下架");
+                         throw new Exception("product".$goods['GOODS_NAME']."Removed from the shelf");
 			         }
 			     }
 			 }
@@ -337,7 +339,8 @@ class DeclarationUpgradeForm extends Model
                 throw new Exception(Form::formatErrorsForApi($addressModel->getErrors()));
             }
             // 扣报单人现金钱包
-            Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'为'.$this->insertUserName.'升级报单']);
+//            Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'为'.$this->insertUserName.'升级报单']);
+            Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'by'.$this->insertUserName.'Upgrade entry']);
             // 为被升级人进行升级操作
             $decLevelLog = new DecLevelLog();
             $decLog = [
@@ -351,7 +354,7 @@ class DeclarationUpgradeForm extends Model
             $modifyDecLv = $decLevelLog->frontendChange($decLog);
             if (empty($modifyDecLv)) {
                 $transaction->rollBack();
-                throw new Exception("为会员升级失败");
+                throw new Exception("Failed to upgrade for member");//为会员升级失败
             }
             $transaction->commit();
         } catch(Exception $e) {
@@ -375,7 +378,7 @@ class DeclarationUpgradeForm extends Model
         ->asArray()
         ->one();
         if (!$decUser) {
-            $this->addError($attribute, '报单中心不存在');
+            $this->addError($attribute, 'Entry center does not exist');//报单中心不存在
             return false;
         } else {
             // 判断报单中心是否在新加入会员的安置网上级中
@@ -384,7 +387,8 @@ class DeclarationUpgradeForm extends Model
             //in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
             $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
             if (!isset($flipParent[$this->decUserName])) {
-                $this->addError($attribute, '为' . $this->insertUserName . '升级报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
+//                $this->addError($attribute, '为' . $this->insertUserName . '升级报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
+                $this->addError($attribute, 'by' . $this->insertUserName . 'Upgrade declaration, declaration Center' . $this->decUserName . 'be not in' . $this->insertUserName . 'Online level of resettlement');
                 return ;
             }
             $this->_decId = $decUser['ID'];
@@ -395,11 +399,11 @@ class DeclarationUpgradeForm extends Model
     // 判断是否已选择商品或套餐
     public function hasProduct($attribute) {
         if ($this->decWay==1 && empty($this->packageId)) {
-            $this->addError($attribute, '购买套餐升级,请选择套餐');
+            $this->addError($attribute, 'Purchase package upgrade, please select package');//购买套餐升级,请选择套餐
             return false;
         }
         if ($this->decWay!=1 && empty($this->goodsId)) {
-            $this->addError($attribute, '购买商品升级,请选择商品');
+            $this->addError($attribute, 'Purchase product upgrade, please select product');//购买商品升级,请选择商品'
             return false;
         }
 
@@ -413,7 +417,7 @@ class DeclarationUpgradeForm extends Model
         $maxPerfInfo = DeclarationLevel::getMaxDecPref(); 
         $maxDecId = $maxPerfInfo['ID']; // 级别配置中最高级别ID
         if ($maxDecId == $userDecId) {
-            $this->addError($attribute, '已是最高级别,无需升级');
+            $this->addError($attribute, 'It is already the highest level and no upgrade is required');//已是最高级别,无需升级
             return false;
         }
 

+ 2 - 1
frontendApi/config/params.php

@@ -14,6 +14,7 @@ return [
         'v1/oauth/no-login-modify-password',
         'v1/site/doc',
         'v1/site/config',
-        'v1/shop/verify-approach-order'],
+        'v1/shop/verify-approach-order',
+        ],
     'noCheckPermissionActions' => [],
 ];

+ 42 - 21
frontendApi/modules/v1/controllers/ShopController.php

@@ -37,21 +37,6 @@ use Yii;
 class ShopController extends BaseController {
     public $modelClass = DecOrder::class;
 
-    protected $_method_not_check = [
-        'actionVerifyApproachOrder',
-        'verify-approach-order'
-    ];
-
-    public function beforeAction($action)
-    {
-        $currentAction = $action->id;
-        if (in_array($currentAction, $this->_method_not_check)) {
-            $action->controller->enableCsrfValidation = false;
-        }
-
-        return parent::beforeAction($action);
-    }
-
     /**
      * 商品列表
      * @return mixed
@@ -193,16 +178,52 @@ class ShopController extends BaseController {
      * @throws \yii\web\HttpException
      */
     public function actionVerifyApproachOrder() {
-        $request = \Yii::$app->request;
-        LoggerTool::info($request);
+        if (\Yii::$app->request->isPost) {
+            $request = \Yii::$app->request->post();
+            // TODO:支付webhook回调日志
+            LoggerTool::info($request);
+            $data = $request['data'];
+            $status = $request['data']['status'] ?? 'false';
+            // 订单状态
+            $orderStatus = ($status == 'success') ? \Yii::$app->params['orderStatus']['paid']['value'] : \Yii::$app->params['orderStatus']['failPaid']['value'];
 
-        http_response_code(200);
+            $customFields = $data['metadata']['custom_fields'][0] ?? [];
+            $oderSn = $customFields['value'] ?? '';
 
-        if (parent::edit(ApproachOrderForm::class, 'PayStack pay Success', 'verifyPayStack', ['verifyPayStack'])) {
-            return http_response_code(200);
+            $formModel = new ApproachOrderForm();
+            $formModel->scenario = 'verifyPayStack';
+            $load = [
+                'sn' => $oderSn,
+                'scenario' => 'verifyPayStack',
+                'status' => $orderStatus,
+                'note' => [
+                    'id' => $data['id'],
+                    'domain' => $data['domain'],
+                    'status' => $data['status'],
+                    'reference' => $data['reference'],
+                    'amount' => $data['amount'],
+                    'created_at' => $data['created_at'],
+                    'paid_at' => $data['paid_at'],
+                    'channel' => $data['channel'],
+                    'currency' => $data['currency'],
+                    'ip_address' => $data['ip_address'],
+                    'metadata' => $data['metadata'],
+                    'customer' => $data['customer'],
+                    'email' => $data['customer']['email'] ?? '',
+                ],
+            ];
+
+            if ($formModel->load($load, '') && $order = $formModel->verifyPayStack()) {
+                LoggerTool::error($order);
+//                return static::notice($order);
+                return http_response_code(200);
+            } else {
+                LoggerTool::error(Form::formatErrorsForApi($formModel->getErrors()));
+                return http_response_code(500);
+            }
         }
 
-        return http_response_code(500);
+        return http_response_code(200);
     }
 
     /**

+ 41 - 0
frontendEle/build/trial.js

@@ -0,0 +1,41 @@
+'use strict'
+require('./check-versions')()
+
+process.env.NODE_ENV = 'trial'
+
+const ora = require('ora')
+const rm = require('rimraf')
+const path = require('path')
+const chalk = require('chalk')
+const webpack = require('webpack')
+const config = require('../config')
+const webpackConfig = require('./webpack.trial.conf')
+
+const spinner = ora('building for trial...')
+spinner.start()
+
+rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
+  if (err) throw err
+  webpack(webpackConfig, (err, stats) => {
+    spinner.stop()
+    if (err) throw err
+    process.stdout.write(stats.toString({
+      colors: true,
+      modules: false,
+      children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
+      chunks: false,
+      chunkModules: false
+    }) + '\n\n')
+
+    if (stats.hasErrors()) {
+      console.log(chalk.red('  Build failed with errors.\n'))
+      process.exit(1)
+    }
+
+    console.log(chalk.cyan('  Build complete.\n'))
+    console.log(chalk.yellow(
+      '  Tip: built files are meant to be served over an HTTP server.\n' +
+      '  Opening index.html over file:// won\'t work.\n'
+    ))
+  })
+})

+ 150 - 0
frontendEle/build/webpack.trial.conf.js

@@ -0,0 +1,150 @@
+'use strict'
+const path = require('path')
+const utils = require('./utils')
+const webpack = require('webpack')
+const config = require('../config')
+const merge = require('webpack-merge')
+const baseWebpackConfig = require('./webpack.base.conf')
+const CopyWebpackPlugin = require('copy-webpack-plugin')
+const HtmlWebpackPlugin = require('html-webpack-plugin')
+const ExtractTextPlugin = require('extract-text-webpack-plugin')
+const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
+const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
+
+// const env = process.env.NODE_ENV === 'testing'
+//   ? require('../config/test.env')
+//   : require('../config/prod.env')
+const env = require('../config/trial.env')
+
+const webpackConfig = merge(baseWebpackConfig, {
+  module: {
+    rules: utils.styleLoaders({
+      sourceMap: config.trial.productionSourceMap,
+      extract: true,
+      usePostCSS: true
+    })
+  },
+  devtool: config.trial.productionSourceMap ? config.trial.devtool : false,
+  output: {
+    path: config.trial.assetsRoot,
+    filename: utils.assetsPath('js/[name].[chunkhash].js'),
+    chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
+  },
+  plugins: [
+    // http://vuejs.github.io/vue-loader/en/workflow/production.html
+    new webpack.DefinePlugin({
+      'process.env': env
+    }),
+    new UglifyJsPlugin({
+      uglifyOptions: {
+        compress: {
+          warnings: false
+        }
+      },
+      sourceMap: config.trial.productionSourceMap,
+      parallel: true
+    }),
+    // extract css into its own file
+    new ExtractTextPlugin({
+      filename: utils.assetsPath('css/[name].[contenthash].css'),
+      // Setting the following option to `false` will not extract CSS from codesplit chunks.
+      // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
+      // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
+      // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
+      allChunks: true,
+    }),
+    // Compress extracted CSS. We are using this plugin so that possible
+    // duplicated CSS from different components can be deduped.
+    new OptimizeCSSPlugin({
+      cssProcessorOptions: config.trial.productionSourceMap
+        ? { safe: true, map: { inline: false } }
+        : { safe: true }
+    }),
+    // generate dist index.html with correct asset hash for caching.
+    // you can customize output by editing /index.html
+    // see https://github.com/ampedandwired/html-webpack-plugin
+    new HtmlWebpackPlugin({
+      filename: process.env.NODE_ENV === 'testing'
+        ? 'index.html'
+        : config.trial.index,
+      template: 'index.html',
+      inject: true,
+      minify: {
+        removeComments: true,
+        collapseWhitespace: true,
+        removeAttributeQuotes: true
+        // more options:
+        // https://github.com/kangax/html-minifier#options-quick-reference
+      },
+      // necessary to consistently work with multiple chunks via CommonsChunkPlugin
+      chunksSortMode: 'dependency'
+    }),
+    // keep module.id stable when vendor modules does not change
+    new webpack.HashedModuleIdsPlugin(),
+    // enable scope hoisting
+    new webpack.optimize.ModuleConcatenationPlugin(),
+    // split vendor js into its own file
+    new webpack.optimize.CommonsChunkPlugin({
+      name: 'vendor',
+      minChunks (module) {
+        // any required modules inside node_modules are extracted to vendor
+        return (
+          module.resource &&
+          /\.js$/.test(module.resource) &&
+          module.resource.indexOf(
+            path.join(__dirname, '../node_modules')
+          ) === 0
+        )
+      }
+    }),
+    // extract webpack runtime and module manifest to its own file in order to
+    // prevent vendor hash from being updated whenever app bundle is updated
+    new webpack.optimize.CommonsChunkPlugin({
+      name: 'manifest',
+      minChunks: Infinity
+    }),
+    // This instance extracts shared chunks from code splitted chunks and bundles them
+    // in a separate chunk, similar to the vendor chunk
+    // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
+    new webpack.optimize.CommonsChunkPlugin({
+      name: 'app',
+      async: 'vendor-async',
+      children: true,
+      minChunks: 3
+    }),
+
+    // copy custom static assets
+    new CopyWebpackPlugin([
+      {
+        from: path.resolve(__dirname, '../static'),
+        to: config.trial.assetsSubDirectory,
+        ignore: ['.*']
+      }
+    ])
+  ]
+})
+
+if (config.trial.productionGzip) {
+  const CompressionWebpackPlugin = require('compression-webpack-plugin')
+
+  webpackConfig.plugins.push(
+    new CompressionWebpackPlugin({
+      asset: '[path].gz[query]',
+      algorithm: 'gzip',
+      test: new RegExp(
+        '\\.(' +
+        config.trial.productionGzipExtensions.join('|') +
+        ')$'
+      ),
+      threshold: 10240,
+      minRatio: 0.8
+    })
+  )
+}
+
+if (config.trial.bundleAnalyzerReport) {
+  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
+  webpackConfig.plugins.push(new BundleAnalyzerPlugin())
+}
+
+module.exports = webpackConfig

+ 4 - 0
frontendEle/config/trial.env.js

@@ -0,0 +1,4 @@
+'use strict'
+module.exports = {
+  NODE_ENV: '"trial"'
+}

+ 2 - 1
frontendEle/package.json

@@ -11,7 +11,8 @@
     "e2e": "node test/e2e/runner.js",
     "test": "npm run unit && npm run e2e",
     "lint": "eslint --ext .js,.vue src test/unit test/e2e/specs",
-    "build": "node build/build.js"
+    "build": "node build/build.js",
+    "trial": "node build/trial.js"
   },
   "dependencies": {
     "ajv": "^6.2.0",

+ 1 - 0
frontendEle/src/router/_import_trial.js

@@ -0,0 +1 @@
+module.exports = file => () => import('@/views/' + file + '.vue')

+ 45 - 0
frontendEle/src/utils/config.js

@@ -0,0 +1,45 @@
+let config
+if (process.env.NODE_ENV === 'development') {
+  config = require('./config_development')
+} else if(process.env.NODE_ENV === 'trial') {
+  config = require('./config_trial')
+} else {
+  config = require('./config_production')
+}
+const APP_NAME = config.APP_NAME
+const SERVER_API_DOMAIN = config.SERVER_API_DOMAIN
+const SERVER_API_HTTP_TYPE = config.SERVER_API_HTTP_TYPE
+const SERVER_API_PORT = config.SERVER_API_PORT
+const SERVER_API_VERSION = config.SERVER_API_VERSION
+const REQUEST_URL = config.REQUEST_URL
+const WEBSOCKET_HOST = config.WEBSOCKET_HOST
+const BONUS_WEBSOCKET_HOST = config.BONUS_WEBSOCKET_HOST
+const DEVICE_TYPE = config.DEVICE_TYPE
+const ACCESS_TOKEN_PREFIX = config.ACCESS_TOKEN_PREFIX
+const CDN_BASE_URL = config.CDN_BASE_URL
+const CDN_IMG_URL = config.CDN_IMG_URL
+const PRICE_IS_ROUND = config.PRICE_IS_ROUND
+const FRONTEND_SERVER = config.FRONTEND_SERVER
+const REGION_URL = config.REGION_URL
+const PAY_STACK_PUBLIC_KEY = config.PAY_STACK_PUBLIC_KEY
+const PAY_STACK_CURRENCY = config.PAY_STACK_CURRENCY
+
+export {
+  APP_NAME,
+  SERVER_API_DOMAIN,
+  SERVER_API_HTTP_TYPE,
+  SERVER_API_PORT,
+  SERVER_API_VERSION,
+  REQUEST_URL,
+  WEBSOCKET_HOST,
+  BONUS_WEBSOCKET_HOST,
+  DEVICE_TYPE,
+  ACCESS_TOKEN_PREFIX,
+  CDN_BASE_URL,
+  CDN_IMG_URL,
+  PRICE_IS_ROUND,
+  FRONTEND_SERVER,
+  REGION_URL,
+  PAY_STACK_PUBLIC_KEY,
+  PAY_STACK_CURRENCY
+}

+ 4 - 3
frontendEle/src/views/user/dec.vue

@@ -129,8 +129,8 @@
                 <el-form-item label="Placement tree"><!--安置区位-->
                     <el-radio-group v-model="form.location">
                         <el-radio-button :label="1">Left</el-radio-button><!--左区-->
-                        <el-radio-button :label="2">Middle</el-radio-button><!--中区-->
-                        <el-radio-button :label="3">Right</el-radio-button><!--右区-->
+                        <!-- <el-radio-button :label="2">Middle</el-radio-button> --><!--中区-->
+                        <el-radio-button :label="2">Right</el-radio-button><!--右区-->
                     </el-radio-group>
                 </el-form-item>
 
@@ -262,6 +262,7 @@
     import baseInfo from '@/utils/baseInfo'
     import store from '@/utils/vuexStore'
      import tool from '@/utils/tool'
+    import userInfo from '@/utils/userInfo'
 
     export default {
         name: 'user_dec',
@@ -292,7 +293,7 @@
                     realName:'',
                     decLv: '',
                     insertUserName:'',
-                    decUserName:'',
+                    decUserName: userInfo.userName(),
                     recUserName:'',
                     conUserName:'',
                     insertUserIdCard:'',