|
|
@@ -61,6 +61,7 @@ class DeclarationForm extends Model
|
|
|
public $bankCity;
|
|
|
public $bankCounty;
|
|
|
public $conUserName;
|
|
|
+ public $bottomUserName;
|
|
|
public $recUserName;
|
|
|
public $decUserName;
|
|
|
public $location;
|
|
|
@@ -137,8 +138,8 @@ class DeclarationForm extends Model
|
|
|
[['insertUserName'], 'isCanAddUser'],
|
|
|
[['decUserName'], 'issetDec'],
|
|
|
[['conUserName'], 'isConUserName'],
|
|
|
-// [['recUserName'], 'isRecUserName'],
|
|
|
-// [['location'], 'isLocation'],
|
|
|
+ [['recUserName'], 'isRecUserName'],
|
|
|
+ [['location'], 'isLocation'],
|
|
|
// [['insertUserIdCard'], 'isSameSystem'],
|
|
|
];
|
|
|
}
|
|
|
@@ -211,12 +212,12 @@ class DeclarationForm extends Model
|
|
|
$this->addError($attribute, Yii::t('app', 'stockistDoesNotExist'));
|
|
|
return false;
|
|
|
} else {
|
|
|
-// if ($this->decType !== 'ba') {
|
|
|
+ if ($this->decType !== 'ba') {
|
|
|
// 判断报单中心是否在新加入会员的安置网上级中
|
|
|
-// $this->loopFindParentToNetwork($this->insertUserName);
|
|
|
+ $this->loopFindParentToNetwork($this->insertUserName);
|
|
|
//反转数组,in_array搜索错误
|
|
|
//in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
|
|
|
-// $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
|
|
|
+ $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
|
|
|
// var_dump($flipParent);
|
|
|
// echo $this->insertUserName.'=='.$this->decUserName;
|
|
|
// exit;
|
|
|
@@ -225,7 +226,7 @@ class DeclarationForm extends Model
|
|
|
// $this->addError($attribute, 'To' . $this->insertUserName . 'Entry, Stockist' . $this->decUserName . 'not in exist' . $this->insertUserName . 'in the placement superiors');
|
|
|
// return;
|
|
|
// }
|
|
|
-// }
|
|
|
+ }
|
|
|
$this->_decId = $decUser['ID'];
|
|
|
}
|
|
|
}
|
|
|
@@ -270,13 +271,13 @@ class DeclarationForm extends Model
|
|
|
$conUser = $this->_tempParentUser[$this->conUserName];
|
|
|
// 判断接点会员的下级会员是否大于三个,如果大于三个则不允许
|
|
|
if($conUser['CON_NUM'] >= 3){
|
|
|
-// if($this->insertUserName){
|
|
|
-// // $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'下级点位已满');
|
|
|
-// $this->addError($attribute, 'To'.$this->insertUserName.'Entry,Instructor'.$this->conUserName.'lower level is full');
|
|
|
-// } else {
|
|
|
-// //$this->addError($attribute, '指导老师'.$this->conUserName.'下级点位已满');
|
|
|
-// $this->addError($attribute, 'Instructor'.$this->conUserName.'lower level is full');
|
|
|
-// }
|
|
|
+ if($this->insertUserName){
|
|
|
+ // $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'下级点位已满');
|
|
|
+ $this->addError($attribute, 'To'.$this->insertUserName.'Entry,Instructor'.$this->conUserName.'lower level is full');
|
|
|
+ } else {
|
|
|
+ //$this->addError($attribute, '指导老师'.$this->conUserName.'下级点位已满');
|
|
|
+ $this->addError($attribute, 'Instructor'.$this->conUserName.'lower level is full');
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
if($this->insertUserName){
|
|
|
@@ -513,44 +514,44 @@ class DeclarationForm extends Model
|
|
|
$conUser = $this->_tempParentUser[$this->conUserName];
|
|
|
|
|
|
// 开拓人
|
|
|
-// if(!isset($this->_tempParentUser[$this->recUserName])){
|
|
|
-// $recUserTemp = UserInfo::findOneAsArray('USER_NAME=:USER_NAME', [':USER_NAME' => $this->recUserName]);
|
|
|
-// if(!$recUserTemp){
|
|
|
-//// $this->addError($attribute, '为'.$this->insertUserName.'报单,开拓人'.$this->recUserName.'不存在');
|
|
|
-// $this->addError($attribute, 'To'.$this->insertUserName.'Entry, 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];
|
|
|
+ if(!isset($this->_tempParentUser[$this->recUserName])){
|
|
|
+ $recUserTemp = UserInfo::findOneAsArray('USER_NAME=:USER_NAME', [':USER_NAME' => $this->recUserName]);
|
|
|
+ if(!$recUserTemp){
|
|
|
+// $this->addError($attribute, '为'.$this->insertUserName.'报单,开拓人'.$this->recUserName.'不存在');
|
|
|
+ $this->addError($attribute, 'To'.$this->insertUserName.'Entry, 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];
|
|
|
|
|
|
// 判断接点会员的下级会员是否大于三个,如果大于三个则不允许
|
|
|
-// if($conUser['CON_NUM'] >= 3){
|
|
|
-//// $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'下级点位已满');
|
|
|
-// $this->addError($attribute, 'To'.$this->insertUserName.'Entry, Sponsor'.$this->conUserName.'lower level is full');
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// // 判断指导老师相应的区位是否已满
|
|
|
-// if($conUser['LOCATION'.$this->location]){
|
|
|
-//// $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'该市场已存在会员');
|
|
|
-// $this->addError($attribute, 'To'.$this->insertUserName.'Entry, Sponsor'.$this->conUserName.'Members already exist in this market');
|
|
|
-// return;
|
|
|
-// }
|
|
|
+ if($conUser['CON_NUM'] >= 3){
|
|
|
+// $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'下级点位已满');
|
|
|
+ $this->addError($attribute, 'To'.$this->insertUserName.'Entry, Sponsor'.$this->conUserName.'lower level is full');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 判断指导老师相应的区位是否已满
|
|
|
+ if($conUser['LOCATION'.$this->location]){
|
|
|
+// $this->addError($attribute, '为'.$this->insertUserName.'报单,指导老师'.$this->conUserName.'该市场已存在会员');
|
|
|
+ $this->addError($attribute, 'To'.$this->insertUserName.'Entry, Sponsor'.$this->conUserName.'Members already exist in this market');
|
|
|
+ return;
|
|
|
+ }
|
|
|
// if($conUser['CON_NUM'] == 0 && $this->location != 1){
|
|
|
// $this->addError($attribute, '为'.$this->insertUserName.'报单,市场必须为指导老师'.$this->conUserName.'下第一市场');
|
|
|
// return;
|
|
|
@@ -562,21 +563,21 @@ class DeclarationForm extends Model
|
|
|
// $this->_tempParentUser[$this->recUserName]['REC_NUM'] += 1;
|
|
|
|
|
|
// 把自己加入到临时上级会员数组中
|
|
|
-// $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,
|
|
|
-// ];
|
|
|
+ $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,
|
|
|
+ ];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -856,6 +857,7 @@ class DeclarationForm extends Model
|
|
|
$userForm->zcAmount = $this->_decAmount;
|
|
|
$userForm->conUserName = $this->conUserName;
|
|
|
$userForm->recUserName = $this->recUserName;
|
|
|
+ $userForm->bottomUserName = $this->bottomUserName;
|
|
|
$userForm->location = $this->location;
|
|
|
$userForm->idCard = $this->mobile;
|
|
|
$userForm->allData = $allData;
|