ApproachDeclarationUpgradeForm.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. <?php
  2. namespace common\models\forms;
  3. use common\components\Model;
  4. use common\helpers\Cache;
  5. use common\helpers\Date;
  6. use common\helpers\Form;
  7. use common\helpers\user\Cash;
  8. use common\helpers\user\Info;
  9. use common\models\ApproachDecOrder;
  10. use common\models\ApproachOrder;
  11. use common\models\ApproachOrderGoods;
  12. use common\models\Config;
  13. use common\models\DeclarationLevel;
  14. use common\models\DeclarationPackage;
  15. use common\models\DecLevelLog;
  16. use common\models\DecOrder;
  17. use common\models\EmployLevel;
  18. use common\models\Instalment;
  19. use common\models\Order;
  20. use common\models\OrderGoods;
  21. use common\models\Period;
  22. use common\models\ReceiveAddress;
  23. use common\models\Region;
  24. use common\models\ShopGoods;
  25. use common\models\User;
  26. use common\models\UserInfo;
  27. use common\models\UserNetwork;
  28. use Yii;
  29. use yii\base\Exception;
  30. /**
  31. * 升级管理,进行升级
  32. */
  33. class ApproachDeclarationUpgradeForm extends Model
  34. {
  35. public $type;
  36. public $decLv;
  37. public $decWay;
  38. public $packageId;
  39. public $goodsId;
  40. public $goodsNum;
  41. public $insertUserName;
  42. public $consignee;
  43. public $acceptMobile;
  44. public $province;
  45. public $city;
  46. public $county;
  47. public $lgaName;
  48. public $cityName;
  49. public $address;
  50. public $nowPerf;
  51. public $nextPerf;
  52. public $decUserName;
  53. public $remark;
  54. public $payType;
  55. // 传过来的全部数据
  56. public $allData;
  57. private $_decId;
  58. public $_insertUserId;
  59. private $_decAmount;
  60. private $_decPv;
  61. private $_orderGoods;
  62. private $_standardAmount;
  63. private $_decAmountStandard;
  64. public $period;
  65. public $instalment;
  66. public $isMax;
  67. public $maxLv;
  68. const TYPE_ZC = 'ZC';
  69. private $_userForm = null;
  70. // 全部的安置网上级
  71. private $_tempNetworkParentUser = [];
  72. /**
  73. * @inheritdoc
  74. */
  75. public function rules()
  76. {
  77. return [
  78. [['remark','type','decLv','decWay','packageId','goodsId', 'goodsNum', 'insertUserName','consignee','acceptMobile','province',/*'city','county',*/'lgaName','cityName','address','nowPerf','nextPerf'], 'trim'],
  79. [['type','decLv','decWay','insertUserName','nowPerf','province',/*'city','county',*/'address','acceptMobile', 'isMax'], 'required'],
  80. [['decUserName'], 'issetDec'], // 必须是报单中心
  81. [['decWay'], 'hasProduct'],// 必须选择商品
  82. [['decLv'], 'alreadyMaxDec'], //判断要升级用户是否已经是最高级
  83. ];
  84. }
  85. public function attributeLabels()
  86. {
  87. return [
  88. 'type' => 'Upgrade type',//升级类型
  89. 'decLv' => 'Upgrade level',//升级级别
  90. 'decWay' => 'Declaration method',//报单方式
  91. 'packageId' => 'Upgrade package',//升级套餐
  92. 'goodsId' => 'Product ID',//商品ID
  93. 'goodsNum' => 'Product quantity',//商品数量
  94. 'insertUserName' => 'Member number to be upgraded',//要升级的会员编号
  95. 'consignee' => 'consignee',//收货人
  96. 'acceptMobile' => 'The phone number of Consignee',//收货人手机
  97. 'province' => 'Receiving Province',//收货省
  98. 'city' => 'Receiving City',//收货市
  99. 'county' => 'Receiving area / county',//收货区县
  100. 'lgaName' => 'Local Government Area',
  101. 'cityName' => 'City',
  102. 'address' => 'Receiving detailed address',//收货详细地址
  103. ];
  104. }
  105. /**
  106. * 添加报单
  107. * @param $allData
  108. * @throws Exception
  109. * @throws \yii\db\Exception
  110. */
  111. public function add($allData){
  112. if(!$this->validate()){
  113. return null;
  114. }
  115. $hasInstalment = 0;
  116. // 首购单
  117. if($this->type == self::TYPE_ZC){
  118. $baseInfo = Info::baseInfoZhByUserName($this->insertUserName);
  119. $userId = $baseInfo['ID'];
  120. // 获取用户是否是观察期
  121. $observe = Config::getConfigByType('observe'); // 获取观察期配置信息
  122. $observeLimit = $observe['observePeriodLimit']['value']; // 月份限制
  123. $isObserve = User::checkIsObserve($baseInfo['CREATED_AT'], $observeLimit); // 判断用户是否再观察期中
  124. $diffPerf = $isObserve ? $this->nowPerf : 0; // 观察期内升级要加上用户累计的PV,全额则基础PV为0,全额购买
  125. if ($this->decWay != 2) {
  126. throw new Exception(Yii::t('app', 'upgradeMethodIncorrect'));
  127. }
  128. $decLevel = [];
  129. $toDecLevel = $this->isMax ? $this->maxLv : '';
  130. if (!$this->isMax) {
  131. //报单商品及PV判断
  132. $decLevelConfig = Cache::getDecLevelConfig();
  133. $decLevel = $decLevelConfig[$this->decLv];
  134. $toDecLevel = $this->decLv;
  135. if(!$this->decLv){
  136. throw new Exception(Yii::t('app', 'pleaseSelectUpgradeLevel'));
  137. }
  138. $userDecPvSum = User::sumDevPvByUserId($userId); // 用户所有报单PV总和
  139. if ($userDecPvSum != $this->nowPerf) {
  140. throw new Exception(Yii::t('app', 'checkPerformanceOfUpgradedMember'));
  141. }
  142. }
  143. {
  144. $ids = $this->goodsId;
  145. $totalAmount = 0;
  146. $totalAmountStandard = 0;
  147. $totalPv = 0;
  148. $exchangeRate = floatval(Cache::getSystemConfig()['exchangeRate']['VALUE'] ?? 0); // 汇率
  149. foreach ($this->goodsNum as $k => $v) {
  150. if ($v) {
  151. $goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
  152. if (!$goods) {
  153. throw new Exception('Products does not exists!');
  154. }
  155. if($goods['STORE_NUMS']>0){
  156. $totalAmount += $goods['SELL_PRICE'] * intval($v);
  157. $totalAmountStandard += $goods['SELL_PRICE_STANDARD'] * intval($v);
  158. $realPriceStandard = $goods['SELL_PRICE_STANDARD'];
  159. $totalPv += $goods['PRICE_PV'] * intval($v);
  160. $this->_orderGoods[] = [
  161. 'GOODS_ID' => $goods['ID'],
  162. 'PRICE' => $goods['SELL_PRICE'],
  163. 'REAL_PRICE' => $goods['SELL_PRICE'],
  164. 'PV' => $goods['PRICE_PV'],
  165. 'REAL_PV' => $goods['PRICE_PV'],
  166. 'POINT' => $goods['POINT'],
  167. 'BUY_NUMS' => intval($v),
  168. 'SKU_CODE' => $goods['GOODS_NO'],
  169. 'GOODS_TITLE' => $goods['GOODS_NAME'],
  170. 'EMAIL' => Info::getUserEmailByUserId(\Yii::$app->user->id) ?? '',
  171. 'STANDARD_PRICE' => $goods['SELL_PRICE_STANDARD'],
  172. 'REAL_STANDARD_PRICE' => $realPriceStandard,
  173. 'EXCHANGE_RATE' => $exchangeRate,
  174. 'TAX_RATE' => $goods['TAX_RATE'],
  175. ];
  176. }
  177. if($goods['INSTALMENT']>0){ // 如果有分期付款商品,检查用户的分期付款状态
  178. if($v>1){ // 不可以购买多个
  179. throw new Exception(Yii::t('app', 'allowOnlyOne'));
  180. }
  181. // 分期的总期数
  182. $instalment = intval(Cache::getSystemConfig()['instalment']['VALUE'] ?? 3);
  183. // 分期商品的期数不能大于总分期数限制
  184. if (intval($goods['INSTALMENT']) > $instalment) {
  185. throw new Exception(Yii::t('app', 'instalmentGoodsNoError'));
  186. }
  187. $userStage = Instalment::getStage($userId);
  188. $userInstalmentInfo = Instalment::getInfo($userId);
  189. if (!$userInstalmentInfo){ // 如果没有分期付款记录
  190. throw new Exception(Yii::t('app', 'canNotBuy'));
  191. } else if ($userInstalmentInfo['ORDER_TYPE']!='BD' || (($userStage == $instalment) && ($goods['INSTALMENT'] != 1))) { // 如果分期付款记录中,不是报单,或已是最后一期
  192. throw new Exception(Yii::t('app', 'canNotBuy'));
  193. }
  194. if($userStage + 1 != $goods['INSTALMENT']){ // 若用户分期阶段+1不等于商品的分期阶段,则报异常
  195. throw new Exception(Yii::t('app', 'canNotBuy'));
  196. }
  197. if ($userStage + 1 > $instalment){ // 若用户分期阶段+1大于总分期阶段,则报异常
  198. throw new Exception(Yii::t('app', 'canNotBuy'));
  199. }
  200. $hasInstalment = $goods['INSTALMENT'];
  201. }
  202. }
  203. }
  204. if (!$this->isMax) {
  205. // 这里特殊是用户原报单PV之和+用户购买的商品总PV
  206. $checkPv = $totalPv + $diffPerf;
  207. if ($hasInstalment){ // 如果买了分期付款商品,则不判断总pv
  208. $allData['hasInstalment'] = 1;
  209. }else if($checkPv < $decLevel['PERF']) {
  210. throw new Exception(Yii::t('app', 'totalPVLessThan'), 400);
  211. }
  212. // 会员已有PV+本次订单PV 不能多于 下一个级别所需PV
  213. $nextDecLv = DeclarationLevel::getNextDecLv($toDecLevel);
  214. if ($nextDecLv && ($checkPv >= $nextDecLv['PERF'])) {
  215. throw new Exception(Yii::t('app', 'totalPvExceedPv'), 400);
  216. }
  217. }
  218. $this->_decAmount = $totalAmount;
  219. $this->_decPv = $totalPv;
  220. $this->_decAmountStandard = $totalAmountStandard;
  221. $this->_standardAmount = $this->_decAmountStandard;
  222. }
  223. $baseInfo = Info::baseInfoZhByUserName($this->insertUserName);
  224. $this->_insertUserId = $baseInfo['ID']; // 被报单人,通过insername 查找用户id
  225. $insertConId = $baseInfo['CON_UID'];
  226. $insertRecId = $baseInfo['REC_UID'];
  227. $decResult = $this->addDecOrder($insertConId, $insertRecId, $baseInfo['DEC_LV'], $isObserve, $this->remark);
  228. if (!$decResult) {
  229. throw new Exception(Yii::t('app', 'failed'), 400);
  230. }
  231. if ($hasInstalment){ // 如果有分期付款的商品,写入信息至分期付款表
  232. $instalmentModel = Instalment::findOne(['USER_ID'=>$userId]);
  233. if(!$instalmentModel) {
  234. $instalmentModel = new Instalment();
  235. }
  236. $instalmentModel->USER_ID = $userId;
  237. $instalmentModel->STAGE = $hasInstalment;
  238. $instalmentModel->ORDER_TYPE = 'BD';
  239. $instalmentModel->UPDATE_TIME = time();
  240. $instalmentModel->save();
  241. }
  242. return $decResult;
  243. }
  244. return true;
  245. }
  246. /**
  247. * 添加报单订单
  248. * @throws Exception|\Throwable
  249. */
  250. public function addDecOrder($insertConId, $insertRecId, $oriDecLv, $isObserve, $remark = ''): ApproachOrder
  251. {
  252. $periodObj = Period::instance();
  253. $nowPeriodNum = $this->period ?: $periodObj->getNowPeriodNum();
  254. $nowCalcMonth = $periodObj->getYearMonth($nowPeriodNum);
  255. $warehouse = Region::getWarehouseByCode($this->province);//仓库
  256. if(!$warehouse){
  257. throw new Exception(Yii::t('app', 'deliveryTemporarilyNotSupported'), 400);
  258. }
  259. $upgradeType = $isObserve ? 1 : 2; // 1补差 2全额
  260. // $periodObj = Period::instance();
  261. // $nowPeriodNum = $periodObj->getNowPeriodNum();
  262. // $nowCalcMonth = $periodObj->getYearMonth($nowPeriodNum);
  263. $ord = date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 10);
  264. // 加入报单信息
  265. $db = \Yii::$app->db;
  266. $transaction = $db->beginTransaction();
  267. try {
  268. $decOrderModel = new ApproachDecOrder();
  269. $decOrderModel->DEC_SN = 'DS'.$ord;
  270. $decOrderModel->ORDER_SN = 'OS'.$ord;
  271. $decOrderModel->TYPE = $this->type;
  272. $decOrderModel->USER_ID = \Yii::$app->user->id; // 报单人
  273. $decOrderModel->TO_USER_ID = $this->_insertUserId; // 被报单人
  274. $decOrderModel->DEC_AMOUNT = $this->_decAmount;
  275. $decOrderModel->DEC_PV = $this->_decPv;
  276. $decOrderModel->PERIOD_NUM = $nowPeriodNum;
  277. $decOrderModel->CALC_MONTH = $nowCalcMonth;
  278. $decOrderModel->P_CALC_MONTH = Date::ociToDate($nowCalcMonth, Date::OCI_TIME_FORMAT_SHORT_MONTH);
  279. $decOrderModel->PAID_WALLET = 'cash';
  280. $decOrderModel->CON_USER_ID = $insertConId;
  281. $decOrderModel->REC_USER_ID = $insertRecId;
  282. $decOrderModel->DEC_ID = $this->_decId;
  283. $decOrderModel->IS_DEL = 0;
  284. $decOrderModel->DETAIL_TYPE = 2;
  285. $decOrderModel->CREATED_AT = Date::nowTime();
  286. $decOrderModel->UPGRADE_TYPE = $upgradeType;
  287. $decOrderModel->REMARK = $remark;
  288. $decOrderModel->ORI_LV = $oriDecLv; // 变更前的级别
  289. $decOrderModel->UPGRADE_LV = $this->decLv; // 变更后的级别
  290. if (!$decOrderModel->save()) {
  291. $transaction->rollBack();
  292. throw new Exception(Form::formatErrorsForApi($decOrderModel->getErrors()));
  293. }
  294. $exchangeRate = floatval(Cache::getSystemConfig()['exchangeRate']['VALUE'] ?? 0);
  295. $orderModel = new ApproachOrder();
  296. $orderModel->SN = 'OS' . $ord;
  297. $orderModel->DEC_SN = 'DS' . $ord;
  298. $orderModel->ORDER_TYPE = $this->type;
  299. $orderModel->USER_ID = $this->_insertUserId;
  300. $orderModel->USER_NAME = $this->insertUserName; // 要升级的用户
  301. $orderModel->ORDER_AMOUNT = $this->_decAmount;
  302. $orderModel->PV = $this->_decPv;
  303. $orderModel->PAY_AMOUNT = $this->_decAmount;
  304. $orderModel->PAY_PV = $this->_decPv;
  305. $orderModel->PAY_AT = 0;
  306. $orderModel->PAY_TYPE = 'pay_stack';
  307. $orderModel->PERIOD_NUM = $nowPeriodNum;
  308. $orderModel->P_CALC_MONTH = Date::ociToDate($nowCalcMonth, Date::OCI_TIME_FORMAT_SHORT_MONTH);
  309. $orderModel->FREIGHT = 0;
  310. $orderModel->PAY_FREIGHT = 0;
  311. $orderModel->CONSIGNEE = $this->consignee;
  312. $orderModel->MOBILE = $this->acceptMobile;
  313. $orderModel->PROVINCE = $this->province;
  314. $orderModel->LGA_NAME = $this->lgaName;
  315. $orderModel->CITY_NAME = $this->cityName;
  316. $orderModel->ADDRESS = $this->address;
  317. $orderModel->WAREHOUSE = $warehouse;
  318. $orderModel->STATUS = \Yii::$app->params['orderStatus']['notPaid']['value'];
  319. $orderModel->CREATED_AT = Date::nowTime();
  320. $orderModel->CREATE_USER = Info::getUserNameByUserId(\Yii::$app->user->id);
  321. $orderModel->EMAIL = Info::getUserEmailByUserId(\Yii::$app->user->id) ?? '';
  322. $orderModel->ORDER_AMOUNT_STANDARD = $this->_decAmountStandard;
  323. $orderModel->PAY_AMOUNT_STANDARD = $this->_standardAmount;
  324. $orderModel->EXCHANGE_RATE = $exchangeRate;
  325. if(!$orderModel->save()){
  326. $transaction->rollBack();
  327. throw new Exception(Form::formatErrorsForApi($orderModel->getErrors()));
  328. }
  329. foreach ($this->goodsNum as $k => $v) {
  330. if ($v) {
  331. $goods = ShopGoods::findOneAsArray('ID=:ID',[':ID'=> $this->goodsId[$k]]);
  332. $storenums = $goods['STORE_NUMS'] - $this->goodsNum[$k];
  333. if($goods['STATUS']==1){
  334. if($goods['STORE_NUMS'] >=$this->goodsNum[$k]) {
  335. $data = ShopGoods::find()->where(['ID' => $this->goodsId[$k]])->one();
  336. $data->STORE_NUMS = $storenums;
  337. $data->update();
  338. if ($storenums==0) {
  339. $data->STATUS = 0;
  340. $data->UPDATED_AT = Date::nowTime();
  341. $data->update();
  342. }
  343. } else {
  344. throw new Exception("product".$goods['GOODS_NAME']."Insufficient inventory");//"商品".$goods['GOODS_NAME']."库存不足"
  345. }
  346. } else {
  347. throw new Exception("product".$goods['GOODS_NAME']."Removed from the shelf");// "商品".$goods['GOODS_NAME']."已下架"
  348. }
  349. }
  350. }
  351. // 加入商品到订单商品表
  352. foreach($this->_orderGoods as $key=>$value){
  353. $this->_orderGoods[$key]['ORDER_SN'] = $orderModel->SN;
  354. $this->_orderGoods[$key]['P_CALC_MONTH'] = Date::ociToDate($nowCalcMonth, Date::OCI_TIME_FORMAT_SHORT_MONTH);
  355. }
  356. ApproachOrderGoods::batchInsert($this->_orderGoods);
  357. //写入收货地址信息
  358. $addressModel = new ReceiveAddress();
  359. $addressModel->USER_ID = $this->_insertUserId;
  360. $addressModel->USER_NAME = $this->insertUserName;
  361. $addressModel->CONSIGNEE = $this->consignee;
  362. $addressModel->MOBILE = $this->acceptMobile;
  363. $addressModel->PROVINCE = $this->province;
  364. $addressModel->LGA_NAME = $this->lgaName;
  365. $addressModel->CITY_NAME = $this->cityName;
  366. $addressModel->ADDRESS = $this->address;
  367. $addressModel->IS_DEFAULT = 0;
  368. if (!$addressModel->save()) {
  369. $transaction->rollBack();
  370. throw new Exception(Form::formatErrorsForApi($addressModel->getErrors()));
  371. }
  372. $transaction->commit();
  373. return $orderModel;
  374. } catch(Exception $e) {
  375. $transaction->rollBack();
  376. throw new Exception($e->getMessage());
  377. }
  378. }
  379. /**
  380. * 判断报单中心是否存在
  381. * @param $attribute
  382. * @return false|void
  383. */
  384. public function issetDec($attribute){
  385. $decUser = User::find()
  386. ->select('ID')
  387. ->where('IS_DEC=1 AND USER_NAME=:USER_NAME', [':USER_NAME' => $this->decUserName])
  388. ->asArray()
  389. ->one();
  390. if (!$decUser) {
  391. $this->addError($attribute, 'Entry center does not exist');//报单中心不存在
  392. return false;
  393. } else {
  394. // 判断报单中心是否在新加入会员的安置网上级中
  395. // $this->loopFindParentToNetwork($this->insertUserName);
  396. //反转数组,in_array搜索错误
  397. //in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
  398. // $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
  399. // if (!isset($flipParent[$this->decUserName])) {
  400. //// $this->addError($attribute, '为' . $this->insertUserName . '升级报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
  401. // $this->addError($attribute, 'by' . $this->insertUserName . 'Upgrade declaration, declaration Center' . $this->decUserName . 'be not in' . $this->insertUserName . 'Online level of resettlement');
  402. // return ;
  403. // }
  404. $this->_decId = $decUser['ID'];
  405. }
  406. }
  407. // 判断是否已选择商品或套餐
  408. public function hasProduct($attribute) {
  409. if ($this->decWay==1 && empty($this->packageId)) {
  410. $this->addError($attribute, 'Purchase package upgrade, please select package');//购买套餐升级,请选择套餐
  411. return false;
  412. }
  413. if ($this->decWay!=1 && empty($this->goodsId)) {
  414. $this->instalment = ShopGoods::findAllAsArray('INSTALMENT > 0 AND ID IN(' . implode(',', $this->goodsId) . ')');
  415. $this->addError($attribute, 'Purchase product upgrade, please select product');//购买商品升级,请选择商品'
  416. return false;
  417. }
  418. return true;
  419. }
  420. // 判断要升级的会员,是否已是最高级别
  421. public function alreadyMaxDec($attribute) {
  422. $baseInfo = Info::baseInfoZhByUserName($this->insertUserName);
  423. $userDecId = $baseInfo['DEC_LV'];// 用户当前的级别
  424. $maxPerfInfo = DeclarationLevel::getMaxDecPref();
  425. $maxDecId = $maxPerfInfo['ID']; // 级别配置中最高级别ID
  426. $this->maxLv = $maxPerfInfo['ID'];
  427. if (!$this->isMax) {
  428. if ($maxDecId == $userDecId) {
  429. $this->addError($attribute, 'It is already the highest level and no upgrade is required');//已是最高级别,无需升级
  430. return false;
  431. }
  432. }
  433. return true;
  434. }
  435. /**
  436. * 寻找被升级人的上级
  437. * @param null $conUserName
  438. * @return bool
  439. */
  440. private function loopFindParentToNetwork($conUserName = null) {
  441. if($conUserName == null ){
  442. $conUserName = $this->insertUserName;
  443. }
  444. $baseUser = Info::getBaseUserByUserName($conUserName);
  445. $userNetworkInfo = UserNetwork::findOneAsArray('USER_ID=:USER_ID', [':USER_ID' => $baseUser['ID']]);
  446. unset($baseUser);
  447. $allParentUserIdsArr = explode(',', $userNetworkInfo['PARENT_UIDS']);
  448. unset($userNetworkInfo);
  449. $allParentUserIds = array_reverse($allParentUserIdsArr);
  450. unset($allParentUserIdsArr);
  451. if($allParentUserIds){
  452. foreach($allParentUserIds as $parentUserId) {
  453. $parentBaseUser = Info::getBaseUserById($parentUserId);
  454. if (is_null($parentBaseUser)) {
  455. continue;
  456. }
  457. $this->_tempNetworkParentUser[$this->insertUserName][] = $parentBaseUser['USER_NAME'] ;
  458. unset($parentUserId, $parentBaseUser);
  459. }
  460. }
  461. unset($allParentUserIds);
  462. return true;
  463. }
  464. }