NetworkList.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. namespace backendApi\modules\v1\models\lists\atlas;
  3. use backendApi\modules\v1\models\Admin;
  4. use common\helpers\Cache;
  5. use common\helpers\Tool;
  6. use common\helpers\user\Info;
  7. use common\helpers\user\Perf;
  8. use common\libs\dataList\column\Price;
  9. use common\libs\dataList\DataListInterface;
  10. use common\models\CalcBonus;
  11. use common\models\EmployLevel;
  12. use common\models\PerfMonth;
  13. use common\models\Period;
  14. use common\models\StarCrownLevel;
  15. use common\models\UserBind;
  16. use common\models\UserInfo;
  17. use common\libs\dataList\column\DateTime;
  18. use common\models\UserNetwork;
  19. use common\models\UserRelation;
  20. use common\models\UserSystem;
  21. use common\models\UserTeamwork;
  22. use Yii;
  23. class NetworkList extends \common\libs\dataList\DataList implements DataListInterface {
  24. /**
  25. * 列表名称
  26. * @return string
  27. */
  28. public function getListName() {
  29. return '安置网络列表';
  30. }
  31. /**
  32. * 列表筛选到的数据
  33. * @throws \yii\base\Exception
  34. */
  35. public function dataHandle() {
  36. $userId = $this->others['userId'];
  37. $deep = $this->others['deep'];
  38. $periodNum = $this->others['periodNum'];
  39. $period = Period::instance();
  40. $mainUserInfo = Info::baseInfo($userId, $periodNum);
  41. $decLevelConfig = Cache::getDecLevelConfig();
  42. $empLevelConfig = Cache::getEmpLevelConfig();
  43. $crownLevelConfig = Cache::getStarCrownLevelConfig();
  44. $param = [];
  45. if ( $this->pageSize ) $param['pageSize'] = $this->pageSize;
  46. if ( $this->page !== null ) $param['page'] = $this->page;
  47. $this->listData = UserNetwork::getChildrenInDeepFromPeriodWithPage($userId, $deep, $periodNum, $param);
  48. foreach($this->listData['list'] as $key=>$value){
  49. $userBaseInfo = Info::baseInfo($value['USER_ID'], $periodNum);
  50. $this->listData['list'][$key]['LIST_PERIOD_NUM'] = $periodNum?$periodNum:$period->getNowPeriodNum();
  51. // $this->listData['list'][$key]['COUNT_DEEP'] = (int)($userBaseInfo['NETWORK_DEEP']-$mainUserInfo['NETWORK_DEEP']);
  52. $this->listData['list'][$key]['COUNT_DEEP'] = (int)($userBaseInfo['NETWORK_DEEP']);
  53. $this->listData['list'][$key]['USER_NAME'] = $userBaseInfo['USER_NAME'];
  54. $this->listData['list'][$key]['SEE_USER_NAME'] = $userBaseInfo['USER_NAME'];
  55. $this->listData['list'][$key]['REAL_NAME'] = $userBaseInfo['REAL_NAME'];
  56. $this->listData['list'][$key]['PERIOD_AT'] = $userBaseInfo['PERIOD_AT'];
  57. $this->listData['list'][$key]['DEC_LV_NAME'] = $decLevelConfig[$userBaseInfo['DEC_LV']]['LEVEL_NAME'];
  58. $this->listData['list'][$key]['EMP_LV_NAME'] = isset($empLevelConfig[$userBaseInfo['EMP_LV']])?$empLevelConfig[$userBaseInfo['EMP_LV']]['LEVEL_NAME']:$empLevelConfig[EmployLevel::getDefaultLevelId()]['LEVEL_NAME'];
  59. $this->listData['list'][$key]['CROWN_LV_NAME'] = isset($crownLevelConfig[$userBaseInfo['CROWN_LV']]) ? $crownLevelConfig[$userBaseInfo['CROWN_LV']]['LEVEL_NAME'] : $crownLevelConfig[StarCrownLevel::getDefaultLevelId()]['LEVEL_NAME'];
  60. }
  61. $this->listData['periodNum'] = $periodNum;
  62. $this->listData['listTopDeep'] = $mainUserInfo['NETWORK_DEEP'];
  63. }
  64. /**
  65. * 要展示和导出的所有字段
  66. * @return array
  67. */
  68. public function getColumn() {
  69. if (!$this->columns) {
  70. $this->columns = [
  71. 'USER_ID' => null, // 这种传输方式主要是用于索引,因为过滤后的字段可能没有这种ID,但是一些功能的操作还需要用这种ID去关联,例如前台会员列表中的勾选批量状态管理,这里需要的就是USER_ID
  72. 'SEE_USER_NAME' => null,
  73. 'COUNT_DEEP' => [
  74. 'header' => 'Number Of Layers', // 层数
  75. 'headerOther' => ['width' => '140'],
  76. ],
  77. 'USER_NAME' => [
  78. 'header' => 'Placement Member Number', // 安置会员编号
  79. // 'headerOther' => ['width' => '150'],
  80. ],
  81. 'REAL_NAME' => [
  82. 'header' => 'Placement Member Name', // 安置会员姓名
  83. ],
  84. 'DEC_LV_NAME' => [
  85. 'header' => 'Recommended Member Level', // 推荐会员级别
  86. 'headerOther' => [
  87. 'width' => '210',
  88. ],
  89. ],
  90. 'EMP_LV_NAME' => [
  91. 'header' => 'Highest Director', // 最高管理星级
  92. 'headerOther' => [
  93. 'width' => '210',
  94. ],
  95. ],
  96. 'CROWN_LV_NAME' => [
  97. 'header' => 'Highest Crown', // 最高皇冠星级
  98. 'headerOther' => [
  99. 'width' => '210',
  100. ],
  101. ],
  102. 'PERIOD_AT' => [
  103. 'header' => 'Joining Period', // 加入期数
  104. 'headerOther' => ['width' => '110'],
  105. ],
  106. ];
  107. }
  108. return $this->columns;
  109. }
  110. /**
  111. * 前台用于筛选的类型集合
  112. * @return mixed
  113. */
  114. public function getFilterTypes() {
  115. if (!$this->filterTypes) {
  116. $this->filterTypes = [
  117. 'userName' => ['isUserTable' => false, 'name' => 'Member Code'], // 会员编号
  118. 'deep' => ['isUserTable' => false, 'name' => 'Depth'], // 深度
  119. 'periodNum' => ['isUserTable' => false, 'name' => 'Number Of Periods'], // 期数
  120. ];
  121. }
  122. return $this->filterTypes;
  123. }
  124. }