| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?php
- namespace backendApi\modules\v1\models\lists\atlas;
- use backendApi\modules\v1\models\Admin;
- use common\helpers\Cache;
- use common\helpers\Tool;
- use common\helpers\user\Info;
- use common\libs\dataList\column\Price;
- use common\libs\dataList\DataListInterface;
- use common\models\CalcBonus;
- use common\models\Period;
- use common\models\UserBind;
- use common\models\UserInfo;
- use common\libs\dataList\column\DateTime;
- use common\models\UserNetwork;
- use common\models\UserRelation;
- use common\models\UserSystem;
- use common\models\UserTeamwork;
- use Yii;
- class RelationList extends \common\libs\dataList\DataList implements DataListInterface {
- /**
- * 列表名称
- * @return string
- */
- public function getListName() {
- return '开拓网络列表';
- }
- /**
- * 列表筛选到的数据
- * @throws \yii\base\Exception
- */
- public function dataHandle() {
- $userId = $this->others['userId'];
- $deep = $this->others['deep'];
- $periodNum = $this->others['periodNum'];
- $period = Period::instance();
- $mainUserInfo = Info::baseInfo($userId, $periodNum);
- $decLevelConfig = Cache::getDecLevelConfig();
- $empLevelConfig = Cache::getEmpLevelConfig();
- $param = [];
- if ( $this->pageSize ) $param['pageSize'] = $this->pageSize;
- if ( $this->page !== null ) $param['page'] = $this->page;
- $this->listData = UserRelation::getChildrenInDeepFromPeriodWithPage($userId, $deep, $periodNum, $param);
- foreach($this->listData['list'] as $key=>$value){
- $userBaseInfo = Info::baseInfo($value['USER_ID'], $periodNum);
- $this->listData['list'][$key]['LIST_PERIOD_NUM'] = $periodNum?$periodNum:$period->getNowPeriodNum();
- $this->listData['list'][$key]['COUNT_DEEP'] = (int)($userBaseInfo['RELATION_DEEP']);
- $this->listData['list'][$key]['USER_NAME'] = $userBaseInfo['USER_NAME'];
- $this->listData['list'][$key]['SEE_USER_NAME'] = $userBaseInfo['USER_NAME'];
- $this->listData['list'][$key]['REAL_NAME'] = $userBaseInfo['REAL_NAME'];
- $this->listData['list'][$key]['PERIOD_AT'] = $userBaseInfo['PERIOD_AT'];
- $this->listData['list'][$key]['DEC_LV_NAME'] = $decLevelConfig[$userBaseInfo['DEC_LV']]['LEVEL_NAME'];
- $this->listData['list'][$key]['EMP_LV_NAME'] = isset($empLevelConfig[$userBaseInfo['EMP_LV']])?$empLevelConfig[$userBaseInfo['EMP_LV']]['LEVEL_NAME']:'';
- }
- $this->listData['periodNum'] = $periodNum;
- $this->listData['listTopDeep'] = $mainUserInfo['RELATION_DEEP'];
- }
- /**
- * 要展示和导出的所有字段
- * @return array
- */
- public function getColumn() {
- if (!$this->columns) {
- $this->columns = [
- 'USER_ID' => null, // 这种传输方式主要是用于索引,因为过滤后的字段可能没有这种ID,但是一些功能的操作还需要用这种ID去关联,例如前台会员列表中的勾选批量状态管理,这里需要的就是USER_ID
- 'SEE_USER_NAME' => null,
- // 'LIST_PERIOD_NUM' => [
- // 'header' => '期数',
- // 'headerOther' => ['width' => '110'],
- // ],
- 'COUNT_DEEP' => [
- 'header' => '层数',
- 'headerOther' => ['width' => '100'],
- ],
- 'USER_NAME' => [
- 'header' => '推荐会员编号',
- // 'headerOther' => ['width' => '150'],
- ],
- 'REAL_NAME' => [
- 'header' => '推荐会员姓名',
- // 'headerOther' => [
- // 'width' => '120',
- // ],
- ],
- 'DEC_LV_NAME' => [
- 'header' => '推荐会员级别',
- 'headerOther' => [
- 'width' => '110',
- ],
- ],
- 'EMP_LV_NAME' => [
- 'header' => '推荐会员聘级',
- 'headerOther' => [
- 'width' => '130',
- ],
- ],
- 'PERIOD_AT' => [
- 'header' => '加入期数',
- 'headerOther' => ['width' => '110'],
- ],
- ];
- }
- return $this->columns;
- }
- /**
- * 前台用于筛选的类型集合
- * @return mixed
- */
- public function getFilterTypes() {
- if (!$this->filterTypes) {
- $this->filterTypes = [
- 'userName' => ['isUserTable' => false, 'name' => '会员编号'],
- 'deep' => ['isUserTable' => false, 'name' => '深度'],
- 'periodNum' => ['isUserTable' => false, 'name' => '期数'],
- ];
- }
- return $this->filterTypes;
- }
- }
|