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

Merge branch 'master' into feature/calc-serve-1646

root 3 лет назад
Родитель
Сommit
c6f852e00a
49 измененных файлов с 1250 добавлено и 457 удалено
  1. 7 4
      backendApi/config/menu.php
  2. 3 0
      backendApi/config/urlManagerRules.php
  3. 49 3
      backendApi/modules/v1/controllers/ArticleController.php
  4. 1 1
      backendApi/modules/v1/controllers/BaseController.php
  5. 1 0
      backendApi/modules/v1/controllers/ShopController.php
  6. 2 2
      backendApi/modules/v1/models/lists/bonus/PeriodBonusList.php
  7. 3 0
      backendApi/modules/v1/models/lists/shop/OrderList.php
  8. 2 2
      backendEle/src/router/index.js
  9. 4 4
      backendEle/src/views/ad/edit.vue
  10. 3 3
      backendEle/src/views/ad/list.vue
  11. 1 1
      backendEle/src/views/article/detail.vue
  12. 5 0
      backendEle/src/views/article/edit.vue
  13. 89 0
      backendEle/src/views/article/index.vue
  14. 2 2
      backendEle/src/views/finance/recharge.vue
  15. 189 185
      backendEle/src/views/shop/goods-add.vue
  16. 4 5
      backendEle/src/views/shop/index.vue
  17. 121 121
      backendEle/src/views/user/move-add.vue
  18. 8 8
      backendEle/src/views/user/move.vue
  19. 29 23
      common/helpers/bonus/BonusCalc.php
  20. 119 0
      common/helpers/bonus/BonusSend.php
  21. 5 2
      common/helpers/bonus/CalcCache.php
  22. 113 1
      common/helpers/bonus/PerfCalc.php
  23. 8 6
      common/models/Article.php
  24. 25 0
      common/models/FlowRemainPv.php
  25. 17 0
      common/models/Period.php
  26. 22 0
      common/models/RemainPv.php
  27. 2 2
      common/models/UserMove.php
  28. 28 5
      common/models/forms/ArticleForm.php
  29. 1 1
      common/models/forms/NetMoveForm.php
  30. 145 50
      common/models/forms/OrderForm.php
  31. 7 3
      common/models/forms/ShopGoodsForm.php
  32. 2 2
      frontendApi/config/menu.php
  33. 5 0
      frontendApi/modules/v1/controllers/DashboardController.php
  34. 2 0
      frontendApi/modules/v1/controllers/ShopController.php
  35. 2 2
      frontendEle/src/router/index.js
  36. BIN
      frontendEle/src/static/img/simple-img.jpg
  37. 5 5
      frontendEle/src/views/article/list.vue
  38. 2 2
      frontendEle/src/views/config/receive-address-list.vue
  39. 4 1
      frontendEle/src/views/dashboard/index.vue
  40. 3 2
      frontendEle/src/views/finance/recharge.vue
  41. 1 1
      frontendEle/src/views/finance/transfer-list.vue
  42. 3 2
      frontendEle/src/views/shop/dec-order-list.vue
  43. 3 5
      frontendEle/src/views/shop/index.vue
  44. 26 0
      sql/upgrade/1350.sql
  45. 26 0
      sql/upgrade/1540.sql
  46. 1 0
      sql/upgrade/2022_08_05_1866.sql
  47. 133 0
      sql/upgrade/QTRCALC.sql
  48. 14 0
      sql/upgrade/QTRCLEAN.sql
  49. 3 1
      sql/upgrade/star_to_crown.sql

+ 7 - 4
backendApi/config/menu.php

@@ -109,8 +109,8 @@ return [
             //['name'=>'体系导出', 'class'=>'', 'icon'=>'', 'controller'=>'user', 'action'=>'system-export', 'routePath'=>'user/system-export', 'show'=>0,],
             //['name'=>'团队领导人列表', 'class'=>'', 'icon'=>'', 'controller'=>'user', 'action'=>'group', 'routePath'=>'user/group', 'show'=>1,],
             //['name'=>'团队领导人列表导出', 'class'=>'', 'icon'=>'', 'controller'=>'user', 'action'=>'group-export', 'routePath'=>'user/group-export', 'show'=>0,],
-            ['name'=>'Move network management', 'class'=>'', 'icon'=>'', 'controller'=>'user', 'action'=>'move', 'routePath'=>'user/move', 'show'=>1,],//移网管理
-            ['name'=>'申请移网', 'class'=>'', 'icon'=>'', 'controller'=>'user', 'action'=>'move-add', 'routePath'=>'user/move-add', 'show'=>0,],
+            ['name'=>'Move network management', 'class'=>'', 'icon'=>'', 'controller'=>'user', 'action'=>'move', 'routePath'=>'user/move', 'show'=>1,], // 移网管理
+            ['name'=>'Apply for moving network', 'class'=>'', 'icon'=>'', 'controller'=>'user', 'action'=>'move-add', 'routePath'=>'user/move-add', 'show'=>0,], // 申请移网
             ['name'=>'移网修改并审核', 'class'=>'', 'icon'=>'', 'controller'=>'user', 'action'=>'move-pass', 'routePath'=>'user/move-pass', 'show'=>0,],
             ['name'=>'移网审核', 'class'=>'', 'icon'=>'', 'controller'=>'user', 'action'=>'move-audit', 'routePath'=>'user/move-audit', 'show'=>0,],
             ['name'=>'移网导出', 'class'=>'', 'icon'=>'', 'controller'=>'user', 'action'=>'move-export', 'routePath'=>'user/move-export', 'show'=>0,],
@@ -147,7 +147,7 @@ return [
         'routePath'=>'atlas',
         'show'=>1,
         'child'=>[
-            ['name'=>'Sponor network', 'class'=>'', 'icon'=>'', 'controller'=>'atlas', 'action'=>'relation-opt', 'routePath'=>'atlas/relation-opt', 'show'=>1,],//开拓网络
+            ['name'=>'Sponsor network', 'class'=>'', 'icon'=>'', 'controller'=>'atlas', 'action'=>'relation-opt', 'routePath'=>'atlas/relation-opt', 'show'=>1,],//开拓网络
             ['name'=>'开拓网络图', 'class'=>'', 'icon'=>'', 'controller'=>'atlas', 'action'=>'relation', 'routePath'=>'atlas/relation', 'show'=>0,],
             ['name'=>'开拓网络列表', 'class'=>'', 'icon'=>'', 'controller'=>'atlas', 'action'=>'relation-list', 'routePath'=>'atlas/relation-list', 'show'=>0,],
             ['name'=>'开拓网络列表导出', 'class'=>'', 'icon'=>'', 'controller'=>'atlas', 'action'=>'relation-list-export', 'routePath'=>'atlas/relation-list-export', 'show'=>0,],
@@ -367,8 +367,11 @@ return [
             ['name'=>'Article Management', 'class'=>'', 'icon'=>'', 'controller'=>'article', 'action'=>'index', 'routePath'=>'article/index', 'show'=>1,],//文章列表
             ['name'=>'添加文章', 'class'=>'', 'icon'=>'', 'controller'=>'article', 'action'=>'add', 'routePath'=>'article/add', 'show'=>0,],
             ['name'=>'编辑文章', 'class'=>'', 'icon'=>'', 'controller'=>'article', 'action'=>'edit', 'routePath'=>'article/edit', 'show'=>0,],
+            ['name'=>'文章排序', 'class'=>'', 'icon'=>'', 'controller'=>'article', 'action'=>'sort', 'routePath'=>'article/sort', 'show'=>0,],
             ['name'=>'删除文章', 'class'=>'', 'icon'=>'', 'controller'=>'article', 'action'=>'article-delete', 'routePath'=>'article/article-delete', 'show'=>0,],
-
+            ['name'=>'文章详情', 'class'=>'', 'icon'=>'', 'controller'=>'article', 'action'=>'detail', 'routePath'=>'article/detail', 'show'=>0,],
+            ['name'=>'隐藏文章', 'class'=>'', 'icon'=>'', 'controller'=>'article', 'action'=>'article-hide', 'routePath'=>'article/article-hide', 'show'=>0,],
+            ['name'=>'显示文章', 'class'=>'', 'icon'=>'', 'controller'=>'article', 'action'=>'article-un-hide', 'routePath'=>'article/article-un-hide', 'show'=>0,],
         ]
     ],
 //    'message'=>[

+ 3 - 0
backendApi/config/urlManagerRules.php

@@ -499,11 +499,14 @@ return [
             'GET detail' => 'detail',
             'GET detail/<id>' => 'detail',
             'GET,POST article-delete' => 'article-delete',
+            'GET,POST article-hide' => 'article-hide',
+            'GET,POST article-un-hide' => 'article-un-hide',
             'GET category' => 'category',
             'POST category-add' => 'category-add',
             'GET,POST category-delete' => 'category-delete',
             'GET category-sort' => 'category-sort',
             'POST upload' => 'upload',
+            'GET sort' => 'sort',
         ],
     ],
     [

+ 49 - 3
backendApi/modules/v1/controllers/ArticleController.php

@@ -84,8 +84,8 @@ class ArticleController extends BaseController
      */
     public function actionIndex(){
         $data = Article::lists('', [], [
-            'select' => 'ID,TITLE,CID,STATUS,CREATED_AT',
-            'orderBy' => 'CREATED_AT',
+            'select' => 'ID,TITLE,CID,STATUS,SORT,CREATED_AT',
+            'orderBy' => 'SORT ASC,CREATED_AT DESC',
         ]);
         // 全部分类
         $data['allCategory'] = ArticleCategory::getAllCategory();
@@ -142,6 +142,34 @@ class ArticleController extends BaseController
         return $result;
     }
 
+    /**
+     * 隐藏
+     * @return mixed
+     * @throws \yii\db\Exception
+     * @throws \yii\web\HttpException
+     */
+    public function actionArticleHide(){
+        $adForm = new ArticleForm();
+        $result = static::hide(Article::class, 'hide', function ($selected) use ($adForm) {
+        }, function ($selected) use ($adForm) {
+        }, true);
+        return $result;
+    }
+
+    /**
+     * 取消隐藏
+     * @return mixed
+     * @throws \yii\db\Exception
+     * @throws \yii\web\HttpException
+     */
+    public function actionArticleUnHide(){
+        $adForm = new ArticleForm();
+        $result = static::hide(Article::class, 'un-hide', function ($selected) use ($adForm) {
+        }, function ($selected) use ($adForm) {
+        }, true);
+        return $result;
+    }
+
     /**
      * 获取文章详细
      * @return mixed
@@ -152,7 +180,7 @@ class ArticleController extends BaseController
         $id = \Yii::$app->request->get('id');
         $data = null;
         if($id){
-            $data = Article::findOneAsArray('ID=:ID AND STATUS=1', [':ID'=>$id], 'ID,TITLE,CID,CREATED_AT');
+            $data = Article::findOneAsArray('ID=:ID AND STATUS=1', [':ID'=>$id], 'ID,TITLE,CID,SORT,CREATED_AT');
         }
         if($data){
             // 暂时先从文件中取内容
@@ -191,4 +219,22 @@ class ArticleController extends BaseController
             return static::notice($token);
         }
     }
+
+    /**
+     * 排序
+     * @return mixed
+     * @throws \yii\web\HttpException
+     */
+    public function actionSort()
+    {
+        if (Yii::$app->request->get('id')) {
+            $formModel = new ArticleForm();
+            $formModel->scenario = 'sort';
+            if ($formModel->load(Yii::$app->request->get(), '') && $formModel->sortTo()) {
+                return static::notice('Success');
+            } else {
+                return static::notice('Fail', 400);
+            }
+        }
+    }
 }

+ 1 - 1
backendApi/modules/v1/controllers/BaseController.php

@@ -158,7 +158,7 @@ class BaseController extends \yii\rest\ActiveController {
             }
             if ($afterFun) $afterFun($selected);
             $transaction->commit();
-            return self::notice('hide successfully');//删除成功
+            return self::notice($statusTo.' successfully');//删除成功
         } catch (Exception $e) {
             $transaction->rollBack();
             return self::notice($e->getMessage(), 500);

+ 1 - 0
backendApi/modules/v1/controllers/ShopController.php

@@ -385,6 +385,7 @@ class ShopController extends BaseController {
             'MOBILE'=> 'O.MOBILE',
             'PERIOD_NUM'=> 'O.PERIOD_NUM',
             'CREATED_AT'=> 'O.CREATED_AT',
+            'ORDER_TYPE'=> 'O.ORDER_TYPE',
             'STATUS' => 'O.STATUS',
         ]);
         $condition = ' 1=1 ' . $filter['condition'];

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

@@ -498,11 +498,11 @@ class PeriodBonusList extends \common\libs\dataList\DataList implements DataList
 //                        'prop'=>'ORI_BONUS_BD',
 //                    ],
 //                ],
-                'REAL_BONUS_QUARTER' => [
+                'BONUS_QUARTER' => [
                     'header' => 'Quarterly Bonus',// 季度分红
                     'value' => function($row) {
                         return (new Price([
-                            'value' => $row['REAL_BONUS_QUARTER'],
+                            'value' => $row['BONUS_QUARTER'],
                         ]))->result();
                     },
                     'headerOther' => [

+ 3 - 0
backendApi/modules/v1/models/lists/shop/OrderList.php

@@ -197,6 +197,8 @@ class OrderList extends \common\libs\dataList\DataList implements DataListInterf
                     'headerOther' => ['width' => '120'],
                     'value' => function ($row) {
                         switch ($row['ORDER_TYPE']) {
+                            case 'FO':
+                                return 'remain BV order';
                             case 'ZC':
                                 return 'Welcome pack';
                             case 'FX':
@@ -364,6 +366,7 @@ class OrderList extends \common\libs\dataList\DataList implements DataListInterf
                 'SN'=> ['name'=> 'Order No'],//订单编号
                 'USER_NAME'=> ['name'=> 'Member code'],//会员编号
                 'MOBILE'=> ['name'=> 'Contact 1'],//联系方式1
+                'ORDER_TYPE'=> ['name'=> 'Order Type'],
                 'PERIOD_NUM'=> ['name'=> 'Number of periods'],//期数
                 'CREATED_AT'=> ['name'=> 'Creation time', 'other'=>'date'],//创建时间
                 'STATUS'=> ['name'=> 'Status', 'other'=> 'select', 'selectData'=> [

+ 2 - 2
backendEle/src/router/index.js

@@ -345,7 +345,7 @@ export const constantRouterMap = [
         component: _import('user/move-add'),
         name: 'user_move-add',
         meta: {
-          title: '申请移网',
+          title: 'Apply for moving network', // 申请移网
           highLight: '/user/move',
           breadcrumb: [
             {title: 'Dashboard', path: '/dashboard/index'},
@@ -504,7 +504,7 @@ export const constantRouterMap = [
         component: _import('atlas/relation-opt'),
         name: 'atlas_relation-opt',
         meta: {
-          title: 'Sponor network', // 开拓网络
+          title: 'Sponsor network', // 开拓网络
           breadcrumb: [
             {title: 'Dashboard', path: '/dashboard/index'}, // Dashboard
             {title: 'Network Chart', path: '/atlas/relation-opt'}, // 网络图谱

+ 4 - 4
backendEle/src/views/ad/edit.vue

@@ -54,8 +54,8 @@ export default {
         this.form.type = response.oneData.TYPE
 
         this.imageAd = response.oneData.IMAGE;
-        this.form.image = response.oneData.IMAGE.indexOf('http') > -1 ? response.oneData.IMAGE : SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + response.oneData.IMAGE;
-        this.defaultImageUrl = response.oneData.IMAGE.indexOf('http') > -1 ? response.oneData.IMAGE : SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + response.oneData.IMAGE;
+        this.form.image = SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + response.oneData.IMAGE;
+        this.defaultImageUrl = SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + response.oneData.IMAGE;
 
         this.form.content = response.oneData.CONTENT
         if (response.oneData.TYPE === '1') {
@@ -121,8 +121,8 @@ export default {
     },
     handleSuccess (imageUrl) {
       this.imageAd = imageUrl
-      this.form.image = imageUrl.indexOf('http') > -1 ? imageUrl : SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + imageUrl;
-      this.defaultImageUrl = imageUrl.indexOf('http') > -1 ? imageUrl : SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + imageUrl;
+      this.form.image = SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + imageUrl;
+      this.defaultImageUrl = SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + imageUrl;
     },
   },
   watch: {

+ 3 - 3
backendEle/src/views/ad/list.vue

@@ -81,7 +81,7 @@
                 <el-dropdown-item command="edit" @click.native="handleEdit(scope.row)" v-if="permission.hasPermission(`ad/edit`)">Edit</el-dropdown-item>
                 <el-dropdown-item command="delete" @click.native="handleDelete(scope.row)" v-if="permission.hasPermission(`ad/ad-delete`)">Delete</el-dropdown-item>
                 <el-dropdown-item command="hide" @click.native="handleHide(scope.row)" v-if="permission.hasPermission(`ad/ad-hide`)">Hide</el-dropdown-item>
-                <el-dropdown-item command="un-hide" @click.native="handleUnHide(scope.row)" v-if="permission.hasPermission(`ad/ad-un-hide`)">UnHide</el-dropdown-item>
+                <el-dropdown-item command="un-hide" @click.native="handleUnHide(scope.row)" v-if="permission.hasPermission(`ad/ad-un-hide`)">Unhide</el-dropdown-item>
               </el-dropdown-menu>
             </el-dropdown>
           </template>
@@ -95,7 +95,7 @@
           <el-dropdown-menu slot="dropdown">
             <el-dropdown-item command="delete" @click.native="handleMuliDel()">Delete</el-dropdown-item>
             <el-dropdown-item command="hide" @click.native="handleMultiHide()">Hide</el-dropdown-item>
-            <el-dropdown-item command="un-hide" @click.native="handleMultiUnHide()">UnHide</el-dropdown-item>
+            <el-dropdown-item command="un-hide" @click.native="handleMultiUnHide()">Unhide</el-dropdown-item>
           </el-dropdown-menu>
         </el-dropdown>
         <el-button type="primary" size="small" @click="handleAdd" icon="el-icon-plus" v-if="permission.hasPermission(`ad/add`)">Add Ad</el-button>
@@ -272,7 +272,7 @@ export default {
       })
     },
     getImage(imageUrl) {
-      return imageUrl.indexOf('http') > -1 ? imageUrl : SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + imageUrl;
+      return SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + imageUrl;
     },
     getContent(aid) {
       let titles = this.allArticle.filter(article => article.ID === aid).map(article => article.TITLE);

+ 1 - 1
backendEle/src/views/article/detail.vue

@@ -48,7 +48,7 @@ export default {
       })
     },
     getLink(fileUrl) {
-      return fileUrl.indexOf('http') > -1 ? fileUrl : SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + fileUrl;
+      return SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + fileUrl;
     },
   }
 }

+ 5 - 0
backendEle/src/views/article/edit.vue

@@ -10,6 +10,9 @@
             <el-option v-for="item in allCategory" :label="item.CATE_NAME" :value="item.ID" :key="item.ID"></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="Order" style="width: 500px;"><!--排序值-->
+            <el-input v-model="form.sort"></el-input>
+        </el-form-item>
         <el-form-item label="Content"><!--内容-->
           <editor id="contentEditor" :cloud-channel="editorRootUrl" ref="contentEditor" v-model="form.content"
                   :init="editorOptions"></editor>
@@ -41,6 +44,7 @@ export default {
         this.form.title = response.oneData.TITLE
         this.form.cid = response.oneData.CID
         this.form.content = response.oneData.CONTENT
+        this.form.sort = response.oneData.SORT
         this.allCategory = response.allCategory
         this.loading = false
         this.isEdit = true
@@ -58,6 +62,7 @@ export default {
         title: '',
         cid: null,
         content: '',
+        sort: 1,
       },
       allCategory: null,
       loading: false,

+ 89 - 0
backendEle/src/views/article/index.vue

@@ -22,11 +22,23 @@
             {{allData.allCategory[scope.row.CID].CATE_NAME}}
           </template>
         </el-table-column>
+        <el-table-column label="Sort" width="100"> <!-- 排序 -->
+          <template slot-scope="scope">
+            <el-input v-model="scope.row.SORT" min="0" max="99" @change="handleChangeSort(scope.row, scope.row.SORT)"></el-input>
+          </template>
+        </el-table-column>
         <el-table-column label="Creation time"><!--创建时间-->
           <template slot-scope="scope">
             {{tool.formatDate(scope.row.CREATED_AT)}}
           </template>
         </el-table-column>
+        <el-table-column label="Status"> <!-- 状态 -->
+          <template slot-scope="scope">
+            <div v-if="scope.row.STATUS === '1'">Show</div>
+            <div v-else>Hide</div>
+          </template>
+        </el-table-column>
+
         <el-table-column fixed="right" label="Action" width="180"><!--操作-->
           <template slot-scope="scope">
             <el-dropdown size="small" trigger="click">
@@ -36,6 +48,8 @@
               <el-dropdown-menu slot="dropdown">
                 <el-dropdown-item command="edit" @click.native="handleEdit(scope.row)">Edit</el-dropdown-item>
                 <el-dropdown-item command="delete" @click.native="handleDelete(scope.row)">Delete</el-dropdown-item>
+                <el-dropdown-item command="hide" @click.native="handleHide(scope.row)">Hide</el-dropdown-item>
+                <el-dropdown-item command="un-hide" @click.native="handleUnHide(scope.row)">Unhide</el-dropdown-item>
               </el-dropdown-menu>
             </el-dropdown>
           </template>
@@ -48,6 +62,8 @@
           </el-button>
           <el-dropdown-menu slot="dropdown">
             <el-dropdown-item command="delete" @click.native="handleMuliDel()">Delete</el-dropdown-item>
+            <el-dropdown-item command="hide" @click.native="handleMultiHide()">Hide</el-dropdown-item>
+            <el-dropdown-item command="un-hide" @click.native="handleMultiUnHide()">Unhide</el-dropdown-item>
           </el-dropdown-menu>
         </el-dropdown>
         <el-button type="primary" size="small" @click="handleAdd">New article</el-button><!--添加文章-->
@@ -108,9 +124,26 @@ export default {
     handleDelete (row) {
       this.delData(row.ID)
     },
+    handleHide (row) {
+      this.hideData(row.ID)
+    },
+    handleUnHide(row) {
+      this.unHideData(row.ID)
+    },
     handleMuliDel () {
       this.delData()
     },
+    handleMultiHide () {
+      this.hideData()
+    },
+    handleMultiUnHide () {
+      this.unHideData()
+    },
+    handleChangeSort (row, sort) {
+      network.getData('/article/sort', {id: row.ID, sort: sort}).then(_ => {
+        this.getData(this.currentPage, this.pageSize)
+      })
+    },
     getData (page, pageSize) {
       let obj = this
       network.getPageData(this, 'article/index', page, pageSize, this.filterData, function (response) {
@@ -144,6 +177,62 @@ export default {
         obj.getData(obj.currentPage, obj.pageSize)
       }).catch(response => {
 
+      })
+    },
+    hideData (id = null) {
+      let obj = this
+      obj.$confirm('Are you sure to hide the selected data?', 'Notice', { // 确定删除选定的数据?
+        confirmButtonText: 'confirm', // 确定
+        cancelButtonText: 'cancel', // 取消
+        type: 'warning'
+      }).then(() => {
+        let selectedIds = []
+        if (id === null) {
+          for (let val of obj.multipleSelection) {
+            selectedIds.push(val.ID)
+          }
+        } else {
+          selectedIds.push(id)
+        }
+        return network.postData(`article/article-hide`, {
+          selected: selectedIds
+        })
+      }).then(response => {
+        this.$message({
+          message: response,
+          type: 'success'
+        })
+        obj.getData(obj.currentPage, obj.pageSize)
+      }).catch(response => {
+
+      })
+    },
+    unHideData (id = null) {
+      let obj = this
+      obj.$confirm('Are you sure to un-hide the selected data?', 'Notice', { // 确定删除选定的数据?
+        confirmButtonText: 'confirm', // 确定
+        cancelButtonText: 'cancel', // 取消
+        type: 'warning'
+      }).then(() => {
+        let selectedIds = []
+        if (id === null) {
+          for (let val of obj.multipleSelection) {
+            selectedIds.push(val.ID)
+          }
+        } else {
+          selectedIds.push(id)
+        }
+        return network.postData(`article/article-un-hide`, {
+          selected: selectedIds
+        })
+      }).then(response => {
+        this.$message({
+          message: response,
+          type: 'success'
+        })
+        obj.getData(obj.currentPage, obj.pageSize)
+      }).catch(response => {
+
       })
     },
   }

+ 2 - 2
backendEle/src/views/finance/recharge.vue

@@ -57,7 +57,7 @@
     import permission from '@/utils/permission'
     import Pagination from '@/components/Pagination'
     import filterHelper from '@/utils/filterHelper'
-    import {FRONTEND_SERVER} from '@/utils/config'
+    import {FRONTEND_SERVER,SERVER_API_HTTP_TYPE,SERVER_API_DOMAIN} from '@/utils/config'
     import store from './../../utils/vuexStore'
     export default {
         name: 'recharge',
@@ -152,7 +152,7 @@
                     this.dialogInvoiceLoading = false
                     let invoiceUrl = response.list;
                     console.log(row)
-                    this.urlimg=row.BANK_PROVE
+                    this.urlimg= SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + row.BANK_PROVE;
                     console.log(this.urlimg)
 
                 })

+ 189 - 185
backendEle/src/views/shop/goods-add.vue

@@ -21,6 +21,9 @@
                 <!-- <el-form-item label="复消购买方式">
                     <el-checkbox  v-for="(value,key) in sellType" v-model="form.sellType[key-1]" :key="key" >{{value.name}}</el-checkbox>
                 </el-form-item> -->
+                <el-form-item label="BV split">
+                    <el-checkbox v-model="form.pvSplit"></el-checkbox>
+                </el-form-item>
                 <el-form-item label="Product Category"><!-- 商品分类 -->
                     <el-select v-model="form.categoryType" placeholder="">
                         <el-option v-for="item in categoryType" :key="item.id" :label="item.name" :value="item.id"></el-option>
@@ -83,196 +86,197 @@
 </template>
 
 <script>
-    import store from '@/utils/vuexStore'
-    import network from '@/utils/network'
-    import tool from '@/utils/tool'
-    import baseInfo from '../../utils/baseInfo'
-    import LeoUploader from '@/components/Uploader';
-    export default {
-        name: "goods-add",
-        components:{LeoUploader},
-        mounted () {
-            this.getData();
-            this.getFileToken();
-        },
-        data(){
-            return{
-                dialogImageUrl: '',
-                dialogVisible: false,
-                disabled: false,
-                loading: false,
-                file:null,
-                uploadToken:'',
-                form:{
-                    goodsName:'',
-                    type:'',
-                    giftType:[false,false,false,false],
-                    sellType:[false,false],
-                    goodsNo:'',
-                    unit:'',
-                    marketPrice:'',
-                    sellPrice:'',
-                    pricePv:'',
-                    point:'',
-                    storeNums:'',
-                    content:'',
-                    sort:'',
-                    discount:'',
-                    cover:'',
-                    textarea:'',
-                    sellDiscount:'',
-                    categoryType: '',
-                    sellPriceStandard: '',
-                    taxRate: 0,
-                },
-                submitButtonStat: false,
-                goodsType:[],
-                GiftTypeArr:[],
-                categoryType: [],
-                sellType:null,
-                width:'100px',
-                height:'100px',
-                pvDisabled: true,
-                exchangeRate: baseInfo.exchangeRate(),
-            }
-        },
-        watch:{
-            dialogVisible(newVal,oldVal){
-                console.log(newVal,oldVal)
-            },
-            // 监听商品分类,控制PV是否展示
-            'form.categoryType': {
-                deep: true,
-                handler(modern, origin) {
-                    this.pvDisabled = (parseInt(modern) === 1)
-                }
-            },
-            // 监听商品标准价格,自动计算销售价格
-            // 'form.sellPriceStandard': {
-            //     deep: true,
-            //     handler(modern, origin) {
-            //         this.form.sellPrice = modern * this.exchangeRate
-            //     }
-            // },
-        },
-        methods: {
-            handleRemove(file) {
-                console.log(file);
-            },
-            upLoadSuccess(file){
-                this.form.cover=file;
-            },
-            handlePictureCardPreview(file) {
-                this.dialogImageUrl = file.url;
-                this.dialogVisible = true;
-                this.file=file;
-                // console.log(file);
+import store from '@/utils/vuexStore'
+import network from '@/utils/network'
+import tool from '@/utils/tool'
+import baseInfo from '../../utils/baseInfo'
+import LeoUploader from '@/components/Uploader';
+export default {
+  name: 'goods-add',
+  components: {LeoUploader},
+  mounted () {
+    this.getData();
+    this.getFileToken();
+  },
+  data () {
+    return {
+      dialogImageUrl: '',
+      dialogVisible: false,
+      disabled: false,
+      loading: false,
+      file: null,
+      uploadToken: '',
+      form: {
+        goodsName: '',
+        type: '',
+        giftType: [false,false,false,false],
+        sellType: [false,false],
+        goodsNo: '',
+        unit: '',
+        marketPrice: '',
+        sellPrice: '',
+        pvSplit: '',
+        pricePv: '',
+        point: '',
+        storeNums: '',
+        content: '',
+        sort: '',
+        discount: '',
+        cover: '',
+        textarea: '',
+        sellDiscount: '',
+        categoryType: '',
+        sellPriceStandard: '',
+        taxRate: 0,
+      },
+      submitButtonStat: false,
+      goodsType: [],
+      GiftTypeArr: [],
+      categoryType: [],
+      sellType: null,
+      width: '100px',
+      height: '100px',
+      pvDisabled: true,
+      exchangeRate: baseInfo.exchangeRate(),
+    }
+  },
+  watch: {
+    dialogVisible (newVal,oldVal) {
+      console.log(newVal,oldVal)
+    },
+    // 监听商品分类,控制PV是否展示
+    'form.categoryType': {
+      deep: true,
+      handler (modern, origin) {
+        this.pvDisabled = (parseInt(modern) === 1)
+      }
+    },
+    // 监听商品标准价格,自动计算销售价格
+    // 'form.sellPriceStandard': {
+    //     deep: true,
+    //     handler(modern, origin) {
+    //         this.form.sellPrice = modern * this.exchangeRate
+    //     }
+    // },
+  },
+  methods: {
+    handleRemove (file) {
+      console.log(file);
+    },
+    upLoadSuccess (file) {
+      this.form.cover = file;
+    },
+    handlePictureCardPreview (file) {
+      this.dialogImageUrl = file.url;
+      this.dialogVisible = true;
+      this.file = file;
+      // console.log(file);
 
-            },
-            handleDownload(file) {
-                console.log(file);
-            },
-            getFile(){
-                let data={
-                    uploadToken:this.uploadToken,
-                    file:this.file
-                }
-                if(this.uploadToken){
-                    network.postData('shop/upload',data)
-                    .then(response=>{
-                        console.log(response);
-                    })
-                }
-            },
-            getFileToken(){
-                network.getData('shop/upload').then(response=>{
-                   this.uploadToken=response;
-                })
-            },
-            getData (page, pageSize) {
-                let filterData = this.filterModel
-                let vueObj = this
-                network.getPageData(this, 'shop/goods-add', page, pageSize, this.filterModel, response=>{
-                    this.categoryType = response.categoryType
-                    this.goodsType=response.goodsType
-                    this.GiftTypeArr=response.giftType
-                    this.sellType=response.sellType
-                    // this.form.sellType=this.form.sellType.map((item,index)=>{
-                    //   return response.sellType.some(val=>(index+1).toString()==val)
-                    // })
-                })
-            },
-            addSubmit() {
-                this.submitButtonStat = true
-                let path = 'shop/goods-add';
+    },
+    handleDownload (file) {
+      console.log(file);
+    },
+    getFile () {
+      let data = {
+        uploadToken: this.uploadToken,
+        file: this.file
+      }
+      if (this.uploadToken) {
+        network.postData('shop/upload', data)
+          .then(response => {
+            console.log(response);
+          })
+      }
+    },
+    getFileToken () {
+      network.getData('shop/upload').then(response => {
+        this.uploadToken = response;
+      })
+    },
+    getData (page, pageSize) {
+      let filterData = this.filterModel
+      let vueObj = this
+      network.getPageData(this, 'shop/goods-add', page, pageSize, this.filterModel, response => {
+        this.categoryType = response.categoryType
+        this.goodsType = response.goodsType
+        this.GiftTypeArr = response.giftType
+        this.sellType = response.sellType
+        // this.form.sellType=this.form.sellType.map((item,index)=>{
+        //   return response.sellType.some(val=>(index+1).toString()==val)
+        // })
+      })
+    },
+    addSubmit () {
+      this.submitButtonStat = true
+      let path = 'shop/goods-add';
 
-                // let sellType =[]
-                // this.form.sellType.map((item,index)=>{
-                //   if(item){
-                //     sellType.push((index+1).toString())
-                //   }
-                // });
+      // let sellType =[]
+      // this.form.sellType.map((item,index)=>{
+      //   if(item){
+      //     sellType.push((index+1).toString())
+      //   }
+      // });
 
-                let sen_gift=[];
-                this.form.giftType.map((item,index)=>{
-                    if(item){
-                        sen_gift.push((index+1).toString())
-                    }
-                })
+      let sen_gift = [];
+      this.form.giftType.map((item,index) => {
+        if (item) {
+          sen_gift.push((index+1).toString())
+        }
+      })
 
-                let postData = {
-                    goodsName: this.form.goodsName,
-                    sellDiscount: this.form.sellDiscount,
-                    discount: this.form.type.discount,
-                    type: this.form.type,
-                    giftType: sen_gift,
-                    // sellType: sellType,
-                    sellType: this.form.sellType,
-                    categoryType: this.form.categoryType,
-                    goodsNo: this.form.goodsNo,
-                    unit: this.form.unit,
-                    marketPrice: this.form.marketPrice,
-                    sellPrice: this.form.sellPrice,
-                    sellPriceStandard: this.form.sellPriceStandard,
-                    pricePv: this.form.pricePv,
-                    // point: this.form.point,
-                    storeNums: this.form.storeNums,
-                    content: this.form.content,
-                    sort: this.form.sort,
-                    cover: this.form.cover,
-                    taxRate: this.form.taxRate,
-                }
+      let postData = {
+        goodsName: this.form.goodsName,
+        sellDiscount: this.form.sellDiscount,
+        discount: this.form.type.discount,
+        type: this.form.type,
+        giftType: sen_gift,
+        // sellType: sellType,
+        sellType: this.form.sellType,
+        pvSplit: this.form.pvSplit,
+        categoryType: this.form.categoryType,
+        goodsNo: this.form.goodsNo,
+        unit: this.form.unit,
+        marketPrice: this.form.marketPrice,
+        sellPrice: this.form.sellPrice,
+        sellPriceStandard: this.form.sellPriceStandard,
+        pricePv: this.form.pricePv,
+        // point: this.form.point,
+        storeNums: this.form.storeNums,
+        content: this.form.content,
+        sort: this.form.sort,
+        cover: this.form.cover,
+        taxRate: this.form.taxRate,
+      }
 
-                return network.postData(path, postData).then(response => {
-                    this.$message({
-                        message: response,
-                        type: 'success'
-                    })
-                    this.submitButtonStat = false
-                    this.$router.go(-1)
-                }).catch(() => {
-                    this.submitButtonStat = false
-                })
-            },
-           /*
-            handleEdit() {
-                this.dialogEditFormVisible = false
-                this.$message({
-                    message: '正在修改数据',
-                    type: 'info'
-                })
-                let path = 'finance/deal-type-edit'
-                network.postData(path, this.form).then(response => {
-                    this.$message({
-                        message: response,
-                        type: 'success'
-                    })
-                    this.getData(this.currentPage, this.pageSize)
-                }).catch(response => {
-                })
-            },*/
-        }
-    }
+      return network.postData(path, postData).then(response => {
+        this.$message({
+          message: response,
+          type: 'success'
+        })
+        this.submitButtonStat = false
+        this.$router.go(-1)
+      }).catch(() => {
+        this.submitButtonStat = false
+      })
+    },
+    // handleEdit() {
+    //   this.dialogEditFormVisible = false
+    //   this.$message({
+    //     message: '正在修改数据',
+    //     type: 'info'
+    //   })
+    //   let path = 'finance/deal-type-edit'
+    //   network.postData(path, this.form).then(response => {
+    //     this.$message({
+    //       message: response,
+    //       type: 'success'
+    //     })
+    //     this.getData(this.currentPage, this.pageSize)
+    //   }).catch(response => {
+    //   })
+    // },
+  }
+}
 </script>
 
 <style scoped>

+ 4 - 5
backendEle/src/views/shop/index.vue

@@ -85,6 +85,9 @@
                     <!-- <el-form-item label="复消购买方式">
                          <el-checkbox  v-for="(value,index) in sell_type" v-model="value.checked" :key="index" >{{value.name}}</el-checkbox>
                     </el-form-item> -->
+                    <el-form-item label="BV split">
+                      <el-checkbox v-model="form.pvSplit" :checked="form.pvSplit">Yes</el-checkbox>
+                    </el-form-item>
                     <el-form-item label="Product Category"> <!-- 商品分类 -->
                         <el-select v-model="form.categoryType">
                             <el-option v-for="item in categoryType" :key="item.id" :label="item.name" :value="item.id" ></el-option>
@@ -318,11 +321,7 @@
                     //   })
 
                     vueObj.form.coverOrigin = response.goodsInfo.COVER
-                    if (response.goodsInfo.COVER.indexOf('/') === -1) {
-                        vueObj.form.cover = SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + response.goodsInfo.COVER
-                    } else {
-                        vueObj.form.cover = response.goodsInfo.COVER
-                    }
+                    vueObj.form.cover = SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + response.goodsInfo.COVER
 
                     this.$forceUpdate()
                 })

+ 121 - 121
backendEle/src/views/user/move-add.vue

@@ -3,16 +3,16 @@
     <div class="white-box">
       <el-form ref="form" :model="form" label-width="250px" class="form-page">
 
-        <el-form-item label="移网类型">
-          <el-select v-model="form.type" placeholder="请选择移网类型" @change="chkAlert">
+        <el-form-item label="Moving network type"> <!-- 移网类型 -->
+          <el-select v-model="form.type" placeholder="Please select moving network type" @change="chkAlert"> <!-- 请选择移网类型 -->
             <el-option v-for="(item,key) in netType" :label="item.name" :value="item.id" :key="key"></el-option>
           </el-select>
         </el-form-item>
         <div v-if="form.type==='network'">
-          <el-form-item label="移动会员编号">
+          <el-form-item label="Move Member Code"> <!-- 移动会员编号 -->
             <el-input v-model="form.moveUserName" @blur="handleChkUser"></el-input>
           </el-form-item>
-          <el-form-item label="移动会员姓名" v-if="moveUser">
+          <el-form-item label="Move Member Name" v-if="moveUser"> <!-- 移动会员姓名 -->
             <el-input v-model="moveUser.REAL_NAME" :disabled="true"></el-input>
           </el-form-item>
 <!--          <el-form-item label="原上级编号" v-if="moveUser">-->
@@ -21,20 +21,20 @@
 <!--          <el-form-item label="原上级姓名" v-if="moveUser">-->
 <!--            <el-input v-model="moveUser.CON_REAL_NAME" :disabled="true"></el-input>-->
 <!--          </el-form-item>-->
-          <el-form-item label="移动到节点会员编号">
+          <el-form-item label="Move to placement member code"> <!-- 移动到节点会员编号 -->
             <el-input v-model="form.toConUserName"></el-input>
             <el-tag v-if="showToName==''?false:true">{{showToName}}</el-tag>
             <el-alert :title="toAlertTile" :type="toAlertType" :closable="false" v-show="toAlertShow"></el-alert>
           </el-form-item>
-          <el-form-item label="移动到节点会员姓名">
+          <el-form-item label="Move to placement member name"> <!-- 移动到节点会员编号 -->
             <el-input v-model="form.toConRealName"></el-input>
           </el-form-item>
         </div>
         <div v-if="form.type==='relation'">
-          <el-form-item label="移动会员编号">
+          <el-form-item label="Move Member Code"> <!-- 移动会员编号 -->
             <el-input v-model="form.moveUserName" @blur="handleChkUser"></el-input>
           </el-form-item>
-          <el-form-item label="移动会员姓名" v-if="moveUser">
+          <el-form-item label="Move Member Name" v-if="moveUser"> <!-- 移动会员姓名 -->
             <el-input v-model="moveUser.REAL_NAME" :disabled="true"></el-input>
           </el-form-item>
 <!--          <el-form-item label="原开拓人编号" v-if="moveUser">-->
@@ -43,25 +43,25 @@
 <!--          <el-form-item label="原开拓人姓名" v-if="moveUser">-->
 <!--            <el-input v-model="moveUser.REC_REAL_NAME" :disabled="true"></el-input>-->
 <!--          </el-form-item>-->
-          <el-form-item label="移动到开拓会员编号">
+          <el-form-item label="Move to sponsor member code"> <!-- 移动到开拓会员编号 -->
             <el-input v-model="form.toConUserName"></el-input>
             <el-tag v-if="showToName==''?false:true">{{showToName}}</el-tag>
             <el-alert :title="toAlertTile" :type="toAlertType" :closable="false" v-show="toAlertShow"></el-alert>
           </el-form-item>
-          <el-form-item label="移动到开拓会员姓名">
+          <el-form-item label="Move to sponsor member name"> <!-- 移动到开拓会员编号 -->
             <el-input v-model="form.toConRealName"></el-input>
           </el-form-item>
         </div>
 
-        <el-form-item v-if="form.type==='network'" label="移动到区位">
-          <el-select v-model="form.location" placeholder="移动到区位">
-            <el-option label="一市场" :value="1" key="location_1"></el-option>
-            <el-option label="二市场" :value="2" key="location_2"></el-option>
-            <el-option label="三市场" :value="3" key="location_3"></el-option>
+        <el-form-item v-if="form.type==='network'" label="Move to location"> <!-- 移动到区位 -->
+          <el-select v-model="form.location" placeholder="Move to location"> <!-- 移动到区位 -->
+            <el-option label="I. Market" value="1" key="location_1"></el-option><!-- 一市场 -->
+            <el-option label="II. Market" value="2" key="location_2"></el-option><!-- 二市场 -->
+            <el-option label="III. Market" value="3" key="location_3"></el-option><!-- 三市场 -->
           </el-select>
         </el-form-item>
 
-        <el-form-item label="备注" v-if="form.type">
+        <el-form-item label="Note" v-if="form.type"> <!-- 备注 -->
           <el-input v-model="form.remark"></el-input>
         </el-form-item>
 
@@ -74,121 +74,121 @@
 </template>
 
 <script>
-  import Vue from 'vue'
-  import store from '@/utils/vuexStore'
-  import network from '@/utils/network'
-  import tool from '@/utils/tool'
+import Vue from 'vue'
+import store from '@/utils/vuexStore'
+import network from '@/utils/network'
+import tool from '@/utils/tool'
 
-  export default {
-    name: 'user_move-add',
-    created() {
+export default {
+  name: 'user_move-add',
+  created () {
 
+  },
+  mounted () {
+    network.getData('user/move-net-type').then(response => {
+      this.netType = response.netType
+      this.loading = false
+    })
+  },
+  data () {
+    return {
+      form: {
+        moveUserName: null,
+        toConUserName: null,
+        toConRealName: null,
+        type: null,
+        location: null,
+        remark: null,
+      },
+      moveUser: {},
+      netType: null,
+      loading: true,
+      submitButtonStat: false,
+      openBanks: null,
+      toAlertShow: false,
+      toAlertTile: '',
+      toAlertType: 'success',
+      isRelation: false,
+      showToName: '',
+    }
+  },
+  methods: {
+    chkAlert () {
+      // if(this.form.type==='network'){
+      //   this.chkRelation()
+      // }else{
+      //   this.toAlertShow=false
+      // }
+
+      this.toAlertShow = false
     },
-    mounted() {
-      network.getData('user/move-net-type').then(response => {
-        this.netType = response.netType
-        this.loading = false
-      })
-    },
-    data() {
-      return {
-        form: {
-          moveUserName: null,
-          toConUserName: null,
-          toConRealName: null,
-          type: null,
-          location: 1,
-          remark: null,
-        },
-        moveUser: {},
-        netType: null,
-        loading: true,
-        submitButtonStat: false,
-        openBanks: null,
-        toAlertShow:false,
-        toAlertTile:'',
-        toAlertType:'success',
-        isRelation:false,
-        showToName:'',
+    handleChkUser () {
+      if (this.form.moveUserName) {
+        this.loading = true
+        network.getData('user/full-info', {userName: this.form.moveUserName}).then(response => {
+          this.moveUser = response
+          this.loading = false
+        }).catch(response => {
+          this.loading = false
+        })
       }
     },
-    methods: {
-      chkAlert(){
-        // if(this.form.type==='network'){
-        //   this.chkRelation()
-        // }else{
-        //   this.toAlertShow=false
-        // }
-
-        this.toAlertShow=false
-      },
-      handleChkUser() {
-        if (this.form.moveUserName) {
-          this.loading = true
-          network.getData('user/full-info', {userName: this.form.moveUserName}).then(response => {
-            this.moveUser = response
-            this.loading = false
-          }).catch(response => {
-            this.loading = false
-          })
-        }
-      },
-      chkRelation(){
-        if (this.form.toConUserName&&this.form.moveUserName) {
-          this.loading = true
-          this.toAlertShow=false
-          network.getData('user/chk-relation', {userName: this.form.moveUserName,toUserName:this.form.toConUserName}).then(response => {
-            if(response.is===1){
-              this.isRelation=true
-              this.toAlertTile='在同一推荐网络内'
-              this.toAlertType='success'
-            }else{
-              this.isRelation=false
-              this.toAlertTile='不同一推荐网络内'
-              this.toAlertType='warning'
-            }
-            this.showToName=response.real_name
-            this.toAlertShow=true
-            this.loading = false
-          }).catch(response => {
-            this.loading = false
-          })
-        }
-      },
-      onSubmit() {
-        let thisObj=this
-        // if(thisObj.form.type==='network' && this.isRelation===false){
-        //   thisObj.$confirm('不在同一推荐网络内是否确认处理', 'Hint', {
-        //     confirmButtonText: 'confirm', // 确定
-        //     cancelButtonText: 'cancel', // 取消
-        //     type: 'warning'
-        //   }).then(() => {
-        //     thisObj._handleSubmit()
-        //   }).catch(() => {
-        //
-        //   })
-        // }else{
-        //   thisObj._handleSubmit()
-        // }
-
-        thisObj._handleSubmit()
-      },
-      _handleSubmit(){
-        this.submitButtonStat = true
-        let path = 'user/move-add'
-        network.postData(path, this.form).then(response => {
-          this.$message({
-            message: response,
-            type: 'success'
-          })
-          this.submitButtonStat = false
-          this.$router.go(-1)
+    chkRelation () {
+      if (this.form.toConUserName && this.form.moveUserName) {
+        this.loading = true
+        this.toAlertShow = false
+        network.getData('user/chk-relation', {userName: this.form.moveUserName, toUserName: this.form.toConUserName}).then(response => {
+          if (response.is === 1) {
+            this.isRelation = true
+            this.toAlertTile = '在同一推荐网络内'
+            this.toAlertType = 'success'
+          } else {
+            this.isRelation = false
+            this.toAlertTile = '不同一推荐网络内'
+            this.toAlertType = 'warning'
+          }
+          this.showToName = response.real_name
+          this.toAlertShow = true
+          this.loading = false
         }).catch(response => {
-          this.submitButtonStat = false
+          this.loading = false
         })
       }
+    },
+    onSubmit () {
+      let thisObj = this
+      // if(thisObj.form.type==='network' && this.isRelation===false){
+      //   thisObj.$confirm('不在同一推荐网络内是否确认处理', 'Hint', {
+      //     confirmButtonText: 'confirm', // 确定
+      //     cancelButtonText: 'cancel', // 取消
+      //     type: 'warning'
+      //   }).then(() => {
+      //     thisObj._handleSubmit()
+      //   }).catch(() => {
+      //
+      //   })
+      // }else{
+      //   thisObj._handleSubmit()
+      // }
+
+      thisObj._handleSubmit()
+    },
+    _handleSubmit () {
+      this.submitButtonStat = true
+      let path = 'user/move-add'
+      network.postData(path, this.form).then(response => {
+        this.$message({
+          message: response,
+          type: 'success'
+        })
+        this.submitButtonStat = false
+        this.$router.go(-1)
+      }).catch(response => {
+        this.submitButtonStat = false
+      })
     }
   }
+}
 </script>
 
 <style scoped>

+ 8 - 8
backendEle/src/views/user/move.vue

@@ -88,10 +88,10 @@
           <el-form-item label="Original superior name"><!-- 原上级姓名 -->
             <el-input v-model="form.baseInfo.CON_REAL_NAME" :disabled="true"></el-input>
           </el-form-item>
-          <el-form-item label="Move to node member code"><!-- 移动到节点会员编号 -->
+          <el-form-item label="Move to placement member code"><!-- 移动到节点会员编号 -->
             <el-input v-model="form.toConUserName"></el-input>
           </el-form-item>
-          <el-form-item label="Move to node member name"><!-- 移动到节点会员姓名 -->
+          <el-form-item label="Move to placement member name"><!-- 移动到节点会员姓名 -->
             <el-input v-model="form.toConRealName"></el-input>
           </el-form-item>
         </div>
@@ -108,10 +108,10 @@
           <el-form-item label="Name of original developer"><!-- 原开拓人姓名 -->
             <el-input v-model="form.baseInfo.REC_REAL_NAME" :disabled="true"></el-input>
           </el-form-item>
-          <el-form-item label="Move to development member code"><!-- 移动到开拓会员编号 -->
+          <el-form-item label="Move to sponsor member code"><!-- 移动到开拓会员编号 -->
             <el-input v-model="form.toConUserName"></el-input>
           </el-form-item>
-          <el-form-item label="Move to development member name"><!-- 移动到开拓会员姓名 -->
+          <el-form-item label="Move to sponsor member name"><!-- 移动到开拓会员姓名 -->
             <el-input v-model="form.toConRealName"></el-input>
           </el-form-item>
         </div>
@@ -151,10 +151,10 @@
           <el-form-item label="Original superior name"><!-- 原上级姓名 -->
             <el-input v-model="form.baseInfo.CON_REAL_NAME" :disabled="true"></el-input>
           </el-form-item>
-          <el-form-item label="Move to node member code"><!-- 移动到节点会员编号 -->
+          <el-form-item label="Move to placement member code"><!-- 移动到节点会员编号 -->
             <el-input v-model="form.toConUserName"></el-input>
           </el-form-item>
-          <el-form-item label="Move to node member name"><!-- 移动到节点会员姓名 -->
+          <el-form-item label="Move to placement member name"><!-- 移动到节点会员姓名 -->
             <el-input v-model="form.toConRealName"></el-input>
           </el-form-item>
         </div>
@@ -171,10 +171,10 @@
           <el-form-item label="Name of original developer"><!-- 原开拓人姓名 -->
             <el-input v-model="form.baseInfo.REC_REAL_NAME" :disabled="true"></el-input>
           </el-form-item>
-          <el-form-item label="Move to development member code"><!-- 移动到开拓会员编号 -->
+          <el-form-item label="Move to sponsor member code"><!-- 移动到开拓会员编号 -->
             <el-input v-model="form.toConUserName"></el-input>
           </el-form-item>
-          <el-form-item label="Move to development member name"><!-- 移动到开拓会员姓名 -->
+          <el-form-item label="Move to sponsor member name"><!-- 移动到开拓会员姓名 -->
             <el-input v-model="form.toConRealName"></el-input>
           </el-form-item>
         </div>

+ 29 - 23
common/helpers/bonus/BonusCalc.php

@@ -65,7 +65,7 @@ use yii\db\Query;
 class BonusCalc extends BaseObject {
     use StaticInstanceTrait;
 
-    private $_limit = 1000;
+    private $_limit = 10000;
     private $_gxLimit = 500;
     private $_handleUserId;
     private $_companyMonthPerf = 0;
@@ -1656,8 +1656,8 @@ class BonusCalc extends BaseObject {
     public function calcQuarter() {
         if( !$this->_isCalcMonth || !in_array($this->_calcMonth, [3,6,9,12])) {
             // 不是结算月,则不进行计算
-            echo('不是季结点,进这里,不计算季度奖'. PHP_EOL);
-            return true;
+//            echo('不是季结点,进这里,不计算季度奖'. PHP_EOL);
+            return false;
         }
         $result = \Yii::$app->db->createCommand("CALL QtrCalc(:periodNum)")
             ->bindValue(':periodNum' , $this->_periodNum )
@@ -1733,7 +1733,10 @@ class BonusCalc extends BaseObject {
             $starCrownPoint = $this->_starCrownLevelConfig[$userStarCrownObj[$userId]['LAST_CROWN_LV']]['TOURISM_PERCENT'] ?? 0;
             // 奖金比例:
             $bonusPoint = max($starDirectorPoint, $starCrownPoint);
-
+            if ($bonusPoint <= 0) {
+                continue;
+            }
+            
             $insertBonusData[] = [
                 'ID' => SnowFake::instance()->generateId(),
                 'USER_ID' => $userId,
@@ -1814,13 +1817,13 @@ class BonusCalc extends BaseObject {
         $subQuery = CalcBonusQY::find()
             ->yearMonth($this->_calcYearMonth)
             ->where('CALC_MONTH = :CALC_MONTH AND LAST_CROWN_LV <> :NO_CROWN_LV', [':CALC_MONTH' => $this->_calcYearMonth, ':NO_CROWN_LV' => StarCrownLevel::NO_LEVEL_ID])
-            ->select('USER_ID,LAST_DEC_LV,LAST_EMP_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')
+            ->select('USER_ID,LAST_DEC_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')
             ->joinWith(['starCrown' => function($query) {
                 $query->select(['LEVEL_NAME', 'SORT']);
             }])
             ->having(1)
             ->orderBy('USER_ID ASC, SORT DESC');
-        $userStarCrownObj = (new Query())->from(['u' => $subQuery])->select('USER_ID,LAST_DEC_LV,LAST_EMP_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')->groupBy('USER_ID')->indexBy('USER_ID')->all();
+        $userStarCrownObj = (new Query())->from(['u' => $subQuery])->select('USER_ID,LAST_DEC_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')->groupBy('USER_ID')->indexBy('USER_ID')->all();
 
         // 奖金点数综合
         $bonusPointComplex = 0;
@@ -1835,10 +1838,10 @@ class BonusCalc extends BaseObject {
             $insertBonusData[] = [
                 'ID' => SnowFake::instance()->generateId(),
                 'USER_ID' => $item['USER_ID'],
-                'LAST_DEC_LV' => $item['LAST_DEC_LV'],
-                'LAST_EMP_LV' => $item['LAST_EMP_LV'],
-                'LAST_STATUS' => $item['LAST_STATUS'],
-                'LAST_CROWN_LV' => $item['LAST_CROWN_LV'],
+                'LAST_DEC_LV' => $item['LAST_DEC_LV'] ?? '',
+                'LAST_EMP_LV' => $item['LAST_EMP_LV'] ?? '',
+                'LAST_STATUS' => $item['LAST_STATUS'] ?? 0,
+                'LAST_CROWN_LV' => $item['LAST_CROWN_LV'] ?? '',
                 'AMOUNT' => 0,
                 'POINT' => $bonusPoint,
                 'PERIOD_NUM' => $this->_periodNum,
@@ -1918,7 +1921,7 @@ class BonusCalc extends BaseObject {
         $userStarDirector = CalcBonusBS::find()
             ->yearMonth($this->_calcYearMonth)
             ->where('CALC_MONTH = :CALC_MONTH', [':CALC_MONTH' => $this->_calcYearMonth])
-            ->select('USER_ID,LEVEL_ID,LAST_DEC_LV,LAST_EMP_LV,LAST_STATUS')
+            ->select('USER_ID,LEVEL_ID,LAST_DEC_LV,LAST_STATUS')
             ->groupBy('USER_ID')
             ->asArray()
             ->all();
@@ -1928,13 +1931,13 @@ class BonusCalc extends BaseObject {
         $subQuery = CalcBonusQY::find()
             ->yearMonth($this->_calcYearMonth)
             ->where('CALC_MONTH = :CALC_MONTH AND LAST_CROWN_LV <> :NO_CROWN_LV', [':CALC_MONTH' => $this->_calcYearMonth, ':NO_CROWN_LV' => StarCrownLevel::NO_LEVEL_ID])
-            ->select('USER_ID,LAST_DEC_LV,LAST_EMP_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')
+            ->select('USER_ID,LAST_DEC_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')
             ->joinWith(['starCrown' => function($query) {
                 $query->select(['LEVEL_NAME', 'SORT']);
             }])
             ->having(1)
             ->orderBy('USER_ID ASC, SORT DESC');
-        $userStarCrownObj = (new Query())->from(['u' => $subQuery])->select('USER_ID,LAST_DEC_LV,LAST_EMP_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')->groupBy('USER_ID')->indexBy('USER_ID')->all();
+        $userStarCrownObj = (new Query())->from(['u' => $subQuery])->select('USER_ID,LAST_DEC_LV,LAST_CROWN_LV,LAST_STATUS,LEVEL_NAME,SORT')->groupBy('USER_ID')->indexBy('USER_ID')->all();
         
         // 合并用户ID,去重
         $bonusUsers = array_unique(array_merge(array_keys($userStarDirectorObj), array_keys($userStarCrownObj)));
@@ -1949,12 +1952,15 @@ class BonusCalc extends BaseObject {
             $starCrownPoint = !isset($userStarCrownObj[$userId]['LAST_CROWN_LV']) ? 0: ($this->_starCrownLevelConfig[$userStarCrownObj[$userId]['LAST_CROWN_LV']]['GARAGE_PERCENT'] ?? 0);
             // 奖金比例:
             $bonusPoint = max($starDirectorPoint, $starCrownPoint);
+            if ($bonusPoint <= 0) {
+                continue;
+            }
 
             $insertBonusData[] = [
                 'ID' => SnowFake::instance()->generateId(),
                 'USER_ID' => $userId,
                 'LAST_DEC_LV' => $userStarDirectorObj[$userId]['LAST_DEC_LV'] ?? ($userStarCrownObj[$userId]['LAST_DEC_LV'] ?? ''),
-                'LAST_EMP_LV' => $userStarDirectorObj[$userId]['LAST_EMP_LV'] ?? ($userStarCrownObj[$userId]['LAST_EMP_LV'] ?? ''),
+                'LAST_EMP_LV' => $userStarDirectorObj[$userId]['LEVEL_ID'] ?? '',
                 'LAST_STATUS' => $userStarDirectorObj[$userId]['LAST_STATUS'] ?? ($userStarCrownObj[$userId]['LAST_STATUS'] ?? 1),
                 'LAST_CROWN_LV' => $userStarCrownObj[$userId]['LAST_CROWN_LV'] ?? '',
                 'AMOUNT' => 0,
@@ -2024,8 +2030,8 @@ class BonusCalc extends BaseObject {
                 ->all();
         if ($allData){
             // 达标条件:会员级别:钻卡
-            $config = json_decode($this->_sysConfig['openGL']['OPTIONS'], true);
-            $minDecLevel = $config['mntDec'] ?? [];
+            $config = json_decode($this->_sysConfig['openQuarter']['OPTIONS'], true);
+            $minDecLevel = $config['declarationLevel'] ?? [];
 
             foreach ($allData as $user) {
                 // 扣除相应的复消积分和管理费
@@ -2034,14 +2040,14 @@ class BonusCalc extends BaseObject {
                 $manageTax = $deductData['manageTax']; // 管理费
                 $point = $deductData['reConsumePoints'] + $user['RECONSUME_POINTS'];// 复消积分
                 // 管理奖钻卡发放
-//                if (in_array($user['LAST_DEC_LV'], $minDecLevel)) {
-                // 把对碰后的奖金存入缓存中
-                CalcCache::bonus($user['USER_ID'], $this->_periodNum, 'BONUS_QUARTER', $user['ORI_BONUS'], $deductData);
-                // 加入月奖的会员
-                CalcCache::addHasMonthBonusUsers($user['USER_ID'], $this->_periodNum);
-//                }
+                if ($user['LAST_DEC_LV'] == $minDecLevel) {
+                    // 把对碰后的奖金存入缓存中
+                    CalcCache::bonus($user['USER_ID'], $this->_periodNum, 'BONUS_QUARTER', $user['ORI_BONUS'], $deductData);
+                    // 加入月奖的会员
+                    CalcCache::addHasMonthBonusUsers($user['USER_ID'], $this->_periodNum);
+                }
 
-                // 更新蓝星奖金存储过程的实发金额数据
+                // 更新奖金存储过程的实发金额数据
                 CalcBonusQuarter::updateAll([
                     'RECONSUME_POINTS' => $point,
                     'AMOUNT' => $realBonusBs,

+ 119 - 0
common/helpers/bonus/BonusSend.php

@@ -19,6 +19,7 @@ use common\helpers\user\Status;
 use common\libs\api\sms\SmsApi;
 use common\libs\swoole\Process;
 use common\models\DealType;
+use common\models\FlowRemainPv;
 use common\models\PerfPeriod;
 use common\models\DecOrder;
 use common\models\EmployLevel;
@@ -32,6 +33,9 @@ use common\models\UserPerf;
 use common\models\UserPerfUpdate;
 use common\models\UserTeamwork;
 use common\models\YearHighestEmpLv;
+use common\models\Order;
+use common\models\RemainPv;
+use common\models\forms\OrderForm;
 use yii\base\BaseObject;
 use yii\base\StaticInstanceTrait;
 use common\helpers\Cache;
@@ -120,6 +124,66 @@ class BonusSend extends BaseObject {
         return $this->_errors;
     }
 
+    /**
+     * 挂网时处理虚假订单
+     *
+     */
+    public function putFakeOrder() {
+        echo('开始处理假订单' . PHP_EOL);
+        $fakeOrder= Order::find()->where(['PERIOD_NUM'=>$this->_periodNum, 'ORDER_TYPE'=>'FO'])->asArray()->all();
+        foreach($fakeOrder as $fOrder){
+            $oRemainPv=RemainPv::findOne(["USER_ID"=>$fOrder['USER_ID']]);
+            $transactionRemain = \Yii::$app->db->beginTransaction();
+            try{
+                $flowRemainPvModel = new FlowRemainPv();
+                $flowRemainPvModel->ID = $this->_generateSn();
+                $flowRemainPvModel->USER_ID = $fOrder['USER_ID'];
+                $flowRemainPvModel->REMAIN_PV_FLOW = -30;
+                $flowRemainPvModel->REMAIN_PV_TOTAL = $oRemainPv->REMAIN_PV - 30;
+                $flowRemainPvModel->PERIOD_NUM = $this->_periodNum;
+                $flowRemainPvModel->UPDATED_AT = Date::nowTime();
+                $flowRemainPvModel->ORDER_SN = $fOrder['SN'];
+                if(!$flowRemainPvModel->save()){
+                    $this->addErrors($flowRemainPvModel->getErrors());
+                    return false;
+                }
+                $oRemainPv->updateCounters(['REMAIN_PV'=>-30]);
+                $transactionRemain->commit();
+            } catch (Exception $e) {
+                $transactionRemain->rollBack();
+                $this->addError('add', $e->getMessage());
+                return null;
+            }
+        }
+        echo('假订单处理完' . PHP_EOL);
+        return true; // $flowRemainPvModel;
+    }
+    /**
+     * 生成流水号
+     * @return string
+     */
+    private function _generateSn() {
+        return Date::today('Ymd') . $this->_random(10, 1);
+    }
+
+    /**
+     * 生成随机数
+     * @param $length
+     * @param int $numeric
+     * @return string
+     */
+    private function _random($length, $numeric = 0) {
+        $seed = base_convert(md5(microtime() . $_SERVER['DOCUMENT_ROOT']), 16, $numeric ? 10 : 35);
+        $seed = $numeric ? (str_replace('0', '', $seed) . '012340567890') : ($seed . 'zZ' . strtoupper($seed));
+        $hash = '';
+        $max = strlen($seed) - 1;
+        for ($i = 0; $i < $length; $i++) {
+            $hash .= $seed[mt_rand(0, $max)];
+        }
+        return $hash;
+    }
+
+
     /**
      * 进行奖金发放步骤
      * @return bool
@@ -129,6 +193,11 @@ class BonusSend extends BaseObject {
             $t1 = microtime(true);
             // 初始化
             $this->initTask();
+            echo('挂网开始');
+            $this->putFakeOrder();
+            // 先把有remainPv的订单处理一下,将remainPv加入到remain_pv及流水表
+            echo('处理当期REMAIN PV ' . date('Y-m-d  H:i:s', time()) . PHP_EOL);
+            $this->_calcRemainPv();
             $t2 = microtime(true);
             echo('初始化完成,当前期数【' . $this->_periodNum . '】,耗时:' . round($t2 - $t1, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             // 改变状态
@@ -201,6 +270,56 @@ class BonusSend extends BaseObject {
         return true;
     }
 
+    /**
+     * 处理order表中有remain_pv的订单
+     * 将结果写入到remainPv相关表中
+     *
+     */
+    private function _calcRemainPv(){
+        $orders = Order::find()->where('PERIOD_NUM=:PERIOD_NUM AND REMAIN_PV>0',[':PERIOD_NUM'=>$this->_periodNum])->asArray()->all();
+        foreach($orders as $order){
+            $oRemainPv = RemainPv::find()->where(['USER_ID' => $order['USER_ID']])->one();
+
+            $transactionRemain = \Yii::$app->db->beginTransaction();
+            try{
+                $flowRemainPvModel = new FlowRemainPv();
+                $flowRemainPvModel->ID = $this->_generateSn();
+                $flowRemainPvModel->USER_ID = $order['USER_ID'];
+                $flowRemainPvModel->REMAIN_PV_FLOW = $order['REMAIN_PV'];
+                $flowRemainPvModel->REMAIN_PV_TOTAL = $oRemainPv['REMAIN_PV'] + $order['REMAIN_PV'];
+                $flowRemainPvModel->PERIOD_NUM = $this->_periodNum;
+                $flowRemainPvModel->UPDATED_AT = Date::nowTime();
+                $flowRemainPvModel->ORDER_SN = $order['SN'];
+                if(!$flowRemainPvModel->save()){
+                    $this->addErrors($flowRemainPvModel->getErrors());
+                    return false;
+                }
+
+                $oRemainPv = RemainPv::find()->where(['USER_ID' => $order['USER_ID']])->one();
+                if($oRemainPv){
+                    $oRemainPv->updateCounters(['REMAIN_PV'=>$order['REMAIN_PV']]);
+                }else{
+                    $remainPvModel = new RemainPv();
+                    $remainPvModel->ID = $this->_generateSn();
+                    $remainPvModel->USER_ID = $order['USER_ID'];
+                    $remainPvModel->UPDATED_AT = Date::nowTime();
+                    $remainPvModel->REMAIN_PV = $order['REMAIN_PV'];
+                    $remainPvModel->STATUS = 1;
+                    if(!$remainPvModel->save()){
+                        $this->addErrors($remainPvModel->getErrors());
+                        return false;
+                    }
+                }
+                $transactionRemain->commit();
+            } catch (Exception $e) {
+                $transactionRemain->rollBack();
+                $this->addError('add', $e->getMessage());
+                return null;
+            }
+        }
+        return null;
+    }
+
     /**
      * 需要多进程执行的任务
      * @param $workId

+ 5 - 2
common/helpers/bonus/CalcCache.php

@@ -25,12 +25,15 @@ use common\models\UserBonus;
 use common\models\UserNetwork;
 use common\models\UserPerf;
 use common\models\UserRelation;
+use common\models\RemainPv;
+use common\models\Order;
+use common\models\forms\OrderForm;
 use Yii;
 use common\models\UserInfo;
 use yii\helpers\Json;
 
 class CalcCache {
-    const LIMIT = 1000;
+    const LIMIT = 10000;
 
     const REDIS_KEY_PREFIX_USER = 'calc:user_';
     const REDIS_KEY_PREFIX_USER_ACTIVE = 'calc:userActive_';
@@ -224,10 +227,10 @@ class CalcCache {
      * @return bool
      */
     public static function addUsers($periodNum, $offset = 0, $limit = self::LIMIT) {
-//        echo sprintf("时间:[%s]缓存用户,当前offset为:【%s】" . PHP_EOL, date('Y-m-d H:i:s', time()) , $offset);
         // 修复USER_INFO表里面已经没有PERIOD_NUM了
         $allData = UserInfo::findUseDbCalc()->from(UserInfo::tableName(). 'AS UI')->select('UI.USER_ID,U.STATUS')->leftJoin(User::tableName() . 'AS U', 'U.ID=UI.USER_ID')->where('1=1')->orderBy('UI.RELATION_DEEP DESC,UI.ID DESC')->offset($offset)->limit($limit)->asArray()->all();
         //$allData = User::findUseDbShopCalc()->select('ID AS USER_ID')->where('PERIOD_AT<=:PERIOD_AT AND IS_UNION=0 AND DELETED=0', [':PERIOD_AT' => $periodNum])->offset($offset)->limit($limit)->asArray()->all();
+//        print_r($allData);
         if ($allData) {
             foreach ($allData as $data) {
 //                if(User::find()->where('ID=:ID',[':ID'=>$data['USER_ID']])->exists()) continue;

+ 113 - 1
common/helpers/bonus/PerfCalc.php

@@ -19,6 +19,7 @@ use common\helpers\user\Reconsume;
 use common\models\CalcBonus;
 use common\models\DeclarationLevel;
 use common\models\forms\DeclarationForm;
+use common\models\forms\OrderForm;
 use common\models\Order;
 use common\models\OrderDec;
 use common\models\OrderShop;
@@ -33,13 +34,15 @@ use common\models\DecOrder;
 use common\models\EmployLevel;
 use common\models\PerfActiveUser;
 use common\models\UserRelation;
+use common\models\RemainPv;
+use common\models\FlowRemainPv;
 use yii\base\Exception;
 use yii\base\StaticInstanceTrait;
 
 class PerfCalc {
     use StaticInstanceTrait;
 
-    private $_limit = 1000;
+    private $_limit = 10000;
     private $_handleUserId;
     private $_companyMonthPerf = 0;
     private $_cfTotalPercent = 0;
@@ -105,6 +108,108 @@ class PerfCalc {
         return $this->_errors;
     }
 
+    /**
+     * 生成流水号
+     * @return string
+     */
+    private function _generateSn() {
+        return Date::today('Ymd') . $this->_random(10, 1);
+    }
+
+    /**
+     * 生成随机数
+     * @param $length
+     * @param int $numeric
+     * @return string
+     */
+    private function _random($length, $numeric = 0) {
+        $seed = base_convert(md5(microtime() . $_SERVER['DOCUMENT_ROOT']), 16, $numeric ? 10 : 35);
+        $seed = $numeric ? (str_replace('0', '', $seed) . '012340567890') : ($seed . 'zZ' . strtoupper($seed));
+        $hash = '';
+        $max = strlen($seed) - 1;
+        for ($i = 0; $i < $length; $i++) {
+            $hash .= $seed[mt_rand(0, $max)];
+        }
+        return $hash;
+    }
+
+    /**
+     * 处理order表中有remain_pv的订单
+     * 将结果写入到remainPv相关表中
+     *
+     */
+    private function _calcRemainPv(){
+        $orders = Order::find()->where('PERIOD_NUM=:PERIOD_NUM AND REMAIN_PV>0',[':PERIOD_NUM'=>$this->_periodNum])->asArray()->all();
+        foreach($orders as $order){
+            $oRemainPv = RemainPv::find()->where(['USER_ID' => $order['USER_ID']])->one();
+
+            $transactionRemain = \Yii::$app->db->beginTransaction();
+            try{
+                $flowRemainPvModel = new FlowRemainPv();
+                $flowRemainPvModel->ID = $this->_generateSn();
+                $flowRemainPvModel->USER_ID = $order['USER_ID'];
+                $flowRemainPvModel->REMAIN_PV_FLOW = $order['REMAIN_PV'];
+                $flowRemainPvModel->REMAIN_PV_TOTAL = $oRemainPv['REMAIN_PV'] + $order['REMAIN_PV'];
+                $flowRemainPvModel->PERIOD_NUM = $this->_periodNum;
+                $flowRemainPvModel->UPDATED_AT = Date::nowTime();
+                $flowRemainPvModel->ORDER_SN = $order['SN'];
+                if(!$flowRemainPvModel->save()){
+                    $this->addErrors($flowRemainPvModel->getErrors());
+                    return false;
+                }
+
+                $oRemainPv = RemainPv::find()->where(['USER_ID' => $order['USER_ID']])->one();
+                if($oRemainPv){
+                    $oRemainPv->updateCounters(['REMAIN_PV'=>$order['REMAIN_PV']]);
+                }else{
+                    $remainPvModel = new RemainPv();
+                    $remainPvModel->ID = $this->_generateSn();
+                    $remainPvModel->USER_ID = $order['USER_ID'];
+                    $remainPvModel->UPDATED_AT = Date::nowTime();
+                    $remainPvModel->REMAIN_PV = $order['REMAIN_PV'];
+                    $remainPvModel->STATUS = 1;
+                    if(!$remainPvModel->save()){
+                        $this->addErrors($remainPvModel->getErrors());
+                        return false;
+                    }
+                }
+                $transactionRemain->commit();
+            } catch (Exception $e) {
+                $transactionRemain->rollBack();
+                $this->addError('add', $e->getMessage());
+                return null;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 生成假订单
+     *
+     */
+    public static function _createFakeOrder($periodNum){
+        echo('假假假'.$periodNum. PHP_EOL);
+        $userHaveRemain = RemainPv::findAllAsArray('REMAIN_PV >0');
+        $currentPeriod = Period::getInfoByPeriodNum($periodNum);
+        if($currentPeriod['IS_MONTH']){
+            print_r('是月结点'.PHP_EOL);
+            $periods = Period::getCurrentMonthPeriodByPeriodNum($periodNum);
+            //先清除本期的假订单
+            echo('首先,清除上次尝试生成业绩单时所创建的虚假订单'. date('Y-m-d  H:i:s', time()) . PHP_EOL);
+            $delFOrder = Order::deleteAll(['ORDER_TYPE'=>'FO','PERIOD_NUM'=>$periodNum]);
+            echo('检查有结余PV的用户,如果他当月PV不足30,则为其创建假订单'. PHP_EOL);
+            foreach($userHaveRemain as $uR){
+                $myPv = Order::find()->where(['PERIOD_NUM'=>$periods, 'USER_ID'=>$uR['USER_ID']])->SUM('PV');
+                if($myPv<30){
+                    //制造虚拟订单
+                    echo('不足30了,生成假订单' . PHP_EOL);
+                    $newOrderForm = new OrderForm();
+                    $newOrderForm->addFakeOrder($uR['USER_ID'],$periodNum);
+                }
+            }
+        }
+    }
+
     /**
      * 计算步骤
      * @param $periodNum
@@ -128,10 +233,17 @@ class PerfCalc {
             // 清空相关表数据
             $this->clearTableData();
             $t2 = microtime(true);
+            echo(PHP_EOL . $periodNum. '期,生成业绩单,开始' . PHP_EOL);
             echo('初始化、清空缓存及相关数据表完成,耗时:' . round($t2 - $t1, 3) . ',内存使用:' . (round(memory_get_usage() / 1024 / 1024, 3)) . 'MB' . PHP_EOL);
             $this->_updatePercent(10);
             // 计算月奖,才需要向缓存中加入按推荐深度的所有用户
             echo('向缓存中加入用户开始 ' . date('Y-m-d  H:i:s', time()) . PHP_EOL);
+//            // 先把有remainPv的订单处理一下,将remainPv加入到remain_pv及流水表
+//            echo('处理当期REMAIN PV ' . date('Y-m-d  H:i:s', time()) . PHP_EOL);
+//            $this->_calcRemainPv();
+            echo('若需要,生成假订单' . date('Y-m-d  H:i:s', time()) . PHP_EOL);
+            $this->_createFakeOrder($periodNum);
+            echo('生成假订单完成,开始缓存用户'. date('Y-m-d  H:i:s', time()) . PHP_EOL);
             //修改每一期都缓存所有用户
             CalcCache::addUsers($this->_periodNum);
             $t3 = microtime(true);

+ 8 - 6
common/models/Article.php

@@ -12,6 +12,7 @@ use Yii;
  * @property string $CID 分类ID
  * @property string $CONTENT 内容
  * @property int $STATUS 状态
+ * @property int $SORT 排序值
  * @property int $CREATED_AT 创建时间
  */
 class Article extends \common\components\ActiveRecord
@@ -31,7 +32,7 @@ class Article extends \common\components\ActiveRecord
     {
         return [
             [['CID', 'CREATED_AT'], 'required'],
-            [['STATUS', 'CREATED_AT'], 'integer'],
+            [['STATUS', 'CREATED_AT', 'SORT'], 'integer'],
             [['ID', 'CID'], 'string', 'max' => 32],
             [['TITLE'], 'string', 'max' => 255],
             [['CONTENT'], 'string', 'max' => 4000],
@@ -47,11 +48,12 @@ class Article extends \common\components\ActiveRecord
     {
         return [
             'ID' => 'ID',
-            'TITLE' => '标题',
-            'CID' => '分类ID',
-            'CONTENT' => '内容',
-            'STATUS' => '状态',
-            'CREATED_AT' => '创建时间',
+            'TITLE' => 'Title', // 标题
+            'CID' => 'Category Type', // 分类
+            'CONTENT' => 'Content', // 内容
+            'STATUS' => 'State', // 状态
+            'Order' => 'Sort', // 排序
+            'CREATED_AT' => 'Creation Time', // 创建时间
         ];
     }
 }

+ 25 - 0
common/models/FlowRemainPv.php

@@ -0,0 +1,25 @@
+<?php
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "{{%FLOW_REMAIN_PV}}".
+ *
+ * @property string $ID
+ * @property string $USER_ID 会员ID
+ * @property int $REMAIN_PV_FLOW 剩余BV FLOW
+ * @property int $UPDATED_AT 更新时间
+ * @property varchar $ORDER_SN 订单SN号
+ */
+class FlowRemainPv extends \common\components\ActiveRecord
+{
+    /**
+     * @inheritdoc
+     */
+    public static function tableName()
+    {
+        return '{{%FLOW_REMAIN_PV}}';
+    }
+
+}

+ 17 - 0
common/models/Period.php

@@ -831,4 +831,21 @@ class Period extends \common\components\ActiveRecord
     public static function getMonthNum($startPeriodNum,$endPeriodNum){
         return self::find()->select('CALC_MONTH')->groupBy('CALC_MONTH')->where('PERIOD_NUM>=:START_PERIOD AND PERIOD_NUM<=:END_PERIOD',[':START_PERIOD'=>$startPeriodNum,':END_PERIOD'=>$endPeriodNum])->count();
     }
+
+    /**
+     * 从期数获取当前月的所有期
+     *
+     */
+    public static function getCurrentMonthPeriodByPeriodNum($periodNum){
+        $currentPeriod = self::getInfoByPeriodNum($periodNum);
+        $currentYear = $currentPeriod['CALC_YEAR'];
+        $currentMonth = $currentPeriod['CALC_MONTH'];
+        $periodsArray = self::findAllAsArray(['CALC_YEAR'=>$currentYear,'CALC_MONTH'=>$currentMonth]);
+        $periods = [];
+        foreach ($periodsArray as $p){
+            $periods[] = $p['PERIOD_NUM'];
+        }
+
+        return $periods;
+    }
 }

+ 22 - 0
common/models/RemainPv.php

@@ -0,0 +1,22 @@
+<?php
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "{{%REMAIN_PV}}".
+ *
+ * @property string $USER_ID 会员ID
+ * @property int $REMAIN_PV 剩余BV
+ * @property int $UPDATED_AT 更新时间
+ */
+class RemainPv extends \common\components\ActiveRecord
+{
+    /**
+     * @inheritdoc
+     */
+    public static function tableName()
+    {
+        return '{{%REMAIN_PV}}';
+    }
+}

+ 2 - 2
common/models/UserMove.php

@@ -39,8 +39,8 @@ class UserMove extends \common\components\ActiveRecord
     const TYPE_RELATION = NetPoint::NET_TYPE_RELATION;
 
     const TYPE_NAME = [
-        self::TYPE_NETWORK => ['id' => self::TYPE_NETWORK, 'name' => '安置网络',],
-        self::TYPE_RELATION => ['id' => self::TYPE_RELATION, 'name' => '开拓网络',],
+        self::TYPE_NETWORK => ['id' => self::TYPE_NETWORK, 'name' => 'Placement network',], // 安置网络
+        self::TYPE_RELATION => ['id' => self::TYPE_RELATION, 'name' => 'Sponsor network',], // 开拓网络
     ];
 
     const STATUS_APPLIED = 0;       // 已申请

+ 28 - 5
common/models/forms/ArticleForm.php

@@ -16,6 +16,7 @@ class ArticleForm extends Model
     public $id;
     public $title;
     public $cid;
+    public $sort;
     public $content;
 
     /**
@@ -36,9 +37,10 @@ class ArticleForm extends Model
     {
         return [
             'id' => 'ID',
-            'title' => '标题',
-            'cid' => '分类',
-            'content' => '内容',
+            'title' => 'Title',//标题
+            'cid' => 'Type', // 分类
+            'content' => 'Content', // 内容
+            'sort' => 'Sort', // 排序
         ];
     }
 
@@ -50,8 +52,9 @@ class ArticleForm extends Model
     {
         $parentScenarios =  parent::scenarios();
         $customScenarios = [
-            'add' => ['title', 'cid', 'content'],
-            'edit' => ['id','title', 'cid', 'content'],
+            'add' => ['title', 'cid', 'content', 'sort'],
+            'edit' => ['id','title', 'cid', 'content', 'sort'],
+            'sort' => ['id', 'sort'],
         ];
         return array_merge($parentScenarios, $customScenarios);
     }
@@ -73,6 +76,8 @@ class ArticleForm extends Model
                 $model->CREATED_AT = Date::nowTime();
             } elseif($this->scenario == 'edit') {
                 $model = Article::findOne(['ID'=>$this->id]);
+            }  elseif($this->scenario == 'sort') {
+                $model = Article::findOne(['ID'=>$this->id]);
             } else {
                 $this->addError('edit', 'Scenario not exists');// 提交场景不存在
                 return null;
@@ -81,6 +86,7 @@ class ArticleForm extends Model
             $model->CID = $this->cid;
             $model->CONTENT = '';
             $model->STATUS = 1;
+            $model->SORT = $this->sort;
             if(!$model->save()){
                 throw new Exception(Form::formatErrorsForApi($model->getErrors()));
             }
@@ -96,5 +102,22 @@ class ArticleForm extends Model
         return $model;
     }
 
+    /**
+     * 排序
+     * @return Article
+     */
+    public function sortTo(): ?Article
+    {
+        if (!$this->validate()) {
+            return null;
+        }
 
+        $model = Article::findOne(['ID' => $this->id]);
+        $model->SORT = $this->sort;
+        if (!$model->save()) {
+            $this->addError('sortTo', Form::formatErrorsForApi($model->getErrors()));
+            return null;
+        }
+        return $model;
+    }
 }

+ 1 - 1
common/models/forms/NetMoveForm.php

@@ -293,7 +293,7 @@ class NetMoveForm extends Model {
         }
 
         $this->adminOperateLogger->afterInsert($model)->clean()->save([
-            'optType' => '申请移网',
+            'optType' => 'Apply for moving network', // 申请移网
             'userId' => $model->USER_ID,
             'userName' => Info::getUserNameByUserId($model->USER_ID),
             'remark' => $this->remark

+ 145 - 50
common/models/forms/OrderForm.php

@@ -19,6 +19,8 @@ use common\models\Region;
 use common\models\ShopGoods;
 use common\models\User;
 use common\models\UserNetwork;
+use common\models\RemainPv;
+use common\models\FlowRemainPv;
 use yii\base\Exception;
 
 /**
@@ -57,6 +59,8 @@ class OrderForm extends Model
     private $_standardAmount;
     private $_decAmountStandard;
     private $_exchangeRate;
+    private $_remainPv;
+    private $_realPv;
 
     /**
      * @var Order
@@ -88,25 +92,25 @@ class OrderForm extends Model
     public function attributeLabels()
     {
         return [
-            'sn' => '订单号',
+            'sn' => 'Order Code', // 订单号
             'expressCompany' => '快递公司',
             'orderTrackNo' => '快递单号',
-            'status' => '状态',
-            'remark' => '备注',
-            'type' => '订单类型',
+            'status' => 'State', // 状态
+            'remark' => 'Remark', // 备注
+            'type' => 'Order Type',// 订单类型
             'addressId' => 'Shipping address',// 收货地址
-            'payType' => '支付方式',
-            'goodsId' => 'product ID',//商品ID
+            'payType' => 'Pay Type',// 支付方式
+            'goodsId' => 'Product ID',//商品ID
             'goodsNum' => 'Product quantity',//商品数量
             'userName' => 'Repeat sales Member No. does not exist',//复消会员编号
-            'consignee' => '收货人',
-            'acceptMobile' => '收货电话',
-            'province' => '省',
-            'city' => '市',
-            'county' => '区',
-            'lgaName' => 'lga name',
+            'consignee' => 'Consignee',// 收货人
+            'acceptMobile' => 'Accept Mobile',// 收货电话
+            'province' => 'Province',// 省
+            'city' => 'City',// 市
+            'county' => 'County',// 区
+            'lgaName' => 'Lga Name',
             'cityName' => 'City Name',
-            'detailaddress' => '收货详细地址',
+            'detailaddress' => 'Address',// 收货详细地址
             'email' => 'Email',
         ];
     }
@@ -416,6 +420,20 @@ class OrderForm extends Model
         return $this->_model;
     }
 
+    /**
+     * BV分期
+     *
+     *
+     */
+    private function _pvSplit($oPv){
+        $currentPv = $oPv % 30 + 30;
+        $remainPv = $oPv - $currentPv;
+        return [
+            'current' => $currentPv,
+            'remain' => $remainPv
+        ];
+    }
+
     /**
      * 复销
      * @throws Exception
@@ -428,8 +446,10 @@ class OrderForm extends Model
         $ids = $this->goodsId;
         $totalAmount = 0;
         $totalPv = 0;
+        $totalRealPv = 0;
         $totalAmountStandard = 0;
         $goodsType = ShopGoods::GOODS_TYPE;
+        $this->_remainPv = 0;
         $exchangeRate = floatval(Cache::getSystemConfig()['exchangeRate']['VALUE'] ?? 0); // 汇率
         foreach ($this->goodsNum as $k => $v) {
             if ($v) {
@@ -446,9 +466,21 @@ class OrderForm extends Model
                         $realPv = $goods['PRICE_PV'] * $discount;
                         $realPriceStandard = $goods['SELL_PRICE_STANDARD'] * $discount;
                     }
+                    if($goods['PV_SPLIT']==1){ // 当商品为PV分期时
+                        $pvSplit = $this->_pvSplit($realPv);
+                        $currentPv = $pvSplit['current'];
+                        $remainPv = $pvSplit['remain'];
+                        $totalPv += $currentPv * intval($v);
+                        $totalRealPv += $realPv * intval($v);
+                        $this->_remainPv += $remainPv * intval($v);
+                    }else{
+                        $currentPv = $goods['PRICE_PV'];
+                        $totalPv += $realPv * intval($v);
+                        $totalRealPv += $realPv * intval($v);
+                        $remainPv = 0;
+                        $this->_remainPv += 0;
+                    }
                     $totalAmount += $realPrice * intval($v);
-                    $totalPv += $realPv * intval($v);
-
                     $totalAmountStandard += $realPriceStandard * intval($v);
 //                    if($this->payType=='cash') {
 //                        $discount = $goodsType[$goods['TYPE']]['discount'];
@@ -465,9 +497,10 @@ class OrderForm extends Model
                     $this->_orderGoods[] = [
                         'GOODS_ID' => $goods['ID'],
                         'PRICE' => $goods['SELL_PRICE'],
-                        'PV' => $goods['PRICE_PV'],
+                        'PV' => $currentPv, // $goods['PRICE_PV'],
                         'REAL_PRICE' => $realPrice,
                         'REAL_PV' => $realPv,
+                        'REMAIN_PV' => $remainPv,
                         'POINT' => $goods['POINT'],
                         'BUY_NUMS' => intval($v),
                         'SKU_CODE' => $goods['GOODS_NO'],
@@ -493,6 +526,7 @@ class OrderForm extends Model
 
         $this->_decAmount = $totalAmount;
         $this->_decPv = $totalPv;
+        $this->_realPv = $totalRealPv;
         $this->_freight = ($totalAmount >= $freeShipping) ? 0 : $freight;
         if($this->_address['PROVINCE']==1){
             $this->_freight = 0;
@@ -510,38 +544,33 @@ class OrderForm extends Model
             if ($result['code'] !== 200) {
                 throw new Exception($result['message']);
             }
-			
-			
-			
+
 			/**
-			             * 2022-04-28
-			             * York
-			             * 支付后减少库存
-			             */
-			            foreach ($this->goodsNum as $k => $v){
-			                if ($v){
-			                    $goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
-			                    if ($goods['STORE_NUMS'] >= $this->goodsNum[$k]){
-			                        $data = ShopGoods::find()->where(['ID' => $ids[$k]])->one();
-			                        $goods_store_nums = $data->STORE_NUMS - $this->goodsNum[$k];
-			                        $data->STORE_NUMS = $goods_store_nums;
-			                        $data->update();
-			                        //下单后库存小于等于0 商品下架
-			                        if($goods_store_nums <= 0){
-			                            $data->STATUS = 0;
-			                            $data->UPDATED_AT = Date::nowTime();
-			                            $data->update();
-			
-			                        }
-			                    }else{
-			                        throw new Exception($goods['GOODS_NAME'].'库存不足,无法购买商品');
-			
-			                    }
-			
-			
-			                }
-			            }
-			//                exit();
+             * 2022-04-28
+             * York
+             * 支付后减少库存
+             */
+            foreach ($this->goodsNum as $k => $v){
+                if ($v){
+                    $goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
+                    if ($goods['STORE_NUMS'] >= $this->goodsNum[$k]){
+                        $data = ShopGoods::find()->where(['ID' => $ids[$k]])->one();
+                        $goods_store_nums = $data->STORE_NUMS - $this->goodsNum[$k];
+                        $data->STORE_NUMS = $goods_store_nums;
+                        $data->update();
+                        //下单后库存小于等于0 商品下架
+                        if($goods_store_nums <= 0){
+                            $data->STATUS = 0;
+                            $data->UPDATED_AT = Date::nowTime();
+                            $data->update();
+
+                        }
+                    }else{
+                        throw new Exception($goods['GOODS_NAME'].'库存不足,无法购买商品');
+
+                    }
+                }
+            }
 
             //写入订单
             if (!$orderResult = $this->addOrder()) {
@@ -584,7 +613,7 @@ class OrderForm extends Model
             if ($payAmount > Balance::getBalanceGarage($loginUserId)) {
                 return ['code' => 500, 'message' => '车房积分不足,无法购买商品'];
             }
-        } else{
+//        } else{
 //            if ($payAmount > Balance::getBalanceReconsumePoints($loginUserId)) {
 //                return ['code' => 500, 'message' => '复消积分不足,无法购买商品'];
 //            }
@@ -619,6 +648,7 @@ class OrderForm extends Model
             $warehouse = '01';
         }
         $_hasPV = in_array($this->payType, ['exchange', 'tourism_points', 'garage_points']) ? 0 : $this->_decPv;
+        $_hasRealPV = in_array($this->payType, ['exchange', 'tourism_points', 'garage_points']) ? 0 : $this->_realPv;
 
         $ordNo = $this->_generateSn();
         $orderModel = new Order();
@@ -630,7 +660,8 @@ class OrderForm extends Model
         $orderModel->ORDER_AMOUNT = $this->_decAmount;
         $orderModel->PV = $_hasPV;
         $orderModel->PAY_AMOUNT = $this->_payAmount;
-        $orderModel->PAY_PV = $_hasPV; // 兑换积分不能算业绩
+        $orderModel->PAY_PV = $_hasRealPV; // 兑换积分不能算业绩
+        $orderModel->REMAIN_PV = $this->_remainPv;
         $orderModel->PAY_AT = Date::nowTime();
         $orderModel->PAY_TYPE = $this->payType;
         $orderModel->PERIOD_NUM = $nowPeriodNum;
@@ -695,6 +726,46 @@ class OrderForm extends Model
             Balance::changeUserBonus(\Yii::$app->user->id,'reconsume_points', -abs($this->_payAmount),['DEAL_TYPE_ID' => DealType::RECONSUME_POINTS_EXCHANGE,'REMARK' => '会员复销积分兑换']);
         }
 
+//        if($this->_remainPv>0) {
+//            $oRemainPv = RemainPv::find()->where(['USER_ID' => $userId])->one();
+//
+//            $transactionRemain = \Yii::$app->db->beginTransaction();
+//            try{
+//                $flowRemainPvModel = new FlowRemainPv();
+//                $flowRemainPvModel->ID = $this->_generateSn();
+//                $flowRemainPvModel->USER_ID = $userId;
+//                $flowRemainPvModel->REMAIN_PV_FLOW = $this->_remainPv;
+//                $flowRemainPvModel->REMAIN_PV_TOTAL = $oRemainPv['REMAIN_PV'] + $this->_remainPv;
+//                $flowRemainPvModel->PERIOD_NUM = $nowPeriodNum;
+//                $flowRemainPvModel->UPDATED_AT = Date::nowTime();
+//                $flowRemainPvModel->ORDER_SN = 'OS'.$ordNo;
+//                if(!$flowRemainPvModel->save()){
+//                    $this->addErrors($flowRemainPvModel->getErrors());
+//                    return false;
+//                }
+//
+//                $oRemainPv = RemainPv::find()->where(['USER_ID' => $userId])->one();
+//                if($oRemainPv){
+//                    $oRemainPv->updateCounters(['REMAIN_PV'=>$this->_remainPv]);
+//                }else{
+//                    $remainPvModel = new RemainPv();
+//                    $remainPvModel->ID = $this->_generateSn();
+//                    $remainPvModel->USER_ID = $userId;
+//                    $remainPvModel->UPDATED_AT = Date::nowTime();
+//                    $remainPvModel->REMAIN_PV = $this->_remainPv;
+//                    $remainPvModel->STATUS = 1;
+//                    if(!$remainPvModel->save()){
+//                        $this->addErrors($remainPvModel->getErrors());
+//                        return false;
+//                    }
+//                }
+//                $transactionRemain->commit();
+//            } catch (Exception $e) {
+//                $transactionRemain->rollBack();
+//                $this->addError('add', $e->getMessage());
+//                return null;
+//            }
+//        }
         return $orderModel;
     }
 
@@ -871,7 +942,7 @@ class OrderForm extends Model
         $orderModel->STATUS = 1;
         $orderModel->CREATED_AT = Date::nowTime();
         $orderModel->CREATE_USER = $loginUserName;
-        $orderModel->EMAIL = $email?$email:'tt@qq.com';
+        $orderModel->EMAIL = $email;
         if(!$orderModel->save()){
             $this->addErrors($orderModel->getErrors());
             return false;
@@ -916,4 +987,28 @@ class OrderForm extends Model
         }
         return $hash;
     }
+
+    public function addFakeOrder($userId, $periodNum){
+        $userName = Info::getUserNameByUserId($userId);
+        $ordNo = $this->_generateSn();
+        $orderModel = new Order();
+        $orderModel->SN = 'OS'.$ordNo;
+        $orderModel->DEC_SN = 'DS'.$ordNo;
+        $orderModel->USER_ID = $userId;
+        $orderModel->USER_NAME = $userName;
+        $orderModel->PERIOD_NUM = $periodNum;
+        $orderModel->CREATE_USER = 'FAKE';
+        $orderModel->ORDER_TYPE = 'FO';
+        $orderModel->STATUS = 1;
+        $orderModel->PV = 30;
+        $orderModel->PAY_PV = 30;
+        $orderModel->P_CALC_MONTH = '1970-01-01';
+        $orderModel->CREATED_AT = Date::nowTime();
+        $orderModel->EXPRESS_TYPE = 1;
+        if(!$orderModel->save()){
+            $this->addErrors($orderModel->getErrors());
+            return false;
+        }
+        return $orderModel;
+    }
 }

+ 7 - 3
common/models/forms/ShopGoodsForm.php

@@ -22,6 +22,7 @@ class ShopGoodsForm extends Model
     public $sellDiscount;
     public $giftType;
     public $sellType;
+    public $pvSplit;
     public $goodsNo;
     public $unit;
     public $taxRate;
@@ -73,7 +74,8 @@ class ShopGoodsForm extends Model
             'sellDiscount' => 'Discount Rate', // 会员折扣
             'giftType' => 'Product Type', // 商品类型
             'categoryType' => 'Product Category', // 商品分类
-            'sellType' => 'SellType', //出售方式
+            'sellType' => 'SellType', // 出售方式
+            'pvSplit' => 'PV Split', // pv分期
             'goodsNo' => 'Product Code', // 产品编号
             'unit' => 'Unit', // 单位
             'cover' => 'Cover',// 封面
@@ -97,8 +99,8 @@ class ShopGoodsForm extends Model
     {
         $parentScenarios =  parent::scenarios();
         $customScenarios = [
-            'add' => ['goodsName','sellDiscount','giftType', 'sellType','goodsNo','unit','sellPrice','marketPrice','pricePv','storeNums', 'content','sort','cover', 'categoryType', 'sellPriceStandard', 'taxRate', 'taxAmount'],
-            'edit' => ['id','goodsName','sellDiscount','giftType', 'sellType','goodsNo','unit','sellPrice','marketPrice','pricePv', 'storeNums', 'content','sort','cover', 'categoryType', 'sellPriceStandard', 'taxRate'],
+            'add' => ['goodsName','sellDiscount','giftType', 'sellType','goodsNo','unit','sellPrice','marketPrice','pricePv','storeNums', 'content','sort','cover', 'categoryType', 'sellPriceStandard', 'taxRate', 'taxAmount','pvSplit'],
+            'edit' => ['id','goodsName','sellDiscount','giftType', 'sellType','goodsNo','unit','sellPrice','marketPrice','pricePv', 'storeNums', 'content','sort','cover', 'categoryType', 'sellPriceStandard', 'taxRate','pvSplit'],
             'changeStatus' => ['selectedIds', 'status'],
         ];
         return array_merge($parentScenarios, $customScenarios);
@@ -198,6 +200,7 @@ class ShopGoodsForm extends Model
             $shopGoods->GIFT_TYPE = implode(',',$this->giftType);
 //             $shopGoods->SELL_TYPE = implode(',',$this->sellType);
             $shopGoods->SELL_TYPE = $this->sellType;
+            $shopGoods->PV_SPLIT = $this->pvSplit;
             $shopGoods->GOODS_NO = $this->goodsNo;
             $shopGoods->UNIT = $this->unit ? $this->unit : '个';
             $shopGoods->COVER = $this->cover ? $this->cover : '';
@@ -245,6 +248,7 @@ class ShopGoodsForm extends Model
             $model->GIFT_TYPE = implode(',',$this->giftType);
 //            $model->SELL_TYPE = implode(',',$this->sellType);
             $model->SELL_TYPE = $this->sellType;
+            $model->PV_SPLIT = $this->pvSplit;
             $model->GOODS_NO = $this->goodsNo;
             $model->UNIT = $this->unit ? $this->unit : '个';
             $model->COVER = $this->cover ? $this->cover : '';

+ 2 - 2
frontendApi/config/menu.php

@@ -86,8 +86,8 @@ return [
             ['name'=>'申请提现', 'class'=>'', 'icon'=>'', 'controller'=>'finance', 'action'=>'withdraw-add', 'routePath'=>'finance/withdraw-add', 'show'=>0,],
             ['name'=>'Recharge details', 'class'=>'', 'icon'=>'', 'controller'=>'finance', 'action'=>'recharge', 'routePath'=>'finance/recharge', 'show'=>1,],//充值明细
             ['name'=>'Apply for recharge', 'class'=>'', 'icon'=>'', 'controller'=>'finance', 'action'=>'recharge-add', 'routePath'=>'finance/recharge-add', 'show'=>0,], // 申请充值
-            ['name'=>'Transfer record list', 'class'=>'', 'icon'=>'', 'controller'=>'finance', 'action'=>'transfer-list', 'routePath'=>'finance/transfer-list', 'show'=>1,'allow'=>'transferRecordSwitch'],
-            ['name'=>'Apply for Transfer', 'class'=>'', 'icon'=>'', 'controller'=>'finance', 'action'=>'transfer-add', 'routePath'=>'finance/transfer-add', 'show'=>1,'allow'=>'transferSwitch'], // 我要转账
+            ['name'=>'Transfer details', 'class'=>'', 'icon'=>'', 'controller'=>'finance', 'action'=>'transfer-list', 'routePath'=>'finance/transfer-list', 'show'=>1,'allow'=>'transferRecordSwitch'],
+            ['name'=>'Apply for Transfer', 'class'=>'', 'icon'=>'', 'controller'=>'finance', 'action'=>'transfer-add', 'routePath'=>'finance/transfer-add', 'show'=>0,'allow'=>'transferSwitch'], // 我要转账
         ]
     ],
 //    'finance'=>[

+ 5 - 0
frontendApi/modules/v1/controllers/DashboardController.php

@@ -19,6 +19,7 @@ use common\models\CalcBonus;
 use common\models\FlowBonus;
 use common\models\Period;
 use common\models\ReconsumePool;
+use common\models\RemainPv;
 
 class DashboardController extends BaseController
 {
@@ -93,6 +94,9 @@ class DashboardController extends BaseController
             12 => 'Dec',
         ];
 
+        //剩余分期PV显示
+        $myRemainPv = RemainPv::findOne(['USER_ID'=>$baseInfo['ID']])->REMAIN_PV ?? 0;
+
         return static::notice([
             'nowTime' => $nowTime,
             'empLv'=>$empLv,
@@ -103,6 +107,7 @@ class DashboardController extends BaseController
             'news'=>$news,
 //            'periodNum'=>'Period '.$periodNum.' ,'.$curYM['CALC_MONTH'].'月第'.$wkrd.'周,共'.$weeks.'周',
             'periodNum'=>$periodNum.' ,'.$wkrd.' period  of '. $monthArray[$curYM['CALC_MONTH']],
+            'myRemainPv'=>$myRemainPv
         ]);
     }
 

+ 2 - 0
frontendApi/modules/v1/controllers/ShopController.php

@@ -318,6 +318,8 @@ class ShopController extends BaseController {
             $value['TAX_AMOUNT'] = Tool::calculateTax($value['REAL_PRICE'], floatval($value['TAX_RATE']), intval($value['BUY_NUMS']));
             $value['STATUS'] = \Yii::$app->params['orderStatus'][$value['STATUS']]['label'] ?? '';
             $value['CREATED_AT'] = $value['CREATED_AT'] ? Date::convert($value['CREATED_AT'],'Y-m-d H:i:s') : '';
+            $value['REAL_PV'] = Tool::formatPrice($value['REAL_PV'] * $value['BUY_NUMS']);
+            $value['TOTAL_AMOUNT'] = Tool::formatPrice($value['REAL_PRICE'] * $value['BUY_NUMS']);
         }
 
         return static::notice($data);

+ 2 - 2
frontendEle/src/router/index.js

@@ -455,7 +455,7 @@ export const constantRouterMap = [
         component: _import('finance/transfer-list'),
         name: 'finance_transfer-list',
         meta: {
-          title: 'Tranfer record',
+          title: 'Transfer',
           breadcrumb: [
             {title: 'Dashboard', path: '/dashboard/index'},
             {title: 'Financial management', path: '/finance/index'},
@@ -467,7 +467,7 @@ export const constantRouterMap = [
         component: _import('finance/transfer-add'),
         name: 'finance_transfer-add',
         meta: {
-          title: 'Transfer list',
+          title: 'Transfer',
           highLight: '/finance/transfer-list',
           breadcrumb: [
             {title: 'Dashboard', path: '/dashboard/index'},

BIN
frontendEle/src/static/img/simple-img.jpg


+ 5 - 5
frontendEle/src/views/article/list.vue

@@ -7,11 +7,11 @@
             <router-link :to="`/article/detail/${scope.row.ID}`">{{scope.row.TITLE}}</router-link>
           </template>
         </el-table-column>
-        <el-table-column label="Classification">
-          <template slot-scope="scope">
-            {{allData.allCategory[scope.row.CID].CATE_NAME}}
-          </template>
-        </el-table-column>
+<!--        <el-table-column label="Classification">-->
+<!--          <template slot-scope="scope">-->
+<!--            {{allData.allCategory[scope.row.CID].CATE_NAME}}-->
+<!--          </template>-->
+<!--        </el-table-column>-->
         <el-table-column label="Creation Time">
           <template slot-scope="scope">
             {{tool.formatDate(scope.row.CREATED_AT)}}

+ 2 - 2
frontendEle/src/views/config/receive-address-list.vue

@@ -16,11 +16,11 @@
           </template>
         </el-table-column>
 
-        <el-table-column fixed="right" label="Edit/Delete" width="180"><!-- 操作 -->
+        <el-table-column fixed="right" label="Action" width="180"><!-- 操作 -->
           <template slot-scope="scope">
             <el-dropdown size="small" trigger="click">
               <el-button type="primary" size="small" @click.stop="">
-                Edit/Delete<!-- 操作该数据 --><i class="el-icon-arrow-down el-icon--right"></i>
+                Action<!-- 操作该数据 --><i class="el-icon-arrow-down el-icon--right"></i>
 
               </el-button>
               <el-dropdown-menu slot="dropdown">

+ 4 - 1
frontendEle/src/views/dashboard/index.vue

@@ -17,6 +17,7 @@
               </el-col><!--聘级-->
               <el-col :xs="24" :sm="24" :md="24" :lg="4" :xl="12">Member Level:{{decLvName}}</el-col><!--会员级别-->
               <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="12">Current Period:{{periodNum}}</el-col><!--当前业绩期-->
+              <el-col :xs="24" :sm="24" :md="24" :lg="8" :xl="12">Remain BV:{{myRemainPv}}</el-col><!--剩余的PV-->
             </el-row>
           </el-col>
         </el-row>
@@ -88,6 +89,7 @@
         this.news = response.news
         this.periodNum = response.periodNum
         this.decLvName = response.decLvName
+        this.myRemainPv = response.myRemainPv
         this.loading = false
         this.imgLoad()
         return network.getData(`dashboard/bonus-num`)
@@ -120,6 +122,7 @@
         news: [],
         periodNum: '',
         decLvName: '',
+        myRemainPv: '',
         bannerHeight: '',
       }
     },
@@ -156,7 +159,7 @@
         }
       },
       imageArticle(imageUrl) {
-        return imageUrl.indexOf('http') > -1 ? imageUrl : SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + imageUrl;
+        return SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + imageUrl;
       },
     }
   }

+ 3 - 2
frontendEle/src/views/finance/recharge.vue

@@ -73,6 +73,7 @@ import tool from '@/utils/tool'
 import LeoFilter from '@/components/Filter'
 import LeoUploader from '@/components/Uploader'
 import Pagination from '@/components/Pagination'
+import {SERVER_API_HTTP_TYPE,SERVER_API_DOMAIN} from '@/utils/config'
 export default {
   name: 'recharge',
   components: {LeoFilter, LeoUploader, Pagination},
@@ -145,7 +146,7 @@ export default {
       this.$router.push({path: `/finance/recharge-add`})
     },
     handlePictureCardPreview (file) {
-      this.dialogImageUrl = file.url;
+      this.dialogImageUrl = SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + file.url;
       this.dialogVisible = true;
       this.file = file;
       // console.log(file);
@@ -200,7 +201,7 @@ export default {
         this.dialogInvoiceLoading = false
         let invoiceUrl = response.list;
         // console.log(row)
-        this.urlimg = row.BANK_PROVE
+        this.urlimg = SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + row.BANK_PROVE
         this.auditId = row.ID
       })
     },

+ 1 - 1
frontendEle/src/views/finance/transfer-list.vue

@@ -30,7 +30,7 @@
         <el-table-column label="Remark" prop="REMARK"></el-table-column> <!-- 备注 -->
       </el-table>
       <div class="white-box-footer">
-        <!--<el-button type="primary" size="small" @click="handleAdd">我要转账</el-button>-->
+        <el-button type="primary" size="small" @click="handleAdd">Apply for Transfer</el-button><!--我要转账-->
         <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
       </div>
     </div>

+ 3 - 2
frontendEle/src/views/shop/dec-order-list.vue

@@ -4,11 +4,12 @@
             <el-table class="withdraw-table" :data="tableData" :max-height="maxHeight" style="width: 100%;" :span-method="objectSpanMethod">
 				        <el-table-column width="120" label="Product code" prop="SKU_CODE"></el-table-column><!--商品编号-->
                 <el-table-column width="120" label="Product Name" prop="GOODS_TITLE"></el-table-column><!--商品名称-->
+                <el-table-column width="120" label="Product Price" prop="REAL_PRICE"></el-table-column><!--报单金额-->
+                <el-table-column width="120" label="Product BV" prop="REAL_PV"></el-table-column><!--报单BV-->
                 <el-table-column width="120" label="Qty" prop="BUY_NUMS"></el-table-column><!--数量-->
-                <el-table-column width="120" label="Price" prop="REAL_PRICE"></el-table-column><!--报单金额-->
-                <el-table-column width="120" label="BV" prop="REAL_PV"></el-table-column><!--报单BV-->
                 <el-table-column width="120" label="Tax rate" prop="TAX_RATE"></el-table-column><!--税率-->
                 <el-table-column width="120" label="Tax" prop="TAX_AMOUNT"></el-table-column><!--税额-->
+                <el-table-column width="120" label="Total Price" prop="TOTAL_AMOUNT"></el-table-column><!--总计金额-->
                 <el-table-column width="120" label="Code" prop="DEC_SN"></el-table-column><!--报单编号-->
                 <el-table-column width="120" label="Order code" prop="ORDER_SN"></el-table-column><!--订单编号-->
                 <el-table-column width="120" label="Member code" prop="USER_NAME"></el-table-column><!--会员编号-->

+ 3 - 5
frontendEle/src/views/shop/index.vue

@@ -17,14 +17,14 @@
 
                       </el-table-column>
 
-                      <el-table-column label="Product picture" ><!--图片-->
+                      <el-table-column label="Product Picture" ><!--图片-->
                         <template slot-scope="scope">
 <!--                          <img :src="scope.row.COVER" alt="" style="width:100px" >-->
                           <el-image style="width: 100px; height: 100px" :src="scope.row.COVER" :preview-src-list="[scope.row.COVER]"></el-image>
                         </template>
                       </el-table-column>
 
-                      <el-table-column label="Product price" prop="SELL_PRICE"><!--商品价格-->
+                      <el-table-column label="Product Price" prop="SELL_PRICE"><!--商品价格-->
                           <template slot-scope="scope">
                               <span>{{ Math.round(scope.row.SELL_PRICE * 100) / 100 }}</span>
                           </template>
@@ -269,9 +269,7 @@ export default {
                                     break;
                                 }
                             }
-                            if (obj.tableData[i].COVER.indexOf('/') === -1) {
-                              obj.tableData[i].COVER = SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + obj.tableData[i].COVER
-                            }
+                            obj.tableData[i].COVER = SERVER_API_HTTP_TYPE + SERVER_API_DOMAIN + '/uploads/' + obj.tableData[i].COVER
                         }
                         obj.selectLock = false;
                     })

+ 26 - 0
sql/upgrade/1350.sql

@@ -34,3 +34,29 @@ CREATE TABLE `AR_CALC_BONUS_QUARTER`  (
   `CREATED_AT` datetime(0) NOT NULL,
   PRIMARY KEY (`ID`) USING BTREE
 ) ENGINE = InnoDB AUTO_INCREMENT = 2005 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
+
+DROP TABLE IF EXISTS `AR_QTR_CALC_WEIGHT`;
+CREATE TABLE `AR_QTR_CALC_WEIGHT`  (
+    `ID` int(11) NOT NULL AUTO_INCREMENT,
+    `USER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+    `MAX_SORT` int(11) NULL DEFAULT NULL,
+    `WEIGHT` decimal(16, 3) NULL DEFAULT NULL,
+    `PERIOD_NUM` int(11) NULL DEFAULT NULL,
+    `CALC_MONTH` int(11) NULL DEFAULT NULL,
+    `CALC_YEAR` int(11) NULL DEFAULT NULL,
+    PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 512 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
+
+DROP TABLE IF EXISTS `AR_QTR_CALC_SCORE`;
+CREATE TABLE `AR_QTR_CALC_SCORE`  (
+    `ID` int(11) NOT NULL AUTO_INCREMENT,
+    `USER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+    `CNT` int(11) NOT NULL,
+    `SCORE` decimal(16, 3) NOT NULL,
+    `CALC_MONTH` int(11) NULL DEFAULT NULL,
+    `CALC_YEAR` int(11) NULL DEFAULT NULL,
+    PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 256 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
+
+alter table `AR_CALC_BONUS` add column ORI_BONUS_QUARTER decimal(16,2) not null default 0.00 comment "季度奖-原奖金";
+alter table `AR_CALC_BONUS` add column BONUS_QUARTER decimal(16,2) not null default 0.00 comment "季度奖";

+ 26 - 0
sql/upgrade/1540.sql

@@ -0,0 +1,26 @@
+alter table `AR_ORDER` add column REMAIN_PV decimal(16,2) not null default 0.00 comment "当期未计入的剩余PV";
+alter table `AR_ORDER_GOODS` add column REMAIN_PV decimal(16,2) not null default 0.00 comment "当期未计入的剩余PV";
+
+alter table `AR_APPROACH_ORDER` add column REMAIN_PV decimal(16,2) not null default 0.00 comment "当期未计入的剩余PV";
+
+ALTER TABLE `AR_SHOP_GOODS` ADD COLUMN PV_SPLIT TINYINT NOT NULL DEFAULT 0 COMMENT "是否BV分期";
+
+CREATE TABLE `AR_REMAIN_PV`  (
+  `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+  `USER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+  `REMAIN_PV` decimal(16, 2) NULL DEFAULT NULL,
+  `UPDATED_AT` int(10) NOT NULL,
+  `STATUS` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+  PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
+
+CREATE TABLE `AR_FLOW_REMAIN_PV`  (
+  `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+  `USER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+  `REMAIN_PV_FLOW` decimal(16, 2) NULL DEFAULT NULL,
+  `REMAIN_PV_TOTAL` decimal(16, 2) NULL DEFAULT NULL,
+  `PERIOD_NUM` int(11) NOT NULL,
+  `UPDATED_AT` int(10) NOT NULL,
+  `ORDER_SN` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+  PRIMARY KEY (`ID`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

+ 1 - 0
sql/upgrade/2022_08_05_1866.sql

@@ -0,0 +1 @@
+ALTER TABLE `AR_ARTICLE` ADD COLUMN `SORT` tinyint NOT NULL DEFAULT 10 COMMENT '排序值' AFTER `STATUS`;

+ 133 - 0
sql/upgrade/QTRCALC.sql

@@ -0,0 +1,133 @@
+CREATE DEFINER=`black_tea_0309`@`%` PROCEDURE `QTRCALC`(IN `PCPID` INT)
+LABEL: BEGIN
+-- DECLARE QTRSTARTPID, QTRSTARTMONTH, THISYEAR, THISMONTH, MISMONTH INT;
+
+DECLARE TBONUS,BONUSPERU DECIMAL; -- 奖金总额,每份奖金
+DECLARE QTRSTARTMONTH, THISYEAR, THISMONTH, MISMONTH INT; -- 这个月
+
+-- DECLARE OCROWN1NUM,OCROWN2NUM,OCROWN3NUM,OCROWN4NUM,OCROWN5NUM,OCROWN6NUM,OCROWN7NUM INT; -- 各星级的人数,原始不加权
+-- DECLARE  CROWN1U, CROWN2U, CROWN3U, CROWN4U, CROWN5U, CROWN6U, CROWN7U INT; -- 各星级的人数(加权)
+
+DECLARE TOTALU INT; -- 加权的总份数
+
+DECLARE MAXID, USERTBID INT;
+DECLARE Q, R INT;
+
+START TRANSACTION;
+-- 日志;
+DELETE FROM AR_QTR_CALC_RECORD ;
+CALL QTRCALCRECORD(-1,'开始',PCPID,NOW());
+COMMIT;
+
+CALL QTRCLEAN(PCPID);
+CALL QTRCALCRECORD(1,'清除数据',PCPID,NOW());
+COMMIT;
+
+SELECT
+ CALC_YEAR, CALC_MONTH, IS_MONTH INTO THISYEAR, THISMONTH, MISMONTH FROM AR_PERIOD WHERE PERIOD_NUM = PCPID;
+
+CALL QTRCALCRECORD(2,'初始化',PCPID,NOW());
+COMMIT;
+
+-- 查看是否季度结
+
+IF(THISMONTH!=3 AND THISMONTH!=6 AND THISMONTH!=9 AND THISMONTH!=12) OR MISMONTH!=1 THEN
+  CALL QTRCALCRECORD(12,'非季结,结束',PCPID,NOW());
+	COMMIT;
+  LEAVE LABEL;
+END IF;
+
+CALL QTRCALCRECORD(3,'计算总奖金',PCPID,NOW());
+COMMIT;
+
+-- 按照条件,查询当前季度所有月的总PV,计算总奖金
+SET QTRSTARTMONTH = THISMONTH - 2;
+
+SELECT 
+   SUM(PV_PCS) * 0.02 
+INTO TBONUS
+  FROM AR_PERF_MONTH 
+WHERE CALC_MONTH >= CONCAT(THISYEAR, lpad(QTRSTARTMONTH,2,0)) AND CALC_MONTH <= CONCAT(THISYEAR, lpad(THISMONTH,2,0));
+
+CALL QTRCALCRECORD(4,'计算总人数及加权',PCPID,NOW());
+COMMIT;
+
+
+-- 查找,所有星级用户
+INSERT INTO AR_QTR_CALC_WEIGHT
+	SELECT 
+		NULL AS ID,
+		QY.USER_ID,
+		MAX(CL.SORT) AS MAX_SORT,
+		(MAX(CL.SORT) - 1)/2 + 1 AS WEIGHT,
+		PERIOD_NUM,
+		CALC_MONTH,
+		CALC_YEAR
+	FROM
+		AR_CALC_BONUS_QY AS QY
+	 INNER JOIN 
+		AR_CROWN_LEVEL AS CL
+	 ON QY.LAST_CROWN_LV = CL.ID
+	 
+	WHERE
+		QY.LAST_CROWN_LV != (SELECT ID FROM AR_CROWN_LEVEL WHERE SORT = 0)
+
+	GROUP BY USER_ID, CALC_MONTH;
+
+COMMIT;
+
+INSERT INTO AR_QTR_CALC_SCORE
+	SELECT
+		NULL AS ID,
+		USER_ID, 
+		COUNT(*) AS CNT,
+		SUM(WEIGHT) AS SCORE,
+		CALC_MONTH,
+		CALC_YEAR
+	FROM 
+		AR_QTR_CALC_WEIGHT
+	GROUP BY USER_ID;
+
+COMMIT;
+	
+SELECT SUM(SCORE) INTO TOTALU FROM AR_QTR_CALC_SCORE;
+
+SET BONUSPERU = TBONUS / TOTALU;
+
+
+CALL QTRCALCRECORD(5,'计算每一份奖金',PCPID,NOW());
+COMMIT;
+
+
+
+INSERT INTO AR_QTR_CALC_USER
+	SELECT 
+		NULL AS ID,
+		SC.USER_ID,
+		BONUSPERU * SC.SCORE AS AMOUNT,
+		CALC_YEAR,
+		CALC_MONTH,
+		PCPID AS PERIOD_NUM
+	FROM
+		AR_QTR_CALC_SCORE AS SC;
+
+
+INSERT INTO AR_CALC_BONUS_QUARTER
+	SELECT
+		NULL AS ID,
+		USER_ID,
+		AMOUNT AS ORI_BONUS,
+		0 AS MANAGE_TAX,
+		AMOUNT,
+		0 AS RECONSUME_POINTS,
+		CALC_YEAR, 
+		CALC_MONTH, 
+		PERIOD_NUM,
+		NOW() AS CREATE_AT
+	FROM
+		AR_QTR_CALC_USER;
+
+CALL QTRCALCRECORD(20,'写入季度奖金表',PCPID,NOW());
+COMMIT;	
+
+END

+ 14 - 0
sql/upgrade/QTRCLEAN.sql

@@ -0,0 +1,14 @@
+CREATE DEFINER=`black_tea_0309`@`%` PROCEDURE `QTRCLEAN`(IN `PCPID` INT)
+BEGIN-- 删除当期奖金
+	DELETE 
+	FROM
+		AR_CALC_BONUS_QUARTER
+	WHERE
+		PERIOD_NUM >= PCPID;
+  TRUNCATE
+		AR_QTR_CALC_USER;
+	TRUNCATE
+		AR_QTR_CALC_WEIGHT;
+	TRUNCATE
+		AR_QTR_CALC_SCORE;
+END

+ 3 - 1
sql/upgrade/star_to_crown.sql

@@ -12,4 +12,6 @@ ALTER TABLE AR_FLOW_GARAGE_POINTS CHANGE LAST_STAR_LV LAST_CROWN_LV VARCHAR(32);
 
 ALTER TABLE AR_FLOW_VILLA_POINTS CHANGE LAST_STAR_LV LAST_CROWN_LV VARCHAR(32);
 
-ALTER TABLE AR_STAR_LEVEL RENAME TO AR_CROWN_LEVEL;
+ALTER TABLE AR_STAR_LEVEL RENAME TO AR_CROWN_LEVEL;
+
+ALTER TABLE AR_USER CHANGE STAR_LV CROWN_LV VARCHAR(32);