kevin_zhangl 3 лет назад
Родитель
Сommit
f36b481881

+ 17 - 16
common/models/forms/ApproachDeclarationForm.php

@@ -67,6 +67,7 @@ class ApproachDeclarationForm extends Model
     public $cityName;
     public $lgaName;
     public $payType;
+    public $decType;
 
     // 传过来的全部数据
     public $allData;
@@ -127,7 +128,7 @@ class ApproachDeclarationForm extends Model
             [['type','decLv','decWay','insertUserName',/* 'insertUserIdCard',*/'password','payPassword','decUserName'], 'required'],
             [['type'], 'isType', 'on'=>['userDec', 'canDec']],
             [['insertUserName'], 'isCanAddUser'],
-            [['decUserName'], 'issetDec'],
+            [['decUserName', 'decType'], 'issetDec'],
             [['conUserName'], 'isConUserName'],
             [['recUserName'], 'isRecUserName'],
             [['location'], 'isLocation'],
@@ -181,8 +182,8 @@ class ApproachDeclarationForm extends Model
     {
         $parentScenarios =  parent::scenarios();
         $customScenarios = [
-            'userDec' => ['type','allData', 'decLv','decWay','insertUserName','password','payPassword', 'realName',/* 'insertUserIdCard',*/ 'mobile', 'address', 'openBank', 'bankAddress', 'bankNo', 'bankProvince','bankCity','bankCounty', 'consignee','acceptMobile','province',/*'city','county',*/ 'conUserName', 'recUserName','decUserName', 'location', 'email'],
-            'canDec' => ['type', 'insertUserName',/* 'insertUserIdCard',*/ 'conUserName', 'recUserName', 'location'],
+            'userDec' => ['type','allData', 'decLv','decWay','insertUserName','password','payPassword', 'realName',/* 'insertUserIdCard',*/ 'mobile', 'address', 'openBank', 'bankAddress', 'bankNo', 'bankProvince','bankCity','bankCounty', 'consignee','acceptMobile','province',/*'city','county',*/ 'conUserName', 'recUserName','decUserName', 'location', 'email', 'decType'],
+            'canDec' => ['type', 'insertUserName',/* 'insertUserIdCard',*/ 'conUserName', 'recUserName', 'location', 'decType'],
             'notFull' => ['type', 'insertUserName', 'conUserName', 'recUserName', 'location'],
         ];
         return array_merge($parentScenarios, $customScenarios);
@@ -197,19 +198,19 @@ class ApproachDeclarationForm extends Model
             $this->addError($attribute, 'Stockist does not exist');//报单中心不存在
             return false;
         } else {
-            // 判断报单中心是否在新加入会员的安置网上级中
-            $this->loopFindParentToNetwork($this->insertUserName);
-            //反转数组,in_array搜索错误
-            //in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
-            $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
-//            var_dump($flipParent);
-//            echo $this->insertUserName.'=='.$this->decUserName;
-//            exit;
-            if (!isset($flipParent[$this->decUserName])) {
-                //$this->addError($attribute, '为' . $this->insertUserName . '报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
-                $this->addError($attribute, 'To' . $this->insertUserName . 'Entry, Stockist' . $this->decUserName . 'not in exist' . $this->insertUserName . 'in the placement superiors');
-                return ;
+            if ($this->decType !== 'ba') {
+                // 判断报单中心是否在新加入会员的安置网上级中
+                $this->loopFindParentToNetwork($this->insertUserName);
+                //反转数组,in_array搜索错误
+                //in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
+                $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
+                if (!isset($flipParent[$this->decUserName])) {
+                    //$this->addError($attribute, '为' . $this->insertUserName . '报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
+                    $this->addError($attribute, 'To' . $this->insertUserName . 'Entry, Stockist' . $this->decUserName . 'not in exist' . $this->insertUserName . 'in the placement superiors');
+                    return ;
+                }
             }
+
             $this->_decId = $decUser['ID'];
         }
     }
@@ -325,7 +326,7 @@ class ApproachDeclarationForm extends Model
             $this->_tempParentUser[$this->recUserName]['REC_NUM'] += 1;
 
             // 存在新加入会员时查看开拓人是否在新加入会员的安置网上级中
-            if($this->insertUserName) {
+            if($this->decType !== 'ba' && $this->insertUserName) {
                 $this->loopFindParentToNetwork($this->insertUserName);
                 if (!$this->recUserIsInNetworkParent()) {
                    // $this->addError($attribute, '为' . $this->insertUserName . '报单,开拓人' . $this->recUserName . '不在' . $this->insertUserName . '的安置网上级中');

+ 1 - 0
common/models/forms/ApproachDeclarationLoopForm.php

@@ -88,6 +88,7 @@ class ApproachDeclarationLoopForm extends Model
                 $model->conUserName = null;
                 $model->recUserName = null;
                 $model->location = null;
+                $model->decType = null;
             } else {
                 $this->addError($attribute, 'The format of the report data is incorrect');// 报单数据格式错误
             }

+ 19 - 14
common/models/forms/DeclarationForm.php

@@ -62,6 +62,7 @@ class DeclarationForm extends Model
     public $county;
     public $cityName;
     public $lgaName;
+    public $decType;
 
     // 传过来的全部数据
     public $allData;
@@ -192,18 +193,20 @@ class DeclarationForm extends Model
             $this->addError($attribute, 'Stockist does not exist'); // 报单中心不存在
             return false;
         } else {
-            // 判断报单中心是否在新加入会员的安置网上级中
-            $this->loopFindParentToNetwork($this->insertUserName);
-            //反转数组,in_array搜索错误
-            //in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
-            $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
+            if ($this->decType !== 'ba') {
+                // 判断报单中心是否在新加入会员的安置网上级中
+                $this->loopFindParentToNetwork($this->insertUserName);
+                //反转数组,in_array搜索错误
+                //in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
+                $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
 //            var_dump($flipParent);
 //            echo $this->insertUserName.'=='.$this->decUserName;
 //            exit;
-            if (!isset($flipParent[$this->decUserName])) {
-                //$this->addError($attribute, '为' . $this->insertUserName . '报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
-                $this->addError($attribute, 'To' . $this->insertUserName . 'Entry, Stockist' . $this->decUserName . 'not in exist' . $this->insertUserName . 'in the placement superiors');
-                return ;
+                if (!isset($flipParent[$this->decUserName])) {
+                    //$this->addError($attribute, '为' . $this->insertUserName . '报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
+                    $this->addError($attribute, 'To' . $this->insertUserName . 'Entry, Stockist' . $this->decUserName . 'not in exist' . $this->insertUserName . 'in the placement superiors');
+                    return ;
+                }
             }
             $this->_decId = $decUser['ID'];
         }
@@ -321,11 +324,13 @@ class DeclarationForm extends Model
 
             // 存在新加入会员时查看开拓人是否在新加入会员的安置网上级中
             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 ;
+                if ($this->decType !== 'ba') {
+                    $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 ;
+                    }
                 }
             }
 

+ 1 - 0
common/models/forms/DeclarationLoopForm.php

@@ -88,6 +88,7 @@ class DeclarationLoopForm extends Model
                 $model->conUserName = null;
                 $model->recUserName = null;
                 $model->location = null;
+                $model->decType = null;
             } else {
                 $this->addError($attribute, 'The format of the report data is incorrect');// 报单数据格式错误
             }

+ 0 - 1
frontendApi/modules/v1/controllers/UserController.php

@@ -405,7 +405,6 @@ class UserController extends BaseController {
             $post['insertUserName'] = $insertUserName;
             $post['type'] = DeclarationForm::TYPE_ZC;
 
-            unset($post['decType']);
             $allData['data'][] = $post;
             if ($formModel->load($allData, '') && $result = $formModel->add()) {
                 return static::notice($result);//报单成功