theo пре 3 година
родитељ
комит
4a1b84cc1b

+ 3 - 3
common/models/BaDecOrder.php

@@ -47,7 +47,7 @@ class BaDecOrder extends \common\components\ActiveRecord
     public function rules()
     {
         return [
-            [['USER_ID', 'TO_USER_ID','REC_USER_ID','CON_USER_ID','DEC_ID', 'TYPE', 'PAID_WALLET', 'PERIOD_NUM', 'P_CALC_MONTH', 'CREATED_AT'], 'required'],
+            [['USER_ID', 'TO_USER_ID','REC_USER_ID',/*'CON_USER_ID','DEC_ID',*/ 'TYPE', 'PAID_WALLET', 'PERIOD_NUM', 'P_CALC_MONTH', 'CREATED_AT'], 'required'],
             [['IS_ADMIN', 'IS_BATCH', 'PERIOD_NUM', 'CALC_MONTH', 'CREATED_AT', 'IS_DEL', 'DELETED_AT'], 'integer'],
             [['DEC_AMOUNT', 'DEC_PV'], 'number'],
             [['ID', 'DEC_SN', 'ORDER_SN', 'USER_ID', 'TO_USER_ID','REC_USER_ID','CON_USER_ID','DEC_ID', 'TYPE', 'UPDATER', 'UPDATED_AT'], 'string', 'max' => 32],
@@ -77,8 +77,8 @@ class BaDecOrder extends \common\components\ActiveRecord
             'IS_BATCH' => '是否批量报单',
             'REMARK' => '备注',
             'REC_USER_ID' => '开拓人编号',
-            'CON_USER_ID' => '上级编号',
-            'DEC_ID' => '上级编号',
+            'CON_USER_ID' => '上级编号1',
+            'DEC_ID' => '上级编号2',
             'PERIOD_NUM' => '报单期数',
             'P_CALC_MONTH' => '分区结算月',
             'CALC_MONTH' => '结算月',

+ 2 - 2
common/models/BaUserInfo.php

@@ -79,8 +79,8 @@ class BaUserInfo extends \common\components\ActiveRecord
     public function rules()
     {
         return [
-            [['USER_ID', 'USER_NAME', 'CON_UID', 'REC_UID', 'CREATED_AT'], 'required'],
-            [['ZC_PV', 'INVOICE_BALANCE', 'TRANSFER_PROP', 'ZC_AMOUNT'], 'number'],
+            [['USER_ID', 'USER_NAME',/* 'CON_UID', 'REC_UID',*/ 'CREATED_AT'], 'required'],
+//            [['ZC_PV', 'INVOICE_BALANCE', 'TRANSFER_PROP', 'ZC_AMOUNT'], 'number'],
             [['CON_NUM', 'REC_NUM', 'NETWORK_DEEP', 'RELATION_DEEP', 'IS_SYSTEM_LEADER', 'IS_TEAM', 'IS_BIND', 'IS_TEAM_MAIN', 'IS_BIND_MAIN', 'IS_AUTO_WITHDRAW', 'CLOSE_LOGIN', 'REG_EXPIRES', 'STORE_TYPE', 'CREATED_AT', 'UPDATED_AT', 'CLOSE_LOGIN_AT', 'PULLED_AT', 'DELETED', 'DELETED_AT', 'ALLOW_TRANSFER', 'HIGHEST_EMP_LV_PERIOD', 'IS_GROUP_LEADER', 'GROUP_LEADER_AT', 'ALLOW_RECONSUME_SMS', 'ALLOW_RECONSUME_SMS_TO', 'LOGIN_NUMS', 'FAIL_NUMS', 'LAST_LOGIN_AT'], 'integer'],
             [['ID','USER_ID', 'CON_UID', 'REC_UID', 'SYSTEM_ID', 'REG_TYPE', 'SHOULD_REG_TYPE', 'HIGHEST_EMP_LV', 'SHOW_EMP_LV'], 'string', 'max' => 32],
             [['USER_NAME', 'LAST_LOGIN_IP'], 'string', 'max' => 16],

+ 111 - 54
common/models/forms/BaDeclarationForm.php

@@ -21,6 +21,7 @@ use common\models\DeclarationLevel;
 use common\models\Region;
 use common\models\ShopGoods;
 use common\models\BaUser;
+use common\models\UserInfo;
 use common\models\BaUserInfo;
 use common\models\UserNetwork;
 use common\models\UserRelation;
@@ -169,7 +170,7 @@ class BaDeclarationForm extends Model
      * @param $attribute
      */
     public function issetDec($attribute){
-        if (!$decUser = User::find()->select('ID')->where('IS_DEC=1 AND USER_NAME=:USER_NAME', [':USER_NAME' => $this->decUserName])->asArray()->one()) {
+        if (!$decUser = BaUser::find()->select('ID')->where('IS_DEC=1 AND USER_NAME=:USER_NAME', [':USER_NAME' => $this->decUserName])->asArray()->one()) {
             $this->addError($attribute, 'Stockist does not exist'); // 报单中心不存在
             return false;
         } else {
@@ -177,6 +178,76 @@ class BaDeclarationForm extends Model
         }
     }
 
+    /**
+     * 判断开拓人
+     * @param $attribute
+     */
+    public function isRecUserName($attribute){
+        if($this->type == self::TYPE_ZC){
+            // 开拓人
+//            if(!isset($this->_tempParentUser[$this->recUserName])){
+//                $recUserTemp = UserInfo::findOneAsArray('USER_NAME=:USER_NAME', [':USER_NAME' => $this->recUserName]);
+//                if(!$recUserTemp){
+//                    if($this->insertUserName){
+//                        //$this->addError($attribute, '为'.$this->insertUserName.'报单,开拓人'.$this->recUserName.'不存在');
+//                        $this->addError($attribute, 'To'.$this->insertUserName.'Entry, Sponsor'.$this->recUserName.'not in exist');
+//                    } else {
+//                       // $this->addError($attribute, '开拓人'.$this->recUserName.'不存在');
+//                        $this->addError($attribute, 'Sponsor'.$this->recUserName.'not in exist');
+//                    }
+//
+//                    return ;
+//                }
+//                $recUserTemp['CON_NUM'] = UserNetwork::firstFloorChildNum($recUserTemp['USER_ID']);
+//                $recUserTemp['REC_NUM'] = UserRelation::firstFloorChildNum($recUserTemp['USER_ID']);
+//                $this->_tempParentUser[$this->recUserName] = [
+//                    'USER_NAME' => $this->recUserName,
+//                    'ZC_PV' => $recUserTemp['ZC_PV'],
+//                    'CON_USER_NAME' => Info::getUserNameByUserId($recUserTemp['CON_UID']),
+//                    'REC_USER_NAME' => Info::getUserNameByUserId($recUserTemp['REC_UID']),
+//                    'CON_NUM' => $recUserTemp['CON_NUM'],
+//                    'REC_NUM' => $recUserTemp['REC_NUM'],
+//                    'SYSTEM_ID' => $recUserTemp['SYSTEM_ID'],
+//                    'LOCATION' => UserNetwork::getLocation($recUserTemp['USER_ID'], $recUserTemp['CON_UID']),
+//                ];
+//                // 把该会员下面的5个区是否存在会员都付上
+//                for($i=1;$i<=5;$i++){
+//                    $this->_tempParentUser[$this->recUserName]["LOCATION$i"] = UserNetwork::issetUserInLocation($recUserTemp['USER_ID'], $i);
+//                }
+//            }
+            $recUser = $this->_tempParentUser[$this->recUserName];
+            $this->_tempParentUser[$this->recUserName]['REC_NUM'] += 1;
+
+            // 存在新加入会员时查看开拓人是否在新加入会员的安置网上级中
+//            if($this->insertUserName) {
+//                $this->loopFindParentToNetwork($this->insertUserName);
+//                if (!$this->recUserIsInNetworkParent()) {
+//                   // $this->addError($attribute, '为' . $this->insertUserName . '报单,开拓人' . $this->recUserName . '不在' . $this->insertUserName . '的安置网上级中');
+//                    $this->addError($attribute, 'To' . $this->insertUserName . 'Entry, Sponsor' . $this->recUserName . 'not in exist' . $this->insertUserName . 'in the placement superiors');
+//                    return ;
+//                }
+//            }
+//
+//            // 把自己加入到临时上级会员数组中
+//            $this->_tempParentUser[$this->insertUserName] = [
+//                'USER_NAME' => $this->insertUserName,
+//                //'ZC_PV' => $this->decPv,
+//                'CON_USER_NAME' => $this->conUserName,
+//                'REC_USER_NAME' => $this->recUserName,
+//                'CON_NUM' => 0,
+//                'REC_NUM' => 0,
+//                'SYSTEM_ID' => $recUser['SYSTEM_ID'],
+//                'LOCATION' => $this->location,
+//                'LOCATION1' => 0,
+//                'LOCATION2' => 0,
+//                'LOCATION3' => 0,
+//                'LOCATION4' => 0,
+//                'LOCATION5' => 0,
+//            ];
+        }
+
+    }
+
     /**
      * 添加报单
      * @param $allData
@@ -201,47 +272,33 @@ class BaDeclarationForm extends Model
 //            if(!$this->decLv){
 //                throw new Exception('Please select the entry level'); // 请选择报单级别
 //            }
-            if($this->decWay==1) {
-//                $decPackage = BaDeclarationPackage::findOneAsArray('ID=:ID', [':ID'=>$this->packageId]);
-//                $this->_decAmount = $decPackage['AMOUNT'];
-//                $this->_decPv = $decPackage['PV'];
-//                $this->_orderGoods[] = [
-//                    'GOODS_ID' => $this->packageId,
-//                    'PRICE' => $this->_decAmount,
-//                    'REAL_PRICE' => $this->_decAmount,
-//                    'PV' => $this->_decPv,
-//                    'REAL_PV' => $this->_decPv,
-//                    'BUY_NUMS' => 1,
-//                    'SKU_CODE' => $decPackage['PACKAGE_NO'],
-//                    'GOODS_TITLE' => $decPackage['PACKAGE_NAME'],
-//                    'EMAIL' => $this->email
-//                ];
-            }else{
-                $ids = $this->goodsId;
-                $totalAmount = 0;
-                $totalPv = 0;
-                foreach ($this->goodsNum as $k => $v) {
-                    if ($v) {
-                        $goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
-                        if($goods['STORE_NUMS']>0){
-                            $totalAmount += $goods['SELL_PRICE'] * intval($v);
-                            $totalPv += $goods['PRICE_PV'] * intval($v);
-                            $this->_orderGoods[] = [
-                                'GOODS_ID' => $goods['ID'],
-                                'PRICE' => $goods['SELL_PRICE'],
-                                'REAL_PRICE' => $goods['SELL_PRICE'],
-                                'PV' => $goods['PRICE_PV'],
-                                'REAL_PV' => $goods['PRICE_PV'],
-                                'POINT' => $goods['POINT'],
-                                'BUY_NUMS' => intval($v),
-                                'SKU_CODE' => $goods['GOODS_NO'],
-                                'GOODS_TITLE' => $goods['GOODS_NAME'],
-                                'EMAIL' => $this->email,
-                                'TAX_RATE' => $goods['TAX_RATE'],
-                            ];
-                        }
+
+            $ids = $this->goodsId;
+            $totalAmount = 0;
+            $totalPv = 0;
+
+            foreach ($this->goodsNum as $k => $v) {
+                if ($v) {
+                    $goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
+                    if($goods['STORE_NUMS']>0){
+                        $totalAmount += $goods['SELL_PRICE'] * intval($v);
+                        $totalPv += $goods['PRICE_PV'] * intval($v);
+                        $this->_orderGoods[] = [
+                            'GOODS_ID' => $goods['ID'],
+                            'PRICE' => $goods['SELL_PRICE'],
+                            'REAL_PRICE' => $goods['SELL_PRICE'],
+                            'PV' => $goods['PRICE_PV'],
+                            'REAL_PV' => $goods['PRICE_PV'],
+                            'POINT' => $goods['POINT'],
+                            'BUY_NUMS' => intval($v),
+                            'SKU_CODE' => $goods['GOODS_NO'],
+                            'GOODS_TITLE' => $goods['GOODS_NAME'],
+                            'EMAIL' => $this->email,
+                            'TAX_RATE' => $goods['TAX_RATE'],
+                        ];
                     }
                 }
+            }
 //                if($totalPv<$decLevel['PERF']){
 //                    throw new Exception('The total BV of self selected goods cannot be less than the BV of the selected entry level');//自选商品总BV不能小于所选报单级别BV
 //                }
@@ -253,18 +310,19 @@ class BaDeclarationForm extends Model
 //                if($this->decLv!=$toDecLevel){
 //                    throw new Exception('The total BV of self selected goods cannot exceed the BV value of the next level under the selected level');//自选商品总BV不能超过已选级别下一个级别的BV值
 //                }
-                $this->_decAmount = $totalAmount;
+            $this->_decAmount = $totalAmount;
 //                $this->_decPv = $totalPv;
-            }
+
             //看现金余额是否充足
             $loginUserId = \Yii::$app->user->id;
             if (Cash::getAvailableBalance($loginUserId) < $this->_decAmount){
                 throw new Exception('The applicant is short of cash and cannot complete the declaration');//报单人现金不足,无法完成报单
             }
-
+//            print_r($allData);exit;
             if(!($zcResult = $this->addBaUser($allData))) {
                 throw new Exception(Form::formatErrorsForApi($this->_userForm->getErrors()));
             }
+//            print_r($allData);exit;
             if(!($decResult = $this->addBaDecOrder())) {
                 throw new Exception(Form::formatErrorsForApi($decResult->getErrors()));
             }
@@ -325,12 +383,13 @@ class BaDeclarationForm extends Model
         $userForm->userId = $this->_insertUserId;
         $userForm->userName = $this->insertUserName;
 //        $userForm->zcPv = $this->_decPv;
-//        $userForm->zcAmount = $this->_decAmount;
+        $userForm->zcAmount = $this->_decAmount;
 //        $userForm->conUserName = $this->conUserName;
         $userForm->recUserName = $this->recUserName;
 //        $userForm->location = $this->location;
         $userForm->idCard = $this->mobile;
         $userForm->allData = $allData;
+//        print_r($userForm);exit;
         if(!$userForm->validate()){
             $this->addErrors($userForm->getErrors());
             return false;
@@ -361,14 +420,14 @@ class BaDeclarationForm extends Model
         $decOrderModel->USER_ID = \Yii::$app->user->id;
         $decOrderModel->TO_USER_ID = $this->_insertUserId;
         $decOrderModel->DEC_AMOUNT = $this->_decAmount;
-        $decOrderModel->DEC_PV = $this->_decPv;
+//        $decOrderModel->DEC_PV = $this->_decPv;
         $decOrderModel->PERIOD_NUM = $nowPeriodNum;
         $decOrderModel->CALC_MONTH = $nowCalcMonth;
         $decOrderModel->P_CALC_MONTH = Date::ociToDate($nowCalcMonth, Date::OCI_TIME_FORMAT_SHORT_MONTH);
         $decOrderModel->PAID_WALLET = 'cash';
-        $decOrderModel->CON_USER_ID = Info::getUserIdByUserName($this->conUserName);
+//        $decOrderModel->CON_USER_ID = Info::getUserIdByUserName($this->conUserName);
         $decOrderModel->REC_USER_ID = Info::getUserIdByUserName($this->recUserName);
-        $decOrderModel->DEC_ID = $this->_decId;
+//        $decOrderModel->DEC_ID = $this->_decId;
         $decOrderModel->IS_DEL = 0;
         $decOrderModel->CREATED_AT = Date::nowTime();
         if(!$decOrderModel->save()){
@@ -391,9 +450,9 @@ class BaDeclarationForm extends Model
         $orderModel->USER_ID = $this->_insertUserId;
         $orderModel->USER_NAME = $this->insertUserName;
         $orderModel->ORDER_AMOUNT = $this->_decAmount;
-        $orderModel->PV = $this->_decPv;
+//        $orderModel->PV = $this->_decPv;
         $orderModel->PAY_AMOUNT = $this->_decAmount;
-        $orderModel->PAY_PV = $this->_decPv;
+//        $orderModel->PAY_PV = $this->_decPv;
         $orderModel->PAY_AT = Date::nowTime();
         $orderModel->PAY_TYPE = 'cash';
         $orderModel->PERIOD_NUM = $nowPeriodNum;
@@ -439,14 +498,12 @@ class BaDeclarationForm extends Model
             if(!$addressModel->save()){
                 throw new Exception(Form::formatErrorsForApi($addressModel->getErrors()));
             }
-            //扣报单人现金钱包
-//            Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'为'.$this->insertUserName.'报单']);
-            Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'To'.$this->insertUserName.'Entry']);
-            return $addressModel;
         }else{
             $addressModel = new ReceiveAddress();
-            return $addressModel;
         }
+        //扣报单人现金钱包
+        Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'To'.$this->insertUserName.'Entry']); // 报单
+        return $addressModel;
     }
 
     /**

+ 0 - 29
common/models/forms/BaDeclarationLoopForm.php

@@ -115,35 +115,6 @@ class BaDeclarationLoopForm extends Model
             $model->scenario = $this->scenario;
             $model->allData = $this->data;
             foreach ($this->data as $value){
-				/**
-                 * 2022-04-29
-                 * York
-                 * 获取商品套餐信息
-                 */
-//                if (isset($value['packageId']) && $value['packageId']){
-//                    $packagedata = DeclarationPackage::findOneAsArray('ID=:ID', [':ID' => $value['packageId']]);
-//                    //var_dump($packagedata['ID']);
-//                    if($packagedata['STORE_NUMS']>0){
-//                        $data =  DeclarationPackage::find()->where(['ID'=> $packagedata['ID'] ])->one();
-//                        $goods_store_nums = $data->STORE_NUMS - 1;
-//                        $data->STORE_NUMS = $goods_store_nums;
-//                        $data->update();
-////                        var_dump('输出一下数量');
-////                        var_dump($goods_store_nums);
-//                        //库存为0下架套餐
-//                        if ($goods_store_nums <= 0){
-//                            $data->STATUS = 0;
-//                            $data->UPDATED_AT = Date::nowTime();
-////                            var_dump('购买后套餐库存为0 下架拉');
-//                        }
-//
-//                    }else{
-//                        throw new Exception($packagedata['PACKAGE_NAME'].'Insufficient inventory');// 库存不足
-//                    }
-//
-//
-//                }
-
                 if (count($value['goodsId']) > 0 && (count($value['goodsId']) == count($value['goodsNum']))){
                     for ($i=0;$i<count($value['goodsId']);$i++){
                         $goods = ShopGoods::findOneAsArray('ID=:ID',[':ID'=> $value['goodsId'][$i]]);

+ 33 - 37
common/models/forms/BaUserForm.php

@@ -55,10 +55,10 @@ class BaUserForm extends Model
     private $_recUid;
     private $_limit = 1000;
 
-    private $_conTopUid;
+//    private $_conTopUid;
     private $_conTopDeep;
-    private $_recTopUid;
-    private $_recTopDeep;
+//    private $_recTopUid;
+//    private $_recTopDeep;
 
     public function init() {
         parent::init();
@@ -75,7 +75,7 @@ class BaUserForm extends Model
         return [
             [['userId', 'userName', 'zcPv', 'zcAmount', 'conUserName', 'recUserName','conUid', 'recUid', 'location',/* 'nation', */'realName', /* 'mobile','openBank','bankAddress','bankNo', */ 'email'], 'trim'],
             [['userId', 'userName',/* 'zcPv', 'zcAmount',*/ 'conUid', 'recUid', 'location'], 'required', 'on'=>'addWithUid'],
-            [['userId', 'userName',/* 'zcPv', 'zcAmount', 'conUserName',*/ 'recUserName',/* 'location'*/], 'required', 'on'=>['addWithUserName', 'addByAdmin']],
+            [['userId', 'userName',/* 'zcPv', 'zcAmount', 'conUserName', 'recUserName', 'location'*/], 'required', 'on'=>['addWithUserName', 'addByAdmin']],
             [['idCard', 'allData'], 'required', 'on'=>['addWithUserName']],
             [['userName'], 'required', 'on'=>['validateUser', 'noLoginModifyPassword']],
             [['conUid'], 'required', 'on'=>['validateCon', 'validateAddWithUid']],
@@ -93,15 +93,15 @@ class BaUserForm extends Model
             ['verifyPassword', 'compare', 'compareAttribute' => 'payPassword' ,'message'=>'The two payment passwords are inconsistent' ,'on' => ['modifyPasswordPay']],//两次支付密码输入不一致
             [['userId'], 'unique', 'targetClass'=>BaUserInfo::class, 'targetAttribute'=>'USER_ID', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
             [['userName'], 'unique', 'targetClass'=>BaUserInfo::class, 'targetAttribute'=>'USER_NAME' , 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
-            [['conUid'], 'exist', 'targetClass'=>BaUserInfo::class, 'targetAttribute'=>'USER_ID', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
-            [['recUid'], 'exist', 'targetClass'=>BaUserInfo::class, 'targetAttribute'=>'USER_ID', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
-            [['conUid'], 'isConUid', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
+//            [['conUid'], 'exist', 'targetClass'=>UserInfo::class, 'targetAttribute'=>'USER_ID', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
+            [['recUid'], 'exist', 'targetClass'=>UserInfo::class, 'targetAttribute'=>'USER_ID', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
+//            [['conUid'], 'isConUid', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
             [['recUid'], 'isRecUid', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
-            [['conUserName'], 'exist', 'targetClass'=>BaUserInfo::class, 'targetAttribute'=>'USER_NAME', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
-            [['recUserName'], 'exist', 'targetClass'=>BaUserInfo::class, 'targetAttribute'=>'USER_NAME', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
-            [['conUserName'], 'isCon', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
+//            [['conUserName'], 'exist', 'targetClass'=>UserInfo::class, 'targetAttribute'=>'USER_NAME', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
+            [['recUserName'], 'exist', 'targetClass'=>UserInfo::class, 'targetAttribute'=>'USER_NAME', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
+//            [['conUserName'], 'isCon', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
             [['recUserName'], 'isRec', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
-            [['location'], 'isLocation', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
+//            [['location'], 'isLocation', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
             //[['idCard'], 'isSameNetwork'],
             [[/*'zcPv',*/ 'zcAmount'], 'price', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
 //            [['zcPv'], 'isMinDecLevel', 'on' => ['addWithUserName', 'addWithUid', 'addByAdmin']],
@@ -112,8 +112,8 @@ class BaUserForm extends Model
     {
         return [
             'userId' => '会员ID',
-//            'conUserName' => '接点人账号',
-            'recUserName' => '开拓人帐号',
+            'conUserName' => '接点人账号',
+            'recUserName' => '开拓人帐号1',
 //            'location' => '区位',
 //            'nation' => '民族',
             //'realName' => '真实姓名',
@@ -188,7 +188,7 @@ class BaUserForm extends Model
      */
     public function isRec($attribute, $params){
         // 根据账号找到开拓人
-        $oneRecUserInfo = BaUser::findOneAsArray('USER_NAME=:USER_NAME', [':USER_NAME'=>$this->recUserName]);
+        $oneRecUserInfo = User::findOneAsArray('USER_NAME=:USER_NAME', [':USER_NAME'=>$this->recUserName]);
         if($oneRecUserInfo && $oneRecUserInfo['STATUS']){
             $this->_recUid = $oneRecUserInfo['ID'];
         } else {
@@ -284,13 +284,15 @@ class BaUserForm extends Model
 //        $zcPv = $this->zcPv;
 //        $conUid = $this->_conUid;
         $recUid = $this->_recUid;
+//        print_r('recUid:');
+//        print_r($recUid);
 //        $location = $this->location;
 
 //        $db = \Yii::$app->db;
 //        $transaction = $db->beginTransaction();
         try{
-            $periodObj = Period::instance();
-            $nowPeriodNum = $periodObj->getNowPeriodNum();
+//            $periodObj = Period::instance();
+//            $nowPeriodNum = $periodObj->getNowPeriodNum();
             // 查找接点人的体系信息
 //            $conUserInfo = UserInfo::find()->where('USER_ID=:USER_ID', [':USER_ID'=>$conUid])->asArray()->one();
             // 加入会员信息
@@ -310,37 +312,31 @@ class BaUserForm extends Model
             $userInfoModel->TRANSFER_PROP = 100.00;
             $userInfoModel->IS_GROUP_LEADER = 0;
             $userInfoModel->GROUP_LEADER_AT = 0;
+
             try {
-                print_r($userInfoModel);
-                $userInfoModel->save();
-                print_r('save');
-            }catch (Exception $e){
+                $q = $userInfoModel->save();
+                print_r($q);
+            }catch (Exception $e) {
                 print_r($e);
+                print_r('cccc');
+                throw new Exception('会员信更新失了败');
             }
-            exit;
-            if(!$userInfoModel->save()){
-                throw new Exception('会员信息更新失败');
-            }
-            // 安置关系
-//            $this->_addToNetwork();
-            // 开拓关系
-//            $this->_addToRelation();
-            // 把会员的网络深度也追加上
-//            $userInfoModel->NETWORK_DEEP = $this->_conTopDeep;
-//            $userInfoModel->RELATION_DEEP = $this->_recTopDeep;
+//            print_r($userInfoModel);exit;
 //            if(!$userInfoModel->save()){
-//                throw new Exception('会员网络深度更新失败');
+//                throw new Exception('会员信息更新失败');
 //            }
+//            exit;
+
             // 清空安置网络和开拓网络的顶点和顶点深度的数值
-            $this->_conTopUid = null;
-            $this->_conTopDeep = null;
-            $this->_recTopUid = null;
-            $this->_recTopDeep = null;
+//            $this->_conTopUid = null;
+//            $this->_conTopDeep = null;
+//            $this->_recTopUid = null;
+//            $this->_recTopDeep = null;
 
 //            $transaction->commit();
             return $userInfoModel;
         } catch (Exception $e){
-            print_r($e);exit;
+//            print_r($e);exit;
             throw new Exception('a a a a a');
 //            $transaction->rollBack();
             $this->addError('userId', $e->getMessage());