Ver Fonte

Merge branch 'new-version' into feature/1347-dd-userUpgrade

root há 3 anos atrás
pai
commit
59a545baec

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

@@ -1078,7 +1078,7 @@ class UserController extends BaseController
         $allNation = Yii::$app->params['nation'];
         // 所有开户行
         $allOpenBank = OpenBank::findAllAsArray('STATUS=1');
-        if (!$userName = Info::generateUserName('KD')) {
+        if (!$userName = Info::generateUserName('CQ',9)) {
             return static::notice('会员编号生成失败', 400);
         }
         return static::notice(['allDecRole' => $allDecRole, 'allNation' => $allNation, 'allOpenBank' => $allOpenBank, 'userName' => $userName]);

+ 35 - 0
backendApi/modules/v1/models/Admin.php

@@ -100,6 +100,41 @@ class Admin extends ActiveRecord
         return \Yii::$app->security->validatePassword($password, $this->PASSWORD_HASH);
     }
 
+    /**
+     * verificationPassword
+     *
+     * @param string $password password to validate
+     * @return bool if password provided is valid for current user
+     */
+    public function verificationPassword($password,$scenario,$model)
+    {
+        // 判断密码长度不能少于8位
+        if (strlen($password) < 8){
+            return [ 'code' => 1000, 'type' => $scenario , 'message' => '登录密码不能小于8位' ];
+        }
+
+        // 判断密码中数字、大写字母、小写字母、特殊字符至少三种
+        $symbol = '`~!@#$^&*()=|{}\'\":;\',\\[\\].<>\/?~!@#¥……&*()——|{}【】‘;:”。,、?';
+        // $requiredRules = '/^(?![\d]+$)(?![a-z]+$)(?![A-Z]+$)(?!['.$symbol.']+$)[\da-zA-z'.$symbol.']{8,}$/';   // 这是两种的正则
+        $requiredRules = '/^(?![\da-z]+$)(?![\dA-Z]+$)(?![\d'.$symbol.']+$)(?![a-zA-Z]+$)(?![a-z'.$symbol.']+$)(?![A-Z'.$symbol.']+$)[\da-zA-z'.$symbol.']{8,}$/';
+        $requiredHandleResults = preg_match($requiredRules,$password);
+        if (!$requiredHandleResults){
+            return [ 'code' => 1000, 'type' => $scenario , 'message' => '登录密码中需要包含数字、大写字母、小写字母、特殊字符至少三种' ];
+        }
+
+        // 判断有三位以上重复性
+        if(preg_match('/(\w)*(\w)\1{2}(\w)*/',$password)) {
+            return [ 'code' => 1000, 'type' => $scenario , 'message' => '登录密码中数字、大写字母、小写字母不能连续重复三个以上' ];
+        }
+
+        // 判断密码中不能出现登录账号
+        if (strpos($password, $model->ADMIN_NAME) !== false){
+            return [ 'code' => 1000, 'type' => $scenario , 'message' => '登录密码中不允许出现管理员的登录账号信息' ];
+        }
+
+        return [ 'code' => 200, 'type' => $scenario , 'message' => '验证通过了' ];
+    }
+
     /**
      * 根据用户名查找
      * @param $username

+ 5 - 10
backendApi/modules/v1/models/AdminForm.php

@@ -134,19 +134,14 @@ class AdminForm extends Model
         // 给密码进行加密 ,如果需要添加验证密码安全验证时 ,可以在这个地方加
         if($this->password){
             if ($this->scenario == 'changePassword' || $this->scenario == 'noLoginModifyPassword'){
-                if (strlen($this->password) < 8){
-                    $this->addError($this->scenario, '登录密码不能小于8位');
+                // 进行规则的判断
+                $message = $model->verificationPassword($this->password,$this->scenario,$model);
+                if ( $message['code'] != 200 ){
+                    $this->addError($message['type'], $message['message']);
                     return null;
                 }
-//               $symbol = '!#$%^&*';
-               $symbol = '`~!@#$^&*()=|{}\'\":;\',\\[\\].<>\/?~!@#¥……&*()——|{}【】‘;:”。,、?';
-               $passwordRules = '/^(?![\d]+$)(?![a-z]+$)(?![A-Z]+$)(?!['.$symbol.']+$)[\da-zA-z'.$symbol.']{8,}$/';
-               $verificationResults = preg_match($passwordRules,$this->password);
-               if (!$verificationResults){
-                   $this->addError($this->scenario, '登录密码中需要包含数字、大写字母、小写字母、特殊字符至少两种');
-                   return null;
-               }
             }
+
             $model->PASSWORD_HASH = \Yii::$app->security->generatePasswordHash($this->password);
         }
 

+ 3 - 0
common/helpers/user/Info.php

@@ -444,6 +444,9 @@ class Info {
      */
     public static function generateUserName(string $prefix = 'HZ', int $length = 10) {
         $result = Tool::randomString($length, $prefix).array_rand([0,1,2,3,5,6,7,8,9],1);
+        if(substr($result,-1) == '4'){
+            return self::generateUserName($prefix, $length);
+        }
         if (User::find()->where('USER_NAME=:USER_NAME', [':USER_NAME' => $result])->exists()) {
             return self::generateUserName($prefix, $length);
         }

+ 92 - 0
common/models/CalcBonusBsDetail.php

@@ -0,0 +1,92 @@
+<?php
+
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "{{%CALC_BONUS_BS_DETAIL}}".
+ */
+class CalcBonusBsDetail extends \common\components\ActiveRecord
+{
+    /**
+     * @inheritdoc
+     */
+    public static function tableName()
+    {
+        return '{{%CALC_BONUS_BS_DETAIL}}';
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function rules()
+    {
+        return [
+            [['USER_ID', 'PERIOD_NUM', 'CALC_MONTH', 'CALCULATED_AT', 'CREATED_AT'], 'required'],
+            [['AMOUNT', 'ORI_BONUS', 'MANAGE_TAX'], 'number'],
+            [['LAST_STATUS', 'PERIOD_NUM', 'CALC_MONTH', 'CALCULATED_AT', 'CREATED_AT', 'LAST_FROM_STATUS'], 'integer'],
+            [['ID', 'USER_ID', 'LAST_DEC_LV', 'LAST_EMP_LV', 'FROM_USER_ID',  'LAST_FROM_DEC_LV', 'LAST_FROM_EMP_LV'], 'string', 'max' => 32],
+            [['LOGS'], 'string', 'max' => 2000],
+            [['ID'], 'unique'],
+        ];
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function attributeLabels()
+    {
+        return [
+            'ID' => 'ID',
+            'USER_ID' => '会员ID',
+            'INTRODUCER_ID' => '推荐人的ID',
+            'LAST_DEC_LV' => 'LAST_DEC_LV',
+            'LAST_EMP_LV' => 'LAST_EMP_LV',
+            'LAST_STATUS' => '结算时状态',
+            'LEVEL_ID' => '当期蓝星会员最新聘级.聘级ID',
+            'ORI_BONUS' => '原奖金 包含管理费的奖金',
+            'MANAGE_TAX' => '管理费, 原奖金-管理费=实际总收入',
+            'AMOUNT' => '期实际总收入,发给用户的实际金额,BONUS=BONUS10+……+BONUS90',
+            'PRODUCT_POINT' => '兑换积分,如果本人有小组业绩(GPV),同时没有任何奖金,则把这个业绩*12%换成积分',
+            'PERIOD_NUM' => '结算期数',
+            'CALC_YEAR' => '结算年',
+            'CALC_MONTH' => '结算月',
+            'P_CALC_MONTH' => '结算年月日',
+            'CREATED_AT' => '创建时间',
+            'LAYER' => 'LAYER',
+            'PV' => 'PV',
+            'GPV10' => 'GPV10',
+            'GPV' => 'GPV',
+            'GPV_4_CALC' => 'GPV_4_CALC',
+            'USER_TYPE10' => 'USER_TYPE10',
+            'USER_TYPE' => 'USER_TYPE',
+            'BONUS10' => 'BONUS10',
+            'BONUS20' => 'BONUS20',
+            'BONUS30' => 'BONUS30',
+            'BONUS40' => 'BONUS40',
+            'BONUS50' => 'BONUS50',
+            'BONUS60' => 'BONUS60',
+            'BONUS70' => 'BONUS70',
+            'BONUS80' => 'BONUS80',
+            'BONUS90' => 'BONUS90',
+            'BONUS100' => 'BONUS100',
+            'BONUS110' => 'BONUS110',
+        ];
+    }
+
+    // 判断用户是否是无聘级,并且oribonus大于0
+    public static function isCommonShare($userId, $periodNum, $levelId) {
+        $isCommon = CalcBonusBsDetail::find()
+        ->where(
+            'USER_ID=:USER_ID AND PERIOD_NUM=:PERIOD_NUM  AND LEVEL_ID=:LEVEL_ID  AND ORI_BONUS>0',
+            [':USER_ID'=>$userId,':PERIOD_NUM'=>$periodNum,':LEVEL_ID'=>$levelId]
+        )->asArray()
+        ->one();
+        if (!empty($isCommon)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+}

+ 50 - 0
common/models/User.php

@@ -311,6 +311,56 @@ class User extends \common\components\ActiveRecord
         return password_verify($password, $this->PASSWORD_HASH);
     }
 
+    /**
+     * verificationPassword
+     *
+     * @param string $password password to validate
+     * @return bool if password provided is valid for current user
+     */
+    public function verificationPassword($password,$scenario,$model)
+    {
+        // 判断密码长度不能少于8位
+        if (strlen($password) < 8){
+            return [ 'code' => 1000, 'type' => $scenario , 'message' => '登录密码不能小于8位' ];
+        }
+
+        // 判断密码中数字、大写字母、小写字母、特殊字符至少三种
+        $symbol = '`~!@#$^&*()=|{}\'\":;\',\\[\\].<>\/?~!@#¥……&*()——|{}【】‘;:”。,、?';
+        // $requiredRules = '/^(?![\d]+$)(?![a-z]+$)(?![A-Z]+$)(?!['.$symbol.']+$)[\da-zA-z'.$symbol.']{8,}$/';   // 这是两种的正则
+        $requiredRules = '/^(?![\da-z]+$)(?![\dA-Z]+$)(?![\d'.$symbol.']+$)(?![a-zA-Z]+$)(?![a-z'.$symbol.']+$)(?![A-Z'.$symbol.']+$)[\da-zA-z'.$symbol.']{8,}$/';
+        $requiredHandleResults = preg_match($requiredRules,$password);
+        if (!$requiredHandleResults){
+            return [ 'code' => 1000, 'type' => $scenario , 'message' => '登录密码中需要包含数字、大写字母、小写字母、特殊字符至少三种' ];
+        }
+
+        // 判断有三位以上重复性
+        if(preg_match('/(\w)*(\w)\1{2}(\w)*/',$password)) {
+            return [ 'code' => 1000, 'type' => $scenario , 'message' => '登录密码中数字、大写字母、小写字母不能连续重复三个以上' ];
+        }
+
+        // 判断密码中不能出现登录账号
+        if (strpos($password, $model->USER_NAME) !== false){
+            return [ 'code' => 1000, 'type' => $scenario , 'message' => '登录密码中不允许出现会员登录账号的信息' ];
+        }
+
+        // 判断密码中不能出现会员的手机号
+        if ($model->MOBILE){
+            if (strpos($password, $model->MOBILE) !== false){
+                return [ 'code' => 1000, 'type' => $scenario , 'message' => '登录密码中不允许出现会员的联系方式' ];
+            }
+        }
+
+        // 判断密码中不能出现会员的生日
+        if ($model->ID_CARD && strlen($model->ID_CARD) == 18){
+            $idCard = substr($model->ID_CARD,6,8);
+            if (strpos($password, $idCard) !== false){
+                return [ 'code' => 1000, 'type' => $scenario , 'message' => '登录密码中不允许出现会员的生日' ];
+            }
+        }
+
+        return [ 'code' => 200, 'type' => $scenario , 'message' => '验证通过了' ];
+    }
+
     /**
      * 验证支付密码
      * @param $payPassword

+ 35 - 0
common/models/forms/UserForm.php

@@ -575,6 +575,18 @@ class UserForm extends Model
             $this->addError('modifyPassword', '原登录密码错误');
             return false;
         }
+        if ($this->oldPassword == $this->password) {
+            $this->addError('modifyPassword', '新登录密码不能与原登录密码相同');
+            return false;
+        }
+
+        // 进行规则的判断
+        $message = $model->verificationPassword($this->password,$this->scenario,$model);
+        if ( $message['code'] != 200 ){
+            $this->addError($message['type'], $message['message']);
+            return null;
+        }
+
         $model->PASSWORD_HASH = \Yii::$app->security->generatePasswordHash($this->password);
         if(!$model->save()){
             $this->addErrors($model->getErrors());
@@ -595,6 +607,17 @@ class UserForm extends Model
             $this->addError('modifyPasswordPay', '原支付密码错误');
             return false;
         }
+        if ($this->oldPassword == $this->payPassword) {
+            $this->addError('modifyPasswordPay', '新支付密码不能与原支付密码相同');
+            return false;
+        }
+
+        // 进行规则的判断
+        $message = $model->verificationPassword($this->payPassword,$this->scenario,$model);
+        if ( $message['code'] != 200 ){
+            $this->addError($message['type'], $message['message']);
+            return null;
+        }
         $model->PAY_PASSWORD = \Yii::$app->security->generatePasswordHash($this->payPassword);
         if(!$model->save()){
             $this->addErrors($model->getErrors());
@@ -620,6 +643,18 @@ class UserForm extends Model
             $this->addError('noLoginModifyPassword', '原登录密码错误');
             return false;
         }
+        if ($this->oldPassword==$this->password){
+            $this->addError('noLoginModifyPassword', '新登录密码不能与原登录密码相同');
+            return false;
+        }
+
+        // 进行规则的判断
+        $message = $model->verificationPassword($this->password,$this->scenario,$model);
+        if ( $message['code'] != 200 ){
+            $this->addError($message['type'], $message['message']);
+            return null;
+        }
+
         $model->PASSWORD_HASH = \Yii::$app->security->generatePasswordHash($this->password);
         $model->IS_MODIFY_PASSWORD = 0;
         if(!$model->save()){

+ 15 - 2
frontendApi/modules/v1/controllers/BonusController.php

@@ -16,6 +16,7 @@ use common\helpers\Tool;
 use common\helpers\user\Info;
 use common\helpers\user\Perf;
 use common\models\CalcBonus;
+use common\models\CalcBonusBsDetail;
 use common\models\CalcBonusBT;
 use common\models\CalcBonusFL;
 use common\models\DealType;
@@ -334,11 +335,23 @@ class BonusController extends BaseController {
             ];
         }
         $sysConfig = Cache::getSystemConfig();
-
         if($detailSwitch) {
             $data[] = ['name' => '期数', 'value' => $periodNum];
             $data[] = ['name' => '级别', 'value' => Cache::getDecLevelConfig()[$calcBonus['LAST_DEC_LV']]['LEVEL_NAME']];
-            $data[] = ['name' => '最新聘级', 'value' => Cache::getEmpLevelConfig()[$calcBonus['LAST_EMP_LV']]['LEVEL_NAME']];
+            $isCalcMonth = $period->isCalcMonth($periodNum);
+            // 判断如果是月节点,如果用户是无聘级,则判断是否是同享专员
+            if ($isCalcMonth == 1 && $calcBonus['LAST_EMP_LV'] == EmployLevel::NO_LEVEL_ID) {
+                // 如果ORI_BONUS值大于0,则是同享专员
+                $bsDetail = CalcBonusBsDetail::isCommonShare(\Yii::$app->user->id,$periodNum,EmployLevel::NO_LEVEL_ID);
+                if ($bsDetail) {
+                    $tempEmpName = Cache::getEmpLevelConfig()[$calcBonus['LAST_EMP_LV']]['LEVEL_NAME'];
+                    $data[] = ['name' => '最新聘级', 'value' => $tempEmpName.'(同享专员)'];
+                } else {
+                    $data[] = ['name' => '最新聘级', 'value' => Cache::getEmpLevelConfig()[$calcBonus['LAST_EMP_LV']]['LEVEL_NAME']];
+                }
+            } else {
+                $data[] = ['name' => '最新聘级', 'value' => Cache::getEmpLevelConfig()[$calcBonus['LAST_EMP_LV']]['LEVEL_NAME']];
+            }
             if ($sysConfig['openTG']['VALUE']) {
                 // 销售奖金 就是 原来的推广奖
                 $data[] = ['name' => '销售奖金', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_TG'])];

+ 66 - 16
frontendEle/src/views/shop/dec-order-list.vue

@@ -8,7 +8,7 @@
                 <el-table-column label="报单金额" prop="REAL_PRICE"></el-table-column>
                 <el-table-column label="报单PV" prop="REAL_PV"></el-table-column>
                 <el-table-column label="报单编号" prop="DEC_SN"></el-table-column>
-                <el-table-column label="订单编号" prop="DEC_SN"></el-table-column>
+                <el-table-column label="订单编号" prop="ORDER_SN"></el-table-column>
                 <el-table-column label="会员编号" prop="USER_NAME"></el-table-column>
                 <el-table-column label="会员姓名" prop="REAL_NAME"></el-table-column>
                 <el-table-column label="接点人编号" prop="CON_USER_NAME"></el-table-column>
@@ -48,9 +48,69 @@
                 totalCount: 1,
                 pageSize: 20,
                 tool: tool,
+                //订单号判断
+                spanArr: [], // 用于存放需要合并的行的个数
+                pos: 0, // 记录spanArr数组的下标
+
             }
         },
         methods: {
+
+ //
+      objectSpanMethod(obj) {
+
+        if (
+          obj.columnIndex === 5 ||
+          obj.columnIndex === 6 ||
+          obj.columnIndex === 7 ||
+          obj.columnIndex === 8 ||
+          obj.columnIndex === 9 ||
+          obj.columnIndex === 10
+        ) {
+          // ⼆维数组存储的数据取出
+          var _row = this.spanArr[obj.rowIndex];
+          var _col = _row > 0 ? 1 : 0;
+          return {
+            rowspan: _row,
+            colspan: _col,
+          };
+        } else {
+          return false;
+        }
+      },
+      getSpanArr(orderList) {//传⼊你的列表数据
+        this.pos = 0;
+        orderList.forEach((item, index) => {
+
+          //判断是否是第⼀项
+          if (index === 0) {
+            this.spanArr.push(1);
+            this.pos = 0;
+          } else {
+            //不是第⼀项时,就根据标识去存储
+            if (//orderSn,createdAt...是你的第⼀个数据、第⼆个数据...
+
+              orderList[index].DEC_SN === orderList[index - 1].DEC_SN &&
+              orderList[index].ORDER_SN === orderList[index - 1].ORDER_SN &&
+              orderList[index].USER_NAME === orderList[index - 1].USER_NAME &&
+              orderList[index].REAL_NAME === orderList[index - 1].REAL_NAME &&
+              orderList[index].CON_USER_NAME === orderList[index - 1].CON_USER_NAME &&
+              orderList[index].P_CALC_MONTH === orderList[index - 1].P_CALC_MONTH 
+            ) {
+              // 查找到符合条件的数据时每次要把之前存储的数据+1
+              this.spanArr[this.pos] += 1;
+              this.spanArr.push(0);
+            } else {
+              // 没有符合的数据时,要记住当前的index
+              this.spanArr.push(1);
+              this.pos = index;
+            }
+          }
+        });
+      },
+
+
+
             handleCurrentChange (page) {
                 this.getData(page, this.pageSize)
             },
@@ -58,6 +118,8 @@
                 this.getData(this.currentPage, pageSize)
             },
             getData(page, pageSize) {
+                this.spanArr = [];
+                this.pos = 0;
                 let _this = this
                 network.getPageData(_this, 'shop/dec-order-list', page, pageSize, {type: this.type}, function (response) {
                 //network.getData(`shop/dec-order-list`).then(response => {
@@ -71,23 +133,11 @@
                     } );
 
                     _this.tableData=settingArr;
+                    console.log('11111',_this.tableData);
+                    _this.getSpanArr(_this.tableData);
                 });
             },
-            objectSpanMethod({ row, column, rowIndex, columnIndex }) {
-              if (columnIndex > 4) {
-                if (rowIndex % 2 === 0) {
-                  return {
-                    rowspan: 2,
-                    colspan: 1
-                  };
-                } else {
-                  return {
-                    rowspan: 0,
-                    colspan: 0
-                  };
-                }
-              }
-            },
+
         }
     }
 </script>

+ 77 - 17
frontendEle/src/views/shop/order-list.vue

@@ -37,7 +37,8 @@
         name: "order-list",
         components: {Pagination},
         mounted() {
-            this.getData()
+            this.getData();
+
         },
         data() {
             return {
@@ -52,24 +53,75 @@
                 totalCount: 1,
                 pageSize: 20,
                 tool: tool,
+                //订单号判断
+                spanArr: [], // 用于存放需要合并的行的个数
+                pos: 0, // 记录spanArr数组的下标
+
+
             }
         },
+
+
         methods: {
-            objectSpanMethod({ row, column, rowIndex, columnIndex }) {
-              if (columnIndex > 4) {
-                if (rowIndex % 2 === 0) {
-                  return {
-                    rowspan: 2,
-                    colspan: 1
-                  };
-                } else {
-                  return {
-                    rowspan: 0,
-                    colspan: 0
-                  };
-                }
-              }
-            },
+
+  //
+      objectSpanMethod(obj) {
+
+        if (
+          obj.columnIndex === 5 ||
+          obj.columnIndex === 6 ||
+          obj.columnIndex === 7 ||
+          obj.columnIndex === 8 ||
+          obj.columnIndex === 9 ||
+          obj.columnIndex === 10
+        ) {
+          // ⼆维数组存储的数据取出
+          var _row = this.spanArr[obj.rowIndex];
+          var _col = _row > 0 ? 1 : 0;
+          return {
+            rowspan: _row,
+            colspan: _col,
+          };
+        } else {
+          return false;
+        }
+      },
+      getSpanArr(orderList) {//传⼊你的列表数据
+        this.pos = 0;
+        orderList.forEach((item, index) => {
+
+          //判断是否是第⼀项
+          if (index === 0) {
+            this.spanArr.push(1);
+            this.pos = 0;
+          } else {
+            //不是第⼀项时,就根据标识去存储
+            if (//orderSn,createdAt...是你的第⼀个数据、第⼆个数据...
+
+              orderList[index].ORDER_SN === orderList[index - 1].ORDER_SN &&
+              orderList[index].USER_NAME === orderList[index - 1].USER_NAME &&
+              orderList[index].REAL_NAME === orderList[index - 1].REAL_NAME &&
+              orderList[index].CONSIGNEE === orderList[index - 1].CONSIGNEE &&
+              orderList[index].MOBILE === orderList[index - 1].MOBILE &&
+              orderList[index].PAY_AT === orderList[index - 1].PAY_AT
+            ) {
+              // 查找到符合条件的数据时每次要把之前存储的数据+1
+              this.spanArr[this.pos] += 1;
+              this.spanArr.push(0);
+            } else {
+              // 没有符合的数据时,要记住当前的index
+              this.spanArr.push(1);
+              this.pos = index;
+            }
+          }
+        });
+      },
+
+
+
+
+
+
             handleCurrentChange (page) {
                 this.getData(page, this.pageSize)
             },
@@ -77,18 +129,26 @@
                 this.getData(this.currentPage, pageSize)
             },
             getData(page, pageSize) {
+                 this.spanArr = [];
+                 this.pos = 0;
                 let _this = this
                 network.getPageData(_this, 'shop/order-list', page, pageSize, {type: this.type}, function (response) {
+
                     _this.loading = false;
+
                     _this.list = response.list;
+
                     let settingObj=_this.list;
 
                     let settingArr = Object.keys(settingObj).map(key => {
+
                         //console.log(key); //为每个键名
                         return settingObj[key];  //把每个对象返回出去生成一个新的数组中相当于0:{id:1}
                     } );
+
                     _this.tableData=settingArr;
-                    console.log(this.tableData)
+                   // console.log('11111',_this.tableData);
+                    _this.getSpanArr(_this.tableData);
 
 
                 });